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(
&self,
query: ListUsersQuery,
) -> Result<Vec<ManagedUser>, ManagerError>
pub async fn list( &self, query: ListUsersQuery, ) -> Result<Vec<ManagedUser>, ManagerError>
List users, optionally filtered server-side.
The endpoint exposes no pagination parameters — a single fetch returns all matches.
Stands in for the generated list_users, whose email parameter (an anyOf
string-or-array type) is JSON-serialized into the query — it would send
?email="a@example.com" with literal quotes, which the server does not match. The facade
builds the query itself and decodes into the same generated response model.
Sourcepub async fn list_all(&self) -> Result<Vec<ManagedUser>, ManagerError>
pub async fn list_all(&self) -> Result<Vec<ManagedUser>, ManagerError>
List all users (unfiltered — the endpoint exposes no pagination parameters).
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).