export type CreateApiV1MeasurementResultsArgs = {body: {run_id: string, status: 'success' | 'error', measurements?: Array<{image_name: string, camera: string, length_cm: number, width_cm: number, height_cm: number}> | undefined, expected_scans?: (number | null) | undefined, output_uris?: ({measurements_csv?: (string | null) | undefined, obb_projection_json_files?: Array | undefined}) | undefined, error?: (string | null) | undefined, error_type?: ('inference_oom' | 'inference_failed' | 'mask_missing' | 'image_download_failed' | 'config_invalid' | 'upload_failed' | null) | undefined}}; export type CreateApiV1MeasurementResultsOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/measurement/results */ export const createApiV1MeasurementResults = async (args: CreateApiV1MeasurementResultsArgs, options: CreateApiV1MeasurementResultsOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/measurement/results${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };