1#[cfg(feature = "json")]
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug)]
8#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
9pub struct NewAccount {
10 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
12 pub contact: Option<String>,
13 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
15 #[cfg_attr(feature = "json", serde(rename = "termsOfServiceAgreed"))]
16 pub terms_of_service_agreed: Option<bool>,
17 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
19 #[cfg_attr(feature = "json", serde(rename = "onlyReturnExisting"))]
20 pub only_return_existing: Option<bool>,
21 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
23 #[cfg_attr(feature = "json", serde(rename = "externalAccountBinding"))]
24 pub external_account_binding: Option<super::JsonWebSignature>,
25}
26
27#[cfg(feature = "json")]
28impl NewAccount {
29 pub fn from_str(s: &str) -> Result<NewAccount, serde_json::error::Error> {
31 serde_json::from_str(s)
32 }
33
34 pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
36 serde_json::to_string(self)
37 }
38}
39
40#[derive(Clone, Debug)]
44#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
45pub struct AccountUpdate {
46 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
50 pub contact: Option<Vec<String>>,
51 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
55 pub status: Option<AccountStatus>,
56 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
60 #[cfg_attr(feature = "json", serde(rename = "termsOfServiceAgreed"))]
61 pub terms_of_service_agreed: Option<bool>,
62}
63
64#[cfg(feature = "json")]
65impl AccountUpdate {
66 pub fn from_str(s: &str) -> Result<AccountUpdate, serde_json::error::Error> {
68 serde_json::from_str(s)
69 }
70
71 pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
73 serde_json::to_string(self)
74 }
75}
76
77#[derive(Clone, Debug)]
81#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
82pub struct Account {
83 pub status: AccountStatus,
85 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
87 pub contact: Option<Vec<String>>,
88 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
90 #[cfg_attr(feature = "json", serde(rename = "termsOfServiceAgreed"))]
91 pub terms_of_service_agreed: Option<bool>,
92 #[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
94 #[cfg_attr(feature = "json", serde(rename = "externalAccountBinding"))]
95 pub external_account_binding: Option<super::JsonWebSignature>,
96 pub orders: String,
100}
101
102#[cfg(feature = "json")]
103impl Account {
104 pub fn from_str(s: &str) -> Result<Account, serde_json::error::Error> {
106 serde_json::from_str(s)
107 }
108
109 pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
111 serde_json::to_string(self)
112 }
113}
114
115#[derive(Clone, Debug)]
119#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
120pub struct AccountOrders {
121 pub orders: Vec<String>,
123}
124
125#[cfg(feature = "json")]
126impl AccountOrders {
127 pub fn from_str(s: &str) -> Result<AccountOrders, serde_json::error::Error> {
129 serde_json::from_str(s)
130 }
131
132 pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
134 serde_json::to_string(self)
135 }
136}
137
138#[derive(Clone, Debug)]
142#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
143pub enum AccountStatus {
144 #[cfg_attr(feature = "json", serde(rename = "valid"))]
145 Valid,
146 #[cfg_attr(feature = "json", serde(rename = "deactivated"))]
147 Deactivated,
148 #[cfg_attr(feature = "json", serde(rename = "revoked"))]
149 Revoked,
150}