export type UpdateApiPatientsIdArgs = {id: number, body: {firstname: string, lastname: string, email: string | null, sex: string | null, genderIdentity: string | null, alert: string | null, birthdate: string | null, timezone?: (string | null) | undefined, city: string | null, state: string | null, postalCode: string | null, country: string | null, phoneNumbers: Array<{type?: ('Mobile' | 'Home' | 'Work' | 'Fax' | 'Other' | null) | undefined, code?: (string | null) | undefined, phoneNumber: string}>, privacyPolicy: 'No response' | 'Accepted' | 'Rejected' | '' | null, ndisNumber: string | null, ndisInfo?: ({diagnosis?: (string | null) | undefined, nomineeEmail?: (string | null) | undefined, fundManagement?: (string | null) | undefined, nomineeLastName?: (string | null) | undefined, nomineeFirstName?: (string | null) | undefined, nomineeMobileCode?: (string | null) | undefined, nomineeMobileNumber?: (string | null) | undefined, startDate?: (string | null) | undefined, endDate?: (string | null) | undefined} | null) | undefined, medicareNum: string | null, irn: string | null, veteransFileNumber: string | null, emergencyContactNumber: string | null, emergencyContactName: string | null, emergencyContactRelationship: string | null, patientTags?: (Array | null) | undefined, communicationPreference?: ('NONE' | 'SMS' | 'SMS_EMAIL' | 'EMAIL') | undefined, createdAt?: (string | string) | undefined, updatedAt?: (string | string) | undefined}}; export type UpdateApiPatientsIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update single patient * * PUT /patients/{id} */ export const updateApiPatientsId = async (args: UpdateApiPatientsIdArgs, options?: UpdateApiPatientsIdOptions) => { const {baseUrl = "https://api.splose.com/v1", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "text") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/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 res.blob() };