export type PatchApiMrApiV1CasesIdArgs = {id: string, 'X-Pt-Id': string, body: {display_name?: string | undefined, hi_type?: ('OPConsultation' | 'Prescription' | 'DischargeSummary' | 'DiagnosticReport' | 'ImmunizationRecord' | 'HealthDocumentRecord' | 'WellnessRecord') | undefined, type?: string | undefined, occurred_at?: number | undefined, partner_meta?: {[key: string]: unknown} | undefined}}; export type PatchApiMrApiV1CasesIdOptions = {baseUrl?: string | undefined, auth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Case * * PATCH /mr/api/v1/cases/{id} */ export const patchApiMrApiV1CasesId = async (args: PatchApiMrApiV1CasesIdArgs, options?: PatchApiMrApiV1CasesIdOptions) => { const {baseUrl = "https://api.eka.care", fetch: fetchFn = fetch, auth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Pt-Id'] != null) headers.set("X-Pt-Id", String(args['X-Pt-Id'])) if (auth !== undefined) headers.set('authorization', `Bearer ${auth}`) const url = `${baseUrl.replace(/\/+$/, '')}/mr/api/v1/cases/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };