pub struct UserHandler { /* private fields */ }
Expand description
Handler for user operations
Implementations§
Source§impl UserHandler
impl UserHandler
Sourcepub fn new(client: FilesClient) -> Self
pub fn new(client: FilesClient) -> Self
Creates a new UserHandler
Sourcepub async fn list(
&self,
cursor: Option<String>,
per_page: Option<i32>,
) -> Result<(Vec<UserEntity>, PaginationInfo)>
pub async fn list( &self, cursor: Option<String>, per_page: Option<i32>, ) -> Result<(Vec<UserEntity>, PaginationInfo)>
Sourcepub async fn get(&self, id: i64) -> Result<UserEntity>
pub async fn get(&self, id: i64) -> Result<UserEntity>
Sourcepub async fn create(
&self,
username: &str,
email: Option<&str>,
password: Option<&str>,
name: Option<&str>,
) -> Result<UserEntity>
pub async fn create( &self, username: &str, email: Option<&str>, password: Option<&str>, name: Option<&str>, ) -> Result<UserEntity>
Create a new user
§Arguments
username
- Username (required)email
- Email address (optional)password
- Password (optional)name
- Full name (optional)
§Examples
let handler = UserHandler::new(client);
let user = handler.create(
"newuser",
Some("user@example.com"),
Some("password123"),
Some("New User")
).await?;
Sourcepub async fn update(
&self,
id: i64,
email: Option<&str>,
name: Option<&str>,
company: Option<&str>,
notes: Option<&str>,
) -> Result<UserEntity>
pub async fn update( &self, id: i64, email: Option<&str>, name: Option<&str>, company: Option<&str>, notes: Option<&str>, ) -> Result<UserEntity>
Update a user
§Arguments
id
- User IDemail
- New email (optional)name
- New name (optional)company
- New company (optional)notes
- New notes (optional)
Trait Implementations§
Source§impl Clone for UserHandler
impl Clone for UserHandler
Source§fn clone(&self) -> UserHandler
fn clone(&self) -> UserHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for UserHandler
impl !RefUnwindSafe for UserHandler
impl Send for UserHandler
impl Sync for UserHandler
impl Unpin for UserHandler
impl !UnwindSafe for UserHandler
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