pub struct User;
Implementations§
source§impl User
impl User
sourcepub async fn ban_user(
clerk_client: &Clerk,
user_id: &str
) -> Result<User, Error<BanUserError>>
pub async fn ban_user( clerk_client: &Clerk, user_id: &str ) -> Result<User, Error<BanUserError>>
Marks the given user as banned, which means that all their sessions are revoked and they are not allowed to sign in again.
sourcepub async fn create_user(
clerk_client: &Clerk,
create_user_request: CreateUserRequest
) -> Result<User, Error<CreateUserError>>
pub async fn create_user( clerk_client: &Clerk, create_user_request: CreateUserRequest ) -> Result<User, Error<CreateUserError>>
Creates a new user. Your user management settings determine how you should setup your user model. Any email address and phone number created using this method will be marked as verified. Note: If you are performing a migration, check out our guide on zero downtime migrations. A rate limit rule of 20 requests per 10 seconds is applied to this endpoint.
sourcepub async fn delete_user(
clerk_client: &Clerk,
user_id: &str
) -> Result<DeletedObject, Error<DeleteUserError>>
pub async fn delete_user( clerk_client: &Clerk, user_id: &str ) -> Result<DeletedObject, Error<DeleteUserError>>
Delete the specified user
sourcepub async fn disable_mfa(
clerk_client: &Clerk,
user_id: &str
) -> Result<DisableMfa200Response, Error<DisableMfaError>>
pub async fn disable_mfa( clerk_client: &Clerk, user_id: &str ) -> Result<DisableMfa200Response, Error<DisableMfaError>>
Disable all of a user’s MFA methods (e.g. OTP sent via SMS, TOTP on their authenticator app) at once.
sourcepub async fn get_o_auth_access_token(
clerk_client: &Clerk,
user_id: &str,
provider: &str
) -> Result<Vec<GetOAuthAccessToken200ResponseInner>, Error<GetOAuthAccessTokenError>>
pub async fn get_o_auth_access_token( clerk_client: &Clerk, user_id: &str, provider: &str ) -> Result<Vec<GetOAuthAccessToken200ResponseInner>, Error<GetOAuthAccessTokenError>>
Fetch the corresponding OAuth access token for a user that has previously authenticated with a particular OAuth provider. For OAuth 2.0, if the access token has expired and we have a corresponding refresh token, the access token will be refreshed transparently the new one will be returned.
sourcepub async fn get_user(
clerk_client: &Clerk,
user_id: &str
) -> Result<User, Error<GetUserError>>
pub async fn get_user( clerk_client: &Clerk, user_id: &str ) -> Result<User, Error<GetUserError>>
Retrieve the details of a user
sourcepub async fn get_user_list(
clerk_client: &Clerk,
email_address: Option<Vec<String>>,
phone_number: Option<Vec<String>>,
external_id: Option<Vec<String>>,
username: Option<Vec<String>>,
web3_wallet: Option<Vec<String>>,
user_id: Option<Vec<String>>,
organization_id: Option<Vec<String>>,
query: Option<&str>,
limit: Option<f32>,
offset: Option<f32>,
order_by: Option<&str>
) -> Result<Vec<User>, Error<GetUserListError>>
pub async fn get_user_list( clerk_client: &Clerk, email_address: Option<Vec<String>>, phone_number: Option<Vec<String>>, external_id: Option<Vec<String>>, username: Option<Vec<String>>, web3_wallet: Option<Vec<String>>, user_id: Option<Vec<String>>, organization_id: Option<Vec<String>>, query: Option<&str>, limit: Option<f32>, offset: Option<f32>, order_by: Option<&str> ) -> Result<Vec<User>, Error<GetUserListError>>
Returns a list of all users. The users are returned sorted by creation date, with the newest users appearing first.
sourcepub async fn get_users_count(
clerk_client: &Clerk,
email_address: Option<Vec<String>>,
phone_number: Option<Vec<String>>,
external_id: Option<Vec<String>>,
username: Option<Vec<String>>,
web3_wallet: Option<Vec<String>>,
user_id: Option<Vec<String>>,
query: Option<&str>
) -> Result<TotalCount, Error<GetUsersCountError>>
pub async fn get_users_count( clerk_client: &Clerk, email_address: Option<Vec<String>>, phone_number: Option<Vec<String>>, external_id: Option<Vec<String>>, username: Option<Vec<String>>, web3_wallet: Option<Vec<String>>, user_id: Option<Vec<String>>, query: Option<&str> ) -> Result<TotalCount, Error<GetUsersCountError>>
Returns a total count of all users that match the given filtering criteria.
sourcepub async fn unban_user(
clerk_client: &Clerk,
user_id: &str
) -> Result<User, Error<UnbanUserError>>
pub async fn unban_user( clerk_client: &Clerk, user_id: &str ) -> Result<User, Error<UnbanUserError>>
Removes the ban mark from the given user.
sourcepub async fn update_user(
clerk_client: &Clerk,
user_id: &str,
update_user_request: UpdateUserRequest
) -> Result<User, Error<UpdateUserError>>
pub async fn update_user( clerk_client: &Clerk, user_id: &str, update_user_request: UpdateUserRequest ) -> Result<User, Error<UpdateUserError>>
Update a user’s attributes. You can set the user’s primary contact identifiers (email address and phone numbers) by updating the primary_email_address_id
and primary_phone_number_id
attributes respectively. Both IDs should correspond to verified identifications that belong to the user. You can remove a user’s username by setting the username attribute to null or the blank string "". This is a destructive action; the identification will be deleted forever. Usernames can be removed only if they are optional in your instance settings and there’s at least one other identifier which can be used for authentication.
sourcepub async fn update_user_metadata(
clerk_client: &Clerk,
user_id: &str,
update_user_metadata_request: Option<UpdateUserMetadataRequest>
) -> Result<User, Error<UpdateUserMetadataError>>
pub async fn update_user_metadata( clerk_client: &Clerk, user_id: &str, update_user_metadata_request: Option<UpdateUserMetadataRequest> ) -> Result<User, Error<UpdateUserMetadataError>>
Update a user’s metadata attributes by merging existing values with the provided parameters. This endpoint behaves differently than the Update a user endpoint. Metadata values will not be replaced entirely. Instead, a deep merge will be performed. Deep means that any nested JSON objects will be merged as well. You can remove metadata keys at any level by setting their value to null
.
sourcepub async fn users_get_organization_memberships(
clerk_client: &Clerk,
user_id: &str,
limit: Option<f32>,
offset: Option<f32>
) -> Result<OrganizationMemberships, Error<UsersGetOrganizationMembershipsError>>
pub async fn users_get_organization_memberships( clerk_client: &Clerk, user_id: &str, limit: Option<f32>, offset: Option<f32> ) -> Result<OrganizationMemberships, Error<UsersGetOrganizationMembershipsError>>
Retrieve a paginated list of the user’s organization memberships
sourcepub async fn verify_password(
clerk_client: &Clerk,
user_id: &str,
verify_password_request: Option<VerifyPasswordRequest>
) -> Result<VerifyPassword200Response, Error<VerifyPasswordError>>
pub async fn verify_password( clerk_client: &Clerk, user_id: &str, verify_password_request: Option<VerifyPasswordRequest> ) -> Result<VerifyPassword200Response, Error<VerifyPasswordError>>
Check that the user’s password matches the supplied input. Useful for custom auth flows and re-verification.
sourcepub async fn verify_totp(
clerk_client: &Clerk,
user_id: &str,
verify_totp_request: Option<VerifyTotpRequest>
) -> Result<VerifyTotp200Response, Error<VerifyTotpError>>
pub async fn verify_totp( clerk_client: &Clerk, user_id: &str, verify_totp_request: Option<VerifyTotpRequest> ) -> Result<VerifyTotp200Response, Error<VerifyTotpError>>
Verify that the provided TOTP or backup code is valid for the user. Verifying a backup code will result it in being consumed (i.e. it will become invalid). Useful for custom auth flows and re-verification.