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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use Method;
use Translation;
use crate::;
/// List translated terms for a locale.
///
/// **Endpoint** `GET /api/v1/projects/{projectId}/translations/{localeCode}`
///
/// **Default model** [`Translation`]
///
/// # Examples
/// ```
/// # use traduora::{Login, TestClient as Traduora, TraduoraError};
/// use chrono::{TimeZone, Utc};
/// use traduora::{api::translations::Translations, api::labels::Label, Query};
///
/// # let login = Login::password("tester@mail.example", "letmeinpls");
/// let client = Traduora::with_auth("localhost:8080", login)?;
/// let project = "b1001dd9-e1c0-4fb0-a60d-eaaec304d332".into();
/// let locale = "en_US".into();
/// let translations = Translations::new(project, locale).query(&client)?;
///
/// assert_eq!(translations.len(), 2);
/// assert_eq!(translations[0].value, "My first translation");
/// assert_eq!(
/// translations[0].labels,
/// vec![Label {
/// id: "c16d0fc3-73e6-4962-b8d5-f3054b8ff002".into(),
/// value: "Example label".into(),
/// color: "#D81159".into()
/// }]
/// );
/// assert_eq!(translations[0].term_id.value(), "38ba819e-8023-464b-aa1b-6177c149f888");
/// assert_eq!(translations[0].date.created, Utc.ymd(2021, 10, 25).and_hms_milli(18, 54, 16, 426));
/// assert_eq!(translations[0].date.modified, Utc.ymd(2021, 10, 25).and_hms_milli(18, 54, 16, 426));
///
/// assert_eq!(translations[1].value, "My second translation");
/// assert!(translations[1].labels.is_empty());
/// assert_eq!(translations[1].term_id.value(), "7eafe83d-1448-49ea-8ae0-f8753cbd669c");
/// assert_eq!(translations[1].date.created, Utc.ymd(2021, 10, 25).and_hms_milli(18, 54, 16, 422));
/// assert_eq!(translations[1].date.modified, Utc.ymd(2021, 10, 25).and_hms_milli(18, 54, 21, 000));
/// # Ok::<(), TraduoraError>(())
/// ```