export type CreateApiPatientsIdReconstructArgs = {id: string, body: {LimitToThisLevelMainDicomTags?: boolean | undefined, ReconstructFiles?: boolean | undefined}}; export type CreateApiPatientsIdReconstructOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reconstruct tags & optionally files of patient * * POST /patients/{id}/reconstruct */ export const createApiPatientsIdReconstruct = async (args: CreateApiPatientsIdReconstructArgs, options?: CreateApiPatientsIdReconstructOptions) => { const {baseUrl = "https://orthanc.uclouvain.be/demo", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/patients/${encodeURIComponent(String(args.id))}/reconstruct${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 };