Store a Cow<'a, str> in StringValue

And parametrize all serialize-only types with a lifetime such that
building requests no longer requires unnecessary allocations.
This commit is contained in:
Dirkjan Ochtman 2021-12-14 11:07:01 +01:00 committed by masalachai
parent 1efe19000e
commit d4f4949cd8
29 changed files with 396 additions and 404 deletions

View File

@ -1,6 +1,6 @@
//! Common data types included in EPP Requests and Responses //! Common data types included in EPP Requests and Responses
use std::fmt::Display; use std::{borrow::Cow, fmt::Display};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -11,23 +11,23 @@ pub(crate) const EPP_XMLNS: &str = "urn:ietf:params:xml:ns:epp-1.0";
/// 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(Default, Serialize, Deserialize, Debug, PartialEq, Clone)] #[derive(Default, Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct StringValue(String); pub struct StringValue<'a>(Cow<'a, str>);
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)
} }
} }
impl From<&str> for StringValue { impl<'a> From<&'a str> for StringValue<'a> {
fn from(s: &str) -> Self { fn from(s: &'a str) -> Self {
Self(s.to_owned()) Self(s.into())
} }
} }
impl From<String> for StringValue { impl From<String> for StringValue<'static> {
fn from(s: String) -> Self { fn from(s: String) -> Self {
Self(s) Self(s.into())
} }
} }
@ -42,17 +42,17 @@ impl Extension for NoExtension {
/// The <option> type in EPP XML login requests /// The <option> type in EPP XML login requests
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename = "options")] #[serde(rename = "options")]
pub struct Options { pub struct Options<'a> {
/// The EPP version being used /// The EPP version being used
pub version: StringValue, pub version: StringValue<'a>,
/// The language that will be used during EPP transactions /// The language that will be used during EPP transactions
pub lang: StringValue, pub lang: StringValue<'a>,
} }
impl Options { impl<'a> Options<'a> {
/// 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: &'a str, lang: &'a str) -> Self {
Options { Self {
version: version.into(), version: version.into(),
lang: lang.into(), lang: lang.into(),
} }
@ -62,21 +62,21 @@ impl Options {
/// The <svcExtension> type in EPP XML /// The <svcExtension> type in EPP XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename = "svcExtension")] #[serde(rename = "svcExtension")]
pub struct ServiceExtension { pub struct ServiceExtension<'a> {
/// The service extension URIs being represented by <extURI> in EPP XML /// The service extension URIs being represented by <extURI> in EPP XML
#[serde(rename = "extURI")] #[serde(rename = "extURI")]
pub ext_uris: Option<Vec<StringValue>>, pub ext_uris: Option<Vec<StringValue<'a>>>,
} }
/// The <svcs> type in EPP XML /// The <svcs> type in EPP XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Services { pub struct Services<'a> {
/// The service URIs being used by this EPP session represented by <objURI> in EPP XML /// The service URIs being used by this EPP session represented by <objURI> in EPP XML
#[serde(rename = "objURI")] #[serde(rename = "objURI")]
pub obj_uris: Vec<StringValue>, pub obj_uris: Vec<StringValue<'a>>,
/// The <svcExtention> being used in this EPP session /// The <svcExtention> being used in this EPP session
#[serde(rename = "svcExtension")] #[serde(rename = "svcExtension")]
pub svc_ext: Option<ServiceExtension>, pub svc_ext: Option<ServiceExtension<'a>>,
} }
/// The &lt;hostAddr&gt; types domain or host transactions /// The &lt;hostAddr&gt; types domain or host transactions

View File

@ -33,16 +33,16 @@ impl std::ops::Deref for Country {
/// The &lt;authInfo&gt; tag for domain and contact transactions /// The &lt;authInfo&gt; tag for domain and contact transactions
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ContactAuthInfo { pub struct ContactAuthInfo<'a> {
/// The &lt;pw&gt; tag under &lt;authInfo&gt; /// The &lt;pw&gt; tag under &lt;authInfo&gt;
#[serde(rename = "contact:pw", alias = "pw")] #[serde(rename = "contact:pw", alias = "pw")]
pub password: StringValue, pub password: StringValue<'a>,
} }
impl ContactAuthInfo { impl<'a> ContactAuthInfo<'a> {
/// 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: &'a str) -> Self {
ContactAuthInfo { Self {
password: password.into(), password: password.into(),
} }
} }
@ -76,36 +76,36 @@ impl Phone {
/// The &lt;addr&gt; type on contact transactions /// The &lt;addr&gt; type on contact transactions
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Address { pub struct Address<'a> {
/// The &lt;street&gt; tags under &lt;addr&gt; /// The &lt;street&gt; tags under &lt;addr&gt;
#[serde(rename = "contact:street", alias = "street")] #[serde(rename = "contact:street", alias = "street")]
pub street: Vec<StringValue>, pub street: Vec<StringValue<'a>>,
/// The &lt;city&gt; tag under &lt;addr&gt; /// The &lt;city&gt; tag under &lt;addr&gt;
#[serde(rename = "contact:city", alias = "city")] #[serde(rename = "contact:city", alias = "city")]
pub city: StringValue, pub city: StringValue<'a>,
/// The &lt;sp&gt; tag under &lt;addr&gt; /// The &lt;sp&gt; tag under &lt;addr&gt;
#[serde(rename = "contact:sp", alias = "sp")] #[serde(rename = "contact:sp", alias = "sp")]
pub province: StringValue, pub province: StringValue<'a>,
/// The &lt;pc&gt; tag under &lt;addr&gt; /// The &lt;pc&gt; tag under &lt;addr&gt;
#[serde(rename = "contact:pc", alias = "pc")] #[serde(rename = "contact:pc", alias = "pc")]
pub postal_code: StringValue, pub postal_code: StringValue<'a>,
/// The &lt;cc&gt; tag under &lt;addr&gt; /// The &lt;cc&gt; tag under &lt;addr&gt;
#[serde(rename = "contact:cc", alias = "cc")] #[serde(rename = "contact:cc", alias = "cc")]
pub country: Country, pub country: Country,
} }
impl Address { impl<'a> Address<'a> {
/// Creates a new Address instance /// Creates a new Address instance
pub fn new( pub fn new(
street: &[&str], street: &[&'a str],
city: &str, city: &'a str,
province: &str, province: &'a str,
postal_code: &str, postal_code: &'a str,
country: Country, country: Country,
) -> Address { ) -> Self {
let street = street.iter().map(|&s| s.into()).collect(); let street = street.iter().map(|&s| s.into()).collect();
Address { Self {
street, street,
city: city.into(), city: city.into(),
province: province.into(), province: province.into(),
@ -117,25 +117,25 @@ impl Address {
/// The &lt;postalInfo&gt; type on contact transactions /// The &lt;postalInfo&gt; type on contact transactions
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PostalInfo { pub struct PostalInfo<'a> {
/// The 'type' attr on &lt;postalInfo&gt; /// The 'type' attr on &lt;postalInfo&gt;
#[serde(rename = "type")] #[serde(rename = "type")]
pub info_type: String, pub info_type: String,
/// The &lt;name&gt; tag under &lt;postalInfo&gt; /// The &lt;name&gt; tag under &lt;postalInfo&gt;
#[serde(rename = "contact:name", alias = "name")] #[serde(rename = "contact:name", alias = "name")]
pub name: StringValue, pub name: StringValue<'a>,
/// The &lt;org&gt; tag under &lt;postalInfo&gt; /// The &lt;org&gt; tag under &lt;postalInfo&gt;
#[serde(rename = "contact:org", alias = "org")] #[serde(rename = "contact:org", alias = "org")]
pub organization: StringValue, pub organization: StringValue<'a>,
/// The &lt;addr&gt; tag under &lt;postalInfo&gt; /// The &lt;addr&gt; tag under &lt;postalInfo&gt;
#[serde(rename = "contact:addr", alias = "addr")] #[serde(rename = "contact:addr", alias = "addr")]
pub address: Address, pub address: Address<'a>,
} }
impl PostalInfo { impl<'a> PostalInfo<'a> {
/// Creates a new PostalInfo instance /// Creates a new PostalInfo instance
pub fn new(info_type: &str, name: &str, organization: &str, address: Address) -> PostalInfo { pub fn new(info_type: &str, name: &'a str, organization: &'a str, address: Address<'a>) -> Self {
PostalInfo { Self {
info_type: info_type.to_string(), info_type: info_type.to_string(),
name: name.into(), name: name.into(),
organization: organization.into(), organization: organization.into(),

View File

@ -6,35 +6,32 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for ContactCheck {} impl<'a> Transaction<NoExtension> for ContactCheck<'a> {}
// Request // Request
/// Type that represents the &lt;check&gt; command for contact transactions /// Type that represents the &lt;check&gt; command for contact transactions
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct ContactList { pub struct ContactList<'a> {
/// The XML namespace for the contact &lt;check&gt; /// The XML namespace for the contact &lt;check&gt;
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: &'static str, xmlns: &'a str,
/// The list of contact ids to check for availability /// The list of contact ids to check for availability
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
pub contact_ids: Vec<StringValue>, pub contact_ids: Vec<StringValue<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// The &lt;command&gt; type for contact check command /// The &lt;command&gt; type for contact check command
pub struct ContactCheck { pub struct ContactCheck<'a> {
/// The &lt;check&gt; tag for the contact check command /// The &lt;check&gt; tag for the contact check command
#[serde(rename = "contact:check")] #[serde(rename = "contact:check")]
list: ContactList, list: ContactList<'a>,
} }
impl ContactCheck { impl<'a> ContactCheck<'a> {
pub fn new(contact_ids: &[&str]) -> Self { pub fn new(contact_ids: &[&'a str]) -> Self {
let contact_ids = contact_ids let contact_ids = contact_ids.iter().map(|&d| d.into()).collect();
.iter()
.map(|&d| d.into())
.collect::<Vec<StringValue>>();
Self { Self {
list: ContactList { list: ContactList {
@ -45,7 +42,7 @@ impl ContactCheck {
} }
} }
impl Command for ContactCheck { impl<'a> Command for ContactCheck<'a> {
type Response = ContactCheckResponse; type Response = ContactCheckResponse;
const COMMAND: &'static str = "check"; const COMMAND: &'static str = "check";
} }
@ -57,7 +54,7 @@ impl Command for ContactCheck {
pub struct ContactAvailable { pub struct ContactAvailable {
/// The text of the &lt;id&gt; tag /// The text of the &lt;id&gt; tag
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub id: StringValue, pub id: StringValue<'static>,
/// The avail attr on the &lt;id&gt; tag /// The avail attr on the &lt;id&gt; tag
#[serde(rename = "avail")] #[serde(rename = "avail")]
pub available: u16, pub available: u16,
@ -70,7 +67,7 @@ pub struct ContactCheckResponseDataItem {
#[serde(rename = "id")] #[serde(rename = "id")]
pub contact: ContactAvailable, pub contact: ContactAvailable,
/// The reason for (un)availability /// The reason for (un)availability
pub reason: Option<StringValue>, pub reason: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;chkData&gt; tag for contact check response /// Type that represents the &lt;chkData&gt; tag for contact check response

View File

@ -5,9 +5,9 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for ContactCreate {} impl<'a> Transaction<NoExtension> for ContactCreate<'a> {}
impl Command for ContactCreate { impl<'a> Command for ContactCreate<'a> {
type Response = ContactCreateResponse; type Response = ContactCreateResponse;
const COMMAND: &'static str = "create"; const COMMAND: &'static str = "create";
} }
@ -16,16 +16,16 @@ impl Command for ContactCreate {
/// Type for elements under the contact &lt;create&gt; tag /// Type for elements under the contact &lt;create&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct Contact { pub struct Contact<'a> {
/// XML namespace for contact commands /// XML namespace for contact commands
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: &'static str, xmlns: &'a str,
/// Contact &lt;id&gt; tag /// Contact &lt;id&gt; tag
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue<'a>,
/// Contact &lt;postalInfo&gt; tag /// Contact &lt;postalInfo&gt; tag
#[serde(rename = "contact:postalInfo")] #[serde(rename = "contact:postalInfo")]
postal_info: PostalInfo, postal_info: PostalInfo<'a>,
/// Contact &lt;voice&gt; tag /// Contact &lt;voice&gt; tag
#[serde(rename = "contact:voice")] #[serde(rename = "contact:voice")]
voice: Phone, voice: Phone,
@ -34,27 +34,27 @@ pub struct Contact {
fax: Option<Phone>, fax: Option<Phone>,
/// Contact &lt;email&gt; tag /// Contact &lt;email&gt; tag
#[serde(rename = "contact:email")] #[serde(rename = "contact:email")]
email: StringValue, email: StringValue<'a>,
/// Contact &lt;authInfo&gt; tag /// Contact &lt;authInfo&gt; tag
#[serde(rename = "contact:authInfo")] #[serde(rename = "contact:authInfo")]
auth_info: ContactAuthInfo, auth_info: ContactAuthInfo<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;create&gt; command for contacts /// Type for EPP XML &lt;create&gt; command for contacts
pub struct ContactCreate { pub struct ContactCreate<'a> {
/// Data for &lt;create&gt; command for contact /// Data for &lt;create&gt; command for contact
#[serde(rename = "contact:create")] #[serde(rename = "contact:create")]
pub contact: Contact, pub contact: Contact<'a>,
} }
impl ContactCreate { impl<'a> ContactCreate<'a> {
pub fn new( pub fn new(
id: &str, id: &'a str,
email: &str, email: &'a str,
postal_info: PostalInfo, postal_info: PostalInfo<'a>,
voice: Phone, voice: Phone,
auth_password: &str, auth_password: &'a str,
) -> Self { ) -> Self {
Self { Self {
contact: Contact { contact: Contact {
@ -81,10 +81,10 @@ impl ContactCreate {
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct ContactCreateData { pub struct ContactCreateData {
/// The contact id /// The contact id
pub id: StringValue, pub id: StringValue<'static>,
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
/// The contact creation date /// The contact creation date
pub created_at: StringValue, pub created_at: StringValue<'static>,
} }
/// Type that represents the &lt;resData&gt; tag for contact create response /// Type that represents the &lt;resData&gt; tag for contact create response

View File

@ -5,34 +5,34 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::Serialize; use serde::Serialize;
impl Transaction<NoExtension> for ContactDelete {} impl<'a> Transaction<NoExtension> for ContactDelete<'a> {}
impl Command for ContactDelete { impl<'a> Command for ContactDelete<'a> {
type Response = (); type Response = ();
const COMMAND: &'static str = "delete"; const COMMAND: &'static str = "delete";
} }
/// Type containing the data for the &lt;delete&gt; tag for contacts /// Type containing the data for the &lt;delete&gt; tag for contacts
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct ContactDeleteRequestData { pub struct ContactDeleteRequestData<'a> {
/// XML namespace for the &lt;delete&gt; command for contacts /// XML namespace for the &lt;delete&gt; command for contacts
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: &'static str, xmlns: &'a str,
/// The id of the contact to be deleted /// The id of the contact to be deleted
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// The &lt;delete&gt; type for the contact delete EPP command /// The &lt;delete&gt; type for the contact delete EPP command
pub struct ContactDelete { pub struct ContactDelete<'a> {
#[serde(rename = "contact:delete")] #[serde(rename = "contact:delete")]
/// The data for the &lt;delete&gt; tag for a contact delete command /// The data for the &lt;delete&gt; tag for a contact delete command
contact: ContactDeleteRequestData, contact: ContactDeleteRequestData<'a>,
} }
impl ContactDelete { impl<'a> ContactDelete<'a> {
pub fn new(id: &str) -> ContactDelete { pub fn new(id: &'a str) -> Self {
Self { Self {
contact: ContactDeleteRequestData { contact: ContactDeleteRequestData {
xmlns: XMLNS, xmlns: XMLNS,

View File

@ -5,9 +5,9 @@ use crate::common::{NoExtension, ObjectStatus, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for ContactInfo {} impl<'a> Transaction<NoExtension> for ContactInfo<'a> {}
impl Command for ContactInfo { impl<'a> Command for ContactInfo<'a> {
type Response = ContactInfoResponse; type Response = ContactInfoResponse;
const COMMAND: &'static str = "info"; const COMMAND: &'static str = "info";
} }
@ -16,28 +16,28 @@ impl Command for ContactInfo {
/// Type for elements under the contact &lt;info&gt; tag /// Type for elements under the contact &lt;info&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct ContactInfoRequestData { pub struct ContactInfoRequestData<'a> {
/// XML namespace for contact commands /// XML namespace for contact commands
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: &'static str, xmlns: &'a str,
/// The contact id for the info command /// The contact id for the info command
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue<'a>,
/// The &lt;authInfo&gt; data /// The &lt;authInfo&gt; data
#[serde(rename = "contact:authInfo")] #[serde(rename = "contact:authInfo")]
auth_info: ContactAuthInfo, auth_info: ContactAuthInfo<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;info&gt; command for contacts /// Type for EPP XML &lt;info&gt; command for contacts
pub struct ContactInfo { pub struct ContactInfo<'a> {
/// Data for &lt;info&gt; command for contact /// Data for &lt;info&gt; command for contact
#[serde(rename = "contact:info")] #[serde(rename = "contact:info")]
info: ContactInfoRequestData, info: ContactInfoRequestData<'a>,
} }
impl ContactInfo { impl<'a> ContactInfo<'a> {
pub fn new(id: &str, auth_password: &str) -> ContactInfo { pub fn new(id: &'a str, auth_password: &'a str) -> ContactInfo<'a> {
Self { Self {
info: ContactInfoRequestData { info: ContactInfoRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -52,44 +52,44 @@ impl ContactInfo {
/// Type that represents the &lt;infData&gt; tag for contact check response /// Type that represents the &lt;infData&gt; tag for contact check response
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct ContactInfoData { pub struct ContactInfoData<'a> {
/// The contact id /// The contact id
pub id: StringValue, pub id: StringValue<'a>,
/// The contact ROID /// The contact ROID
pub roid: StringValue, pub roid: StringValue<'a>,
/// The list of contact statuses /// The list of contact statuses
#[serde(rename = "status")] #[serde(rename = "status")]
pub statuses: Vec<ObjectStatus>, pub statuses: Vec<ObjectStatus>,
/// The postal info for the contact /// The postal info for the contact
#[serde(rename = "postalInfo")] #[serde(rename = "postalInfo")]
pub postal_info: PostalInfo, pub postal_info: PostalInfo<'a>,
/// The voice data for the contact /// The voice data for the contact
pub voice: Phone, pub voice: Phone,
/// The fax data for the contact /// The fax data for the contact
pub fax: Option<Phone>, pub fax: Option<Phone>,
/// The email for the contact /// The email for the contact
pub email: StringValue, pub email: StringValue<'a>,
/// The epp user to whom the contact belongs /// The epp user to whom the contact belongs
#[serde(rename = "clID")] #[serde(rename = "clID")]
pub client_id: StringValue, pub client_id: StringValue<'a>,
/// The epp user who created the contact /// The epp user who created the contact
#[serde(rename = "crID")] #[serde(rename = "crID")]
pub creator_id: StringValue, pub creator_id: StringValue<'a>,
/// The creation date /// The creation date
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
pub created_at: StringValue, pub created_at: StringValue<'a>,
/// The epp user who last updated the contact /// The epp user who last updated the contact
#[serde(rename = "upID")] #[serde(rename = "upID")]
pub updater_id: Option<StringValue>, pub updater_id: Option<StringValue<'a>>,
/// The last update date /// The last update date
#[serde(rename = "upDate")] #[serde(rename = "upDate")]
pub updated_at: Option<StringValue>, pub updated_at: Option<StringValue<'a>>,
/// The contact transfer date /// The contact transfer date
#[serde(rename = "trDate")] #[serde(rename = "trDate")]
pub transferred_at: Option<StringValue>, pub transferred_at: Option<StringValue<'a>>,
/// The contact auth info /// The contact auth info
#[serde(rename = "authInfo")] #[serde(rename = "authInfo")]
pub auth_info: Option<ContactAuthInfo>, pub auth_info: Option<ContactAuthInfo<'a>>,
} }
/// Type that represents the &lt;resData&gt; tag for contact info response /// Type that represents the &lt;resData&gt; tag for contact info response
@ -97,7 +97,7 @@ pub struct ContactInfoData {
pub struct ContactInfoResponse { pub struct ContactInfoResponse {
/// Data under the &lt;infData&gt; tag /// Data under the &lt;infData&gt; tag
#[serde(rename = "infData")] #[serde(rename = "infData")]
pub info_data: ContactInfoData, pub info_data: ContactInfoData<'static>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -5,15 +5,15 @@ use crate::common::{NoExtension, ObjectStatus, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::Serialize; use serde::Serialize;
impl Transaction<NoExtension> for ContactUpdate {} impl<'a> Transaction<NoExtension> for ContactUpdate<'a> {}
impl Command for ContactUpdate { impl<'a> Command for ContactUpdate<'a> {
type Response = (); type Response = ();
const COMMAND: &'static str = "update"; const COMMAND: &'static str = "update";
} }
impl ContactUpdate { impl<'a> ContactUpdate<'a> {
pub fn new(id: &str) -> ContactUpdate { pub fn new(id: &'a str) -> ContactUpdate {
Self { Self {
contact: ContactUpdateRequestData { contact: ContactUpdateRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -28,10 +28,10 @@ impl ContactUpdate {
/// Sets the data for the &lt;chg&gt; tag for the contact update request /// Sets the data for the &lt;chg&gt; tag for the contact update request
pub fn set_info( pub fn set_info(
&mut self, &mut self,
email: &str, email: &'a str,
postal_info: PostalInfo, postal_info: PostalInfo<'a>,
voice: Phone, voice: Phone,
auth_password: &str, auth_password: &'a str,
) { ) {
self.contact.change_info = Some(ContactChangeInfo { self.contact.change_info = Some(ContactChangeInfo {
email: Some(email.into()), email: Some(email.into()),
@ -62,17 +62,17 @@ impl ContactUpdate {
/// Type for elements under the &lt;chg&gt; tag for contact update request /// Type for elements under the &lt;chg&gt; tag for contact update request
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct ContactChangeInfo { pub struct ContactChangeInfo<'a> {
#[serde(rename = "contact:postalInfo")] #[serde(rename = "contact:postalInfo")]
postal_info: Option<PostalInfo>, postal_info: Option<PostalInfo<'a>>,
#[serde(rename = "contact:voice")] #[serde(rename = "contact:voice")]
voice: Option<Phone>, voice: Option<Phone>,
#[serde(rename = "contact:fax")] #[serde(rename = "contact:fax")]
fax: Option<Phone>, fax: Option<Phone>,
#[serde(rename = "contact:email")] #[serde(rename = "contact:email")]
email: Option<StringValue>, email: Option<StringValue<'a>>,
#[serde(rename = "contact:authInfo")] #[serde(rename = "contact:authInfo")]
auth_info: Option<ContactAuthInfo>, auth_info: Option<ContactAuthInfo<'a>>,
} }
/// Type for list of elements of the &lt;status&gt; tag for contact update request /// Type for list of elements of the &lt;status&gt; tag for contact update request
@ -84,25 +84,25 @@ pub struct StatusList {
/// Type for elements under the contact &lt;update&gt; tag /// Type for elements under the contact &lt;update&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct ContactUpdateRequestData { pub struct ContactUpdateRequestData<'a> {
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: &'static str, xmlns: &'a str,
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue<'a>,
#[serde(rename = "contact:add")] #[serde(rename = "contact:add")]
add_statuses: Option<StatusList>, add_statuses: Option<StatusList>,
#[serde(rename = "contact:rem")] #[serde(rename = "contact:rem")]
remove_statuses: Option<StatusList>, remove_statuses: Option<StatusList>,
#[serde(rename = "contact:chg")] #[serde(rename = "contact:chg")]
change_info: Option<ContactChangeInfo>, change_info: Option<ContactChangeInfo<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;update&gt; command for contacts /// Type for EPP XML &lt;update&gt; command for contacts
pub struct ContactUpdate { pub struct ContactUpdate<'a> {
/// The data under the &lt;update&gt; tag for the contact update /// The data under the &lt;update&gt; tag for the contact update
#[serde(rename = "contact:update")] #[serde(rename = "contact:update")]
contact: ContactUpdateRequestData, contact: ContactUpdateRequestData<'a>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -14,10 +14,10 @@ pub const XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0";
/// The &lt;hostAttr&gt; type for domain transactions /// The &lt;hostAttr&gt; type for domain transactions
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct HostAttr { pub struct HostAttr<'a> {
/// The &lt;hostName&gt; tag /// The &lt;hostName&gt; tag
#[serde(rename = "domain:hostName", alias = "hostName")] #[serde(rename = "domain:hostName", alias = "hostName")]
pub name: StringValue, pub name: StringValue<'a>,
/// The &lt;hostAddr&gt; tags /// The &lt;hostAddr&gt; tags
#[serde(rename = "domain:hostAddr", alias = "hostAddr")] #[serde(rename = "domain:hostAddr", alias = "hostAddr")]
pub addresses: Option<Vec<HostAddr>>, pub addresses: Option<Vec<HostAddr>>,
@ -25,27 +25,27 @@ pub struct HostAttr {
/// The list of &lt;hostAttr&gt; types for domain transactions. Typically under an &lt;ns&gt; tag /// The list of &lt;hostAttr&gt; types for domain transactions. Typically under an &lt;ns&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostAttrList { pub struct HostAttrList<'a> {
/// The list of &lt;hostAttr&gt; tags /// The list of &lt;hostAttr&gt; tags
#[serde(rename = "domain:hostAttr", alias = "hostAttr")] #[serde(rename = "domain:hostAttr", alias = "hostAttr")]
pub hosts: Vec<HostAttr>, pub hosts: Vec<HostAttr<'a>>,
} }
/// The list of &lt;hostObj&gt; types for domain transactions. Typically under an &lt;ns&gt; tag /// The list of &lt;hostObj&gt; types for domain transactions. Typically under an &lt;ns&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostObjList { pub struct HostObjList<'a> {
/// The list of &lt;hostObj&gt; tags /// The list of &lt;hostObj&gt; tags
#[serde(rename = "domain:hostObj", alias = "hostObj")] #[serde(rename = "domain:hostObj", alias = "hostObj")]
pub hosts: Vec<StringValue>, pub hosts: Vec<StringValue<'a>>,
} }
/// Enum that can accept one type which corresponds to either the &lt;hostObj&gt; or &lt;hostAttr&gt; /// Enum that can accept one type which corresponds to either the &lt;hostObj&gt; or &lt;hostAttr&gt;
/// list of tags /// list of tags
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
#[serde(untagged)] #[serde(untagged)]
pub enum HostList { pub enum HostList<'a> {
HostObjList(HostObjList), HostObjList(HostObjList<'a>),
HostAttrList(HostAttrList), HostAttrList(HostAttrList<'a>),
} }
/// The &lt;contact&gt; type on domain creation and update requests /// The &lt;contact&gt; type on domain creation and update requests
@ -86,16 +86,16 @@ impl Period {
/// The &lt;authInfo&gt; tag for domain and contact transactions /// The &lt;authInfo&gt; tag for domain and contact transactions
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DomainAuthInfo { pub struct DomainAuthInfo<'a> {
/// The &lt;pw&gt; tag under &lt;authInfo&gt; /// The &lt;pw&gt; tag under &lt;authInfo&gt;
#[serde(rename = "domain:pw", alias = "pw")] #[serde(rename = "domain:pw", alias = "pw")]
pub password: StringValue, pub password: StringValue<'a>,
} }
impl DomainAuthInfo { impl<'a> DomainAuthInfo<'a> {
/// 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: &'a str) -> Self {
DomainAuthInfo { Self {
password: password.into(), password: password.into(),
} }
} }

View File

@ -5,22 +5,19 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for DomainCheck {} impl<'a> Transaction<NoExtension> for DomainCheck<'a> {}
impl Command for DomainCheck { impl<'a> Command for DomainCheck<'a> {
type Response = DomainCheckResponse; type Response = DomainCheckResponse;
const COMMAND: &'static str = "check"; const COMMAND: &'static str = "check";
} }
impl DomainCheck { impl<'a> DomainCheck<'a> {
pub fn new(domains: Vec<&str>) -> Self { pub fn new(domains: Vec<&'a str>) -> Self {
Self { Self {
list: DomainList { list: DomainList {
xmlns: XMLNS, xmlns: XMLNS,
domains: domains domains: domains.into_iter().map(|d| d.into()).collect(),
.into_iter()
.map(|d| d.into())
.collect::<Vec<StringValue>>(),
}, },
} }
} }
@ -30,21 +27,21 @@ impl DomainCheck {
/// Type for &lt;name&gt; elements under the domain &lt;check&gt; tag /// Type for &lt;name&gt; elements under the domain &lt;check&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainList { pub struct DomainList<'a> {
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
/// XML namespace for domain commands /// XML namespace for domain commands
pub xmlns: &'static str, pub xmlns: &'a str,
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
/// List of domains to be checked for availability /// List of domains to be checked for availability
pub domains: Vec<StringValue>, pub domains: Vec<StringValue<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;check&gt; command for domains /// Type for EPP XML &lt;check&gt; command for domains
pub struct DomainCheck { pub struct DomainCheck<'a> {
/// The object holding the list of domains to be checked /// The object holding the list of domains to be checked
#[serde(rename = "domain:check")] #[serde(rename = "domain:check")]
list: DomainList, list: DomainList<'a>,
} }
// Response // Response
@ -54,7 +51,7 @@ pub struct DomainCheck {
pub struct DomainAvailable { pub struct DomainAvailable {
/// The domain name /// The domain name
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub name: StringValue, pub name: StringValue<'static>,
/// The domain (un)availability /// The domain (un)availability
#[serde(rename = "avail")] #[serde(rename = "avail")]
pub available: u16, pub available: u16,
@ -67,7 +64,7 @@ pub struct DomainCheckResponseDataItem {
#[serde(rename = "name")] #[serde(rename = "name")]
pub domain: DomainAvailable, pub domain: DomainAvailable,
/// The reason for (un)availability /// The reason for (un)availability
pub reason: Option<StringValue>, pub reason: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;chkData&gt; tag for domain check response /// Type that represents the &lt;chkData&gt; tag for domain check response

View File

@ -6,9 +6,9 @@ use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for DomainCreate {} impl<'a> Transaction<NoExtension> for DomainCreate<'a> {}
impl Command for DomainCreate { impl<'a> Command for DomainCreate<'a> {
type Response = DomainCreateResponse; type Response = DomainCreateResponse;
const COMMAND: &'static str = "create"; const COMMAND: &'static str = "create";
} }
@ -17,48 +17,48 @@ impl Command for DomainCreate {
/// Type for elements under the domain &lt;create&gt; tag /// Type for elements under the domain &lt;create&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainCreateRequestData { pub struct DomainCreateRequestData<'a> {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
pub xmlns: &'static str, pub xmlns: &'a str,
/// The domain name /// The domain name
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
pub name: StringValue, pub name: StringValue<'a>,
/// The period of registration /// The period of registration
#[serde(rename = "domain:period")] #[serde(rename = "domain:period")]
pub period: Period, pub period: Period,
/// The list of nameserver hosts /// The list of nameserver hosts
/// either of type `HostObjList` or `HostAttrList` /// either of type `HostObjList` or `HostAttrList`
#[serde(rename = "domain:ns")] #[serde(rename = "domain:ns")]
pub ns: Option<HostList>, pub ns: Option<HostList<'a>>,
/// The domain registrant /// The domain registrant
#[serde(rename = "domain:registrant")] #[serde(rename = "domain:registrant")]
pub registrant: Option<StringValue>, pub registrant: Option<StringValue<'a>>,
/// The list of contacts for the domain /// The list of contacts for the domain
#[serde(rename = "domain:contact")] #[serde(rename = "domain:contact")]
pub contacts: Option<Vec<DomainContact>>, pub contacts: Option<Vec<DomainContact>>,
/// The auth info for the domain /// The auth info for the domain
#[serde(rename = "domain:authInfo")] #[serde(rename = "domain:authInfo")]
pub auth_info: DomainAuthInfo, pub auth_info: DomainAuthInfo<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;create&gt; command for domains /// Type for EPP XML &lt;create&gt; command for domains
pub struct DomainCreate { pub struct DomainCreate<'a> {
/// The data for the domain to be created with /// The data for the domain to be created with
/// T being the type of nameserver list (`HostObjList` or `HostAttrList`) /// T being the type of nameserver list (`HostObjList` or `HostAttrList`)
/// to be supplied /// to be supplied
#[serde(rename = "domain:create")] #[serde(rename = "domain:create")]
pub domain: DomainCreateRequestData, pub domain: DomainCreateRequestData<'a>,
} }
impl DomainCreate { impl<'a> DomainCreate<'a> {
pub fn new( pub fn new(
name: &str, name: &'a str,
period: u16, period: u16,
ns: Option<HostList>, ns: Option<HostList<'a>>,
registrant_id: Option<&str>, registrant_id: Option<&'a str>,
auth_password: &str, auth_password: &'a str,
contacts: Option<Vec<DomainContact>>, contacts: Option<Vec<DomainContact>>,
) -> Self { ) -> Self {
Self { Self {
@ -84,13 +84,13 @@ pub struct DomainCreateResponseData {
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
pub xmlns: String, pub xmlns: String,
/// The domain name /// The domain name
pub name: StringValue, pub name: StringValue<'static>,
/// The creation date /// The creation date
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
pub created_at: StringValue, pub created_at: StringValue<'static>,
/// The expiry date /// The expiry date
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
pub expiring_at: Option<StringValue>, pub expiring_at: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;resData&gt; tag for domain create response /// Type that represents the &lt;resData&gt; tag for domain create response

View File

@ -5,15 +5,15 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::Serialize; use serde::Serialize;
impl Transaction<NoExtension> for DomainDelete {} impl<'a> Transaction<NoExtension> for DomainDelete<'a> {}
impl Command for DomainDelete { impl<'a> Command for DomainDelete<'a> {
type Response = (); type Response = ();
const COMMAND: &'static str = "delete"; const COMMAND: &'static str = "delete";
} }
impl DomainDelete { impl<'a> DomainDelete<'a> {
pub fn new(name: &str) -> Self { pub fn new(name: &'a str) -> Self {
Self { Self {
domain: DomainDeleteRequestData { domain: DomainDeleteRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -25,21 +25,21 @@ impl DomainDelete {
/// Type for &lt;name&gt; element under the domain &lt;delete&gt; tag /// Type for &lt;name&gt; element under the domain &lt;delete&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainDeleteRequestData { pub struct DomainDeleteRequestData<'a> {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: &'static str, xmlns: &'a str,
/// The domain to be deleted /// The domain to be deleted
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
name: StringValue, name: StringValue<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;delete&gt; command for domains /// Type for EPP XML &lt;delete&gt; command for domains
pub struct DomainDelete { pub struct DomainDelete<'a> {
/// The data under the &lt;delete&gt; tag for domain deletion /// The data under the &lt;delete&gt; tag for domain deletion
#[serde(rename = "domain:delete")] #[serde(rename = "domain:delete")]
domain: DomainDeleteRequestData, domain: DomainDeleteRequestData<'a>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -5,15 +5,15 @@ use crate::common::{NoExtension, ObjectStatus, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for DomainInfo {} impl<'a> Transaction<NoExtension> for DomainInfo<'a> {}
impl Command for DomainInfo { impl<'a> Command for DomainInfo<'a> {
type Response = DomainInfoResponse; type Response = DomainInfoResponse;
const COMMAND: &'static str = "info"; const COMMAND: &'static str = "info";
} }
impl DomainInfo { impl<'a> DomainInfo<'a> {
pub fn new(name: &str, auth_password: Option<&str>) -> Self { pub fn new(name: &'a str, auth_password: Option<&'a str>) -> Self {
Self { Self {
info: DomainInfoRequestData { info: DomainInfoRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -43,24 +43,24 @@ pub struct Domain {
/// Type for &lt;name&gt; element under the domain &lt;info&gt; tag /// Type for &lt;name&gt; element under the domain &lt;info&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainInfoRequestData { pub struct DomainInfoRequestData<'a> {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: &'static str, xmlns: &'a str,
/// The data for the domain to be queried /// The data for the domain to be queried
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
domain: Domain, domain: Domain,
/// The auth info for the domain /// The auth info for the domain
#[serde(rename = "domain:authInfo")] #[serde(rename = "domain:authInfo")]
auth_info: Option<DomainAuthInfo>, auth_info: Option<DomainAuthInfo<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;info&gt; command for domains /// Type for EPP XML &lt;info&gt; command for domains
pub struct DomainInfo { pub struct DomainInfo<'a> {
/// The data under the &lt;info&gt; tag for domain info /// The data under the &lt;info&gt; tag for domain info
#[serde(rename = "domain:info")] #[serde(rename = "domain:info")]
info: DomainInfoRequestData, info: DomainInfoRequestData<'a>,
} }
// Response // Response
@ -71,23 +71,23 @@ pub struct DomainInfo {
pub struct DomainNsList { pub struct DomainNsList {
/// List of &lt;hostObj&gt; ns elements /// List of &lt;hostObj&gt; ns elements
#[serde(rename = "hostObj")] #[serde(rename = "hostObj")]
pub host_obj: Option<Vec<StringValue>>, pub host_obj: Option<Vec<StringValue<'static>>>,
/// List of &lt;hostAttr&gt; ns elements /// List of &lt;hostAttr&gt; ns elements
pub host_attr: Option<Vec<HostAttr>>, pub host_attr: Option<Vec<HostAttr<'static>>>,
} }
/// Type that represents the &lt;infData&gt; tag for domain info response /// Type that represents the &lt;infData&gt; tag for domain info response
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct DomainInfoResponseData { pub struct DomainInfoResponseData {
/// The domain name /// The domain name
pub name: StringValue, pub name: StringValue<'static>,
/// The domain ROID /// The domain ROID
pub roid: StringValue, pub roid: StringValue<'static>,
/// The list of domain statuses /// The list of domain statuses
#[serde(rename = "status")] #[serde(rename = "status")]
pub statuses: Option<Vec<ObjectStatus>>, pub statuses: Option<Vec<ObjectStatus>>,
/// The domain registrant /// The domain registrant
pub registrant: Option<StringValue>, pub registrant: Option<StringValue<'static>>,
/// The list of domain contacts /// The list of domain contacts
#[serde(rename = "contact")] #[serde(rename = "contact")]
pub contacts: Option<Vec<DomainContact>>, pub contacts: Option<Vec<DomainContact>>,
@ -96,31 +96,31 @@ pub struct DomainInfoResponseData {
pub ns: Option<DomainNsList>, pub ns: Option<DomainNsList>,
/// The list of domain hosts /// The list of domain hosts
#[serde(rename = "host")] #[serde(rename = "host")]
pub hosts: Option<Vec<StringValue>>, pub hosts: Option<Vec<StringValue<'static>>>,
/// The epp user who owns the domain /// The epp user who owns the domain
#[serde(rename = "clID")] #[serde(rename = "clID")]
pub client_id: StringValue, pub client_id: StringValue<'static>,
/// The epp user who created the domain /// The epp user who created the domain
#[serde(rename = "crID")] #[serde(rename = "crID")]
pub creator_id: Option<StringValue>, pub creator_id: Option<StringValue<'static>>,
/// The domain creation date /// The domain creation date
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
pub created_at: Option<StringValue>, pub created_at: Option<StringValue<'static>>,
/// The domain expiry date /// The domain expiry date
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
pub expiring_at: Option<StringValue>, pub expiring_at: Option<StringValue<'static>>,
/// The epp user who last updated the domain /// The epp user who last updated the domain
#[serde(rename = "upID")] #[serde(rename = "upID")]
pub updater_id: Option<StringValue>, pub updater_id: Option<StringValue<'static>>,
/// The domain last updated date /// The domain last updated date
#[serde(rename = "upDate")] #[serde(rename = "upDate")]
pub updated_at: Option<StringValue>, pub updated_at: Option<StringValue<'static>>,
/// The domain transfer date /// The domain transfer date
#[serde(rename = "trDate")] #[serde(rename = "trDate")]
pub transferred_at: Option<StringValue>, pub transferred_at: Option<StringValue<'static>>,
/// The domain auth info /// The domain auth info
#[serde(rename = "authInfo")] #[serde(rename = "authInfo")]
pub auth_info: Option<DomainAuthInfo>, pub auth_info: Option<DomainAuthInfo<'static>>,
} }
/// Type that represents the &lt;resData&gt; tag for domain info response /// Type that represents the &lt;resData&gt; tag for domain info response

View File

@ -6,15 +6,15 @@ use crate::request::{Command, Transaction};
use chrono::NaiveDate; use chrono::NaiveDate;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for DomainRenew {} impl<'a> Transaction<NoExtension> for DomainRenew<'a> {}
impl Command for DomainRenew { impl<'a> Command for DomainRenew<'a> {
type Response = DomainRenewResponse; type Response = DomainRenewResponse;
const COMMAND: &'static str = "renew"; const COMMAND: &'static str = "renew";
} }
impl DomainRenew { impl<'a> DomainRenew<'a> {
pub fn new(name: &str, current_expiry_date: NaiveDate, years: u16) -> Self { pub fn new(name: &'a str, current_expiry_date: NaiveDate, years: u16) -> Self {
let exp_date_str = current_expiry_date.format("%Y-%m-%d").to_string().into(); let exp_date_str = current_expiry_date.format("%Y-%m-%d").to_string().into();
Self { Self {
domain: DomainRenewRequestData { domain: DomainRenewRequestData {
@ -31,16 +31,16 @@ impl DomainRenew {
/// Type for data under the domain &lt;renew&gt; tag /// Type for data under the domain &lt;renew&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainRenewRequestData { pub struct DomainRenewRequestData<'a> {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: &'static str, xmlns: &'a str,
/// The name of the domain to be renewed /// The name of the domain to be renewed
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
name: StringValue, name: StringValue<'a>,
/// The current expiry date of the domain in 'Y-m-d' format /// The current expiry date of the domain in 'Y-m-d' format
#[serde(rename = "domain:curExpDate")] #[serde(rename = "domain:curExpDate")]
current_expiry_date: StringValue, current_expiry_date: StringValue<'a>,
/// The period of renewal /// The period of renewal
#[serde(rename = "domain:period")] #[serde(rename = "domain:period")]
period: Period, period: Period,
@ -48,10 +48,10 @@ pub struct DomainRenewRequestData {
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;renew&gt; command for domains /// Type for EPP XML &lt;renew&gt; command for domains
pub struct DomainRenew { pub struct DomainRenew<'a> {
/// The data under the &lt;renew&gt; tag for the domain renewal /// The data under the &lt;renew&gt; tag for the domain renewal
#[serde(rename = "domain:renew")] #[serde(rename = "domain:renew")]
domain: DomainRenewRequestData, domain: DomainRenewRequestData<'a>,
} }
// Response // Response
@ -60,10 +60,10 @@ pub struct DomainRenew {
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct DomainRenewResponseData { pub struct DomainRenewResponseData {
/// The name of the domain /// The name of the domain
pub name: StringValue, pub name: StringValue<'static>,
/// The new expiry date after renewal /// The new expiry date after renewal
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
pub expiring_at: Option<StringValue>, pub expiring_at: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;resData&gt; tag for domain renew response /// Type that represents the &lt;resData&gt; tag for domain renew response

View File

@ -5,15 +5,15 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for DomainTransfer {} impl<'a> Transaction<NoExtension> for DomainTransfer<'a> {}
impl Command for DomainTransfer { impl<'a> Command for DomainTransfer<'a> {
type Response = DomainTransferResponse; type Response = DomainTransferResponse;
const COMMAND: &'static str = "transfer"; const COMMAND: &'static str = "transfer";
} }
impl DomainTransfer { impl<'a> DomainTransfer<'a> {
pub fn new(name: &str, years: Option<u16>, auth_password: &str) -> Self { pub fn new(name: &'a str, years: Option<u16>, auth_password: &'a str) -> Self {
Self::build( Self::build(
"request", "request",
name, name,
@ -22,7 +22,7 @@ impl DomainTransfer {
) )
} }
pub fn query(name: &str, auth_password: &str) -> Self { pub fn query(name: &'a str, auth_password: &'a str) -> Self {
Self::build( Self::build(
"query", "query",
name, name,
@ -31,23 +31,23 @@ impl DomainTransfer {
) )
} }
pub fn approve(name: &str) -> Self { pub fn approve(name: &'a str) -> Self {
Self::build("approve", name, None, None) Self::build("approve", name, None, None)
} }
pub fn reject(name: &str) -> Self { pub fn reject(name: &'a str) -> Self {
Self::build("reject", name, None, None) Self::build("reject", name, None, None)
} }
pub fn cancel(name: &str) -> Self { pub fn cancel(name: &'a str) -> Self {
Self::build("cancel", name, None, None) Self::build("cancel", name, None, None)
} }
fn build( fn build(
operation: &str, operation: &'a str,
name: &str, name: &'a str,
period: Option<Period>, period: Option<Period>,
auth_info: Option<DomainAuthInfo>, auth_info: Option<DomainAuthInfo<'a>>,
) -> Self { ) -> Self {
Self { Self {
operation: operation.to_string(), operation: operation.to_string(),
@ -65,13 +65,13 @@ impl DomainTransfer {
/// Type for elements under the domain &lt;transfer&gt; tag /// Type for elements under the domain &lt;transfer&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainTransferReqData { pub struct DomainTransferReqData<'a> {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: &'static str, xmlns: &'a str,
/// The name of the domain under transfer /// The name of the domain under transfer
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
name: StringValue, name: StringValue<'a>,
/// The period of renewal upon a successful transfer /// The period of renewal upon a successful transfer
/// Only applicable in case of a transfer request /// Only applicable in case of a transfer request
#[serde(rename = "domain:period")] #[serde(rename = "domain:period")]
@ -79,19 +79,19 @@ pub struct DomainTransferReqData {
/// The authInfo for the domain under transfer /// The authInfo for the domain under transfer
/// Only applicable to domain transfer and domain transfer query requests /// Only applicable to domain transfer and domain transfer query requests
#[serde(rename = "domain:authInfo")] #[serde(rename = "domain:authInfo")]
auth_info: Option<DomainAuthInfo>, auth_info: Option<DomainAuthInfo<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;transfer&gt; command for domains /// Type for EPP XML &lt;transfer&gt; command for domains
pub struct DomainTransfer { pub struct DomainTransfer<'a> {
/// The transfer operation to perform indicated by the 'op' attr /// The transfer operation to perform indicated by the 'op' attr
/// The values are one of transfer or query /// The values are one of transfer or query
#[serde(rename = "op")] #[serde(rename = "op")]
operation: String, operation: String,
/// The data under the &lt;transfer&gt; tag in the transfer request /// The data under the &lt;transfer&gt; tag in the transfer request
#[serde(rename = "domain:transfer")] #[serde(rename = "domain:transfer")]
domain: DomainTransferReqData, domain: DomainTransferReqData<'a>,
} }
// Response // Response
@ -100,25 +100,25 @@ pub struct DomainTransfer {
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct DomainTransferResponseData { pub struct DomainTransferResponseData {
/// The domain name /// The domain name
pub name: StringValue, pub name: StringValue<'static>,
/// The domain transfer status /// The domain transfer status
#[serde(rename = "trStatus")] #[serde(rename = "trStatus")]
pub transfer_status: StringValue, pub transfer_status: StringValue<'static>,
/// The epp user who requested the transfer /// The epp user who requested the transfer
#[serde(rename = "reID")] #[serde(rename = "reID")]
pub requester_id: StringValue, pub requester_id: StringValue<'static>,
/// The transfer rquest date /// The transfer rquest date
#[serde(rename = "reDate")] #[serde(rename = "reDate")]
pub requested_at: StringValue, pub requested_at: StringValue<'static>,
/// The epp user who should acknowledge the transfer request /// The epp user who should acknowledge the transfer request
#[serde(rename = "acID")] #[serde(rename = "acID")]
pub ack_id: StringValue, pub ack_id: StringValue<'static>,
/// THe date by which the acknowledgment should be made /// THe date by which the acknowledgment should be made
#[serde(rename = "acDate")] #[serde(rename = "acDate")]
pub ack_by: StringValue, pub ack_by: StringValue<'static>,
/// The domain expiry date /// The domain expiry date
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
pub expiring_at: Option<StringValue>, pub expiring_at: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;resData&gt; tag for domain transfer response /// Type that represents the &lt;resData&gt; tag for domain transfer response

View File

@ -8,15 +8,15 @@ use crate::{
use serde::Serialize; use serde::Serialize;
impl Transaction<NoExtension> for DomainUpdate {} impl<'a> Transaction<NoExtension> for DomainUpdate<'a> {}
impl Command for DomainUpdate { impl<'a> Command for DomainUpdate<'a> {
type Response = (); type Response = ();
const COMMAND: &'static str = "update"; const COMMAND: &'static str = "update";
} }
impl DomainUpdate { impl<'a> DomainUpdate<'a> {
pub fn new(name: &str) -> Self { pub fn new(name: &'a str) -> Self {
Self { Self {
domain: DomainUpdateRequestData { domain: DomainUpdateRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -29,39 +29,39 @@ impl DomainUpdate {
} }
/// Sets the data for the &lt;chg&gt; tag /// Sets the data for the &lt;chg&gt; tag
pub fn info(&mut self, info: DomainChangeInfo) { pub fn info(&mut self, info: DomainChangeInfo<'a>) {
self.domain.change_info = Some(info); self.domain.change_info = Some(info);
} }
/// Sets the data for the &lt;add&gt; tag /// Sets the data for the &lt;add&gt; tag
pub fn add(&mut self, add: DomainAddRemove) { pub fn add(&mut self, add: DomainAddRemove<'a>) {
self.domain.add = Some(add); self.domain.add = Some(add);
} }
/// Sets the data for the &lt;rem&gt; tag /// Sets the data for the &lt;rem&gt; tag
pub fn remove(&mut self, remove: DomainAddRemove) { pub fn remove(&mut self, remove: DomainAddRemove<'a>) {
self.domain.remove = Some(remove); self.domain.remove = Some(remove);
} }
} }
/// Type for elements under the &lt;chg&gt; tag for domain update /// Type for elements under the &lt;chg&gt; tag for domain update
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainChangeInfo { pub struct DomainChangeInfo<'a> {
/// The new registrant contact for the domain /// The new registrant contact for the domain
#[serde(rename = "domain:registrant")] #[serde(rename = "domain:registrant")]
pub registrant: Option<StringValue>, pub registrant: Option<StringValue<'a>>,
/// The new auth info for the domain /// The new auth info for the domain
#[serde(rename = "domain:authInfo")] #[serde(rename = "domain:authInfo")]
pub auth_info: Option<DomainAuthInfo>, pub auth_info: Option<DomainAuthInfo<'a>>,
} }
/// Type for elements under the &lt;add&gt; and &lt;rem&gt; tags for domain update /// Type for elements under the &lt;add&gt; and &lt;rem&gt; tags for domain update
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainAddRemove { pub struct DomainAddRemove<'a> {
/// The list of nameservers to add or remove /// The list of nameservers to add or remove
/// Type T can be either a `HostObjList` or `HostAttrList` /// Type T can be either a `HostObjList` or `HostAttrList`
#[serde(rename = "domain:ns")] #[serde(rename = "domain:ns")]
pub ns: Option<HostList>, pub ns: Option<HostList<'a>>,
/// The list of contacts to add to or remove from the domain /// The list of contacts to add to or remove from the domain
#[serde(rename = "domain:contact")] #[serde(rename = "domain:contact")]
pub contacts: Option<Vec<DomainContact>>, pub contacts: Option<Vec<DomainContact>>,
@ -72,31 +72,31 @@ pub struct DomainAddRemove {
/// Type for elements under the &lt;update&gt; tag for domain update /// Type for elements under the &lt;update&gt; tag for domain update
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct DomainUpdateRequestData { pub struct DomainUpdateRequestData<'a> {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
pub xmlns: &'static str, pub xmlns: &'a str,
/// The name of the domain to update /// The name of the domain to update
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
pub name: StringValue, pub name: StringValue<'a>,
/// `DomainAddRemove` Object containing the list of elements to be added /// `DomainAddRemove` Object containing the list of elements to be added
/// to the domain /// to the domain
#[serde(rename = "domain:add")] #[serde(rename = "domain:add")]
pub add: Option<DomainAddRemove>, pub add: Option<DomainAddRemove<'a>>,
/// `DomainAddRemove` Object containing the list of elements to be removed /// `DomainAddRemove` Object containing the list of elements to be removed
/// from the domain /// from the domain
#[serde(rename = "domain:rem")] #[serde(rename = "domain:rem")]
pub remove: Option<DomainAddRemove>, pub remove: Option<DomainAddRemove<'a>>,
/// The data under the &lt;chg&gt; tag for domain update /// The data under the &lt;chg&gt; tag for domain update
#[serde(rename = "domain:chg")] #[serde(rename = "domain:chg")]
pub change_info: Option<DomainChangeInfo>, pub change_info: Option<DomainChangeInfo<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;update&gt; command for domains /// Type for EPP XML &lt;update&gt; command for domains
pub struct DomainUpdate { pub struct DomainUpdate<'a> {
#[serde(rename = "domain:update")] #[serde(rename = "domain:update")]
pub domain: DomainUpdateRequestData, pub domain: DomainUpdateRequestData<'a>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -11,7 +11,7 @@ use crate::request::{Extension, Transaction};
pub const XMLNS: &str = "http://www.verisign.com/epp/sync-1.0"; pub const XMLNS: &str = "http://www.verisign.com/epp/sync-1.0";
impl Transaction<Update> for DomainUpdate {} impl<'a> Transaction<Update> for DomainUpdate<'a> {}
impl Extension for Update { impl Extension for Update {
type Response = NoExtension; type Response = NoExtension;
@ -84,7 +84,7 @@ pub struct UpdateData {
pub xmlns: &'static str, pub xmlns: &'static str,
/// The expiry date of the domain /// The expiry date of the domain
#[serde(rename = "sync:expMonthDay")] #[serde(rename = "sync:expMonthDay")]
pub exp: StringValue, pub exp: StringValue<'static>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -23,29 +23,29 @@ pub const XMLNS: &str = "http://www.verisign-grs.com/epp/namestoreExt-1.1";
// Contact // Contact
impl Transaction<NameStore> for ContactCheck {} impl<'a> Transaction<NameStore> for ContactCheck<'a> {}
impl Transaction<NameStore> for ContactCreate {} impl<'a> Transaction<NameStore> for ContactCreate<'a> {}
impl Transaction<NameStore> for ContactDelete {} impl<'a> Transaction<NameStore> for ContactDelete<'a> {}
impl Transaction<NameStore> for ContactInfo {} impl<'a> Transaction<NameStore> for ContactInfo<'a> {}
impl Transaction<NameStore> for ContactUpdate {} impl<'a> Transaction<NameStore> for ContactUpdate<'a> {}
// Domain // Domain
impl Transaction<NameStore> for DomainCheck {} impl<'a> Transaction<NameStore> for DomainCheck<'a> {}
impl Transaction<NameStore> for DomainCreate {} impl<'a> Transaction<NameStore> for DomainCreate<'a> {}
impl Transaction<NameStore> for DomainDelete {} impl<'a> Transaction<NameStore> for DomainDelete<'a> {}
impl Transaction<NameStore> for DomainInfo {} impl<'a> Transaction<NameStore> for DomainInfo<'a> {}
impl Transaction<NameStore> for DomainRenew {} impl<'a> Transaction<NameStore> for DomainRenew<'a> {}
impl Transaction<NameStore> for DomainTransfer {} impl<'a> Transaction<NameStore> for DomainTransfer<'a> {}
impl Transaction<NameStore> for DomainUpdate {} impl<'a> Transaction<NameStore> for DomainUpdate<'a> {}
// Host // Host
impl Transaction<NameStore> for HostCheck {} impl<'a> Transaction<NameStore> for HostCheck<'a> {}
impl Transaction<NameStore> for HostCreate {} impl<'a> Transaction<NameStore> for HostCreate<'a> {}
impl Transaction<NameStore> for HostDelete {} impl<'a> Transaction<NameStore> for HostDelete<'a> {}
impl Transaction<NameStore> for HostInfo {} impl<'a> Transaction<NameStore> for HostInfo<'a> {}
impl Transaction<NameStore> for HostUpdate {} impl<'a> Transaction<NameStore> for HostUpdate<'a> {}
impl NameStore { impl NameStore {
/// Create a new RGP restore report request /// Create a new RGP restore report request
@ -53,7 +53,7 @@ impl NameStore {
NameStore { NameStore {
data: NameStoreData { data: NameStoreData {
xmlns: XMLNS.to_string(), xmlns: XMLNS.to_string(),
subproduct: subproduct.into(), subproduct: subproduct.to_owned().into(),
}, },
} }
} }
@ -78,7 +78,7 @@ pub struct NameStoreData {
pub xmlns: String, pub xmlns: String,
/// The object holding the list of domains to be checked /// The object holding the list of domains to be checked
#[serde(rename = "namestoreExt:subProduct", alias = "subProduct")] #[serde(rename = "namestoreExt:subProduct", alias = "subProduct")]
pub subproduct: StringValue, pub subproduct: StringValue<'static>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -8,22 +8,22 @@ use serde::Serialize;
use super::{Update, XMLNS}; use super::{Update, XMLNS};
impl Transaction<Update<RgpRestoreReport>> for DomainUpdate {} impl<'a> Transaction<Update<RgpRestoreReport<'a>>> for DomainUpdate<'a> {}
impl RgpRestoreReport { impl<'a> RgpRestoreReport<'a> {
/// Create a new RGP restore report request /// Create a new RGP restore report request
pub fn new( pub fn new(
pre_data: &str, pre_data: &'a str,
post_data: &str, post_data: &'a str,
deleted_at: DateTime<Utc>, deleted_at: DateTime<Utc>,
restored_at: DateTime<Utc>, restored_at: DateTime<Utc>,
restore_reason: &str, restore_reason: &'a str,
statements: &[&str], statements: &[&'a str],
other: &str, other: &'a str,
) -> RgpRestoreReport { ) -> Self {
let statements = statements.iter().map(|&s| s.into()).collect(); let statements = statements.iter().map(|&s| s.into()).collect();
RgpRestoreReport { Self {
xmlns: XMLNS, xmlns: XMLNS,
restore: RgpRestoreReportSection { restore: RgpRestoreReportSection {
op: "report".to_string(), op: "report".to_string(),
@ -45,55 +45,55 @@ impl RgpRestoreReport {
} }
} }
impl Extension for Update<RgpRestoreReport> { impl<'a> Extension for Update<RgpRestoreReport<'a>> {
type Response = NoExtension; type Response = NoExtension;
} }
/// Type corresponding to the &lt;report&gt; section in the EPP rgp restore extension /// Type corresponding to the &lt;report&gt; section in the EPP rgp restore extension
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct RgpRestoreReportSectionData { pub struct RgpRestoreReportSectionData<'a> {
/// The pre-delete registration date /// The pre-delete registration date
#[serde(rename = "rgp:preData")] #[serde(rename = "rgp:preData")]
pre_data: StringValue, pre_data: StringValue<'a>,
/// The post-delete registration date /// The post-delete registration date
#[serde(rename = "rgp:postData")] #[serde(rename = "rgp:postData")]
post_data: StringValue, post_data: StringValue<'a>,
/// The domain deletion date /// The domain deletion date
#[serde(rename = "rgp:delTime")] #[serde(rename = "rgp:delTime")]
deleted_at: StringValue, deleted_at: StringValue<'a>,
/// The domain restore request date /// The domain restore request date
#[serde(rename = "rgp:resTime")] #[serde(rename = "rgp:resTime")]
restored_at: StringValue, restored_at: StringValue<'a>,
/// The reason for domain restoration /// The reason for domain restoration
#[serde(rename = "rgp:resReason")] #[serde(rename = "rgp:resReason")]
restore_reason: StringValue, restore_reason: StringValue<'a>,
/// The registrar's statements on the domain restoration /// The registrar's statements on the domain restoration
#[serde(rename = "rgp:statement")] #[serde(rename = "rgp:statement")]
statements: Vec<StringValue>, statements: Vec<StringValue<'a>>,
/// Other remarks for domain restoration /// Other remarks for domain restoration
#[serde(rename = "rgp:other")] #[serde(rename = "rgp:other")]
other: StringValue, other: StringValue<'a>,
} }
/// Type corresponding to the &lt;restore&gt; section in the rgp restore extension /// Type corresponding to the &lt;restore&gt; section in the rgp restore extension
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct RgpRestoreReportSection { pub struct RgpRestoreReportSection<'a> {
/// The value of the op attribute for the &lt;restore&gt; tag /// The value of the op attribute for the &lt;restore&gt; tag
op: String, op: String,
/// Data for the &lt;report&gt; tag /// Data for the &lt;report&gt; tag
#[serde(rename = "rgp:report")] #[serde(rename = "rgp:report")]
report: RgpRestoreReportSectionData, report: RgpRestoreReportSectionData<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;check&gt; command for domains /// Type for EPP XML &lt;check&gt; command for domains
pub struct RgpRestoreReport { pub struct RgpRestoreReport<'a> {
/// XML namespace for the RGP restore extension /// XML namespace for the RGP restore extension
#[serde(rename = "xmlns:rgp")] #[serde(rename = "xmlns:rgp")]
xmlns: &'static str, xmlns: &'a str,
/// The object holding the list of domains to be checked /// The object holding the list of domains to be checked
#[serde(rename = "rgp:restore")] #[serde(rename = "rgp:restore")]
restore: RgpRestoreReportSection, restore: RgpRestoreReportSection<'a>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -9,9 +9,9 @@ use serde::{Deserialize, Serialize};
use super::{Update, XMLNS}; use super::{Update, XMLNS};
impl Transaction<Update<RgpRestoreRequest>> for DomainUpdate {} impl<'a> Transaction<Update<RgpRestoreRequest>> for DomainUpdate<'a> {}
impl Transaction<Update<RgpRestoreRequest>> for DomainInfo {} impl<'a> Transaction<Update<RgpRestoreRequest>> for DomainInfo<'a> {}
impl Extension for Update<RgpRestoreRequest> { impl Extension for Update<RgpRestoreRequest> {
type Response = Update<RgpRequestResponse>; type Response = Update<RgpRequestResponse>;

View File

@ -33,22 +33,22 @@ impl EppXml for HelloDocument {}
/// Type for data within the <svcMenu> section of an EPP greeting /// Type for data within the <svcMenu> section of an EPP greeting
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub struct ServiceMenu { pub struct ServiceMenu {
pub options: Options, pub options: Options<'static>,
pub services: Services, pub services: Services<'static>,
} }
/// Simplified service menu type for deserialization to `ServiceMenu` type from EPP greeting XML /// Simplified service menu type for deserialization to `ServiceMenu` type from EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
struct FlattenedServiceMenu { struct FlattenedServiceMenu {
pub version: StringValue, pub version: StringValue<'static>,
pub lang: StringValue, pub lang: StringValue<'static>,
#[serde(rename = "objURI")] #[serde(rename = "objURI")]
pub obj_uris: Vec<StringValue>, pub obj_uris: Vec<StringValue<'static>>,
#[serde(rename = "svcExtension")] #[serde(rename = "svcExtension")]
pub svc_ext: Option<ServiceExtension>, pub svc_ext: Option<ServiceExtension<'static>>,
} }
impl<'de> Deserialize<'de> for ServiceMenu { impl<'a, 'de: 'a> Deserialize<'de> for ServiceMenu {
/// Deserializes the <svcMenu> data to the `ServiceMenu` type /// Deserializes the <svcMenu> data to the `ServiceMenu` type
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where
@ -238,14 +238,14 @@ pub struct Statement {
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Absolute { pub struct Absolute {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub absolute: StringValue, pub absolute: StringValue<'static>,
} }
/// Type corresponding to <relative> value in the EPP greeting XML /// Type corresponding to <relative> value in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Relative { pub struct Relative {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub relative: StringValue, pub relative: StringValue<'static>,
} }
/// Type corresponding to possible <expiry> type values /// Type corresponding to possible <expiry> type values

View File

@ -7,15 +7,15 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for HostCheck {} impl<'a> Transaction<NoExtension> for HostCheck<'a> {}
impl Command for HostCheck { impl<'a> Command for HostCheck<'a> {
type Response = HostCheckResponse; type Response = HostCheckResponse;
const COMMAND: &'static str = "check"; const COMMAND: &'static str = "check";
} }
impl HostCheck { impl<'a> HostCheck<'a> {
pub fn new(hosts: &[&str]) -> Self { pub fn new(hosts: &[&'a str]) -> Self {
let hosts = hosts.iter().map(|&d| d.into()).collect(); let hosts = hosts.iter().map(|&d| d.into()).collect();
Self { Self {
@ -31,21 +31,21 @@ impl HostCheck {
/// Type for data under the host &lt;check&gt; tag /// Type for data under the host &lt;check&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostList { pub struct HostList<'a> {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: &'static str, xmlns: &'a str,
/// List of hosts to be checked for availability /// List of hosts to be checked for availability
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
pub hosts: Vec<StringValue>, pub hosts: Vec<StringValue<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;check&gt; command for hosts /// Type for EPP XML &lt;check&gt; command for hosts
pub struct HostCheck { pub struct HostCheck<'a> {
/// The instance holding the list of hosts to be checked /// The instance holding the list of hosts to be checked
#[serde(rename = "host:check")] #[serde(rename = "host:check")]
list: HostList, list: HostList<'a>,
} }
// Response // Response
@ -55,7 +55,7 @@ pub struct HostCheck {
pub struct HostAvailable { pub struct HostAvailable {
/// The host name /// The host name
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub name: StringValue, pub name: StringValue<'static>,
/// The host (un)availability /// The host (un)availability
#[serde(rename = "avail")] #[serde(rename = "avail")]
pub available: u16, pub available: u16,
@ -68,7 +68,7 @@ pub struct HostCheckDataItem {
#[serde(rename = "name")] #[serde(rename = "name")]
pub host: HostAvailable, pub host: HostAvailable,
/// The reason for (un)availability /// The reason for (un)availability
pub reason: Option<StringValue>, pub reason: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;chkData&gt; tag for host check response /// Type that represents the &lt;chkData&gt; tag for host check response

View File

@ -5,15 +5,15 @@ use crate::common::{HostAddr, NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for HostCreate {} impl<'a> Transaction<NoExtension> for HostCreate<'a> {}
impl Command for HostCreate { impl<'a> Command for HostCreate<'a> {
type Response = HostCreateResponse; type Response = HostCreateResponse;
const COMMAND: &'static str = "create"; const COMMAND: &'static str = "create";
} }
impl HostCreate { impl<'a> HostCreate<'a> {
pub fn new(host: &str, addresses: Vec<HostAddr>) -> Self { pub fn new(host: &'a str, addresses: Vec<HostAddr>) -> Self {
Self { Self {
host: HostCreateRequestData { host: HostCreateRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -28,13 +28,13 @@ impl HostCreate {
/// Type for data under the host &lt;create&gt; tag /// Type for data under the host &lt;create&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostCreateRequestData { pub struct HostCreateRequestData<'a> {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: &'static str, xmlns: &'a str,
/// The name of the host to be created /// The name of the host to be created
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
pub name: StringValue, pub name: StringValue<'a>,
/// The list of IP addresses for the host /// The list of IP addresses for the host
#[serde(rename = "host:addr")] #[serde(rename = "host:addr")]
pub addresses: Option<Vec<HostAddr>>, pub addresses: Option<Vec<HostAddr>>,
@ -42,10 +42,10 @@ pub struct HostCreateRequestData {
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;create&gt; command for hosts /// Type for EPP XML &lt;create&gt; command for hosts
pub struct HostCreate { pub struct HostCreate<'a> {
/// The instance holding the data for the host to be created /// The instance holding the data for the host to be created
#[serde(rename = "host:create")] #[serde(rename = "host:create")]
host: HostCreateRequestData, host: HostCreateRequestData<'a>,
} }
// Response // Response
@ -54,10 +54,10 @@ pub struct HostCreate {
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct HostCreateData { pub struct HostCreateData {
/// The host name /// The host name
pub name: StringValue, pub name: StringValue<'static>,
/// The host creation date /// The host creation date
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
pub created_at: StringValue, pub created_at: StringValue<'static>,
} }
/// Type that represents the &lt;resData&gt; tag for host check response /// Type that represents the &lt;resData&gt; tag for host check response

View File

@ -5,15 +5,15 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::Serialize; use serde::Serialize;
impl Transaction<NoExtension> for HostDelete {} impl<'a> Transaction<NoExtension> for HostDelete<'a> {}
impl Command for HostDelete { impl<'a> Command for HostDelete<'a> {
type Response = (); type Response = ();
const COMMAND: &'static str = "delete"; const COMMAND: &'static str = "delete";
} }
impl HostDelete { impl<'a> HostDelete<'a> {
pub fn new(name: &str) -> Self { pub fn new(name: &'a str) -> Self {
Self { Self {
host: HostDeleteRequestData { host: HostDeleteRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -25,21 +25,21 @@ impl HostDelete {
/// Type for data under the host &lt;delete&gt; tag /// Type for data under the host &lt;delete&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostDeleteRequestData { pub struct HostDeleteRequestData<'a> {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: &'static str, xmlns: &'a str,
/// The host to be deleted /// The host to be deleted
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
name: StringValue, name: StringValue<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;delete&gt; command for hosts /// Type for EPP XML &lt;delete&gt; command for hosts
pub struct HostDelete { pub struct HostDelete<'a> {
/// The instance holding the data for the host to be deleted /// The instance holding the data for the host to be deleted
#[serde(rename = "host:delete")] #[serde(rename = "host:delete")]
host: HostDeleteRequestData, host: HostDeleteRequestData<'a>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -5,15 +5,15 @@ use crate::common::{HostAddr, NoExtension, ObjectStatus, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for HostInfo {} impl<'a> Transaction<NoExtension> for HostInfo<'a> {}
impl Command for HostInfo { impl<'a> Command for HostInfo<'a> {
type Response = HostInfoResponse; type Response = HostInfoResponse;
const COMMAND: &'static str = "info"; const COMMAND: &'static str = "info";
} }
impl HostInfo { impl<'a> HostInfo<'a> {
pub fn new(name: &str) -> Self { pub fn new(name: &'a str) -> Self {
Self { Self {
info: HostInfoRequestData { info: HostInfoRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -27,21 +27,21 @@ impl HostInfo {
/// Type for data under the host &lt;info&gt; tag /// Type for data under the host &lt;info&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostInfoRequestData { pub struct HostInfoRequestData<'a> {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: &'static str, xmlns: &'a str,
/// The name of the host to be queried /// The name of the host to be queried
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
name: StringValue, name: StringValue<'a>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;info&gt; command for hosts /// Type for EPP XML &lt;info&gt; command for hosts
pub struct HostInfo { pub struct HostInfo<'a> {
/// The instance holding the data for the host query /// The instance holding the data for the host query
#[serde(rename = "host:info")] #[serde(rename = "host:info")]
info: HostInfoRequestData, info: HostInfoRequestData<'a>,
} }
// Response // Response
@ -50,9 +50,9 @@ pub struct HostInfo {
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct HostInfoResponseData { pub struct HostInfoResponseData {
/// The host name /// The host name
pub name: StringValue, pub name: StringValue<'static>,
/// The host ROID /// The host ROID
pub roid: StringValue, pub roid: StringValue<'static>,
/// The list of host statuses /// The list of host statuses
#[serde(rename = "status")] #[serde(rename = "status")]
pub statuses: Vec<ObjectStatus>, pub statuses: Vec<ObjectStatus>,
@ -61,22 +61,22 @@ pub struct HostInfoResponseData {
pub addresses: Vec<HostAddr>, pub addresses: Vec<HostAddr>,
/// The epp user to whom the host belongs /// The epp user to whom the host belongs
#[serde(rename = "clID")] #[serde(rename = "clID")]
pub client_id: StringValue, pub client_id: StringValue<'static>,
/// THe epp user that created the host /// THe epp user that created the host
#[serde(rename = "crID")] #[serde(rename = "crID")]
pub creator_id: StringValue, pub creator_id: StringValue<'static>,
/// The host creation date /// The host creation date
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
pub created_at: StringValue, pub created_at: StringValue<'static>,
/// The epp user that last updated the host /// The epp user that last updated the host
#[serde(rename = "upID")] #[serde(rename = "upID")]
pub updater_id: Option<StringValue>, pub updater_id: Option<StringValue<'static>>,
/// The host last update date /// The host last update date
#[serde(rename = "upDate")] #[serde(rename = "upDate")]
pub updated_at: Option<StringValue>, pub updated_at: Option<StringValue<'static>>,
/// The host transfer date /// The host transfer date
#[serde(rename = "trDate")] #[serde(rename = "trDate")]
pub transferred_at: Option<StringValue>, pub transferred_at: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;resData&gt; tag for host info response /// Type that represents the &lt;resData&gt; tag for host info response

View File

@ -5,15 +5,15 @@ use crate::common::{HostAddr, NoExtension, ObjectStatus, StringValue};
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::Serialize; use serde::Serialize;
impl Transaction<NoExtension> for HostUpdate {} impl<'a> Transaction<NoExtension> for HostUpdate<'a> {}
impl Command for HostUpdate { impl<'a> Command for HostUpdate<'a> {
type Response = (); type Response = ();
const COMMAND: &'static str = "update"; const COMMAND: &'static str = "update";
} }
impl HostUpdate { impl<'a> HostUpdate<'a> {
pub fn new(name: &str) -> Self { pub fn new(name: &'a str) -> Self {
Self { Self {
host: HostUpdateRequestData { host: HostUpdateRequestData {
xmlns: XMLNS, xmlns: XMLNS,
@ -26,7 +26,7 @@ impl HostUpdate {
} }
/// Sets the data for the &lt;chg&gt; element of the host update /// Sets the data for the &lt;chg&gt; element of the host update
pub fn info(&mut self, info: HostChangeInfo) { pub fn info(&mut self, info: HostChangeInfo<'a>) {
self.host.change_info = Some(info); self.host.change_info = Some(info);
} }
@ -43,10 +43,10 @@ impl HostUpdate {
/// Type for data under the &lt;chg&gt; tag /// Type for data under the &lt;chg&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostChangeInfo { pub struct HostChangeInfo<'a> {
/// The new name for the host /// The new name for the host
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
pub name: StringValue, pub name: StringValue<'a>,
} }
/// Type for data under the &lt;add&gt; and &lt;rem&gt; tags /// Type for data under the &lt;add&gt; and &lt;rem&gt; tags
@ -62,13 +62,13 @@ pub struct HostAddRemove {
/// Type for data under the host &lt;update&gt; tag /// Type for data under the host &lt;update&gt; tag
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostUpdateRequestData { pub struct HostUpdateRequestData<'a> {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: &'static str, xmlns: &'a str,
/// The name of the host /// The name of the host
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
name: StringValue, name: StringValue<'a>,
/// The IP addresses and statuses to be added to the host /// The IP addresses and statuses to be added to the host
#[serde(rename = "host:add")] #[serde(rename = "host:add")]
add: Option<HostAddRemove>, add: Option<HostAddRemove>,
@ -77,15 +77,15 @@ pub struct HostUpdateRequestData {
remove: Option<HostAddRemove>, remove: Option<HostAddRemove>,
/// The host details that need to be updated /// The host details that need to be updated
#[serde(rename = "host:chg")] #[serde(rename = "host:chg")]
change_info: Option<HostChangeInfo>, change_info: Option<HostChangeInfo<'a>>,
} }
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;update&gt; command for hosts /// Type for EPP XML &lt;update&gt; command for hosts
pub struct HostUpdate { pub struct HostUpdate<'a> {
/// The instance holding the data for the host to be updated /// The instance holding the data for the host to be updated
#[serde(rename = "host:update")] #[serde(rename = "host:update")]
host: HostUpdateRequestData, host: HostUpdateRequestData<'a>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -8,27 +8,27 @@ use crate::{
request::{Command, Transaction, EPP_LANG, EPP_VERSION}, request::{Command, Transaction, EPP_LANG, EPP_VERSION},
}; };
impl Transaction<NoExtension> for Login {} impl<'a> Transaction<NoExtension> for Login<'a> {}
#[derive(Serialize, Debug, PartialEq)] #[derive(Serialize, Debug, PartialEq)]
/// Type corresponding to the &lt;login&gt; tag in an EPP XML login request /// Type corresponding to the &lt;login&gt; tag in an EPP XML login request
pub struct Login { pub struct Login<'a> {
/// The username to use for the login /// The username to use for the login
#[serde(rename(serialize = "clID", deserialize = "clID"))] #[serde(rename(serialize = "clID", deserialize = "clID"))]
username: StringValue, username: StringValue<'a>,
/// The password to use for the login /// The password to use for the login
#[serde(rename = "pw", default)] #[serde(rename = "pw", default)]
password: StringValue, password: StringValue<'a>,
/// Data under the <options> tag /// Data under the <options> tag
options: Options, options: Options<'a>,
/// Data under the <svcs> tag /// Data under the <svcs> tag
#[serde(rename = "svcs")] #[serde(rename = "svcs")]
services: Services, services: Services<'a>,
} }
impl Login { impl<'a> Login<'a> {
pub fn new(username: &str, password: &str, ext_uris: Option<Vec<String>>) -> Self { pub fn new(username: &'a str, password: &'a str, ext_uris: Option<Vec<&'a str>>) -> Self {
let ext_uris = ext_uris.map(|uris| uris.iter().map(|u| u.as_str().into()).collect()); let ext_uris = ext_uris.map(|uris| uris.into_iter().map(|u| u.into()).collect());
Self { Self {
username: username.into(), username: username.into(),
@ -49,17 +49,17 @@ impl Login {
} }
/// Sets the <options> tag data /// Sets the <options> tag data
pub fn options(&mut self, options: Options) { pub fn options(&mut self, options: Options<'a>) {
self.options = options; self.options = options;
} }
/// Sets the <svcs> tag data /// Sets the <svcs> tag data
pub fn services(&mut self, services: Services) { pub fn services(&mut self, services: Services<'a>) {
self.services = services; self.services = services;
} }
} }
impl Command for Login { impl<'a> Command for Login<'a> {
type Response = (); type Response = ();
const COMMAND: &'static str = "login"; const COMMAND: &'static str = "login";
} }
@ -72,9 +72,7 @@ mod tests {
#[test] #[test]
fn command() { fn command() {
let ext_uris = Some(vec![ let ext_uris = Some(vec!["http://schema.ispapi.net/epp/xml/keyvalue-1.0"]);
"http://schema.ispapi.net/epp/xml/keyvalue-1.0".to_string()
]);
let xml = get_xml("request/login.xml").unwrap(); let xml = get_xml("request/login.xml").unwrap();
let object = Login::new("username", "password", ext_uris); let object = Login::new("username", "password", ext_uris);

View File

@ -34,25 +34,25 @@ impl Default for MessagePoll {
pub struct MessageDomainTransferData { pub struct MessageDomainTransferData {
/// The name of the domain under transfer /// The name of the domain under transfer
#[serde(rename = "domain:name", alias = "name")] #[serde(rename = "domain:name", alias = "name")]
pub name: StringValue, pub name: StringValue<'static>,
/// The domain transfer status /// The domain transfer status
#[serde(rename = "domain:trStatus", alias = "trStatus")] #[serde(rename = "domain:trStatus", alias = "trStatus")]
pub transfer_status: StringValue, pub transfer_status: StringValue<'static>,
/// The epp user who requested the transfer /// The epp user who requested the transfer
#[serde(rename = "domain:reID", alias = "reID")] #[serde(rename = "domain:reID", alias = "reID")]
pub requester_id: StringValue, pub requester_id: StringValue<'static>,
/// The date of the transfer request /// The date of the transfer request
#[serde(rename = "domain:reDate", alias = "reDate")] #[serde(rename = "domain:reDate", alias = "reDate")]
pub requested_at: StringValue, pub requested_at: StringValue<'static>,
/// The epp user who should acknowledge the transfer request /// The epp user who should acknowledge the transfer request
#[serde(rename = "domain:acID", alias = "acID")] #[serde(rename = "domain:acID", alias = "acID")]
pub ack_id: StringValue, pub ack_id: StringValue<'static>,
/// The date by which the transfer request should be acknowledged /// The date by which the transfer request should be acknowledged
#[serde(rename = "domain:acDate", alias = "acDate")] #[serde(rename = "domain:acDate", alias = "acDate")]
pub ack_by: StringValue, pub ack_by: StringValue<'static>,
/// The domain expiry date /// The domain expiry date
#[serde(rename = "domain:exDate", alias = "exDate")] #[serde(rename = "domain:exDate", alias = "exDate")]
pub expiring_at: Option<StringValue>, pub expiring_at: Option<StringValue<'static>>,
} }
/// Type that represents the &lt;resData&gt; tag for message poll response /// Type that represents the &lt;resData&gt; tag for message poll response

View File

@ -60,7 +60,7 @@ pub struct CommandWrapper<'a, D, E> {
pub data: &'a D, pub data: &'a D,
/// The client TRID /// The client TRID
pub extension: Option<&'a E>, pub extension: Option<&'a E>,
pub client_tr_id: StringValue, pub client_tr_id: StringValue<'a>,
} }
impl<'a, D: Serialize, E: Serialize> Serialize for CommandWrapper<'a, D, E> { impl<'a, D: Serialize, E: Serialize> Serialize for CommandWrapper<'a, D, E> {

View File

@ -26,7 +26,7 @@ pub struct ExtValue {
/// Data under the <value> tag /// Data under the <value> tag
pub value: ResultValue, pub value: ResultValue,
/// Data under the <reason> tag /// Data under the <reason> tag
pub reason: StringValue, pub reason: StringValue<'static>,
} }
/// Type corresponding to the <result> tag in an EPP response XML /// Type corresponding to the <result> tag in an EPP response XML
@ -36,7 +36,7 @@ pub struct EppResult {
pub code: u16, pub code: u16,
/// The result message /// The result message
#[serde(rename = "msg")] #[serde(rename = "msg")]
pub message: StringValue, pub message: StringValue<'static>,
/// Data under the <extValue> tag /// Data under the <extValue> tag
#[serde(rename = "extValue")] #[serde(rename = "extValue")]
pub ext_value: Option<ExtValue>, pub ext_value: Option<ExtValue>,
@ -47,10 +47,10 @@ pub struct EppResult {
pub struct ResponseTRID { pub struct ResponseTRID {
/// The client TRID /// The client TRID
#[serde(rename = "clTRID")] #[serde(rename = "clTRID")]
pub client_tr_id: Option<StringValue>, pub client_tr_id: Option<StringValue<'static>>,
/// The server TRID /// The server TRID
#[serde(rename = "svTRID")] #[serde(rename = "svTRID")]
pub server_tr_id: StringValue, pub server_tr_id: StringValue<'static>,
} }
/// Type corresponding to the <msgQ> tag in an EPP response XML /// Type corresponding to the <msgQ> tag in an EPP response XML
@ -62,10 +62,10 @@ pub struct MessageQueue {
pub id: String, pub id: String,
/// The message date /// The message date
#[serde(rename = "qDate")] #[serde(rename = "qDate")]
pub date: Option<StringValue>, pub date: Option<StringValue<'static>>,
/// The message text /// The message text
#[serde(rename = "msg")] #[serde(rename = "msg")]
pub message: Option<StringValue>, pub message: Option<StringValue<'static>>,
} }
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]