rusty_box/rest_api/users/models/
user.rs

1/*
2 * Box Platform API
3 *
4 * [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.
5 *
6 * The version of the OpenAPI document: 2.0.0
7 * Contact: devrel@box.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11// use super::user_all_of_notification_email::UserAllOfNotificationEmail; // TODO: disabled for now
12
13/// User : A standard representation of a user, as returned from any user API endpoints by default
14
15#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
16pub struct User {
17    /// The unique identifier for this user
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<String>,
20    /// `user`
21    #[serde(rename = "type")]
22    pub r#type: RHashType,
23    /// The display name of this user
24    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
25    pub name: Option<String>,
26    /// The primary email address of this user
27    #[serde(rename = "login", skip_serializing_if = "Option::is_none")]
28    pub login: Option<String>,
29    /// When the user object was created
30    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
31    pub created_at: Option<String>,
32    /// When the user object was last modified
33    #[serde(rename = "modified_at", skip_serializing_if = "Option::is_none")]
34    pub modified_at: Option<String>,
35    /// The language of the user, formatted in modified version of the [ISO 639-1](/guides/api-calls/language-codes) format.
36    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
37    pub language: Option<String>,
38    /// The user's timezone
39    #[serde(rename = "timezone", skip_serializing_if = "Option::is_none")]
40    pub timezone: Option<String>,
41    /// The user’s total available space amount in bytes
42    #[serde(rename = "space_amount", skip_serializing_if = "Option::is_none")]
43    pub space_amount: Option<i64>,
44    /// The amount of space in use by the user
45    #[serde(rename = "space_used", skip_serializing_if = "Option::is_none")]
46    pub space_used: Option<i64>,
47    /// The maximum individual file size in bytes the user can have
48    #[serde(rename = "max_upload_size", skip_serializing_if = "Option::is_none")]
49    pub max_upload_size: Option<i64>,
50    /// The user's account status
51    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
52    pub status: Option<Status>,
53    /// The user’s job title
54    #[serde(rename = "job_title", skip_serializing_if = "Option::is_none")]
55    pub job_title: Option<String>,
56    /// The user’s phone number
57    #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
58    pub phone: Option<String>,
59    /// The user’s address
60    #[serde(rename = "address", skip_serializing_if = "Option::is_none")]
61    pub address: Option<String>,
62    /// URL of the user’s avatar image
63    #[serde(rename = "avatar_url", skip_serializing_if = "Option::is_none")]
64    pub avatar_url: Option<String>,
65    //
66    //TODO: Empty notification email is not working
67    // #[serde(
68    //     rename = "notification_email",
69    //     default,
70    //     with = "::serde_with::rust::double_option",
71    //     skip_serializing_if = "Option::is_none"
72    // )]
73    // pub notification_email: Option<Option<Box<UserAllOfNotificationEmail>>>,
74    //
75    //
76}
77
78impl User {
79    /// A standard representation of a user, as returned from any user API endpoints by default
80    pub fn new(r#type: RHashType) -> User {
81        User {
82            id: None,
83            r#type,
84            name: None,
85            login: None,
86            created_at: None,
87            modified_at: None,
88            language: None,
89            timezone: None,
90            space_amount: None,
91            space_used: None,
92            max_upload_size: None,
93            status: None,
94            job_title: None,
95            phone: None,
96            address: None,
97            avatar_url: None,
98            //
99            //TODO: Empty notification email is not working
100            // notification_email: None,
101            //
102        }
103    }
104}
105
106/// `user`
107#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
108pub enum RHashType {
109    #[serde(rename = "user")]
110    User,
111}
112
113impl ToString for RHashType {
114    fn to_string(&self) -> String {
115        match self {
116            Self::User => String::from("user"),
117        }
118    }
119}
120
121impl Default for RHashType {
122    fn default() -> RHashType {
123        Self::User
124    }
125}
126/// The user's account status
127#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
128pub enum Status {
129    #[serde(rename = "active")]
130    Active,
131    #[serde(rename = "inactive")]
132    Inactive,
133    #[serde(rename = "cannot_delete_edit")]
134    CannotDeleteEdit,
135    #[serde(rename = "cannot_delete_edit_upload")]
136    CannotDeleteEditUpload,
137}
138
139impl Default for Status {
140    fn default() -> Status {
141        Self::Active
142    }
143}