rust_woocommerce/models/
data.rs

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