export type UpdateApiApiV2UsersUserIdArgs = {Authorization?: string | undefined, 'user-id': string, body: Record}; export type UpdateApiApiV2UsersUserIdOptions = {baseUrl?: string | undefined, noauthAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Atualizar Dados do Usuário * * PUT /api/v2/users/{user-id} */ export const updateApiApiV2UsersUserId = async (args: UpdateApiApiV2UsersUserIdArgs, options?: UpdateApiApiV2UsersUserIdOptions) => { const {baseUrl = "https://cloud-hom.bry.com.br", fetch: fetchFn = fetch, noauthAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (noauthAuth !== undefined) headers.set('authorization', `noauth ${noauthAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/users/${encodeURIComponent(String(args['user-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 (await res.json()) as unknown };