/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { usersCreateUser } from "../funcs/users-create-user.js"; import { usersDeleteServiceAccount } from "../funcs/users-delete-service-account.js"; import { usersGetUserInfo } from "../funcs/users-get-user-info.js"; import { usersQueryUser } from "../funcs/users-query-user.js"; import { usersUpdateServiceAccount } from "../funcs/users-update-service-account.js"; import { usersUpdateUserRoles } from "../funcs/users-update-user-roles.js"; import { usersUpdateUser } from "../funcs/users-update-user.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class Users extends ClientSDK { /** * Create user or service account * * @remarks * Create a user account (type=user, email required; returns user + password for login) or a service account (type=service_account, roles required) for API/automation access. */ async createUser( request: models.CreateUserRequest, options?: RequestOptions, ): Promise { return unwrapAsync(usersCreateUser( this, request, options, )); } /** * Get current user * * @remarks * Use to show the logged-in user's profile in the UI or to check permissions and roles for the current session. */ async getUserInfo( options?: RequestOptions, ): Promise { return unwrapAsync(usersGetUserInfo( this, options, )); } /** * Update current user * * @remarks * Update the current authenticated user. Supports name and metadata updates. */ async updateUser( request: models.UpdateUserRequest, options?: RequestOptions, ): Promise { return unwrapAsync(usersUpdateUser( this, request, options, )); } /** * Query users * * @remarks * Use when listing or searching service accounts in an admin UI, or when auditing who has API access and which roles they have. */ async queryUser( request: models.UserFilter, options?: RequestOptions, ): Promise { return unwrapAsync(usersQueryUser( this, request, options, )); } /** * Update service account * * @remarks * Update a service account by ID (name only). */ async updateServiceAccount( id: string, body: models.UpdateServiceAccountRequest, options?: RequestOptions, ): Promise { return unwrapAsync(usersUpdateServiceAccount( this, id, body, options, )); } /** * Delete service account * * @remarks * Soft-delete (archive) a service account by ID. */ async deleteServiceAccount( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(usersDeleteServiceAccount( this, id, options, )); } /** * Update user roles * * @remarks * Update the roles of a user account (not service accounts — their roles are fixed at creation). Restricted to super_admin; a caller cannot update their own roles. Blocked with a 400 if the user has any active (published, unexpired) API key in any environment, since a key's permissions are snapshotted at creation time and would otherwise silently keep running on the old roles; the error lists the active keys grouped by environment ID so the caller can prompt to expire them first, then retry. */ async updateUserRoles( id: string, body: models.UpdateUserRolesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(usersUpdateUserRoles( this, id, body, options, )); } }