#[cfg(feature = "json")]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug)]
#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
pub struct NewAccount {
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
pub contact: Option<String>,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
#[cfg_attr(feature = "json", serde(rename = "termsOfServiceAgreed"))]
pub terms_of_service_agreed: Option<bool>,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
#[cfg_attr(feature = "json", serde(rename = "onlyReturnExisting"))]
pub only_return_existing: Option<bool>,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
#[cfg_attr(feature = "json", serde(rename = "externalAccountBinding"))]
pub external_account_binding: Option<super::JsonWebSignature>,
}
#[cfg(feature = "json")]
impl NewAccount {
pub fn from_str(s: &str) -> Result<NewAccount, serde_json::error::Error> {
serde_json::from_str(s)
}
pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
serde_json::to_string(self)
}
}
#[derive(Clone, Debug)]
#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
pub struct AccountUpdate {
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
pub contact: Option<Vec<String>>,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
pub status: Option<AccountStatus>,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
#[cfg_attr(feature = "json", serde(rename = "termsOfServiceAgreed"))]
pub terms_of_service_agreed: Option<bool>,
}
#[cfg(feature = "json")]
impl AccountUpdate {
pub fn from_str(s: &str) -> Result<AccountUpdate, serde_json::error::Error> {
serde_json::from_str(s)
}
pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
serde_json::to_string(self)
}
}
#[derive(Clone, Debug)]
#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
pub struct Account {
pub status: AccountStatus,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
pub contact: Option<Vec<String>>,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
#[cfg_attr(feature = "json", serde(rename = "termsOfServiceAgreed"))]
pub terms_of_service_agreed: Option<bool>,
#[cfg_attr(feature = "json", serde(skip_serializing_if = "Option::is_none"))]
#[cfg_attr(feature = "json", serde(rename = "externalAccountBinding"))]
pub external_account_binding: Option<super::JsonWebSignature>,
pub orders: String,
}
#[cfg(feature = "json")]
impl Account {
pub fn from_str(s: &str) -> Result<Account, serde_json::error::Error> {
serde_json::from_str(s)
}
pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
serde_json::to_string(self)
}
}
#[derive(Clone, Debug)]
#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
pub struct AccountOrders {
pub orders: Vec<String>,
}
#[cfg(feature = "json")]
impl AccountOrders {
pub fn from_str(s: &str) -> Result<AccountOrders, serde_json::error::Error> {
serde_json::from_str(s)
}
pub fn to_string(&self) -> Result<String, serde_json::error::Error> {
serde_json::to_string(self)
}
}
#[derive(Clone, Debug)]
#[cfg_attr(feature = "json", derive(Serialize, Deserialize))]
pub enum AccountStatus {
#[cfg_attr(feature = "json", serde(rename = "valid"))]
Valid,
#[cfg_attr(feature = "json", serde(rename = "deactivated"))]
Deactivated,
#[cfg_attr(feature = "json", serde(rename = "revoked"))]
Revoked,
}