export type RecordExportOrder = number; export type PatientRecordExportOptions = {appointmentId?: (string | null) | undefined, order?: (RecordExportOrder | null) | undefined, includeMedicalHistory?: boolean | undefined, includeSoapNotes?: boolean | undefined, includeMedications?: boolean | undefined, includeRdvmRecords?: boolean | undefined, includeTransactionHistory?: boolean | undefined, includeDischargeRecords?: boolean | undefined, includeLabResults?: boolean | undefined, includeVaccinations?: boolean | undefined, includeReminders?: boolean | undefined, includeAnesthesiaRecords?: boolean | undefined}; export type BulkExportRequest = {patientIds?: Array | undefined, options?: (PatientRecordExportOptions | null) | undefined}; export type CreateApiPatientsExportBulkCsvArgs = {body: BulkExportRequest}; export type CreateApiPatientsExportBulkCsvOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download multiple patient records as a ZIP of CSVs * * POST /patients/export/bulk/csv */ export const createApiPatientsExportBulkCsv = async (args: CreateApiPatientsExportBulkCsvArgs, options?: CreateApiPatientsExportBulkCsvOptions) => { 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/zip") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/patients/export/bulk/csv${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() };