export type CreatedAt = string; export type AdminCreator = {username?: string | undefined}; export type UpdatedAt = string; export type AdminUpdater = {username?: string | undefined}; export type User = {id?: string | undefined, first_name?: string | undefined, last_name?: string | undefined, email?: string | undefined, website?: string | undefined, use_description?: string | undefined, registration_source?: string | undefined, throttle_by_ip?: boolean | undefined, roles?: string | undefined, enabled?: string | undefined, api_key?: string | undefined, api_key_hides_at?: string | undefined, api_key_preview?: string | undefined, email_verified?: boolean | undefined, registration_ip?: string | undefined, registration_user_agent?: string | undefined, registration_referer?: string | undefined, registration_origin?: string | undefined, created_at?: CreatedAt | undefined, creator?: AdminCreator | undefined, updated_at?: UpdatedAt | undefined, updater?: AdminUpdater | undefined}; export type UpdateApiApiUmbrellaV1UsersIdArgs = {body: {user?: User | undefined}}; export type UpdateApiApiUmbrellaV1UsersIdOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the API user/API key * * PUT /api-umbrella/v1/users/{id} * * Also accepts auth: admin_auth_token */ export const updateApiApiUmbrellaV1UsersId = async (args: UpdateApiApiUmbrellaV1UsersIdArgs, options: UpdateApiApiUmbrellaV1UsersIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("X-Api-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api-umbrella/v1/users/${encodeURIComponent(String(args.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 undefined };