export type UpdateApiPatientsIdCustomFieldArgs = {body: {customFieldData: Array<{customFieldId: number, value?: (string | Array | number | unknown) | undefined}>}}; export type UpdateApiPatientsIdCustomFieldOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update single patient custom field * * PUT /patients/{id}/custom-field */ export const updateApiPatientsIdCustomField = async (args: UpdateApiPatientsIdCustomFieldArgs, options?: UpdateApiPatientsIdCustomFieldOptions) => { 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))}/custom-field${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() };