export type GetApiInvoicesIdPatientReceiptPdfArgs = {id: string, patientId?: string | undefined}; export type GetApiInvoicesIdPatientReceiptPdfOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * One pet's receipt for a bill (ITE-1067): only that patient's charges, their share of * discounts and tax, and the bill's payment status and references. Lets a client who * paid one combined invoice for several pets claim each pet on its own insurance. * * GET /Invoices/{id}/patient-receipt-pdf */ export const getApiInvoicesIdPatientReceiptPdf = async (args: GetApiInvoicesIdPatientReceiptPdfArgs, options?: GetApiInvoicesIdPatientReceiptPdfOptions) => { 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.patientId != null) query.append("patientId", String(args.patientId)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/Invoices/${encodeURIComponent(String(args.id))}/patient-receipt-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() };