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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
use crate::controllers::Entity;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Data {
/// Data resource ID.
pub slug: String,
/// Data resource description.
pub description: String,
}
impl Entity for Data {
fn endpoint() -> String {
String::from("data/")
}
fn child_endpoint(parent_id: i32) -> String {
let _ = parent_id;
String::new()
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Continent {
/// 2 character continent code
pub code: String,
/// Full name of continent.
pub name: String,
/// List of countries on this continent.
pub countries: Vec<Country>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Country {
/// ISO3166 alpha-2 country code
pub code: String,
/// Default ISO4127 alpha-3 currency code for the country.
pub currency_code: Option<String>,
/// Currency symbol position for this country.
pub currency_pos: Option<String>,
/// Decimal separator for displayed prices for this country.
pub decimal_sep: Option<String>,
/// The unit lengths are defined in for this country.
pub dimension_unit: Option<String>,
/// Full name of country.
pub name: String,
/// Number of decimal points shown in displayed prices for this country.
pub num_decimals: Option<i32>,
/// List of states in this country. See Continents - Countries - States properties
pub states: Vec<State>,
/// Thousands separator for displayed prices in this country.
pub thousand_sep: Option<String>,
/// The unit weights are defined in for this country.
pub weight_unit: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct State {
/// State code.
pub code: serde_json::Value,
/// Full name of state.
pub name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Currency {
/// ISO4217 currency code.
pub code: CurrencyISO,
/// Full name of currency.
pub name: String,
/// Currency symbol.
pub symbol: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, PartialOrd, Default)]
pub enum CurrencyISO {
AED,
AFN,
ALL,
AMD,
ANG,
AOA,
ARS,
AUD,
AWG,
AZN,
BAM,
BYN,
BBD,
BDT,
BGN,
BHD,
BIF,
BMD,
BND,
BOB,
BRL,
BSD,
BTC,
BTN,
BWP,
BYR,
BZD,
CAD,
CDF,
CHF,
CLP,
CNY,
COP,
CRC,
CUC,
CUP,
CVE,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
ERN,
ETB,
EUR,
FJD,
FKP,
GBP,
GEL,
GGP,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
IMP,
INR,
IQD,
IRR,
IRT,
ISK,
JEP,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KPW,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MAD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRO,
MRU,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
NGN,
NIO,
NOK,
NPR,
NZD,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PRB,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SDG,
SEK,
SGD,
SHP,
SLL,
SOS,
SRD,
SSP,
STD,
STN,
SYP,
SZL,
THB,
TJS,
TMT,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
#[default]
USD,
UYU,
UZS,
VEF,
VES,
VND,
VUV,
WST,
XAF,
XCD,
XOF,
XPF,
YER,
ZAR,
ZMW,
}