export type ClientRecordExportOptions = {includeContactInfo?: boolean | undefined, includeEmergencyContact?: boolean | undefined, includeCommunicationPreferences?: boolean | undefined, includePatients?: boolean | undefined, includeAppointmentHistory?: boolean | undefined, includePaymentHistory?: boolean | undefined}; export type CreateApiClientsClientIdExportPdfArgs = {clientId: string, body: ClientRecordExportOptions | null}; export type CreateApiClientsClientIdExportPdfOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /clients/{clientId}/export/pdf */ export const createApiClientsClientIdExportPdf = async (args: CreateApiClientsClientIdExportPdfArgs, options?: CreateApiClientsClientIdExportPdfOptions) => { 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") headers.set('accept', "application/pdf") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/clients/${encodeURIComponent(String(args.clientId))}/export/pdf${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() };