export type GetApiReferralsIdDocumentsDocumentIdDownloadArgs = {id: string, documentId: string}; export type GetApiReferralsIdDocumentsDocumentIdDownloadOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a document * * GET /Referrals/{id}/documents/{documentId}/download */ export const getApiReferralsIdDocumentsDocumentIdDownload = async (args: GetApiReferralsIdDocumentsDocumentIdDownloadArgs, options?: GetApiReferralsIdDocumentsDocumentIdDownloadOptions) => { const {baseUrl = "https://api.clinicos.vet/backend/business", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/Referrals/${encodeURIComponent(String(args.id))}/documents/${encodeURIComponent(String(args.documentId))}/download${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };