mirror of
https://github.com/instant-labs/instant-epp.git
synced 2025-02-08 01:42:02 +00:00
Replace StringValueTrait with From impls
This seems more idiomatic since it relies on well-known conversion traits from the standard library. It is also more concise. Also apply some other stylistic changes: * Take &[T] instead of Vec<T> if the Vec cannot be reused * Elide type annotations for collect() where unnecessary
This commit is contained in:
parent
2ce09077b1
commit
cca0447fb1
@ -10,35 +10,24 @@ use crate::epp::xml::EPP_XMLNS;
|
|||||||
|
|
||||||
/// Wraps String for easier serialization to and from values that are inner text
|
/// Wraps String for easier serialization to and from values that are inner text
|
||||||
/// for tags rather than attributes
|
/// for tags rather than attributes
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
#[derive(Default, Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||||
pub struct StringValue(String);
|
pub struct StringValue(String);
|
||||||
|
|
||||||
impl Default for StringValue {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self(String::from(""))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for StringValue {
|
impl Display for StringValue {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{}", self.0)
|
write!(f, "{}", self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for StringValue type to add easier conversion from str and String
|
impl From<&str> for StringValue {
|
||||||
pub trait StringValueTrait {
|
fn from(s: &str) -> Self {
|
||||||
fn to_string_value(&self) -> StringValue;
|
Self(s.to_owned())
|
||||||
}
|
|
||||||
|
|
||||||
impl StringValueTrait for &str {
|
|
||||||
fn to_string_value(&self) -> StringValue {
|
|
||||||
StringValue(self.to_string())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StringValueTrait for String {
|
impl From<String> for StringValue {
|
||||||
fn to_string_value(&self) -> StringValue {
|
fn from(s: String) -> Self {
|
||||||
StringValue(self.to_string())
|
Self(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +82,8 @@ impl Options {
|
|||||||
/// Creates an Options object with version and lang data
|
/// Creates an Options object with version and lang data
|
||||||
pub fn build(version: &str, lang: &str) -> Options {
|
pub fn build(version: &str, lang: &str) -> Options {
|
||||||
Options {
|
Options {
|
||||||
version: version.to_string_value(),
|
version: version.into(),
|
||||||
lang: lang.to_string_value(),
|
lang: lang.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Common data types included in EPP Requests and Responses
|
//! Common data types included in EPP Requests and Responses
|
||||||
|
|
||||||
use crate::epp::object::{StringValue, StringValueTrait};
|
use crate::epp::object::StringValue;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// The <status> attribute on EPP XML for domain transactions
|
/// The <status> attribute on EPP XML for domain transactions
|
||||||
@ -217,7 +217,7 @@ impl DomainAuthInfo {
|
|||||||
/// Creates a DomainAuthInfo instance with the given password
|
/// Creates a DomainAuthInfo instance with the given password
|
||||||
pub fn new(password: &str) -> DomainAuthInfo {
|
pub fn new(password: &str) -> DomainAuthInfo {
|
||||||
DomainAuthInfo {
|
DomainAuthInfo {
|
||||||
password: password.to_string_value(),
|
password: password.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ impl ContactAuthInfo {
|
|||||||
/// Creates a ContactAuthInfo instance with the given password
|
/// Creates a ContactAuthInfo instance with the given password
|
||||||
pub fn new(password: &str) -> ContactAuthInfo {
|
pub fn new(password: &str) -> ContactAuthInfo {
|
||||||
ContactAuthInfo {
|
ContactAuthInfo {
|
||||||
password: password.to_string_value(),
|
password: password.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,23 +234,20 @@ impl ContactAuthInfo {
|
|||||||
impl Address {
|
impl Address {
|
||||||
/// Creates a new Address instance
|
/// Creates a new Address instance
|
||||||
pub fn new(
|
pub fn new(
|
||||||
street: Vec<&str>,
|
street: &[&str],
|
||||||
city: &str,
|
city: &str,
|
||||||
province: &str,
|
province: &str,
|
||||||
postal_code: &str,
|
postal_code: &str,
|
||||||
country_code: &str,
|
country_code: &str,
|
||||||
) -> Address {
|
) -> Address {
|
||||||
let street = street
|
let street = street.iter().map(|&s| s.into()).collect();
|
||||||
.iter()
|
|
||||||
.map(|s| s.to_string_value())
|
|
||||||
.collect::<Vec<StringValue>>();
|
|
||||||
|
|
||||||
Address {
|
Address {
|
||||||
street,
|
street,
|
||||||
city: city.to_string_value(),
|
city: city.into(),
|
||||||
province: province.to_string_value(),
|
province: province.into(),
|
||||||
postal_code: postal_code.to_string_value(),
|
postal_code: postal_code.into(),
|
||||||
country_code: country_code.to_string_value(),
|
country_code: country_code.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,8 +257,8 @@ impl PostalInfo {
|
|||||||
pub fn new(info_type: &str, name: &str, organization: &str, address: Address) -> PostalInfo {
|
pub fn new(info_type: &str, name: &str, organization: &str, address: Address) -> PostalInfo {
|
||||||
PostalInfo {
|
PostalInfo {
|
||||||
info_type: info_type.to_string(),
|
info_type: info_type.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
organization: organization.to_string_value(),
|
organization: organization.into(),
|
||||||
address,
|
address,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ use std::time::SystemTime;
|
|||||||
|
|
||||||
use crate::epp::object::{
|
use crate::epp::object::{
|
||||||
ElementName, EmptyTag, EppObject, Extension, Options, ServiceExtension, Services, StringValue,
|
ElementName, EmptyTag, EppObject, Extension, Options, ServiceExtension, Services, StringValue,
|
||||||
StringValueTrait,
|
|
||||||
};
|
};
|
||||||
use crate::epp::xml::{EPP_CONTACT_XMLNS, EPP_DOMAIN_XMLNS, EPP_HOST_XMLNS, EPP_LANG, EPP_VERSION};
|
use crate::epp::xml::{EPP_CONTACT_XMLNS, EPP_DOMAIN_XMLNS, EPP_HOST_XMLNS, EPP_LANG, EPP_VERSION};
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
@ -62,7 +61,7 @@ impl<T: ElementName> Command<T> {
|
|||||||
Command {
|
Command {
|
||||||
command,
|
command,
|
||||||
extension: None,
|
extension: None,
|
||||||
client_tr_id: client_tr_id.to_string_value(),
|
client_tr_id: client_tr_id.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,7 +72,7 @@ impl<T: ElementName, E: ElementName> CommandWithExtension<T, E> {
|
|||||||
CommandWithExtension {
|
CommandWithExtension {
|
||||||
command,
|
command,
|
||||||
extension: Some(Extension { data: ext }),
|
extension: Some(Extension { data: ext }),
|
||||||
client_tr_id: client_tr_id.to_string_value(),
|
client_tr_id: client_tr_id.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,24 +126,22 @@ impl EppLogin {
|
|||||||
ext_uris: &Option<Vec<String>>,
|
ext_uris: &Option<Vec<String>>,
|
||||||
client_tr_id: &str,
|
client_tr_id: &str,
|
||||||
) -> EppLogin {
|
) -> EppLogin {
|
||||||
let ext_uris = ext_uris.as_ref().map(|uris| {
|
let ext_uris = ext_uris
|
||||||
uris.iter()
|
.as_ref()
|
||||||
.map(|u| u.to_string_value())
|
.map(|uris| uris.iter().map(|u| u.as_str().into()).collect());
|
||||||
.collect::<Vec<StringValue>>()
|
|
||||||
});
|
|
||||||
|
|
||||||
let login = Login {
|
let login = Login {
|
||||||
username: username.to_string_value(),
|
username: username.into(),
|
||||||
password: password.to_string_value(),
|
password: password.into(),
|
||||||
options: Options {
|
options: Options {
|
||||||
version: EPP_VERSION.to_string_value(),
|
version: EPP_VERSION.into(),
|
||||||
lang: EPP_LANG.to_string_value(),
|
lang: EPP_LANG.into(),
|
||||||
},
|
},
|
||||||
services: Services {
|
services: Services {
|
||||||
obj_uris: vec![
|
obj_uris: vec![
|
||||||
EPP_HOST_XMLNS.to_string_value(),
|
EPP_HOST_XMLNS.into(),
|
||||||
EPP_CONTACT_XMLNS.to_string_value(),
|
EPP_CONTACT_XMLNS.into(),
|
||||||
EPP_DOMAIN_XMLNS.to_string_value(),
|
EPP_DOMAIN_XMLNS.into(),
|
||||||
],
|
],
|
||||||
svc_ext: Some(ServiceExtension { ext_uris }),
|
svc_ext: Some(ServiceExtension { ext_uris }),
|
||||||
},
|
},
|
||||||
@ -153,7 +150,7 @@ impl EppLogin {
|
|||||||
EppObject::build(Command::<Login> {
|
EppObject::build(Command::<Login> {
|
||||||
command: login,
|
command: login,
|
||||||
extension: None,
|
extension: None,
|
||||||
client_tr_id: client_tr_id.to_string_value(),
|
client_tr_id: client_tr_id.into(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +176,7 @@ impl EppLogout {
|
|||||||
EppObject::build(Command::<Logout> {
|
EppObject::build(Command::<Logout> {
|
||||||
command: Logout,
|
command: Logout,
|
||||||
extension: None,
|
extension: None,
|
||||||
client_tr_id: client_tr_id.to_string_value(),
|
client_tr_id: client_tr_id.into(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/// Types for EPP contact check request
|
/// Types for EPP contact check request
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -43,7 +43,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
///
|
///
|
||||||
/// // Create an EppContactCheck instance
|
/// // Create an EppContactCheck instance
|
||||||
/// let contact_check = EppContactCheck::new(
|
/// let contact_check = EppContactCheck::new(
|
||||||
/// vec!["epp-client-c1", "epp-client-c2"],
|
/// &["epp-client-c1", "epp-client-c2"],
|
||||||
/// generate_client_tr_id(&client).as_str()
|
/// generate_client_tr_id(&client).as_str()
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
@ -79,10 +79,10 @@ pub struct ContactCheck {
|
|||||||
|
|
||||||
impl EppContactCheck {
|
impl EppContactCheck {
|
||||||
/// Creates an EppObject corresponding to the <epp> tag with data for a contact check request
|
/// Creates an EppObject corresponding to the <epp> tag with data for a contact check request
|
||||||
pub fn new(contact_ids: Vec<&str>, client_tr_id: &str) -> EppContactCheck {
|
pub fn new(contact_ids: &[&str], client_tr_id: &str) -> EppContactCheck {
|
||||||
let contact_ids = contact_ids
|
let contact_ids = contact_ids
|
||||||
.iter()
|
.iter()
|
||||||
.map(|d| d.to_string_value())
|
.map(|&d| d.into())
|
||||||
.collect::<Vec<StringValue>>();
|
.collect::<Vec<StringValue>>();
|
||||||
|
|
||||||
let contact_check = ContactCheck {
|
let contact_check = ContactCheck {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data;
|
use crate::epp::object::data;
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -46,7 +46,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
///
|
///
|
||||||
/// // Create the address, postal_info, voice instances
|
/// // Create the address, postal_info, voice instances
|
||||||
/// let street = vec!["58", "Orchid Road"];
|
/// let street = vec!["58", "Orchid Road"];
|
||||||
/// let address = Address::new(street, "New York", "New York", "392374", "US");
|
/// let address = Address::new(&street, "New York", "New York", "392374", "US");
|
||||||
/// let postal_info = PostalInfo::new("int", "John Doe", "Acme Widgets", address);
|
/// let postal_info = PostalInfo::new("int", "John Doe", "Acme Widgets", address);
|
||||||
/// let mut voice = Phone::new("+1.47237942");
|
/// let mut voice = Phone::new("+1.47237942");
|
||||||
/// voice.set_extension("123");
|
/// voice.set_extension("123");
|
||||||
@ -122,11 +122,11 @@ impl EppContactCreate {
|
|||||||
let contact_create = ContactCreate {
|
let contact_create = ContactCreate {
|
||||||
contact: Contact {
|
contact: Contact {
|
||||||
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
||||||
id: id.to_string_value(),
|
id: id.into(),
|
||||||
postal_info,
|
postal_info,
|
||||||
voice,
|
voice,
|
||||||
fax: None,
|
fax: None,
|
||||||
email: email.to_string_value(),
|
email: email.into(),
|
||||||
auth_info: data::ContactAuthInfo::new(auth_password),
|
auth_info: data::ContactAuthInfo::new(auth_password),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -84,7 +84,7 @@ impl EppContactDelete {
|
|||||||
let contact_delete = ContactDelete {
|
let contact_delete = ContactDelete {
|
||||||
contact: ContactDeleteData {
|
contact: ContactDeleteData {
|
||||||
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
||||||
id: id.to_string_value(),
|
id: id.into(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::ContactAuthInfo;
|
use crate::epp::object::data::ContactAuthInfo;
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -89,7 +89,7 @@ impl EppContactInfo {
|
|||||||
let contact_info = ContactInfo {
|
let contact_info = ContactInfo {
|
||||||
info: ContactInfoData {
|
info: ContactInfoData {
|
||||||
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
||||||
id: id.to_string_value(),
|
id: id.into(),
|
||||||
auth_info: ContactAuthInfo::new(auth_password),
|
auth_info: ContactAuthInfo::new(auth_password),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::{ContactAuthInfo, ContactStatus, Phone, PostalInfo};
|
use crate::epp::object::data::{ContactAuthInfo, ContactStatus, Phone, PostalInfo};
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::response::contact::info::EppContactInfoResponse;
|
use crate::epp::response::contact::info::EppContactInfoResponse;
|
||||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
@ -122,7 +122,7 @@ impl EppContactUpdate {
|
|||||||
let contact_update = ContactUpdate {
|
let contact_update = ContactUpdate {
|
||||||
contact: ContactUpdateData {
|
contact: ContactUpdateData {
|
||||||
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
||||||
id: id.to_string_value(),
|
id: id.into(),
|
||||||
add_statuses: None,
|
add_statuses: None,
|
||||||
remove_statuses: None,
|
remove_statuses: None,
|
||||||
change_info: None,
|
change_info: None,
|
||||||
@ -140,7 +140,7 @@ impl EppContactUpdate {
|
|||||||
auth_password: &str,
|
auth_password: &str,
|
||||||
) {
|
) {
|
||||||
self.data.command.contact.change_info = Some(ContactChangeInfo {
|
self.data.command.contact.change_info = Some(ContactChangeInfo {
|
||||||
email: Some(email.to_string_value()),
|
email: Some(email.into()),
|
||||||
postal_info: Some(postal_info),
|
postal_info: Some(postal_info),
|
||||||
voice: Some(voice),
|
voice: Some(voice),
|
||||||
auth_info: Some(ContactAuthInfo::new(auth_password)),
|
auth_info: Some(ContactAuthInfo::new(auth_password)),
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -81,10 +81,7 @@ pub struct DomainCheck {
|
|||||||
impl EppDomainCheck {
|
impl EppDomainCheck {
|
||||||
/// Creates a new EppObject for domain check corresponding to the <epp> tag in EPP XML
|
/// Creates a new EppObject for domain check corresponding to the <epp> tag in EPP XML
|
||||||
pub fn new(domains: Vec<&str>, client_tr_id: &str) -> EppDomainCheck {
|
pub fn new(domains: Vec<&str>, client_tr_id: &str) -> EppDomainCheck {
|
||||||
let domains = domains
|
let domains = domains.into_iter().map(|d| d.into()).collect();
|
||||||
.iter()
|
|
||||||
.map(|d| d.to_string_value())
|
|
||||||
.collect::<Vec<StringValue>>();
|
|
||||||
|
|
||||||
let domain_check = DomainCheck {
|
let domain_check = DomainCheck {
|
||||||
list: DomainList {
|
list: DomainList {
|
||||||
|
@ -5,7 +5,7 @@ use epp_client_macros::*;
|
|||||||
use crate::epp::object::data::{
|
use crate::epp::object::data::{
|
||||||
DomainAuthInfo, DomainContact, HostAttr, HostAttrList, HostList, HostObjList, Period,
|
DomainAuthInfo, DomainContact, HostAttr, HostAttrList, HostList, HostObjList, Period,
|
||||||
};
|
};
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -122,24 +122,21 @@ impl EppDomainCreate {
|
|||||||
pub fn new_with_ns(
|
pub fn new_with_ns(
|
||||||
name: &str,
|
name: &str,
|
||||||
period: u16,
|
period: u16,
|
||||||
ns: Vec<&str>,
|
ns: &[&str],
|
||||||
registrant_id: &str,
|
registrant_id: &str,
|
||||||
auth_password: &str,
|
auth_password: &str,
|
||||||
contacts: Vec<DomainContact>,
|
contacts: Vec<DomainContact>,
|
||||||
client_tr_id: &str,
|
client_tr_id: &str,
|
||||||
) -> EppDomainCreate {
|
) -> EppDomainCreate {
|
||||||
let ns_list = ns
|
let ns_list = ns.iter().map(|&n| n.into()).collect();
|
||||||
.iter()
|
|
||||||
.map(|n| n.to_string_value())
|
|
||||||
.collect::<Vec<StringValue>>();
|
|
||||||
|
|
||||||
let domain_create = DomainCreate {
|
let domain_create = DomainCreate {
|
||||||
domain: DomainCreateData {
|
domain: DomainCreateData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: Period::new(period),
|
period: Period::new(period),
|
||||||
ns: Some(HostList::HostObjList(HostObjList { hosts: ns_list })),
|
ns: Some(HostList::HostObjList(HostObjList { hosts: ns_list })),
|
||||||
registrant: Some(registrant_id.to_string_value()),
|
registrant: Some(registrant_id.into()),
|
||||||
auth_info: DomainAuthInfo::new(auth_password),
|
auth_info: DomainAuthInfo::new(auth_password),
|
||||||
contacts: Some(contacts),
|
contacts: Some(contacts),
|
||||||
},
|
},
|
||||||
@ -161,10 +158,10 @@ impl EppDomainCreate {
|
|||||||
let domain_create = DomainCreate {
|
let domain_create = DomainCreate {
|
||||||
domain: DomainCreateData {
|
domain: DomainCreateData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: Period::new(period),
|
period: Period::new(period),
|
||||||
ns: None,
|
ns: None,
|
||||||
registrant: Some(registrant_id.to_string_value()),
|
registrant: Some(registrant_id.into()),
|
||||||
auth_info: DomainAuthInfo::new(auth_password),
|
auth_info: DomainAuthInfo::new(auth_password),
|
||||||
contacts: Some(contacts),
|
contacts: Some(contacts),
|
||||||
},
|
},
|
||||||
@ -183,7 +180,7 @@ impl EppDomainCreate {
|
|||||||
let domain_create = DomainCreate {
|
let domain_create = DomainCreate {
|
||||||
domain: DomainCreateData {
|
domain: DomainCreateData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: Period::new(period),
|
period: Period::new(period),
|
||||||
ns: None,
|
ns: None,
|
||||||
registrant: None,
|
registrant: None,
|
||||||
@ -209,10 +206,10 @@ impl EppDomainCreate {
|
|||||||
let domain_create = DomainCreate {
|
let domain_create = DomainCreate {
|
||||||
domain: DomainCreateData {
|
domain: DomainCreateData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: Period::new(period),
|
period: Period::new(period),
|
||||||
ns: Some(HostList::HostAttrList(HostAttrList { hosts: ns })),
|
ns: Some(HostList::HostAttrList(HostAttrList { hosts: ns })),
|
||||||
registrant: Some(registrant_id.to_string_value()),
|
registrant: Some(registrant_id.into()),
|
||||||
auth_info: DomainAuthInfo::new(auth_password),
|
auth_info: DomainAuthInfo::new(auth_password),
|
||||||
contacts: Some(contacts),
|
contacts: Some(contacts),
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -82,7 +82,7 @@ impl EppDomainDelete {
|
|||||||
DomainDelete {
|
DomainDelete {
|
||||||
domain: DomainDeleteData {
|
domain: DomainDeleteData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
client_tr_id,
|
client_tr_id,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::Period;
|
use crate::epp::object::data::Period;
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
@ -96,16 +96,13 @@ impl EppDomainRenew {
|
|||||||
years: u16,
|
years: u16,
|
||||||
client_tr_id: &str,
|
client_tr_id: &str,
|
||||||
) -> EppDomainRenew {
|
) -> EppDomainRenew {
|
||||||
let exp_date_str = current_expiry_date
|
let exp_date_str = current_expiry_date.format("%Y-%m-%d").to_string().into();
|
||||||
.format("%Y-%m-%d")
|
|
||||||
.to_string()
|
|
||||||
.to_string_value();
|
|
||||||
|
|
||||||
EppObject::build(Command::<DomainRenew>::new(
|
EppObject::build(Command::<DomainRenew>::new(
|
||||||
DomainRenew {
|
DomainRenew {
|
||||||
domain: DomainRenewData {
|
domain: DomainRenewData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
current_expiry_date: exp_date_str,
|
current_expiry_date: exp_date_str,
|
||||||
period: Period::new(years),
|
period: Period::new(years),
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::domain::update::{DomainChangeInfo, DomainUpdate, DomainUpdateData};
|
use crate::epp::request::domain::update::{DomainChangeInfo, DomainUpdate, DomainUpdateData};
|
||||||
use crate::epp::request::{CommandWithExtension, Extension};
|
use crate::epp::request::{CommandWithExtension, Extension};
|
||||||
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
||||||
@ -67,7 +67,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
/// deleted_at,
|
/// deleted_at,
|
||||||
/// restored_at,
|
/// restored_at,
|
||||||
/// restore_reason,
|
/// restore_reason,
|
||||||
/// statements,
|
/// &statements,
|
||||||
/// other,
|
/// other,
|
||||||
/// generate_client_tr_id(&client).as_str()
|
/// generate_client_tr_id(&client).as_str()
|
||||||
/// );
|
/// );
|
||||||
@ -141,20 +141,17 @@ impl EppDomainRgpRestoreReport {
|
|||||||
deleted_at: DateTime<Utc>,
|
deleted_at: DateTime<Utc>,
|
||||||
restored_at: DateTime<Utc>,
|
restored_at: DateTime<Utc>,
|
||||||
restore_reason: &str,
|
restore_reason: &str,
|
||||||
statements: Vec<&str>,
|
statements: &[&str],
|
||||||
other: &str,
|
other: &str,
|
||||||
client_tr_id: &str,
|
client_tr_id: &str,
|
||||||
) -> EppDomainRgpRestoreReport {
|
) -> EppDomainRgpRestoreReport {
|
||||||
let statements = statements
|
let statements = statements.iter().map(|&s| s.into()).collect();
|
||||||
.iter()
|
|
||||||
.map(|s| s.to_string_value())
|
|
||||||
.collect::<Vec<StringValue>>();
|
|
||||||
|
|
||||||
let command = CommandWithExtension::<DomainUpdate, RgpRestoreReport> {
|
let command = CommandWithExtension::<DomainUpdate, RgpRestoreReport> {
|
||||||
command: DomainUpdate {
|
command: DomainUpdate {
|
||||||
domain: DomainUpdateData {
|
domain: DomainUpdateData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
add: None,
|
add: None,
|
||||||
remove: None,
|
remove: None,
|
||||||
change_info: Some(DomainChangeInfo {
|
change_info: Some(DomainChangeInfo {
|
||||||
@ -169,22 +166,22 @@ impl EppDomainRgpRestoreReport {
|
|||||||
restore: RgpRestoreReportSection {
|
restore: RgpRestoreReportSection {
|
||||||
op: "report".to_string(),
|
op: "report".to_string(),
|
||||||
report: RgpRestoreReportData {
|
report: RgpRestoreReportData {
|
||||||
pre_data: pre_data.to_string_value(),
|
pre_data: pre_data.into(),
|
||||||
post_data: post_data.to_string_value(),
|
post_data: post_data.into(),
|
||||||
deleted_at: deleted_at
|
deleted_at: deleted_at
|
||||||
.to_rfc3339_opts(SecondsFormat::AutoSi, true)
|
.to_rfc3339_opts(SecondsFormat::AutoSi, true)
|
||||||
.to_string_value(),
|
.into(),
|
||||||
restored_at: restored_at
|
restored_at: restored_at
|
||||||
.to_rfc3339_opts(SecondsFormat::AutoSi, true)
|
.to_rfc3339_opts(SecondsFormat::AutoSi, true)
|
||||||
.to_string_value(),
|
.into(),
|
||||||
restore_reason: restore_reason.to_string_value(),
|
restore_reason: restore_reason.into(),
|
||||||
statements,
|
statements,
|
||||||
other: other.to_string_value(),
|
other: other.into(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
client_tr_id: client_tr_id.to_string_value(),
|
client_tr_id: client_tr_id.into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
EppObject::build(command)
|
EppObject::build(command)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject};
|
||||||
use crate::epp::request::domain::update::{DomainChangeInfo, DomainUpdate, DomainUpdateData};
|
use crate::epp::request::domain::update::{DomainChangeInfo, DomainUpdate, DomainUpdateData};
|
||||||
use crate::epp::request::{CommandWithExtension, Extension};
|
use crate::epp::request::{CommandWithExtension, Extension};
|
||||||
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
||||||
@ -86,7 +86,7 @@ impl EppDomainRgpRestoreRequest {
|
|||||||
command: DomainUpdate {
|
command: DomainUpdate {
|
||||||
domain: DomainUpdateData {
|
domain: DomainUpdateData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
add: None,
|
add: None,
|
||||||
remove: None,
|
remove: None,
|
||||||
change_info: Some(DomainChangeInfo {
|
change_info: Some(DomainChangeInfo {
|
||||||
@ -103,7 +103,7 @@ impl EppDomainRgpRestoreRequest {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
client_tr_id: client_tr_id.to_string_value(),
|
client_tr_id: client_tr_id.into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
EppObject::build(command)
|
EppObject::build(command)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::{DomainAuthInfo, Period};
|
use crate::epp::object::data::{DomainAuthInfo, Period};
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -303,7 +303,7 @@ impl EppDomainTransferRequest {
|
|||||||
operation: "request".to_string(),
|
operation: "request".to_string(),
|
||||||
domain: DomainTransferData {
|
domain: DomainTransferData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: Some(Period::new(years)),
|
period: Some(Period::new(years)),
|
||||||
auth_info: Some(DomainAuthInfo::new(auth_password)),
|
auth_info: Some(DomainAuthInfo::new(auth_password)),
|
||||||
},
|
},
|
||||||
@ -326,7 +326,7 @@ impl EppDomainTransferApprove {
|
|||||||
operation: "approve".to_string(),
|
operation: "approve".to_string(),
|
||||||
domain: DomainTransferData {
|
domain: DomainTransferData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: None,
|
period: None,
|
||||||
auth_info: None,
|
auth_info: None,
|
||||||
},
|
},
|
||||||
@ -344,7 +344,7 @@ impl EppDomainTransferCancel {
|
|||||||
operation: "cancel".to_string(),
|
operation: "cancel".to_string(),
|
||||||
domain: DomainTransferData {
|
domain: DomainTransferData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: None,
|
period: None,
|
||||||
auth_info: None,
|
auth_info: None,
|
||||||
},
|
},
|
||||||
@ -362,7 +362,7 @@ impl EppDomainTransferReject {
|
|||||||
operation: "reject".to_string(),
|
operation: "reject".to_string(),
|
||||||
domain: DomainTransferData {
|
domain: DomainTransferData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: None,
|
period: None,
|
||||||
auth_info: None,
|
auth_info: None,
|
||||||
},
|
},
|
||||||
@ -380,7 +380,7 @@ impl EppDomainTransferQuery {
|
|||||||
operation: "query".to_string(),
|
operation: "query".to_string(),
|
||||||
domain: DomainTransferData {
|
domain: DomainTransferData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
period: None,
|
period: None,
|
||||||
auth_info: Some(DomainAuthInfo::new(auth_password)),
|
auth_info: Some(DomainAuthInfo::new(auth_password)),
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::{DomainAuthInfo, DomainContact, DomainStatus, HostList};
|
use crate::epp::object::data::{DomainAuthInfo, DomainContact, DomainStatus, HostList};
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -146,7 +146,7 @@ impl EppDomainUpdate {
|
|||||||
DomainUpdate {
|
DomainUpdate {
|
||||||
domain: DomainUpdateData {
|
domain: DomainUpdateData {
|
||||||
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
xmlns: EPP_DOMAIN_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
add: None,
|
add: None,
|
||||||
remove: None,
|
remove: None,
|
||||||
change_info: None,
|
change_info: None,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -44,7 +44,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
///
|
///
|
||||||
/// // Create an EppHostCheck instance
|
/// // Create an EppHostCheck instance
|
||||||
/// let host_check = EppHostCheck::new(
|
/// let host_check = EppHostCheck::new(
|
||||||
/// vec!["ns1.eppdev-101.com", "ns2.eppdev-101.com"],
|
/// &["ns1.eppdev-101.com", "ns2.eppdev-101.com"],
|
||||||
/// generate_client_tr_id(&client).as_str()
|
/// generate_client_tr_id(&client).as_str()
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
@ -80,11 +80,8 @@ pub struct HostCheck {
|
|||||||
|
|
||||||
impl EppHostCheck {
|
impl EppHostCheck {
|
||||||
/// Creates a new EppObject for host check corresponding to the <epp> tag in EPP XML
|
/// Creates a new EppObject for host check corresponding to the <epp> tag in EPP XML
|
||||||
pub fn new(hosts: Vec<&str>, client_tr_id: &str) -> EppHostCheck {
|
pub fn new(hosts: &[&str], client_tr_id: &str) -> EppHostCheck {
|
||||||
let hosts = hosts
|
let hosts = hosts.iter().map(|&d| d.into()).collect();
|
||||||
.iter()
|
|
||||||
.map(|d| d.to_string_value())
|
|
||||||
.collect::<Vec<StringValue>>();
|
|
||||||
|
|
||||||
let host_check = HostCheck {
|
let host_check = HostCheck {
|
||||||
list: HostList {
|
list: HostList {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::HostAddr;
|
use crate::epp::object::data::HostAddr;
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -92,7 +92,7 @@ impl EppHostCreate {
|
|||||||
let host_create = HostCreate {
|
let host_create = HostCreate {
|
||||||
host: HostCreateData {
|
host: HostCreateData {
|
||||||
xmlns: EPP_HOST_XMLNS.to_string(),
|
xmlns: EPP_HOST_XMLNS.to_string(),
|
||||||
name: host.to_string_value(),
|
name: host.into(),
|
||||||
addresses: Some(addresses),
|
addresses: Some(addresses),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -82,7 +82,7 @@ impl EppHostDelete {
|
|||||||
HostDelete {
|
HostDelete {
|
||||||
host: HostDeleteData {
|
host: HostDeleteData {
|
||||||
xmlns: EPP_HOST_XMLNS.to_string(),
|
xmlns: EPP_HOST_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
client_tr_id,
|
client_tr_id,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -82,7 +82,7 @@ impl EppHostInfo {
|
|||||||
HostInfo {
|
HostInfo {
|
||||||
info: HostInfoData {
|
info: HostInfoData {
|
||||||
xmlns: EPP_HOST_XMLNS.to_string(),
|
xmlns: EPP_HOST_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
client_tr_id,
|
client_tr_id,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::{HostAddr, HostStatus};
|
use crate::epp::object::data::{HostAddr, HostStatus};
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -17,7 +17,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
///
|
///
|
||||||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||||
/// use epp_client::EppClient;
|
/// use epp_client::EppClient;
|
||||||
/// use epp_client::epp::object::StringValueTrait;
|
|
||||||
/// use epp_client::epp::object::data::{HostAddr, HostStatus};
|
/// use epp_client::epp::object::data::{HostAddr, HostStatus};
|
||||||
/// use epp_client::epp::{EppHostUpdate, EppHostUpdateResponse, HostAddRemove, HostChangeInfo};
|
/// use epp_client::epp::{EppHostUpdate, EppHostUpdateResponse, HostAddRemove, HostChangeInfo};
|
||||||
/// use epp_client::epp::generate_client_tr_id;
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
@ -67,7 +66,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
/// host_update.remove(remove);
|
/// host_update.remove(remove);
|
||||||
///
|
///
|
||||||
/// // Send a <chg> section as well
|
/// // Send a <chg> section as well
|
||||||
/// host_update.info(HostChangeInfo { name: "ns2.eppdev-101.com".to_string_value() });
|
/// host_update.info(HostChangeInfo { name: "ns2.eppdev-101.com".into() });
|
||||||
///
|
///
|
||||||
/// // send it to the registry and receive a response of type EppHostUpdateResponse
|
/// // send it to the registry and receive a response of type EppHostUpdateResponse
|
||||||
/// let response = client.transact::<_, EppHostUpdateResponse>(&host_update).await.unwrap();
|
/// let response = client.transact::<_, EppHostUpdateResponse>(&host_update).await.unwrap();
|
||||||
@ -134,7 +133,7 @@ impl EppHostUpdate {
|
|||||||
HostUpdate {
|
HostUpdate {
|
||||||
host: HostUpdateData {
|
host: HostUpdateData {
|
||||||
xmlns: EPP_HOST_XMLNS.to_string(),
|
xmlns: EPP_HOST_XMLNS.to_string(),
|
||||||
name: name.to_string_value(),
|
name: name.into(),
|
||||||
add: None,
|
add: None,
|
||||||
remove: None,
|
remove: None,
|
||||||
change_info: None,
|
change_info: None,
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
mod response {
|
mod response {
|
||||||
use super::super::get_xml;
|
use super::super::get_xml;
|
||||||
use super::super::CLTRID;
|
use super::super::CLTRID;
|
||||||
use crate::epp::object::StringValueTrait;
|
|
||||||
use crate::epp::response::ExpiryType;
|
use crate::epp::response::ExpiryType;
|
||||||
use crate::epp::response::Relative;
|
use crate::epp::response::Relative;
|
||||||
use crate::epp::response::{
|
use crate::epp::response::{
|
||||||
@ -22,11 +21,8 @@ mod response {
|
|||||||
|
|
||||||
assert_eq!(object.data.service_id, "ISPAPI EPP Server");
|
assert_eq!(object.data.service_id, "ISPAPI EPP Server");
|
||||||
assert_eq!(object.data.service_date, "2021-07-25T14:51:17.0Z");
|
assert_eq!(object.data.service_date, "2021-07-25T14:51:17.0Z");
|
||||||
assert_eq!(
|
assert_eq!(object.data.svc_menu.options.version, "1.0".into());
|
||||||
object.data.svc_menu.options.version,
|
assert_eq!(object.data.svc_menu.options.lang, "en".into());
|
||||||
"1.0".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.svc_menu.options.lang, "en".to_string_value());
|
|
||||||
assert_eq!(object.data.svc_menu.services.obj_uris.len(), 4);
|
assert_eq!(object.data.svc_menu.services.obj_uris.len(), 4);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object
|
object
|
||||||
@ -44,7 +40,7 @@ mod response {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.data.dcp.expiry.unwrap().ty,
|
object.data.dcp.expiry.unwrap().ty,
|
||||||
ExpiryType::Relative(Relative {
|
ExpiryType::Relative(Relative {
|
||||||
relative: "P1M".to_string_value()
|
relative: "P1M".into()
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -55,19 +51,13 @@ mod response {
|
|||||||
let object = EppCommandResponseError::deserialize(xml.as_str()).unwrap();
|
let object = EppCommandResponseError::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 2303);
|
assert_eq!(object.data.result.code, 2303);
|
||||||
assert_eq!(
|
assert_eq!(object.data.result.message, "Object does not exist".into());
|
||||||
object.data.result.message,
|
|
||||||
"Object does not exist".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.data.result.ext_value.unwrap().reason,
|
object.data.result.ext_value.unwrap().reason,
|
||||||
"545 Object not found".to_string_value()
|
"545 Object not found".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -76,12 +66,9 @@ mod response {
|
|||||||
let object = EppLoginResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppLoginResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -92,13 +79,10 @@ mod response {
|
|||||||
assert_eq!(object.data.result.code, 1500);
|
assert_eq!(object.data.result.code, 1500);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.data.result.message,
|
object.data.result.message,
|
||||||
"Command completed successfully; ending session".to_string_value()
|
"Command completed successfully; ending session".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -109,22 +93,19 @@ mod response {
|
|||||||
let results = object.data.res_data().unwrap();
|
let results = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
results.check_data.contact_list[0].contact.id,
|
results.check_data.contact_list[0].contact.id,
|
||||||
"eppdev-contact-1".to_string_value()
|
"eppdev-contact-1".into()
|
||||||
);
|
);
|
||||||
assert_eq!(results.check_data.contact_list[0].contact.available, 0);
|
assert_eq!(results.check_data.contact_list[0].contact.available, 0);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
results.check_data.contact_list[1].contact.id,
|
results.check_data.contact_list[1].contact.id,
|
||||||
"eppdev-contact-2".to_string_value()
|
"eppdev-contact-2".into()
|
||||||
);
|
);
|
||||||
assert_eq!(results.check_data.contact_list[1].contact.available, 1);
|
assert_eq!(results.check_data.contact_list[1].contact.available, 1);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -135,17 +116,14 @@ mod response {
|
|||||||
let results = object.data.res_data().unwrap();
|
let results = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(results.create_data.id, "eppdev-contact-4".to_string_value());
|
assert_eq!(results.create_data.id, "eppdev-contact-4".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
results.create_data.created_at,
|
results.create_data.created_at,
|
||||||
"2021-07-25T16:05:32.0Z".to_string_value()
|
"2021-07-25T16:05:32.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -154,12 +132,9 @@ mod response {
|
|||||||
let object = EppContactDeleteResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppContactDeleteResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -174,71 +149,53 @@ mod response {
|
|||||||
let auth_info = result.info_data.auth_info.as_ref().unwrap();
|
let auth_info = result.info_data.auth_info.as_ref().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.info_data.id, "eppdev-contact-3".to_string_value());
|
assert_eq!(result.info_data.id, "eppdev-contact-3".into());
|
||||||
assert_eq!(result.info_data.roid, "UNDEF-ROID".to_string_value());
|
assert_eq!(result.info_data.roid, "UNDEF-ROID".into());
|
||||||
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
|
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
|
||||||
assert_eq!(result.info_data.postal_info.info_type, "loc".to_string());
|
assert_eq!(result.info_data.postal_info.info_type, "loc".to_string());
|
||||||
assert_eq!(
|
assert_eq!(result.info_data.postal_info.name, "John Doe".into());
|
||||||
result.info_data.postal_info.name,
|
|
||||||
"John Doe".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.postal_info.organization,
|
result.info_data.postal_info.organization,
|
||||||
"Acme Widgets".to_string_value()
|
"Acme Widgets".into()
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.info_data.postal_info.address.street[0],
|
|
||||||
"58".to_string_value()
|
|
||||||
);
|
);
|
||||||
|
assert_eq!(result.info_data.postal_info.address.street[0], "58".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.postal_info.address.street[1],
|
result.info_data.postal_info.address.street[1],
|
||||||
"Orchid Road".to_string_value()
|
"Orchid Road".into()
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.info_data.postal_info.address.city,
|
|
||||||
"Paris".to_string_value()
|
|
||||||
);
|
);
|
||||||
|
assert_eq!(result.info_data.postal_info.address.city, "Paris".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.postal_info.address.province,
|
result.info_data.postal_info.address.province,
|
||||||
"Paris".to_string_value()
|
"Paris".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.postal_info.address.postal_code,
|
result.info_data.postal_info.address.postal_code,
|
||||||
"392374".to_string_value()
|
"392374".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.postal_info.address.country_code,
|
result.info_data.postal_info.address.country_code,
|
||||||
"FR".to_string_value()
|
"FR".into()
|
||||||
);
|
);
|
||||||
assert_eq!(result.info_data.voice.number, "+33.47237942".to_string());
|
assert_eq!(result.info_data.voice.number, "+33.47237942".to_string());
|
||||||
assert_eq!(*voice_ext, "123".to_string());
|
assert_eq!(*voice_ext, "123".to_string());
|
||||||
assert_eq!(fax.number, "+33.86698799".to_string());
|
assert_eq!(fax.number, "+33.86698799".to_string());
|
||||||
assert_eq!(*fax_ext, "243".to_string());
|
assert_eq!(*fax_ext, "243".to_string());
|
||||||
assert_eq!(
|
assert_eq!(result.info_data.email, "contact@eppdev.net".into());
|
||||||
result.info_data.email,
|
assert_eq!(result.info_data.client_id, "eppdev".into());
|
||||||
"contact@eppdev.net".to_string_value()
|
assert_eq!(result.info_data.creator_id, "SYSTEM".into());
|
||||||
);
|
assert_eq!(result.info_data.created_at, "2021-07-23T13:09:09.0Z".into());
|
||||||
assert_eq!(result.info_data.client_id, "eppdev".to_string_value());
|
|
||||||
assert_eq!(result.info_data.creator_id, "SYSTEM".to_string_value());
|
|
||||||
assert_eq!(
|
|
||||||
result.info_data.created_at,
|
|
||||||
"2021-07-23T13:09:09.0Z".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*(result.info_data.updater_id.as_ref().unwrap()),
|
*(result.info_data.updater_id.as_ref().unwrap()),
|
||||||
"SYSTEM".to_string_value()
|
"SYSTEM".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*(result.info_data.updated_at.as_ref().unwrap()),
|
*(result.info_data.updated_at.as_ref().unwrap()),
|
||||||
"2021-07-23T13:09:09.0Z".to_string_value()
|
"2021-07-23T13:09:09.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!((*auth_info).password, "eppdev-387323".to_string_value());
|
assert_eq!((*auth_info).password, "eppdev-387323".into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -247,12 +204,9 @@ mod response {
|
|||||||
let object = EppContactUpdateResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppContactUpdateResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -263,22 +217,19 @@ mod response {
|
|||||||
let result = object.data.res_data().unwrap();
|
let result = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.check_data.domain_list[0].domain.name,
|
result.check_data.domain_list[0].domain.name,
|
||||||
"eppdev.com".to_string_value()
|
"eppdev.com".into()
|
||||||
);
|
);
|
||||||
assert_eq!(result.check_data.domain_list[0].domain.available, 1);
|
assert_eq!(result.check_data.domain_list[0].domain.available, 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.check_data.domain_list[1].domain.name,
|
result.check_data.domain_list[1].domain.name,
|
||||||
"eppdev.net".to_string_value()
|
"eppdev.net".into()
|
||||||
);
|
);
|
||||||
assert_eq!(result.check_data.domain_list[1].domain.available, 0);
|
assert_eq!(result.check_data.domain_list[1].domain.available, 0);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -289,21 +240,18 @@ mod response {
|
|||||||
let result = object.data.res_data().unwrap();
|
let result = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.create_data.name, "eppdev-2.com".to_string_value());
|
assert_eq!(result.create_data.name, "eppdev-2.com".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.create_data.created_at,
|
result.create_data.created_at,
|
||||||
"2021-07-25T18:11:35.0Z".to_string_value()
|
"2021-07-25T18:11:35.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.create_data.expiring_at,
|
result.create_data.expiring_at,
|
||||||
"2022-07-25T18:11:34.0Z".to_string_value()
|
"2022-07-25T18:11:34.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -312,12 +260,9 @@ mod response {
|
|||||||
let object = EppDomainDeleteResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppDomainDeleteResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -332,21 +277,15 @@ mod response {
|
|||||||
let hosts = result.info_data.hosts.as_ref().unwrap();
|
let hosts = result.info_data.hosts.as_ref().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.info_data.name, "eppdev-1.com".to_string_value());
|
assert_eq!(result.info_data.name, "eppdev-1.com".into());
|
||||||
assert_eq!(
|
assert_eq!(result.info_data.roid, "125899511_DOMAIN_COM-VRSN".into());
|
||||||
result.info_data.roid,
|
|
||||||
"125899511_DOMAIN_COM-VRSN".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
|
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.statuses[1].status,
|
result.info_data.statuses[1].status,
|
||||||
"clientTransferProhibited".to_string()
|
"clientTransferProhibited".to_string()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(result.info_data.registrant, "eppdev-contact-2".into());
|
||||||
result.info_data.registrant,
|
|
||||||
"eppdev-contact-2".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.contacts[0].id,
|
result.info_data.contacts[0].id,
|
||||||
"eppdev-contact-2".to_string()
|
"eppdev-contact-2".to_string()
|
||||||
@ -371,31 +310,22 @@ mod response {
|
|||||||
result.info_data.contacts[2].contact_type,
|
result.info_data.contacts[2].contact_type,
|
||||||
"billing".to_string()
|
"billing".to_string()
|
||||||
);
|
);
|
||||||
assert_eq!((*ns)[0], "ns1.eppdev-1.com".to_string_value());
|
assert_eq!((*ns)[0], "ns1.eppdev-1.com".into());
|
||||||
assert_eq!((*ns)[1], "ns2.eppdev-1.com".to_string_value());
|
assert_eq!((*ns)[1], "ns2.eppdev-1.com".into());
|
||||||
assert_eq!((*hosts)[0], "ns1.eppdev-1.com".to_string_value());
|
assert_eq!((*hosts)[0], "ns1.eppdev-1.com".into());
|
||||||
assert_eq!((*hosts)[1], "ns2.eppdev-1.com".to_string_value());
|
assert_eq!((*hosts)[1], "ns2.eppdev-1.com".into());
|
||||||
assert_eq!(result.info_data.client_id, "eppdev".to_string_value());
|
assert_eq!(result.info_data.client_id, "eppdev".into());
|
||||||
assert_eq!(result.info_data.creator_id, "SYSTEM".to_string_value());
|
assert_eq!(result.info_data.creator_id, "SYSTEM".into());
|
||||||
assert_eq!(
|
assert_eq!(result.info_data.created_at, "2021-07-23T15:31:20.0Z".into());
|
||||||
result.info_data.created_at,
|
assert_eq!(result.info_data.updater_id, "SYSTEM".into());
|
||||||
"2021-07-23T15:31:20.0Z".to_string_value()
|
assert_eq!(result.info_data.updated_at, "2021-07-23T15:31:21.0Z".into());
|
||||||
);
|
|
||||||
assert_eq!(result.info_data.updater_id, "SYSTEM".to_string_value());
|
|
||||||
assert_eq!(
|
|
||||||
result.info_data.updated_at,
|
|
||||||
"2021-07-23T15:31:21.0Z".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.info_data.expiring_at,
|
result.info_data.expiring_at,
|
||||||
"2023-07-23T15:31:20.0Z".to_string_value()
|
"2023-07-23T15:31:20.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!((*auth_info).password, "epP4uthd#v".to_string_value());
|
assert_eq!((*auth_info).password, "epP4uthd#v".into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -406,17 +336,14 @@ mod response {
|
|||||||
let result = object.data.res_data().unwrap();
|
let result = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(result.renew_data.name, "eppdev-1.com".to_string_value());
|
assert_eq!(result.renew_data.name, "eppdev-1.com".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.renew_data.expiring_at,
|
result.renew_data.expiring_at,
|
||||||
"2024-07-23T15:31:20.0Z".to_string_value()
|
"2024-07-23T15:31:20.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -429,38 +356,23 @@ mod response {
|
|||||||
assert_eq!(object.data.result.code, 1001);
|
assert_eq!(object.data.result.code, 1001);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.data.result.message,
|
object.data.result.message,
|
||||||
"Command completed successfully; action pending".to_string_value()
|
"Command completed successfully; action pending".into()
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.transfer_data.name,
|
|
||||||
"eppdev-transfer.com".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.transfer_data.transfer_status,
|
|
||||||
"pending".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.transfer_data.requester_id,
|
|
||||||
"eppdev".to_string_value()
|
|
||||||
);
|
);
|
||||||
|
assert_eq!(result.transfer_data.name, "eppdev-transfer.com".into());
|
||||||
|
assert_eq!(result.transfer_data.transfer_status, "pending".into());
|
||||||
|
assert_eq!(result.transfer_data.requester_id, "eppdev".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.transfer_data.requested_at,
|
result.transfer_data.requested_at,
|
||||||
"2021-07-23T15:31:21.0Z".to_string_value()
|
"2021-07-23T15:31:21.0Z".into()
|
||||||
);
|
|
||||||
assert_eq!(result.transfer_data.ack_id, "ClientY".to_string_value());
|
|
||||||
assert_eq!(
|
|
||||||
result.transfer_data.ack_by,
|
|
||||||
"2021-07-28T15:31:21.0Z".to_string_value()
|
|
||||||
);
|
);
|
||||||
|
assert_eq!(result.transfer_data.ack_id, "ClientY".into());
|
||||||
|
assert_eq!(result.transfer_data.ack_by, "2021-07-28T15:31:21.0Z".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.transfer_data.expiring_at,
|
result.transfer_data.expiring_at,
|
||||||
"2022-07-02T14:53:19.0Z".to_string_value()
|
"2022-07-02T14:53:19.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -469,12 +381,9 @@ mod response {
|
|||||||
let object = EppDomainTransferApproveResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppDomainTransferApproveResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -483,12 +392,9 @@ mod response {
|
|||||||
let object = EppDomainTransferRejectResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppDomainTransferRejectResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -497,12 +403,9 @@ mod response {
|
|||||||
let object = EppDomainTransferCancelResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppDomainTransferCancelResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -513,37 +416,22 @@ mod response {
|
|||||||
let result = object.data.res_data().unwrap();
|
let result = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(result.transfer_data.name, "eppdev-transfer.com".into());
|
||||||
result.transfer_data.name,
|
assert_eq!(result.transfer_data.transfer_status, "pending".into());
|
||||||
"eppdev-transfer.com".to_string_value()
|
assert_eq!(result.transfer_data.requester_id, "eppdev".into());
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.transfer_data.transfer_status,
|
|
||||||
"pending".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.transfer_data.requester_id,
|
|
||||||
"eppdev".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.transfer_data.requested_at,
|
result.transfer_data.requested_at,
|
||||||
"2021-07-23T15:31:21.0Z".to_string_value()
|
"2021-07-23T15:31:21.0Z".into()
|
||||||
);
|
|
||||||
assert_eq!(result.transfer_data.ack_id, "ClientY".to_string_value());
|
|
||||||
assert_eq!(
|
|
||||||
result.transfer_data.ack_by,
|
|
||||||
"2021-07-28T15:31:21.0Z".to_string_value()
|
|
||||||
);
|
);
|
||||||
|
assert_eq!(result.transfer_data.ack_id, "ClientY".into());
|
||||||
|
assert_eq!(result.transfer_data.ack_by, "2021-07-28T15:31:21.0Z".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.transfer_data.expiring_at,
|
result.transfer_data.expiring_at,
|
||||||
"2022-07-02T14:53:19.0Z".to_string_value()
|
"2022-07-02T14:53:19.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -552,12 +440,9 @@ mod response {
|
|||||||
let object = EppDomainUpdateResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppDomainUpdateResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -568,22 +453,19 @@ mod response {
|
|||||||
let result = object.data.res_data().unwrap();
|
let result = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.check_data.host_list[0].host.name,
|
result.check_data.host_list[0].host.name,
|
||||||
"host1.eppdev-1.com".to_string_value()
|
"host1.eppdev-1.com".into()
|
||||||
);
|
);
|
||||||
assert_eq!(result.check_data.host_list[0].host.available, 1);
|
assert_eq!(result.check_data.host_list[0].host.available, 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.check_data.host_list[1].host.name,
|
result.check_data.host_list[1].host.name,
|
||||||
"ns1.testing.com".to_string_value()
|
"ns1.testing.com".into()
|
||||||
);
|
);
|
||||||
assert_eq!(result.check_data.host_list[1].host.available, 0);
|
assert_eq!(result.check_data.host_list[1].host.available, 0);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -594,20 +476,14 @@ mod response {
|
|||||||
let result = object.data.res_data().unwrap();
|
let result = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(result.create_data.name, "host2.eppdev-1.com".into());
|
||||||
result.create_data.name,
|
|
||||||
"host2.eppdev-1.com".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.create_data.created_at,
|
result.create_data.created_at,
|
||||||
"2021-07-26T05:28:55.0Z".to_string_value()
|
"2021-07-26T05:28:55.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -618,12 +494,9 @@ mod response {
|
|||||||
let result = object.data.res_data().unwrap();
|
let result = object.data.res_data().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(result.info_data.name, "host2.eppdev-1.com".into());
|
||||||
result.info_data.name,
|
assert_eq!(result.info_data.roid, "UNDEF-ROID".into());
|
||||||
"host2.eppdev-1.com".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(result.info_data.roid, "UNDEF-ROID".to_string_value());
|
|
||||||
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
|
assert_eq!(result.info_data.statuses[0].status, "ok".to_string());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*(result.info_data.addresses[0].ip_version.as_ref().unwrap()),
|
*(result.info_data.addresses[0].ip_version.as_ref().unwrap()),
|
||||||
@ -641,25 +514,19 @@ mod response {
|
|||||||
result.info_data.addresses[1].address,
|
result.info_data.addresses[1].address,
|
||||||
"2404:6800:4001:0801:0000:0000:0000:200e".to_string()
|
"2404:6800:4001:0801:0000:0000:0000:200e".to_string()
|
||||||
);
|
);
|
||||||
assert_eq!(result.info_data.client_id, "eppdev".to_string_value());
|
assert_eq!(result.info_data.client_id, "eppdev".into());
|
||||||
assert_eq!(result.info_data.creator_id, "creator".to_string_value());
|
assert_eq!(result.info_data.creator_id, "creator".into());
|
||||||
assert_eq!(
|
assert_eq!(result.info_data.created_at, "2021-07-26T05:28:55.0Z".into());
|
||||||
result.info_data.created_at,
|
|
||||||
"2021-07-26T05:28:55.0Z".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*(result.info_data.updater_id.as_ref().unwrap()),
|
*(result.info_data.updater_id.as_ref().unwrap()),
|
||||||
"creator".to_string_value()
|
"creator".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*(result.info_data.updated_at.as_ref().unwrap()),
|
*(result.info_data.updated_at.as_ref().unwrap()),
|
||||||
"2021-07-26T05:28:55.0Z".to_string_value()
|
"2021-07-26T05:28:55.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -668,12 +535,9 @@ mod response {
|
|||||||
let object = EppHostUpdateResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppHostUpdateResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -682,12 +546,9 @@ mod response {
|
|||||||
let object = EppHostDeleteResponse::deserialize(xml.as_str()).unwrap();
|
let object = EppHostDeleteResponse::deserialize(xml.as_str()).unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -701,45 +562,33 @@ mod response {
|
|||||||
assert_eq!(object.data.result.code, 1301);
|
assert_eq!(object.data.result.code, 1301);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
object.data.result.message,
|
object.data.result.message,
|
||||||
"Command completed successfully; ack to dequeue".to_string_value()
|
"Command completed successfully; ack to dequeue".into()
|
||||||
);
|
);
|
||||||
assert_eq!(msg.count, 5);
|
assert_eq!(msg.count, 5);
|
||||||
assert_eq!(msg.id, "12345".to_string());
|
assert_eq!(msg.id, "12345".to_string());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*(msg.date.as_ref().unwrap()),
|
*(msg.date.as_ref().unwrap()),
|
||||||
"2021-07-23T19:12:43.0Z".to_string_value()
|
"2021-07-23T19:12:43.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*(msg.message.as_ref().unwrap()),
|
*(msg.message.as_ref().unwrap()),
|
||||||
"Transfer requested.".to_string_value()
|
"Transfer requested.".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(result.message_data.name, "eppdev-transfer.com".into());
|
||||||
result.message_data.name,
|
assert_eq!(result.message_data.transfer_status, "pending".into());
|
||||||
"eppdev-transfer.com".to_string_value()
|
assert_eq!(result.message_data.requester_id, "eppdev".into());
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
result.message_data.transfer_status,
|
|
||||||
"pending".to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(result.message_data.requester_id, "eppdev".to_string_value());
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.message_data.requested_at,
|
result.message_data.requested_at,
|
||||||
"2021-07-23T15:31:21.0Z".to_string_value()
|
"2021-07-23T15:31:21.0Z".into()
|
||||||
);
|
|
||||||
assert_eq!(result.message_data.ack_id, "ClientY".to_string_value());
|
|
||||||
assert_eq!(
|
|
||||||
result.message_data.ack_by,
|
|
||||||
"2021-07-28T15:31:21.0Z".to_string_value()
|
|
||||||
);
|
);
|
||||||
|
assert_eq!(result.message_data.ack_id, "ClientY".into());
|
||||||
|
assert_eq!(result.message_data.ack_by, "2021-07-28T15:31:21.0Z".into());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.message_data.expiring_at,
|
result.message_data.expiring_at,
|
||||||
"2022-07-02T14:53:19.0Z".to_string_value()
|
"2022-07-02T14:53:19.0Z".into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(object.data.tr_ids.client_tr_id.unwrap(), CLTRID.into());
|
||||||
object.data.tr_ids.client_tr_id.unwrap(),
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
CLTRID.to_string_value()
|
|
||||||
);
|
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -750,10 +599,10 @@ mod response {
|
|||||||
let msg = object.data.message_queue().unwrap();
|
let msg = object.data.message_queue().unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(msg.count, 4);
|
assert_eq!(msg.count, 4);
|
||||||
assert_eq!(msg.id, "12345".to_string());
|
assert_eq!(msg.id, "12345".to_string());
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -764,8 +613,8 @@ mod response {
|
|||||||
let ext = object.data.extension.unwrap();
|
let ext = object.data.extension.unwrap();
|
||||||
|
|
||||||
assert_eq!(object.data.result.code, 1000);
|
assert_eq!(object.data.result.code, 1000);
|
||||||
assert_eq!(object.data.result.message, SUCCESS_MSG.to_string_value());
|
assert_eq!(object.data.result.message, SUCCESS_MSG.into());
|
||||||
assert_eq!(ext.data.rgp_status.status, "pendingRestore".to_string());
|
assert_eq!(ext.data.rgp_status.status, "pendingRestore".to_string());
|
||||||
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.to_string_value());
|
assert_eq!(object.data.tr_ids.server_tr_id, SVTRID.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ mod request {
|
|||||||
Address, ContactStatus, DomainAuthInfo, DomainContact, DomainStatus, HostAddr, HostAttr,
|
Address, ContactStatus, DomainAuthInfo, DomainContact, DomainStatus, HostAddr, HostAttr,
|
||||||
HostStatus, Phone, PostalInfo,
|
HostStatus, Phone, PostalInfo,
|
||||||
};
|
};
|
||||||
use crate::epp::object::StringValueTrait;
|
|
||||||
use crate::epp::request::{EppHello, EppLogin, EppLogout};
|
use crate::epp::request::{EppHello, EppLogin, EppLogout};
|
||||||
use crate::epp::xml::EppXml;
|
use crate::epp::xml::EppXml;
|
||||||
use crate::epp::*;
|
use crate::epp::*;
|
||||||
@ -48,7 +47,7 @@ mod request {
|
|||||||
#[test]
|
#[test]
|
||||||
fn contact_check() {
|
fn contact_check() {
|
||||||
let xml = get_xml("request/contact/check.xml").unwrap();
|
let xml = get_xml("request/contact/check.xml").unwrap();
|
||||||
let object = EppContactCheck::new(vec!["eppdev-contact-1", "eppdev-contact-2"], CLTRID);
|
let object = EppContactCheck::new(&["eppdev-contact-1", "eppdev-contact-2"], CLTRID);
|
||||||
let serialized = object.serialize().unwrap();
|
let serialized = object.serialize().unwrap();
|
||||||
|
|
||||||
assert_eq!(xml, serialized);
|
assert_eq!(xml, serialized);
|
||||||
@ -58,7 +57,7 @@ mod request {
|
|||||||
fn contact_create() {
|
fn contact_create() {
|
||||||
let xml = get_xml("request/contact/create.xml").unwrap();
|
let xml = get_xml("request/contact/create.xml").unwrap();
|
||||||
|
|
||||||
let street = vec!["58", "Orchid Road"];
|
let street = &["58", "Orchid Road"];
|
||||||
let address = Address::new(street, "Paris", "Paris", "392374", "FR");
|
let address = Address::new(street, "Paris", "Paris", "392374", "FR");
|
||||||
let postal_info = PostalInfo::new("int", "John Doe", "Acme Widgets", address);
|
let postal_info = PostalInfo::new("int", "John Doe", "Acme Widgets", address);
|
||||||
let mut voice = Phone::new("+33.47237942");
|
let mut voice = Phone::new("+33.47237942");
|
||||||
@ -98,7 +97,7 @@ mod request {
|
|||||||
|
|
||||||
let mut object = EppContactUpdate::new("eppdev-contact-3", CLTRID);
|
let mut object = EppContactUpdate::new("eppdev-contact-3", CLTRID);
|
||||||
|
|
||||||
let street = vec!["58", "Orchid Road"];
|
let street = &["58", "Orchid Road"];
|
||||||
let address = Address::new(street, "Paris", "Paris", "392374", "FR");
|
let address = Address::new(street, "Paris", "Paris", "392374", "FR");
|
||||||
let postal_info = PostalInfo::new("loc", "John Doe", "Acme Widgets", address);
|
let postal_info = PostalInfo::new("loc", "John Doe", "Acme Widgets", address);
|
||||||
let voice = Phone::new("+33.47237942");
|
let voice = Phone::new("+33.47237942");
|
||||||
@ -195,7 +194,7 @@ mod request {
|
|||||||
let object = EppDomainCreate::new_with_ns(
|
let object = EppDomainCreate::new_with_ns(
|
||||||
"eppdev-1.com",
|
"eppdev-1.com",
|
||||||
1,
|
1,
|
||||||
vec!["ns1.test.com", "ns2.test.com"],
|
&["ns1.test.com", "ns2.test.com"],
|
||||||
"eppdev-contact-3",
|
"eppdev-contact-3",
|
||||||
"epP4uthd#v",
|
"epP4uthd#v",
|
||||||
contacts,
|
contacts,
|
||||||
@ -228,11 +227,11 @@ mod request {
|
|||||||
|
|
||||||
let host_attr = vec![
|
let host_attr = vec![
|
||||||
HostAttr {
|
HostAttr {
|
||||||
name: "ns1.eppdev-1.com".to_string_value(),
|
name: "ns1.eppdev-1.com".into(),
|
||||||
addresses: None,
|
addresses: None,
|
||||||
},
|
},
|
||||||
HostAttr {
|
HostAttr {
|
||||||
name: "ns2.eppdev-1.com".to_string_value(),
|
name: "ns2.eppdev-1.com".into(),
|
||||||
addresses: Some(vec![
|
addresses: Some(vec![
|
||||||
HostAddr::new_v4("177.232.12.58"),
|
HostAddr::new_v4("177.232.12.58"),
|
||||||
HostAddr::new_v6("2404:6800:4001:801::200e"),
|
HostAddr::new_v6("2404:6800:4001:801::200e"),
|
||||||
@ -385,7 +384,7 @@ mod request {
|
|||||||
fn host_check() {
|
fn host_check() {
|
||||||
let xml = get_xml("request/host/check.xml").unwrap();
|
let xml = get_xml("request/host/check.xml").unwrap();
|
||||||
|
|
||||||
let object = EppHostCheck::new(vec!["ns1.eppdev-1.com", "host1.eppdev-1.com"], CLTRID);
|
let object = EppHostCheck::new(&["ns1.eppdev-1.com", "host1.eppdev-1.com"], CLTRID);
|
||||||
|
|
||||||
let serialized = object.serialize().unwrap();
|
let serialized = object.serialize().unwrap();
|
||||||
|
|
||||||
@ -442,7 +441,7 @@ mod request {
|
|||||||
object.add(add);
|
object.add(add);
|
||||||
object.remove(remove);
|
object.remove(remove);
|
||||||
object.info(HostChangeInfo {
|
object.info(HostChangeInfo {
|
||||||
name: "host2.eppdev-1.com".to_string_value(),
|
name: "host2.eppdev-1.com".into(),
|
||||||
});
|
});
|
||||||
|
|
||||||
let serialized = object.serialize().unwrap();
|
let serialized = object.serialize().unwrap();
|
||||||
@ -505,7 +504,7 @@ mod request {
|
|||||||
let deleted_at = DateTime::from_str("2021-07-10T22:00:00.0Z").unwrap();
|
let deleted_at = DateTime::from_str("2021-07-10T22:00:00.0Z").unwrap();
|
||||||
let restored_at = DateTime::from_str("2021-07-20T22:00:00.0Z").unwrap();
|
let restored_at = DateTime::from_str("2021-07-20T22:00:00.0Z").unwrap();
|
||||||
let restore_reason = "Registrant error.";
|
let restore_reason = "Registrant error.";
|
||||||
let statements = vec![
|
let statements = &[
|
||||||
"This registrar has not restored the Registered Name in order to assume the rights to use or sell the Registered Name for itself or for any third party.",
|
"This registrar has not restored the Registered Name in order to assume the rights to use or sell the Registered Name for itself or for any third party.",
|
||||||
"The information in this report is true to best of this registrar's knowledge, and this registrar acknowledges that intentionally supplying false information in this report shall constitute an incurable material breach of the Registry-Registrar Agreement.",
|
"The information in this report is true to best of this registrar's knowledge, and this registrar acknowledges that intentionally supplying false information in this report shall constitute an incurable material breach of the Registry-Registrar Agreement.",
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user