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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use Method;
use Serialize;
use Project;
use crate::;
/// List all projects the current user has any form of access to.
///
/// **Endpoint** `GET /api/v1/projects`
///
/// **Default model** [`Project`]
///
/// # Examples
/// ```
/// # use traduora::{Login, TestClient as Traduora, TraduoraError};
/// use chrono::{TimeZone, Utc};
/// use traduora::{api::{projects::Projects, Role}, Query};
///
/// # let login = Login::password("tester@mail.example", "letmeinpls");
/// let client = Traduora::with_auth("localhost:8080", login)?;
/// let projects = Projects.query(&client)?;
///
/// assert_eq!(projects.len(), 2);
/// assert_eq!(projects[0].name, "Traduora API bindings");
/// assert_eq!(projects[0].description, "Translations for this Traduora API bindings rust crate.");
/// assert_eq!(projects[0].terms_count, 5812);
/// assert_eq!(projects[0].locales_count, 2);
/// assert_eq!(projects[0].role, Role::Admin);
/// assert_eq!(projects[0].date.created, Utc.ymd(2021, 10, 23).and_hms_milli(16, 07, 39, 946));
/// assert_eq!(projects[0].date.modified, Utc.ymd(2021, 10, 23).and_hms_milli(19, 24, 34, 000));
/// assert_eq!(projects[0].id.value(), "b1001dd9-e1c0-4fb0-a60d-eaaec304d332");
///
/// assert_eq!(projects[1].name, "Test project");
/// assert_eq!(projects[1].description, "Simple project to mess around with.");
/// assert_eq!(projects[1].terms_count, 3);
/// assert_eq!(projects[1].locales_count, 1);
/// assert_eq!(projects[1].role, Role::Viewer);
/// assert_eq!(projects[1].date.created, Utc.ymd(2021, 10, 22).and_hms_milli(12, 45, 13, 138));
/// assert_eq!(projects[1].date.modified, Utc.ymd(2021, 10, 23).and_hms_milli(19, 51, 47, 391));
/// assert_eq!(projects[1].id.value(), "64f92751-ef8f-4d1e-83d1-ea10e6939db9");
/// # Ok::<(), TraduoraError>(())
/// ```
;