1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PersonType {
    User,
    Customer,
    Team
}

#[derive(Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Person {
    pub id: i32,
    pub first_name: Option<String>,
    pub last_name: Option<String>,
    pub email: Option<String>,
    // Undocumented
    pub emails: Option<Vec<String>>,
    pub phone: Option<String>,
    #[serde(rename = "type")]
    pub person_type: Option<PersonType>,
    pub photo_url: Option<String>,
}

impl Person {
    pub fn new(id: i32) -> Person {
        Person {
            id: id,
            first_name: None,
            last_name: None,
            email: None,
            emails: None,
            phone: None,
            person_type: None,
            photo_url: None,
        }
    }
}