export type ClientRecordExportOptions = {includeContactInfo?: boolean | undefined, includeEmergencyContact?: boolean | undefined, includeCommunicationPreferences?: boolean | undefined, includePatients?: boolean | undefined, includeAppointmentHistory?: boolean | undefined, includePaymentHistory?: boolean | undefined}; export type BulkClientExportRequest = {clientIds?: Array | undefined, options?: (ClientRecordExportOptions | null) | undefined}; export type CreateApiClientsExportBulkCsvArgs = {body: BulkClientExportRequest}; export type CreateApiClientsExportBulkCsvOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /clients/export/bulk/csv */ export const createApiClientsExportBulkCsv = async (args: CreateApiClientsExportBulkCsvArgs, options?: CreateApiClientsExportBulkCsvOptions) => { 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(/\/+$/, '')}/clients/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() };