export type CreateApiInstancesIdAnonymizeArgs = {id: string, body: {DicomVersion?: string | undefined, Force?: boolean | undefined, Keep?: Array | undefined, KeepLabels?: boolean | undefined, KeepPrivateTags?: boolean | undefined, KeepSource?: boolean | undefined, LossyQuality?: number | undefined, PrivateCreator?: string | undefined, Remove?: Array | undefined, Replace?: Record | undefined, Transcode?: string | undefined}}; export type CreateApiInstancesIdAnonymizeOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Anonymize instance * * POST /instances/{id}/anonymize */ export const createApiInstancesIdAnonymize = async (args: CreateApiInstancesIdAnonymizeArgs, options?: CreateApiInstancesIdAnonymizeOptions) => { 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") headers.set('accept', "application/dicom") const url = `${baseUrl.replace(/\/+$/, '')}/instances/${encodeURIComponent(String(args.id))}/anonymize${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 res.blob() };