Manage Users in Wacht
fetchUsers(options?: ListUsersOptions)
options
(optional): An object containing pagination and filtering options.
page
(number): The page number to retrieve.per_page
(number): The number of items per page.search
(string): Search term for users.is_active
(boolean): Filter by active status.Promise<UserListResponse>
: A promise that resolves to a list of users and pagination information.
createUser(request: CreateUserRequest)
request
(CreateUserRequest): The request body containing the details of the new user.Promise<User>
: A promise that resolves to the newly created user object.
fetchUserDetails(userId: string)
userId
(string): The unique identifier of the user.Promise<UserDetailsResponse>
: A promise that resolves to the user details object.
updateUser(userId: string, request: UpdateUserRequest)
userId
(string): The unique identifier of the user to update.request
(UpdateUserRequest): The request body containing the updated details of the user.Promise<User>
: A promise that resolves to the updated user object.
updatePassword(userId: string, request: UpdatePasswordRequest)
userId
(string): The unique identifier of the user.request
(UpdatePasswordRequest): The request body containing the current and new passwords.Promise<void>
: A promise that resolves when the password is successfully updated.
addEmail(userId: string, email: string)
userId
(string): The unique identifier of the user.email
(string): The email address to add.Promise<UserEmail>
: A promise that resolves to the newly added email object.
updateEmail(userId: string, emailId: string, isPrimary: boolean, isVerified: boolean)
userId
(string): The unique identifier of the user.emailId
(string): The unique identifier of the email to update.isPrimary
(boolean): Whether this email should be the primary email.isVerified
(boolean): Whether this email has been verified.Promise<UserEmail>
: A promise that resolves to the updated email object.
deleteEmail(userId: string, emailId: string)
userId
(string): The unique identifier of the user.emailId
(string): The unique identifier of the email to delete.Promise<void>
: A promise that resolves when the email is successfully deleted.
addPhone(userId: string, phoneNumber: string)
userId
(string): The unique identifier of the user.phoneNumber
(string): The phone number to add.Promise<UserPhone>
: A promise that resolves to the newly added phone object.
updatePhone(userId: string, phoneId: string, isPrimary: boolean, isVerified: boolean)
userId
(string): The unique identifier of the user.phoneId
(string): The unique identifier of the phone number to update.isPrimary
(boolean): Whether this phone number should be the primary.isVerified
(boolean): Whether this phone number has been verified.Promise<UserPhone>
: A promise that resolves to the updated phone object.
deletePhone(userId: string, phoneId: string)
userId
(string): The unique identifier of the user.phoneId
(string): The unique identifier of the phone number to delete.Promise<void>
: A promise that resolves when the phone number is successfully deleted.
deleteSocialConnection(userId: string, connectionId: string)
userId
(string): The unique identifier of the user.connectionId
(string): The unique identifier of the social connection to delete.Promise<void>
: A promise that resolves when the social connection is successfully deleted.
fetchInvitedUsers()
Promise<InvitationListResponse>
: A promise that resolves to a list of invited users.
inviteUser(request: InviteUserRequest)
request
(InviteUserRequest): The request body containing the invitation details.Promise<UserInvitation>
: A promise that resolves to the newly created user invitation object.
fetchWaitlist()
Promise<WaitlistResponse>
: A promise that resolves to a list of waitlist users.
approveWaitlistUser(waitlistUserId: string)
waitlistUserId
(string): The unique identifier of the waitlist user to approve.Promise<User>
: A promise that resolves to the newly created user object.