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
use super::{HasResponse, HasValue};
use method::Get;
use request::AccountRequest;
use request::Request;
use {ROOT_URL, STATIC_URL_ERROR};
const ACCOUNT_SEGMENT: &'static str = "account";
#[derive(Deserialize, Serialize, Debug, Clone, Getters, Setters)]
pub struct Account {
#[get = "pub"]
droplet_limit: usize,
#[get = "pub"]
floating_ip_limit: usize,
#[get = "pub"]
email: String,
#[get = "pub"]
uuid: String,
#[get = "pub"]
email_verified: bool,
#[get = "pub"]
status: String,
#[get = "pub"]
status_message: String,
}
impl Account {
pub fn get() -> AccountRequest<Get, Account> {
let mut url = ROOT_URL.clone();
url.path_segments_mut()
.expect(STATIC_URL_ERROR)
.push(ACCOUNT_SEGMENT);
Request::new(url)
}
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct AccountResponse {
account: Account,
}
impl HasResponse for Account {
type Response = AccountResponse;
}
impl HasValue for AccountResponse {
type Value = Account;
fn value(self) -> Account {
self.account
}
}