export type GetApiInstancesIdFramesFrameImageUint8Args = {quality?: number | undefined, returnUnsupportedImage?: boolean | undefined, Accept?: string | undefined, frame: number, id: string}; export type GetApiInstancesIdFramesFrameImageUint8Options = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Decode a frame (uint8) * * GET /instances/{id}/frames/{frame}/image-uint8 */ export const getApiInstancesIdFramesFrameImageUint8 = async (args: GetApiInstancesIdFramesFrameImageUint8Args, options?: GetApiInstancesIdFramesFrameImageUint8Options) => { const {baseUrl = "https://orthanc.uclouvain.be/demo", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/jpeg") if (args.quality != null) query.append("quality", String(args.quality)) if (args.returnUnsupportedImage != null) query.append("returnUnsupportedImage", String(args.returnUnsupportedImage)) if (args.Accept != null) headers.set("Accept", String(args.Accept)) const url = `${baseUrl.replace(/\/+$/, '')}/instances/${encodeURIComponent(String(args.id))}/frames/${encodeURIComponent(String(args.frame))}/image-uint8${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };