export type SendPatientReceiptRequestDto = {patientId?: (string | null) | undefined, recipientEmail?: (string | null) | undefined}; export type CreateApiInvoicesIdSendPatientReceiptArgs = {id: string, body: SendPatientReceiptRequestDto}; export type CreateApiInvoicesIdSendPatientReceiptOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Emails one pet's receipt (ITE-1176) — only that pet's charges — to the client, or to * another address such as the pet's insurer. Issues a Draft first, as send-invoice does; * 409 INVOICE_NOT_OPEN for a Void or Superseded bill. * * POST /Invoices/{id}/send-patient-receipt */ export const createApiInvoicesIdSendPatientReceipt = async (args: CreateApiInvoicesIdSendPatientReceiptArgs, options?: CreateApiInvoicesIdSendPatientReceiptOptions) => { const {baseUrl = "https://api.clinicos.vet/backend/business", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/Invoices/${encodeURIComponent(String(args.id))}/send-patient-receipt${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 undefined };