export type UpdateUserDetailsRequest = {profileId?: number | undefined, firstName?: (string | null) | undefined, lastName?: (string | null) | undefined, email?: (string | null) | undefined, roles?: (Array | null) | undefined, roleIds?: (Array | null) | undefined, pin?: (string | null) | undefined, ioid?: (string | null) | undefined, nfcid?: (string | null) | undefined, twoFactorEnabled?: boolean | undefined, properties?: ({[key: string]: string} | null) | undefined, mfaEnabled?: (boolean | null) | undefined, isDashboardEnabled?: boolean | undefined}; export type UpdateApiV1UsersUserIdArgs = {userId: number, Account: unknown, body: UpdateUserDetailsRequest}; export type UpdateApiV1UsersUserIdOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update user details * * PUT /v1/Users/{userId} */ export const updateApiV1UsersUserId = async (args: UpdateApiV1UsersUserIdArgs, options: UpdateApiV1UsersUserIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json-patch+json; x-api-version=1.0") if (args.Account != null) query.append("Account", String(args.Account)) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Users/${encodeURIComponent(String(args.userId))}${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 };