/** * This file was auto-generated by Fern from our API Definition. */ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as WorkOS from "../../.."; export declare namespace UserManagement { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; fetcher?: core.FetchFunction; } interface RequestOptions { timeoutInSeconds?: number; maxRetries?: number; } } export declare class UserManagement { protected readonly _options: UserManagement.Options; constructor(_options?: UserManagement.Options); /** * Lists the authentication factors for a user * * @example * await workOs.userManagement.listAuthFactors("string", { * limit: 10 * }) */ listAuthFactors(userID: string, request?: WorkOS.ListAuthFactorsOpts, requestOptions?: UserManagement.RequestOptions): Promise>; /** * Enrolls a user in a new authentication factor * @throws {@link WorkOS.UnprocessableEntityError} * * @example * await workOs.userManagement.enrollAuthFactor("string", { * type: "totp" * }) */ enrollAuthFactor(userlandUserID: string, request: WorkOS.EnrollAuthFactorOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Sends a one-time authentication code to the user’s email address. The code expires in 10 minutes. To verify the code, authenticate the user with Magic Auth. * @throws {@link WorkOS.BadRequestError} * @throws {@link WorkOS.UnprocessableEntityError} */ sendMagicAuthCode(requestOptions?: UserManagement.RequestOptions): Promise; /** * Get the details of an existing organization membership. * @throws {@link WorkOS.NotFoundError} * * @example * await workOs.userManagement.getOrganizationMembership("string") */ getOrganizationMembership(id: string, requestOptions?: UserManagement.RequestOptions): Promise; /** * Deletes an existing organization membership. * @throws {@link WorkOS.NotFoundError} * * @example * await workOs.userManagement.deleteOrganizationMembership("string") */ deleteOrganizationMembership(id: string, requestOptions?: UserManagement.RequestOptions): Promise; /** * Get a list of all organization memberships matching the criteria specified. * @throws {@link WorkOS.BadRequestError} * @throws {@link WorkOS.NotFoundError} * * @example * await workOs.userManagement.listOrganizationMemberships({ * limit: 10, * order: WorkOS.Order.Normal * }) */ listOrganizationMemberships(request?: WorkOS.ListOrganizationMembershipOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Creates a new organization membership for the given organization and user. * @throws {@link WorkOS.NotFoundError} * @throws {@link WorkOS.UnprocessableEntityError} * * @example * await workOs.userManagement.createOrganizationMembership({ * userID: "string", * organizationID: "string" * }) */ createOrganizationMembership(request: WorkOS.CreateOrganizationMembershipOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Get a list of all of your existing users matching the criteria specified * * @example * await workOs.userManagement.listUsers({ * limit: 10, * order: WorkOS.Order.Normal * }) */ listUsers(request?: WorkOS.ListUsersOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Create a new user in the current environment. After creating a user, you may optionally send the user a verification email * @throws {@link WorkOS.BadRequestError} * @throws {@link WorkOS.NotFoundError} * @throws {@link WorkOS.UnprocessableEntityError} * * @example * await workOs.userManagement.createUser({ * firstName: "string", * lastName: "string", * email: "string", * password: "string", * invitationToken: "string" * }) */ createUser(request: WorkOS.CreateUserOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Get the details of an existing user * @throws {@link WorkOS.NotFoundError} * * @example * await workOs.userManagement.getUser("string") */ getUser(id: string, requestOptions?: UserManagement.RequestOptions): Promise; /** * Updates properties of a user. The omitted properties will be left unchanged * @throws {@link WorkOS.BadRequestError} * @throws {@link WorkOS.UnprocessableEntityError} * * @example * await workOs.userManagement.updateUser("string", { * firstName: "string", * lastName: "string", * email: "string", * password: "string", * passwordHash: "string", * passwordHashType: WorkOS.PasswordHashType.Bcrypt * }) */ updateUser(id: string, request: WorkOS.UpdateUserOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Deletes a user * @throws {@link WorkOS.NotFoundError} * * @example * await workOs.userManagement.deleteUser("string") */ deleteUser(id: string, requestOptions?: UserManagement.RequestOptions): Promise; /** * Sends an email that contains a one-time code used to verify a user’s email address * @throws {@link WorkOS.BadRequestError} * @throws {@link WorkOS.NotFoundError} * * @example * await workOs.userManagement.sendVerificationEmail("string") */ sendVerificationEmail(id: string, requestOptions?: UserManagement.RequestOptions): Promise; /** * Verifies an email address using the one-time code received by the user * @throws {@link WorkOS.BadRequestError} * @throws {@link WorkOS.NotFoundError} * @throws {@link WorkOS.UnprocessableEntityError} * * @example * await workOs.userManagement.verifyEmail("string", { * code: "string" * }) */ verifyEmail(id: string, request: WorkOS.VerifyEmailOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Send a password reset email and change the user’s password * @throws {@link WorkOS.ForbiddenError} * @throws {@link WorkOS.UnprocessableEntityError} * * @example * await workOs.userManagement.sendPasswordResetEmail({ * email: "string", * passwordResetURL: "string" * }) */ sendPasswordResetEmail(request: WorkOS.CreatePasswordResetOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Sets a new password using the token query parameter from the link that the user received * @throws {@link WorkOS.BadRequestError} * @throws {@link WorkOS.ForbiddenError} * @throws {@link WorkOS.NotFoundError} * @throws {@link WorkOS.UnprocessableEntityError} * * @example * await workOs.userManagement.resetPassword({ * token: "string", * newPassword: "string" * }) */ resetPassword(request: WorkOS.ResetPasswordOpts, requestOptions?: UserManagement.RequestOptions): Promise; /** * Generates an OAuth 2.0 authorization URL to authenticate a user with AuthKit or SSO * * @example * await workOs.userManagement.getAuthorizationURL({ * responseType: "code", * redirectURI: "string", * clientID: "string" * }) */ getAuthorizationURL(request: WorkOS.GetAuthorizationURLOpts, requestOptions?: UserManagement.RequestOptions): Promise; protected _getAuthorizationHeader(): Promise; }