export type RdvmExportRequest = {sessionId?: string | undefined, clinicId?: string | undefined, includeMedicalHistory?: boolean | undefined, includeSoapNotes?: boolean | undefined, includeMedications?: boolean | undefined, includeDischargeRecords?: boolean | undefined, includeLabs?: boolean | undefined, includeImaging?: boolean | undefined, dateFrom?: (string | null) | undefined, dateTo?: (string | null) | undefined}; export type CreateApiPublicRdvmReferralsReferralIdExportArgs = {referralId: string, body: RdvmExportRequest}; export type CreateApiPublicRdvmReferralsReferralIdExportOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export patient records on-demand (requires canViewRecords permission) * Returns PDF directly for download, not stored as a document * * POST /public/rdvm/referrals/{referralId}/export */ export const createApiPublicRdvmReferralsReferralIdExport = async (args: CreateApiPublicRdvmReferralsReferralIdExportArgs, options?: CreateApiPublicRdvmReferralsReferralIdExportOptions) => { 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(/\/+$/, '')}/public/rdvm/referrals/${encodeURIComponent(String(args.referralId))}/export${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 };