1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use super::*;

#[derive(Deserialize, Serialize, Debug)]
pub struct User {
    pub id: i32,
    pub email: String,
    pub first_name: Option<String>,
    pub last_name: Option<String>,
    pub birthday: Option<time::Date>,
    pub verified: bool,
}

impl Client {
    pub async fn users(&self) -> Result<Vec<User>, Box<dyn std::error::Error>> {
        Ok(req()
            .get(self.endpoint("/v1/users", vec![]))
            .send()
            .await?
            .json::<Vec<User>>()
            .await?)
    }
}