rusty-box 0.4.1-alpha

Box.com API wrapper
Documentation
/*
 * Box Platform API
 *
 * [Box Platform](https://box.dev) provides functionality to provide access to content stored within [Box](https://box.com). It provides endpoints for basic manipulation of files and folders, management of users within an enterprise, as well as more complex topics such as legal holds and retention policies.
 *
 * The version of the OpenAPI document: 2.0.0
 * Contact: devrel@box.com
 * Generated by: https://openapi-generator.tech
 */

// use super::user_all_of_notification_email::UserAllOfNotificationEmail; // TODO: disabled for now

/// User : A standard representation of a user, as returned from any user API endpoints by default

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct User {
    /// The unique identifier for this user
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// `user`
    #[serde(rename = "type")]
    pub r#type: RHashType,
    /// The display name of this user
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The primary email address of this user
    #[serde(rename = "login", skip_serializing_if = "Option::is_none")]
    pub login: Option<String>,
    /// When the user object was created
    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    /// When the user object was last modified
    #[serde(rename = "modified_at", skip_serializing_if = "Option::is_none")]
    pub modified_at: Option<String>,
    /// The language of the user, formatted in modified version of the [ISO 639-1](/guides/api-calls/language-codes) format.
    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
    pub language: Option<String>,
    /// The user's timezone
    #[serde(rename = "timezone", skip_serializing_if = "Option::is_none")]
    pub timezone: Option<String>,
    /// The user’s total available space amount in bytes
    #[serde(rename = "space_amount", skip_serializing_if = "Option::is_none")]
    pub space_amount: Option<i64>,
    /// The amount of space in use by the user
    #[serde(rename = "space_used", skip_serializing_if = "Option::is_none")]
    pub space_used: Option<i64>,
    /// The maximum individual file size in bytes the user can have
    #[serde(rename = "max_upload_size", skip_serializing_if = "Option::is_none")]
    pub max_upload_size: Option<i64>,
    /// The user's account status
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// The user’s job title
    #[serde(rename = "job_title", skip_serializing_if = "Option::is_none")]
    pub job_title: Option<String>,
    /// The user’s phone number
    #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
    pub phone: Option<String>,
    /// The user’s address
    #[serde(rename = "address", skip_serializing_if = "Option::is_none")]
    pub address: Option<String>,
    /// URL of the user’s avatar image
    #[serde(rename = "avatar_url", skip_serializing_if = "Option::is_none")]
    pub avatar_url: Option<String>,
    //
    //TODO: Empty notification email is not working
    // #[serde(
    //     rename = "notification_email",
    //     default,
    //     with = "::serde_with::rust::double_option",
    //     skip_serializing_if = "Option::is_none"
    // )]
    // pub notification_email: Option<Option<Box<UserAllOfNotificationEmail>>>,
    //
    //
}

impl User {
    /// A standard representation of a user, as returned from any user API endpoints by default
    pub fn new(r#type: RHashType) -> User {
        User {
            id: None,
            r#type,
            name: None,
            login: None,
            created_at: None,
            modified_at: None,
            language: None,
            timezone: None,
            space_amount: None,
            space_used: None,
            max_upload_size: None,
            status: None,
            job_title: None,
            phone: None,
            address: None,
            avatar_url: None,
            //
            //TODO: Empty notification email is not working
            // notification_email: None,
            //
        }
    }
}

/// `user`
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RHashType {
    #[serde(rename = "user")]
    User,
}

impl ToString for RHashType {
    fn to_string(&self) -> String {
        match self {
            Self::User => String::from("user"),
        }
    }
}

impl Default for RHashType {
    fn default() -> RHashType {
        Self::User
    }
}
/// The user's account status
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "inactive")]
    Inactive,
    #[serde(rename = "cannot_delete_edit")]
    CannotDeleteEdit,
    #[serde(rename = "cannot_delete_edit_upload")]
    CannotDeleteEditUpload,
}

impl Default for Status {
    fn default() -> Status {
        Self::Active
    }
}