Struct clerk_rs::apis::users_api::User

source ·
pub struct User;

Implementations§

source§

impl User

source

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.

source

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.

source

pub async fn delete_user( clerk_client: &Clerk, user_id: &str ) -> Result<DeletedObject, Error<DeleteUserError>>

Delete the specified user

source

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.

source

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.

source

pub async fn get_user( clerk_client: &Clerk, user_id: &str ) -> Result<User, Error<GetUserError>>

Retrieve the details of a user

source

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.

source

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.

source

pub async fn unban_user( clerk_client: &Clerk, user_id: &str ) -> Result<User, Error<UnbanUserError>>

Removes the ban mark from the given user.

source

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.

source

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.

source

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

source

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.

source

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.

Auto Trait Implementations§

§

impl Freeze for User

§

impl RefUnwindSafe for User

§

impl Send for User

§

impl Sync for User

§

impl Unpin for User

§

impl UnwindSafe for User

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more