export type UserUpdateRequest = {name?: string | undefined, locale?: string | undefined, pictureUrl?: string | undefined, email?: string | undefined, timeZone?: string | undefined, firstDayOfWeek?: ('MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY') | undefined}; export type UpdateApiUsersArgs = {'X-Zendesk-Doorman-Auth-Response': string, body: UserUpdateRequest}; export type UpdateApiUsersOptions = {baseUrl?: string | undefined, zendeskAuthn?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /users */ export const updateApiUsers = async (args: UpdateApiUsersArgs, options?: UpdateApiUsersOptions) => { const {baseUrl = "http://api.klausapp.com", fetch: fetchFn = fetch, zendeskAuthn} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args['X-Zendesk-Doorman-Auth-Response'] != null) headers.set("X-Zendesk-Doorman-Auth-Response", String(args['X-Zendesk-Doorman-Auth-Response'])) if (zendeskAuthn !== undefined) headers.set("X-Zendesk-Authn", zendeskAuthn) const url = `${baseUrl.replace(/\/+$/, '')}/users${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() };