export type GetApiInstancesIdPdfArgs = {id: string}; export type GetApiInstancesIdPdfOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get embedded PDF * * GET /instances/{id}/pdf */ export const getApiInstancesIdPdf = async (args: GetApiInstancesIdPdfArgs, options?: GetApiInstancesIdPdfOptions) => { const {baseUrl = "https://orthanc.uclouvain.be/demo", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") const url = `${baseUrl.replace(/\/+$/, '')}/instances/${encodeURIComponent(String(args.id))}/pdf${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() };