pub struct UsersResource { /* private fields */ }Expand description
User management — /api/v2/users.
Implementations§
Source§impl UsersResource
impl UsersResource
Sourcepub async fn me(&self) -> Result<GenericItemResponse, ManagerError>
pub async fn me(&self) -> Result<GenericItemResponse, ManagerError>
Get the currently authenticated user.
The underlying generated operation is marked deprecated upstream, but it remains part of the spec and is wrapped here for parity with the TypeScript/Go SDKs.
Sourcepub async fn get_by_email(
&self,
email: &str,
) -> Result<ManagedUserItemResponse, ManagerError>
pub async fn get_by_email( &self, email: &str, ) -> Result<ManagedUserItemResponse, ManagerError>
Get a user by email.
Sourcepub async fn list_all(&self) -> Result<Vec<ManagedUser>, ManagerError>
pub async fn list_all(&self) -> Result<Vec<ManagedUser>, ManagerError>
List all users.
Sourcepub async fn create(
&self,
user: CreateManagedUserRequest,
) -> Result<ManagedUserItemResponse, ManagerError>
pub async fn create( &self, user: CreateManagedUserRequest, ) -> Result<ManagedUserItemResponse, ManagerError>
Create a user.
Sourcepub async fn enable(&self, emails: Vec<String>) -> Result<(), ManagerError>
pub async fn enable(&self, emails: Vec<String>) -> Result<(), ManagerError>
Enable the given users (by email).
Sourcepub async fn disable(&self, emails: Vec<String>) -> Result<(), ManagerError>
pub async fn disable(&self, emails: Vec<String>) -> Result<(), ManagerError>
Disable the given users (by email).
Sourcepub async fn delete(&self, emails: Vec<String>) -> Result<(), ManagerError>
pub async fn delete(&self, emails: Vec<String>) -> Result<(), ManagerError>
Delete the given users (by email).
Sourcepub async fn reset_passwords(
&self,
emails: Vec<String>,
) -> Result<(), ManagerError>
pub async fn reset_passwords( &self, emails: Vec<String>, ) -> Result<(), ManagerError>
Trigger a password-reset email for the given users (by email).
Sourcepub async fn list_roles(&self) -> Result<Vec<AccountRole>, ManagerError>
pub async fn list_roles(&self) -> Result<Vec<AccountRole>, ManagerError>
List the role names that can be assigned to users.
Sourcepub async fn add_roles(
&self,
emails: Vec<String>,
roles: Vec<AccountRole>,
) -> Result<(), ManagerError>
pub async fn add_roles( &self, emails: Vec<String>, roles: Vec<AccountRole>, ) -> Result<(), ManagerError>
Grant the given roles to the given users (by email).
Sourcepub async fn remove_roles(
&self,
emails: Vec<String>,
roles: Vec<AccountRole>,
) -> Result<(), ManagerError>
pub async fn remove_roles( &self, emails: Vec<String>, roles: Vec<AccountRole>, ) -> Result<(), ManagerError>
Revoke the given roles from the given users (by email).
Auto Trait Implementations§
impl !RefUnwindSafe for UsersResource
impl !UnwindSafe for UsersResource
impl Freeze for UsersResource
impl Send for UsersResource
impl Sync for UsersResource
impl Unpin for UsersResource
impl UnsafeUnpin for UsersResource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more