export type GetApiDeabooksBookIdExportPdfArgs = {bookId: string, managerName?: string | undefined, fromDate?: string | undefined, toDate?: string | undefined}; export type GetApiDeabooksBookIdExportPdfOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download DEA log as PDF * * GET /deabooks/{bookId}/export/pdf */ export const getApiDeabooksBookIdExportPdf = async (args: GetApiDeabooksBookIdExportPdfArgs, options?: GetApiDeabooksBookIdExportPdfOptions) => { const {baseUrl = "https://api.clinicos.vet/backend/business", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (args.managerName != null) query.append("managerName", String(args.managerName)) if (args.fromDate != null) query.append("fromDate", String(args.fromDate)) if (args.toDate != null) query.append("toDate", String(args.toDate)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/deabooks/${encodeURIComponent(String(args.bookId))}/export/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() };