Spaces:
Sleeping
Sleeping
File size: 1,703 Bytes
03e3b1b bfdb677 03e3b1b bfdb677 03e3b1b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | export function buildApiGuideEndpoints() {
return [
endpoint('GET', '/health', 'Check service health'),
endpoint('GET', '/info', 'Fetch app and solver metadata'),
endpoint('GET', '/demo-data', 'List available city demos'),
endpoint('GET', '/demo-data/PHILADELPHIA', 'Load a canonical delivery plan'),
endpoint('POST', '/jobs', 'Start a retained solve job', true, '@plan.json'),
endpoint('GET', '/jobs/{id}', 'Fetch retained job status'),
endpoint('GET', '/jobs/{id}/status', 'Fetch retained job status through the stock UI alias'),
endpoint('GET', '/jobs/{id}/snapshot', 'Fetch the latest retained snapshot'),
endpoint('GET', '/jobs/{id}/analysis?snapshot_revision={n}', 'Analyze an exact snapshot revision'),
endpoint('GET', '/jobs/{id}/routes?snapshot_revision={n}', 'Fetch encoded route geometry for a retained snapshot'),
endpoint('POST', '/jobs/{id}/pause', 'Pause a retained job'),
endpoint('POST', '/jobs/{id}/resume', 'Resume a retained job'),
endpoint('POST', '/jobs/{id}/cancel', 'Cancel a retained job'),
endpoint('DELETE', '/jobs/{id}', 'Delete a terminal retained job'),
endpoint('GET', '/jobs/{id}/events', 'Stream retained job events'),
endpoint('POST', '/recommendations/delivery-insertions', 'Rank candidate insertions for one delivery', true),
];
}
function endpoint(method, path, description, json = false, data = null) {
const parts = ['curl'];
if (method !== 'GET') parts.push('-X', method);
if (json) parts.push('-H', '"Content-Type: application/json"');
parts.push(`${window.location.origin}${path}`);
if (data) parts.push('-d', data);
return { method, path, description, curl: parts.join(' ') };
}
|