list

Function list 

Source
pub async fn list(
    client: &mut BoxClient<'_>,
    params: Option<ListUsersParams>,
) -> Result<Users, BoxAPIError>
Expand description

Returns a list of all users for the Enterprise along with their user_id, public_name, and login.
The application and the authenticated user need to have the permission to look up users in the entire enterprise.

Sample usage:

use rusty_box::{Config, DevAuth, BoxClient,BoxAPIError, users_api};

use dotenv;
use std::env;

#[tokio::main]
async fn main() -> Result<(), BoxAPIError> {

    dotenv::from_filename(".dev.env").ok();
    let access_token = env::var("DEVELOPER_TOKEN").expect("DEVELOPER_TOKEN must be set");

    let config = Config::new();
    let auth = DevAuth::new(
        config,
        access_token,
    );
    let mut client = BoxClient::new(Box::new(auth));

    let result = users_api::list(&mut client, None).await?;
    println!("Users:");

    if let Some(users) = result.entries {
        for user in users {
            println!(
                "{}\t{}\t{}\t{}",
                user.id.unwrap(),
                user.r#type.to_string(),
                user.name.unwrap(),
                user.login.unwrap(),
            );
        }
    }

    Ok(())
}