export type GetApiToolsCreateArchiveArgs = {filename?: string | undefined, 'lossy-quality'?: number | undefined, resources: string, transcode?: string | undefined}; export type GetApiToolsCreateArchiveOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create ZIP archive * * GET /tools/create-archive */ export const getApiToolsCreateArchive = async (args: GetApiToolsCreateArchiveArgs, options?: GetApiToolsCreateArchiveOptions) => { const {baseUrl = "https://orthanc.uclouvain.be/demo", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.filename != null) query.append("filename", String(args.filename)) if (args['lossy-quality'] != null) query.append("lossy-quality", String(args['lossy-quality'])) if (args.resources != null) query.append("resources", String(args.resources)) if (args.transcode != null) query.append("transcode", String(args.transcode)) const url = `${baseUrl.replace(/\/+$/, '')}/tools/create-archive${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 undefined };