Remove type aliases for ContactStatus

This commit is contained in:
Dirkjan Ochtman 2021-12-13 17:16:06 +01:00 committed by masalachai
parent 95e21eb9ea
commit 93f8e0e8c8
7 changed files with 22 additions and 27 deletions

View File

@ -79,11 +79,6 @@ pub struct Services {
pub svc_ext: Option<ServiceExtension>,
}
/// The &lt;status&gt; attribute on EPP XML for domain transactions
pub type DomainStatus = ContactStatus;
/// The &lt;status&gt; attribute on EPP XML for host transactions
pub type HostStatus = ContactStatus;
/// The &lt;hostAddr&gt; types domain or host transactions
#[derive(Serialize, Deserialize, Debug)]
pub struct HostAddr {
@ -121,7 +116,7 @@ impl HostAddr {
/// The &lt;status&gt; type on contact transactions
#[derive(Serialize, Deserialize, Debug)]
pub struct ContactStatus {
pub struct ObjectStatus {
/// The status name, represented by the 's' attr on &lt;status&gt; tags
#[serde(rename = "s")]
pub status: String,

View File

@ -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<ContactStatus>,
pub statuses: Vec<ObjectStatus>,
/// The postal info for the contact
#[serde(rename = "postalInfo")]
pub postal_info: PostalInfo,

View File

@ -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 &lt;add&gt; tag for the contact update request
pub fn add(&mut self, statuses: Vec<ContactStatus>) {
pub fn add(&mut self, statuses: Vec<ObjectStatus>) {
self.contact.add_statuses = Some(StatusList { status: statuses });
}
/// Sets the data for the &lt;rem&gt; tag for the contact update request
pub fn remove(&mut self, statuses: Vec<ContactStatus>) {
pub fn remove(&mut self, statuses: Vec<ObjectStatus>) {
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<ContactStatus>,
status: Vec<ObjectStatus>,
}
/// Type for elements under the contact &lt;update&gt; 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);

View File

@ -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<Vec<DomainStatus>>,
pub statuses: Option<Vec<ObjectStatus>>,
/// The domain registrant
pub registrant: Option<StringValue>,
/// The list of domain contacts

View File

@ -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<Vec<DomainContact>>,
/// The list of statuses to add to or remove from the domain
#[serde(rename = "domain:status", alias = "status")]
pub statuses: Option<Vec<DomainStatus>>,
pub statuses: Option<Vec<ObjectStatus>>,
}
/// Type for elements under the &lt;update&gt; 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(),
}]),
};

View File

@ -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<HostStatus>,
pub statuses: Vec<ObjectStatus>,
/// The list of host IP addresses
#[serde(rename = "addr")]
pub addresses: Vec<HostAddr>,

View File

@ -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<Vec<HostAddr>>,
/// The statuses to be added to or removed from the host
#[serde(rename = "host:status", alias = "status")]
pub statuses: Option<Vec<HostStatus>>,
pub statuses: Option<Vec<ObjectStatus>>,
}
/// Type for data under the host &lt;update&gt; 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(),
}]),
};