export type UpdateApiV1PatientsIdArgs = {id: number, body: {name: string, phone: string, ic?: string | undefined, email?: string | undefined, gender?: ('male' | 'female') | undefined, dob?: string | undefined, age?: number | undefined, nickname?: string | undefined, nationality?: string | undefined, race?: string | undefined, religion?: string | undefined, occupation?: string | undefined, marital_status?: ('married' | 'single') | undefined, staff_id?: string | undefined, address?: ({address_1: string, address_2?: string | undefined, postcode: string, city: string, state: string, country?: string | undefined}) | undefined, emergency_contact?: ({name?: string | undefined, relationship?: string | undefined, phone?: string | undefined}) | undefined, panels?: (Array<{panel?: number | undefined, staff_id?: string | undefined, note?: string | undefined}>) | undefined, tagging?: Array | undefined}}; export type UpdateApiV1PatientsIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Replace a patient * * PUT /v1/patients/{id} */ export const updateApiV1PatientsId = async (args: UpdateApiV1PatientsIdArgs, options?: UpdateApiV1PatientsIdOptions) => { const {baseUrl = "https://developer.yezza.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/patients/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };