export type PatchApiManagementV20UsersUserIdArgs = {Accept?: ('application/json' | 'application/hal+json' | 'application/xml' | 'text/xml' | 'text/csv') | undefined, userId: string, body: {id?: string | undefined, name?: string | undefined, acceptedTOS?: boolean | undefined, disabled?: boolean | undefined, cxoneEmail?: string | undefined, cxoneId?: string | undefined, newPassword?: string | undefined}}; export type PatchApiManagementV20UsersUserIdOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update a User * * PATCH /management/v2.0/users/{userId} */ export const patchApiManagementV20UsersUserId = async (args: PatchApiManagementV20UsersUserIdArgs, options?: PatchApiManagementV20UsersUserIdOptions) => { const {baseUrl = "https://api-trial.cognigy.ai/testing", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/management/v2.0/users/${encodeURIComponent(String(args.userId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };