From 7edb2402a2c3b675c3dd4277ef3576c50e73d3e4 Mon Sep 17 00:00:00 2001 From: Nicholas Rempel Date: Thu, 4 Nov 2021 14:37:39 -0700 Subject: [PATCH] Update representations for and children --- epp-client/src/epp/response.rs | 196 +++++++++++++++++++++++++++------ 1 file changed, 163 insertions(+), 33 deletions(-) diff --git a/epp-client/src/epp/response.rs b/epp-client/src/epp/response.rs index 37043af..25bde4a 100644 --- a/epp-client/src/epp/response.rs +++ b/epp-client/src/epp/response.rs @@ -68,60 +68,156 @@ impl<'de> Deserialize<'de> for ServiceMenu { } } -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to in the EPP greeting XML #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct All; -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct NoAccess; + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Null; + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Personal; + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct PersonalAndOther; + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Other; + +/// Type corresponding to possible type values +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub enum AccessType { + /// Data for the tag + #[serde(rename = "all")] + All(All), + /// Data for the tag + #[serde(rename = "none")] + NoAccess(NoAccess), + /// Data for the tag + #[serde(rename = "null")] + Null(Null), + /// Data for the tag + #[serde(rename = "personal")] + Personal(Personal), + /// Data for the tag + #[serde(rename = "personalAndOther")] + PersonalAndOther(PersonalAndOther), + /// Data for the tag + #[serde(rename = "other")] + Other(Other), +} + +/// Type corresponding to in the EPP greeting XML #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Access { - /// Data for the tag - pub all: All, + #[serde(flatten)] + pub ty: AccessType, } -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to possible type values #[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct Admin; +pub enum PurposeType { + /// Data for the tag + #[serde(rename = "admin")] + Admin, + /// Data for the tag + #[serde(rename = "contact")] + Contact, + /// Data for the tag + #[serde(rename = "prov")] + Prov, + /// Data for the tag + #[serde(rename = "other")] + OtherPurpose, +} -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) -#[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct Prov; - -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to in the EPP greeting XML #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Purpose { - /// Data for the tag - pub admin: Admin, - /// Data for the tag - pub prov: Prov, + #[serde(rename = "$value")] + pub purpose: Vec, } -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to possible type values #[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct Ours; +pub enum RecipientType { + /// Data for the tag + #[serde(rename = "other")] + Other, + /// Data for the tag + #[serde(rename = "ours")] + Ours, + /// Data for the tag + #[serde(rename = "public")] + Public, + /// Data for the tag + #[serde(rename = "same")] + Same, + /// Data for the tag + #[serde(rename = "unrelated")] + Unrelated, +} -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) -#[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct Public; - -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to in the EPP greeting XML #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Recipient { - /// Data for the tag - pub ours: Ours, - /// Data for the tag - pub public: Public, + #[serde(rename = "$value")] + pub recipient: Vec, } -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Business; + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Indefinite; + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Legal; + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct No; + +/// Type corresponding to in the EPP greeting XML #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Stated; -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to possible type values +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub enum RetentionType { + /// Data for the tag + #[serde(rename = "business")] + Business(Business), + /// Data for the tag + #[serde(rename = "indefinite")] + Indefinite(Indefinite), + /// Data for the tag + #[serde(rename = "legal")] + Legal(Legal), + /// Data for the tag + #[serde(rename = "none")] + No(No), + /// Data for the tag + #[serde(rename = "stated")] + Stated(Stated), +} + +/// Type corresponding to in the EPP greeting XML #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Retention { - /// Data for the tag - pub stated: Stated, + #[serde(flatten)] + pub ty: RetentionType, } /// Type corresponding to in the EPP greeting XML (pending more compliant implementation) @@ -135,13 +231,47 @@ pub struct Statement { pub retention: Retention, } -/// Type corresponding to in the EPP greeting XML (pending more compliant implementation) +/// Type corresponding to value in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Absolute { + #[serde(rename = "$value")] + pub absolute: StringValue, +} + +/// Type corresponding to value in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Relative { + #[serde(rename = "$value")] + pub relative: StringValue, +} + +/// Type corresponding to possible type values +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub enum ExpiryType { + /// Data for the tag + #[serde(rename = "absolute")] + Absolute(Absolute), + /// Data for the tag + #[serde(rename = "relative")] + Relative(Relative), +} + +/// Type corresponding to in the EPP greeting XML +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct Expiry { + #[serde(flatten)] + pub ty: ExpiryType, +} + +/// Type corresponding to in the EPP greeting XML #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Dcp { /// Data for the tag pub access: Access, - /// Data for the tag - pub statement: Statement, + /// Data for the tags + pub statement: Vec, + /// Data for the tag + pub expiry: Option, } #[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]