Update representations for <dcp> and children

This commit is contained in:
Nicholas Rempel 2021-11-04 14:37:39 -07:00 committed by masalachai
parent 5f1bd57d4a
commit 7edb2402a2
1 changed files with 163 additions and 33 deletions

View File

@ -68,60 +68,156 @@ impl<'de> Deserialize<'de> for ServiceMenu {
} }
} }
/// Type corresponding to <all> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <all> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct All; pub struct All;
/// Type corresponding to <access> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <none> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct NoAccess;
/// Type corresponding to <null> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Null;
/// Type corresponding to <personal> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Personal;
/// Type corresponding to <personalAndOther> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct PersonalAndOther;
/// Type corresponding to <other> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Other;
/// Type corresponding to possible <retention> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub enum AccessType {
/// Data for the <all> tag
#[serde(rename = "all")]
All(All),
/// Data for the <none> tag
#[serde(rename = "none")]
NoAccess(NoAccess),
/// Data for the <null> tag
#[serde(rename = "null")]
Null(Null),
/// Data for the <personal> tag
#[serde(rename = "personal")]
Personal(Personal),
/// Data for the <personalAndOther> tag
#[serde(rename = "personalAndOther")]
PersonalAndOther(PersonalAndOther),
/// Data for the <other> tag
#[serde(rename = "other")]
Other(Other),
}
/// Type corresponding to <access> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Access { pub struct Access {
/// Data for the <all> tag #[serde(flatten)]
pub all: All, pub ty: AccessType,
} }
/// Type corresponding to <admin> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to possible <purpose> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Admin; pub enum PurposeType {
/// Data for the <admin> tag
#[serde(rename = "admin")]
Admin,
/// Data for the <contact> tag
#[serde(rename = "contact")]
Contact,
/// Data for the <prov> tag
#[serde(rename = "prov")]
Prov,
/// Data for the <other> tag
#[serde(rename = "other")]
OtherPurpose,
}
/// Type corresponding to <prov> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <purpose> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Prov;
/// Type corresponding to <purpose> in the EPP greeting XML (pending more compliant implementation)
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Purpose { pub struct Purpose {
/// Data for the <admin> tag #[serde(rename = "$value")]
pub admin: Admin, pub purpose: Vec<PurposeType>,
/// Data for the <prov> tag
pub prov: Prov,
} }
/// Type corresponding to <ours> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to possible <purpose> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Ours; pub enum RecipientType {
/// Data for the <other> tag
#[serde(rename = "other")]
Other,
/// Data for the <ours> tag
#[serde(rename = "ours")]
Ours,
/// Data for the <public> tag
#[serde(rename = "public")]
Public,
/// Data for the <same> tag
#[serde(rename = "same")]
Same,
/// Data for the <unrelated> tag
#[serde(rename = "unrelated")]
Unrelated,
}
/// Type corresponding to <public> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <recipeint> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Public;
/// Type corresponding to <recipeint> in the EPP greeting XML (pending more compliant implementation)
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Recipient { pub struct Recipient {
/// Data for the <ours> tag #[serde(rename = "$value")]
pub ours: Ours, pub recipient: Vec<RecipientType>,
/// Data for the <public> tag
pub public: Public,
} }
/// Type corresponding to <stated> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <business> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Business;
/// Type corresponding to <indefinite> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Indefinite;
/// Type corresponding to <legal> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Legal;
/// Type corresponding to <none> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct No;
/// Type corresponding to <stated> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Stated; pub struct Stated;
/// Type corresponding to <retention> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to possible <retention> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub enum RetentionType {
/// Data for the <business> tag
#[serde(rename = "business")]
Business(Business),
/// Data for the <indefinite> tag
#[serde(rename = "indefinite")]
Indefinite(Indefinite),
/// Data for the <legal> tag
#[serde(rename = "legal")]
Legal(Legal),
/// Data for the <none> tag
#[serde(rename = "none")]
No(No),
/// Data for the <stated> tag
#[serde(rename = "stated")]
Stated(Stated),
}
/// Type corresponding to <retention> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Retention { pub struct Retention {
/// Data for the <stated> tag #[serde(flatten)]
pub stated: Stated, pub ty: RetentionType,
} }
/// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation)
@ -135,13 +231,47 @@ pub struct Statement {
pub retention: Retention, pub retention: Retention,
} }
/// Type corresponding to <dcp> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <absolute> value in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Absolute {
#[serde(rename = "$value")]
pub absolute: StringValue,
}
/// Type corresponding to <relative> value in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Relative {
#[serde(rename = "$value")]
pub relative: StringValue,
}
/// Type corresponding to possible <expiry> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub enum ExpiryType {
/// Data for the <absolute> tag
#[serde(rename = "absolute")]
Absolute(Absolute),
/// Data for the <relative> tag
#[serde(rename = "relative")]
Relative(Relative),
}
/// Type corresponding to <expiry> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Expiry {
#[serde(flatten)]
pub ty: ExpiryType,
}
/// Type corresponding to <dcp> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Dcp { pub struct Dcp {
/// Data for the <access> tag /// Data for the <access> tag
pub access: Access, pub access: Access,
/// Data for the <statement> tag /// Data for the <statement> tags
pub statement: Statement, pub statement: Vec<Statement>,
/// Data for the <expiry> tag
pub expiry: Option<Expiry>,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)] #[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]