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 CreateApiPatientsPatientIdExportCsvArgs = {patientId: string, body: PatientRecordExportOptions | null}; export type CreateApiPatientsPatientIdExportCsvOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download patient record as CSV * * POST /patients/{patientId}/export/csv */ export const createApiPatientsPatientIdExportCsv = async (args: CreateApiPatientsPatientIdExportCsvArgs, options?: CreateApiPatientsPatientIdExportCsvOptions) => { 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', "text/csv") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/patients/${encodeURIComponent(String(args.patientId))}/export/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.text() };