From 93f8e0e8c889f270adfcffa54def4e2acd225510 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 13 Dec 2021 17:16:06 +0100 Subject: [PATCH] Remove type aliases for ContactStatus --- src/common.rs | 7 +------ src/contact/info.rs | 4 ++-- src/contact/update.rs | 14 +++++++------- src/domain/info.rs | 4 ++-- src/domain/update.rs | 8 ++++---- src/host/info.rs | 4 ++-- src/host/update.rs | 8 ++++---- 7 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/common.rs b/src/common.rs index 738e9dd..1b98fd6 100644 --- a/src/common.rs +++ b/src/common.rs @@ -79,11 +79,6 @@ pub struct Services { pub svc_ext: Option, } -/// The <status> attribute on EPP XML for domain transactions -pub type DomainStatus = ContactStatus; -/// The <status> attribute on EPP XML for host transactions -pub type HostStatus = ContactStatus; - /// The <hostAddr> types domain or host transactions #[derive(Serialize, Deserialize, Debug)] pub struct HostAddr { @@ -121,7 +116,7 @@ impl HostAddr { /// The <status> type on contact transactions #[derive(Serialize, Deserialize, Debug)] -pub struct ContactStatus { +pub struct ObjectStatus { /// The status name, represented by the 's' attr on <status> tags #[serde(rename = "s")] pub status: String, diff --git a/src/contact/info.rs b/src/contact/info.rs index a83c28d..d16787f 100644 --- a/src/contact/info.rs +++ b/src/contact/info.rs @@ -1,7 +1,7 @@ //! Types for EPP contact info request use super::XMLNS; -use crate::common::{ContactAuthInfo, ContactStatus, NoExtension, Phone, PostalInfo, StringValue}; +use crate::common::{ContactAuthInfo, NoExtension, ObjectStatus, Phone, PostalInfo, StringValue}; use crate::request::{Command, Transaction}; use serde::{Deserialize, Serialize}; @@ -59,7 +59,7 @@ pub struct ContactInfoData { pub roid: StringValue, /// The list of contact statuses #[serde(rename = "status")] - pub statuses: Vec, + pub statuses: Vec, /// The postal info for the contact #[serde(rename = "postalInfo")] pub postal_info: PostalInfo, diff --git a/src/contact/update.rs b/src/contact/update.rs index b9df755..9d8e6ba 100644 --- a/src/contact/update.rs +++ b/src/contact/update.rs @@ -1,7 +1,7 @@ //! Types for EPP contact create request use super::XMLNS; -use crate::common::{ContactAuthInfo, ContactStatus, NoExtension, Phone, PostalInfo, StringValue}; +use crate::common::{ContactAuthInfo, NoExtension, ObjectStatus, Phone, PostalInfo, StringValue}; use crate::request::{Command, Transaction}; use serde::Serialize; @@ -50,12 +50,12 @@ impl ContactUpdate { } /// Sets the data for the <add> tag for the contact update request - pub fn add(&mut self, statuses: Vec) { + pub fn add(&mut self, statuses: Vec) { self.contact.add_statuses = Some(StatusList { status: statuses }); } /// Sets the data for the <rem> tag for the contact update request - pub fn remove(&mut self, statuses: Vec) { + pub fn remove(&mut self, statuses: Vec) { self.contact.remove_statuses = Some(StatusList { status: statuses }); } } @@ -79,7 +79,7 @@ pub struct ContactChangeInfo { #[derive(Serialize, Debug)] pub struct StatusList { #[serde(rename = "contact:status", alias = "status")] - status: Vec, + status: Vec, } /// Type for elements under the contact <update> tag @@ -108,7 +108,7 @@ pub struct ContactUpdate { #[cfg(test)] mod tests { use super::ContactUpdate; - use crate::common::{Address, ContactStatus, NoExtension, Phone, PostalInfo}; + use crate::common::{Address, NoExtension, ObjectStatus, Phone, PostalInfo}; use crate::request::Transaction; use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID}; @@ -124,11 +124,11 @@ mod tests { let voice = Phone::new("+33.47237942"); object.set_info("newemail@eppdev.net", postal_info, voice, "eppdev-387323"); - let add_statuses = vec![ContactStatus { + let add_statuses = vec![ObjectStatus { status: "clientTransferProhibited".to_string(), }]; object.add(add_statuses); - let remove_statuses = vec![ContactStatus { + let remove_statuses = vec![ObjectStatus { status: "clientDeleteProhibited".to_string(), }]; object.remove(remove_statuses); diff --git a/src/domain/info.rs b/src/domain/info.rs index 9ba63c8..ca46026 100644 --- a/src/domain/info.rs +++ b/src/domain/info.rs @@ -1,7 +1,7 @@ //! Types for EPP domain info request use super::{DomainAuthInfo, DomainContact, HostAttr, XMLNS}; -use crate::common::{DomainStatus, NoExtension, StringValue}; +use crate::common::{NoExtension, ObjectStatus, StringValue}; use crate::request::{Command, Transaction}; use serde::{Deserialize, Serialize}; @@ -85,7 +85,7 @@ pub struct DomainInfoResponseData { pub roid: StringValue, /// The list of domain statuses #[serde(rename = "status")] - pub statuses: Option>, + pub statuses: Option>, /// The domain registrant pub registrant: Option, /// The list of domain contacts diff --git a/src/domain/update.rs b/src/domain/update.rs index f6fd6b9..e31d467 100644 --- a/src/domain/update.rs +++ b/src/domain/update.rs @@ -2,7 +2,7 @@ //! use super::{DomainAuthInfo, DomainContact, HostList, XMLNS}; use crate::{ - common::{DomainStatus, NoExtension, StringValue}, + common::{NoExtension, ObjectStatus, StringValue}, request::{Command, Transaction}, }; @@ -67,7 +67,7 @@ pub struct DomainAddRemove { pub contacts: Option>, /// The list of statuses to add to or remove from the domain #[serde(rename = "domain:status", alias = "status")] - pub statuses: Option>, + pub statuses: Option>, } /// Type for elements under the <update> tag for domain update @@ -102,7 +102,7 @@ pub struct DomainUpdate { #[cfg(test)] mod tests { use super::{DomainAddRemove, DomainAuthInfo, DomainChangeInfo, DomainContact, DomainUpdate}; - use crate::common::{DomainStatus, NoExtension}; + use crate::common::{NoExtension, ObjectStatus}; use crate::request::Transaction; use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID}; @@ -115,7 +115,7 @@ mod tests { let add = DomainAddRemove { ns: None, contacts: None, - statuses: Some(vec![DomainStatus { + statuses: Some(vec![ObjectStatus { status: "clientDeleteProhibited".to_string(), }]), }; diff --git a/src/host/info.rs b/src/host/info.rs index be38072..a5434ef 100644 --- a/src/host/info.rs +++ b/src/host/info.rs @@ -1,7 +1,7 @@ //! Types for EPP host info request use super::XMLNS; -use crate::common::{HostAddr, HostStatus, NoExtension, StringValue}; +use crate::common::{HostAddr, NoExtension, ObjectStatus, StringValue}; use crate::request::{Command, Transaction}; use serde::{Deserialize, Serialize}; @@ -55,7 +55,7 @@ pub struct HostInfoResponseData { pub roid: StringValue, /// The list of host statuses #[serde(rename = "status")] - pub statuses: Vec, + pub statuses: Vec, /// The list of host IP addresses #[serde(rename = "addr")] pub addresses: Vec, diff --git a/src/host/update.rs b/src/host/update.rs index 87ca5b9..536fc1f 100644 --- a/src/host/update.rs +++ b/src/host/update.rs @@ -1,7 +1,7 @@ //! Types for EPP host update request use super::XMLNS; -use crate::common::{HostAddr, HostStatus, NoExtension, StringValue}; +use crate::common::{HostAddr, NoExtension, ObjectStatus, StringValue}; use crate::request::{Command, Transaction}; use serde::Serialize; @@ -57,7 +57,7 @@ pub struct HostAddRemove { pub addresses: Option>, /// The statuses to be added to or removed from the host #[serde(rename = "host:status", alias = "status")] - pub statuses: Option>, + pub statuses: Option>, } /// Type for data under the host <update> tag @@ -91,7 +91,7 @@ pub struct HostUpdate { #[cfg(test)] mod tests { use super::{HostAddRemove, HostChangeInfo, HostUpdate}; - use crate::common::{HostAddr, HostStatus, NoExtension}; + use crate::common::{HostAddr, NoExtension, ObjectStatus}; use crate::request::Transaction; use crate::tests::{get_xml, CLTRID, SUCCESS_MSG, SVTRID}; @@ -108,7 +108,7 @@ mod tests { let remove = HostAddRemove { addresses: None, - statuses: Some(vec![HostStatus { + statuses: Some(vec![ObjectStatus { status: "clientDeleteProhibited".to_string(), }]), };