Refactor Hello/Greeting into hello.rs
This commit is contained in:
parent
5a480317e5
commit
76f2ca5b16
|
@ -52,9 +52,10 @@ use std::{error::Error, fmt::Debug};
|
||||||
use crate::config::EppClientConfig;
|
use crate::config::EppClientConfig;
|
||||||
use crate::connection::registry::{epp_connect, EppConnection};
|
use crate::connection::registry::{epp_connect, EppConnection};
|
||||||
use crate::error;
|
use crate::error;
|
||||||
use crate::request::{generate_client_tr_id, EppHello, EppLogin, EppLogout};
|
use crate::hello::{EppGreeting, EppHello};
|
||||||
|
use crate::request::{generate_client_tr_id, EppLogin, EppLogout};
|
||||||
use crate::response::{
|
use crate::response::{
|
||||||
EppCommandResponse, EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
EppCommandResponse, EppCommandResponseError, EppLoginResponse, EppLogoutResponse,
|
||||||
};
|
};
|
||||||
use crate::xml::EppXml;
|
use crate::xml::EppXml;
|
||||||
/// Instances of the EppClient type are used to transact with the registry.
|
/// Instances of the EppClient type are used to transact with the registry.
|
||||||
|
|
|
@ -0,0 +1,299 @@
|
||||||
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
use epp_client_macros::ElementName;
|
||||||
|
use serde::{Deserialize, Deserializer, Serialize};
|
||||||
|
|
||||||
|
use crate::common::{ElementName, EppObject, Options, ServiceExtension, Services, StringValue};
|
||||||
|
|
||||||
|
/// The EPP Hello request
|
||||||
|
pub type EppHello = EppObject<Hello>;
|
||||||
|
|
||||||
|
impl EppHello {
|
||||||
|
/// Creates a new Epp Hello request
|
||||||
|
pub fn new() -> EppHello {
|
||||||
|
EppObject::build(Hello {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for EppHello {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The EPP Greeting that is received on a successful connection and in response to an EPP hello
|
||||||
|
pub type EppGreeting = EppObject<Greeting>;
|
||||||
|
|
||||||
|
// Request
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
|
||||||
|
#[element_name(name = "hello")]
|
||||||
|
/// Type corresponding to the <hello> tag in an EPP XML hello request
|
||||||
|
pub struct Hello;
|
||||||
|
|
||||||
|
// Response
|
||||||
|
|
||||||
|
/// Type for data within the <svcMenu> section of an EPP greeting
|
||||||
|
#[derive(Serialize, Debug, PartialEq)]
|
||||||
|
pub struct ServiceMenu {
|
||||||
|
pub options: Options,
|
||||||
|
pub services: Services,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Simplified service menu type for deserialization to `ServiceMenu` type from EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
struct FlattenedServiceMenu {
|
||||||
|
pub version: StringValue,
|
||||||
|
pub lang: StringValue,
|
||||||
|
#[serde(rename = "objURI")]
|
||||||
|
pub obj_uris: Vec<StringValue>,
|
||||||
|
#[serde(rename = "svcExtension")]
|
||||||
|
pub svc_ext: Option<ServiceExtension>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de> Deserialize<'de> for ServiceMenu {
|
||||||
|
/// Deserializes the <svcMenu> data to the `ServiceMenu` type
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
let flattened_svc_menu = FlattenedServiceMenu::deserialize(deserializer)?;
|
||||||
|
|
||||||
|
let svc_menu = ServiceMenu {
|
||||||
|
options: Options {
|
||||||
|
version: flattened_svc_menu.version,
|
||||||
|
lang: flattened_svc_menu.lang,
|
||||||
|
},
|
||||||
|
services: Services {
|
||||||
|
obj_uris: flattened_svc_menu.obj_uris,
|
||||||
|
svc_ext: flattened_svc_menu.svc_ext,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(svc_menu)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <all> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct All;
|
||||||
|
|
||||||
|
/// Type corresponding to <none> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct NoAccess;
|
||||||
|
|
||||||
|
/// Type corresponding to <null> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Null;
|
||||||
|
|
||||||
|
/// Type corresponding to <personal> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Personal;
|
||||||
|
|
||||||
|
/// Type corresponding to <personalAndOther> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct PersonalAndOther;
|
||||||
|
|
||||||
|
/// Type corresponding to <other> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Other;
|
||||||
|
|
||||||
|
/// Type corresponding to possible <retention> type values
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub enum AccessType {
|
||||||
|
/// Data for the <all> tag
|
||||||
|
#[serde(rename = "all")]
|
||||||
|
All(All),
|
||||||
|
/// Data for the <none> tag
|
||||||
|
#[serde(rename = "none")]
|
||||||
|
NoAccess(NoAccess),
|
||||||
|
/// Data for the <null> tag
|
||||||
|
#[serde(rename = "null")]
|
||||||
|
Null(Null),
|
||||||
|
/// Data for the <personal> tag
|
||||||
|
#[serde(rename = "personal")]
|
||||||
|
Personal(Personal),
|
||||||
|
/// Data for the <personalAndOther> tag
|
||||||
|
#[serde(rename = "personalAndOther")]
|
||||||
|
PersonalAndOther(PersonalAndOther),
|
||||||
|
/// Data for the <other> tag
|
||||||
|
#[serde(rename = "other")]
|
||||||
|
Other(Other),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <access> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Access {
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub ty: AccessType,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to possible <purpose> type values
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub enum PurposeType {
|
||||||
|
/// Data for the <admin> tag
|
||||||
|
#[serde(rename = "admin")]
|
||||||
|
Admin,
|
||||||
|
/// Data for the <contact> tag
|
||||||
|
#[serde(rename = "contact")]
|
||||||
|
Contact,
|
||||||
|
/// Data for the <prov> tag
|
||||||
|
#[serde(rename = "prov")]
|
||||||
|
Prov,
|
||||||
|
/// Data for the <other> tag
|
||||||
|
#[serde(rename = "other")]
|
||||||
|
OtherPurpose,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <purpose> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Purpose {
|
||||||
|
#[serde(rename = "$value")]
|
||||||
|
pub purpose: Vec<PurposeType>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to possible <purpose> type values
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub enum RecipientType {
|
||||||
|
/// Data for the <other> tag
|
||||||
|
#[serde(rename = "other")]
|
||||||
|
Other,
|
||||||
|
/// Data for the <ours> tag
|
||||||
|
#[serde(rename = "ours")]
|
||||||
|
Ours,
|
||||||
|
/// Data for the <public> tag
|
||||||
|
#[serde(rename = "public")]
|
||||||
|
Public,
|
||||||
|
/// Data for the <same> tag
|
||||||
|
#[serde(rename = "same")]
|
||||||
|
Same,
|
||||||
|
/// Data for the <unrelated> tag
|
||||||
|
#[serde(rename = "unrelated")]
|
||||||
|
Unrelated,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <recipeint> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Recipient {
|
||||||
|
#[serde(rename = "$value")]
|
||||||
|
pub recipient: Vec<RecipientType>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <business> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Business;
|
||||||
|
|
||||||
|
/// Type corresponding to <indefinite> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Indefinite;
|
||||||
|
|
||||||
|
/// Type corresponding to <legal> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Legal;
|
||||||
|
|
||||||
|
/// Type corresponding to <none> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct No;
|
||||||
|
|
||||||
|
/// Type corresponding to <stated> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Stated;
|
||||||
|
|
||||||
|
/// Type corresponding to possible <retention> type values
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub enum RetentionType {
|
||||||
|
/// Data for the <business> tag
|
||||||
|
#[serde(rename = "business")]
|
||||||
|
Business(Business),
|
||||||
|
/// Data for the <indefinite> tag
|
||||||
|
#[serde(rename = "indefinite")]
|
||||||
|
Indefinite(Indefinite),
|
||||||
|
/// Data for the <legal> tag
|
||||||
|
#[serde(rename = "legal")]
|
||||||
|
Legal(Legal),
|
||||||
|
/// Data for the <none> tag
|
||||||
|
#[serde(rename = "none")]
|
||||||
|
No(No),
|
||||||
|
/// Data for the <stated> tag
|
||||||
|
#[serde(rename = "stated")]
|
||||||
|
Stated(Stated),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <retention> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Retention {
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub ty: RetentionType,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation)
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Statement {
|
||||||
|
/// Data for the <purpose> tag
|
||||||
|
pub purpose: Purpose,
|
||||||
|
/// Data for the <recipient> tag
|
||||||
|
pub recipient: Recipient,
|
||||||
|
/// Data for the <retention> tag
|
||||||
|
pub retention: Retention,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <absolute> value in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Absolute {
|
||||||
|
#[serde(rename = "$value")]
|
||||||
|
pub absolute: StringValue,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <relative> value in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Relative {
|
||||||
|
#[serde(rename = "$value")]
|
||||||
|
pub relative: StringValue,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to possible <expiry> type values
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub enum ExpiryType {
|
||||||
|
/// Data for the <absolute> tag
|
||||||
|
#[serde(rename = "absolute")]
|
||||||
|
Absolute(Absolute),
|
||||||
|
/// Data for the <relative> tag
|
||||||
|
#[serde(rename = "relative")]
|
||||||
|
Relative(Relative),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <expiry> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Expiry {
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub ty: ExpiryType,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type corresponding to <dcp> in the EPP greeting XML
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
|
pub struct Dcp {
|
||||||
|
/// Data for the <access> tag
|
||||||
|
pub access: Access,
|
||||||
|
/// Data for the <statement> tags
|
||||||
|
pub statement: Vec<Statement>,
|
||||||
|
/// Data for the <expiry> tag
|
||||||
|
pub expiry: Option<Expiry>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
|
||||||
|
#[serde(rename_all = "lowercase")]
|
||||||
|
#[element_name(name = "greeting")]
|
||||||
|
/// Type corresponding to the <greeting> tag in the EPP greeting XML
|
||||||
|
pub struct Greeting {
|
||||||
|
/// The service ID
|
||||||
|
#[serde(rename = "svID")]
|
||||||
|
pub service_id: String,
|
||||||
|
/// The date from the EPP server
|
||||||
|
#[serde(rename = "svDate")]
|
||||||
|
pub service_date: String,
|
||||||
|
/// Data under the <svcMenu> element
|
||||||
|
#[serde(rename = "svcMenu")]
|
||||||
|
pub svc_menu: ServiceMenu,
|
||||||
|
/// Data under the <dcp> element
|
||||||
|
pub dcp: Dcp,
|
||||||
|
}
|
|
@ -106,6 +106,7 @@ pub mod connection;
|
||||||
pub mod contact;
|
pub mod contact;
|
||||||
pub mod domain;
|
pub mod domain;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
pub mod hello;
|
||||||
pub mod host;
|
pub mod host;
|
||||||
pub mod message;
|
pub mod message;
|
||||||
pub mod request;
|
pub mod request;
|
||||||
|
|
|
@ -22,8 +22,6 @@ pub const EPP_LANG: &str = "en";
|
||||||
/// without an <extension> tag
|
/// without an <extension> tag
|
||||||
pub type Command<T> = CommandWithExtension<T, EmptyTag>;
|
pub type Command<T> = CommandWithExtension<T, EmptyTag>;
|
||||||
|
|
||||||
/// The EPP Hello request
|
|
||||||
pub type EppHello = EppObject<Hello>;
|
|
||||||
/// The EPP Login Request
|
/// The EPP Login Request
|
||||||
pub type EppLogin = EppObject<Command<Login>>;
|
pub type EppLogin = EppObject<Command<Login>>;
|
||||||
/// The EPP Logout request
|
/// The EPP Logout request
|
||||||
|
@ -86,24 +84,6 @@ pub fn generate_client_tr_id(username: &str) -> Result<String, Box<dyn Error>> {
|
||||||
Ok(format!("{}:{}", username, timestamp.as_secs()))
|
Ok(format!("{}:{}", username, timestamp.as_secs()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
|
|
||||||
#[element_name(name = "hello")]
|
|
||||||
/// Type corresponding to the <hello> tag in an EPP XML hello request
|
|
||||||
pub struct Hello;
|
|
||||||
|
|
||||||
impl EppHello {
|
|
||||||
/// Creates a new Epp Hello request
|
|
||||||
pub fn new() -> EppHello {
|
|
||||||
EppObject::build(Hello {})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for EppHello {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
|
||||||
#[element_name(name = "login")]
|
#[element_name(name = "login")]
|
||||||
/// Type corresponding to the <login> tag in an EPP XML login request
|
/// Type corresponding to the <login> tag in an EPP XML login request
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
//! Types for EPP responses
|
//! Types for EPP responses
|
||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
use serde::{Deserialize, Deserializer, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use crate::common::{
|
use crate::common::{ElementName, EmptyTag, EppObject, Extension, StringValue};
|
||||||
ElementName, EmptyTag, EppObject, Extension, Options, ServiceExtension, Services, StringValue,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Type corresponding to the <response> tag in an EPP response without an <extension> section
|
/// Type corresponding to the <response> tag in an EPP response without an <extension> section
|
||||||
pub type CommandResponse<T> = CommandResponseWithExtension<T, EmptyTag>;
|
pub type CommandResponse<T> = CommandResponseWithExtension<T, EmptyTag>;
|
||||||
|
|
||||||
/// The EPP Greeting that is received on a successful connection and in response to an EPP hello
|
|
||||||
pub type EppGreeting = EppObject<Greeting>;
|
|
||||||
/// A generic EPP Response to an EPP command with a result section, a status code and a message
|
/// A generic EPP Response to an EPP command with a result section, a status code and a message
|
||||||
pub type EppCommandResponse = EppObject<CommandResponseStatus>;
|
pub type EppCommandResponse = EppObject<CommandResponseStatus>;
|
||||||
/// An alias of `EppCommandResponse` indicating an EPP Error
|
/// An alias of `EppCommandResponse` indicating an EPP Error
|
||||||
|
@ -22,271 +18,6 @@ pub type EppLoginResponse = EppCommandResponse;
|
||||||
/// An alias of `EppCommandResponse` received in response to a successful logout request
|
/// An alias of `EppCommandResponse` received in response to a successful logout request
|
||||||
pub type EppLogoutResponse = EppCommandResponse;
|
pub type EppLogoutResponse = EppCommandResponse;
|
||||||
|
|
||||||
/// Type for data within the <svcMenu> section of an EPP greeting
|
|
||||||
#[derive(Serialize, Debug, PartialEq)]
|
|
||||||
pub struct ServiceMenu {
|
|
||||||
pub options: Options,
|
|
||||||
pub services: Services,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Simplified service menu type for deserialization to `ServiceMenu` type from EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
struct FlattenedServiceMenu {
|
|
||||||
pub version: StringValue,
|
|
||||||
pub lang: StringValue,
|
|
||||||
#[serde(rename = "objURI")]
|
|
||||||
pub obj_uris: Vec<StringValue>,
|
|
||||||
#[serde(rename = "svcExtension")]
|
|
||||||
pub svc_ext: Option<ServiceExtension>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for ServiceMenu {
|
|
||||||
/// Deserializes the <svcMenu> data to the `ServiceMenu` type
|
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
||||||
where
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
let flattened_svc_menu = FlattenedServiceMenu::deserialize(deserializer)?;
|
|
||||||
|
|
||||||
let svc_menu = ServiceMenu {
|
|
||||||
options: Options {
|
|
||||||
version: flattened_svc_menu.version,
|
|
||||||
lang: flattened_svc_menu.lang,
|
|
||||||
},
|
|
||||||
services: Services {
|
|
||||||
obj_uris: flattened_svc_menu.obj_uris,
|
|
||||||
svc_ext: flattened_svc_menu.svc_ext,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(svc_menu)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <all> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct All;
|
|
||||||
|
|
||||||
/// Type corresponding to <none> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct NoAccess;
|
|
||||||
|
|
||||||
/// Type corresponding to <null> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Null;
|
|
||||||
|
|
||||||
/// Type corresponding to <personal> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Personal;
|
|
||||||
|
|
||||||
/// Type corresponding to <personalAndOther> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct PersonalAndOther;
|
|
||||||
|
|
||||||
/// Type corresponding to <other> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Other;
|
|
||||||
|
|
||||||
/// Type corresponding to possible <retention> type values
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub enum AccessType {
|
|
||||||
/// Data for the <all> tag
|
|
||||||
#[serde(rename = "all")]
|
|
||||||
All(All),
|
|
||||||
/// Data for the <none> tag
|
|
||||||
#[serde(rename = "none")]
|
|
||||||
NoAccess(NoAccess),
|
|
||||||
/// Data for the <null> tag
|
|
||||||
#[serde(rename = "null")]
|
|
||||||
Null(Null),
|
|
||||||
/// Data for the <personal> tag
|
|
||||||
#[serde(rename = "personal")]
|
|
||||||
Personal(Personal),
|
|
||||||
/// Data for the <personalAndOther> tag
|
|
||||||
#[serde(rename = "personalAndOther")]
|
|
||||||
PersonalAndOther(PersonalAndOther),
|
|
||||||
/// Data for the <other> tag
|
|
||||||
#[serde(rename = "other")]
|
|
||||||
Other(Other),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <access> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Access {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ty: AccessType,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to possible <purpose> type values
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub enum PurposeType {
|
|
||||||
/// Data for the <admin> tag
|
|
||||||
#[serde(rename = "admin")]
|
|
||||||
Admin,
|
|
||||||
/// Data for the <contact> tag
|
|
||||||
#[serde(rename = "contact")]
|
|
||||||
Contact,
|
|
||||||
/// Data for the <prov> tag
|
|
||||||
#[serde(rename = "prov")]
|
|
||||||
Prov,
|
|
||||||
/// Data for the <other> tag
|
|
||||||
#[serde(rename = "other")]
|
|
||||||
OtherPurpose,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <purpose> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Purpose {
|
|
||||||
#[serde(rename = "$value")]
|
|
||||||
pub purpose: Vec<PurposeType>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to possible <purpose> type values
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub enum RecipientType {
|
|
||||||
/// Data for the <other> tag
|
|
||||||
#[serde(rename = "other")]
|
|
||||||
Other,
|
|
||||||
/// Data for the <ours> tag
|
|
||||||
#[serde(rename = "ours")]
|
|
||||||
Ours,
|
|
||||||
/// Data for the <public> tag
|
|
||||||
#[serde(rename = "public")]
|
|
||||||
Public,
|
|
||||||
/// Data for the <same> tag
|
|
||||||
#[serde(rename = "same")]
|
|
||||||
Same,
|
|
||||||
/// Data for the <unrelated> tag
|
|
||||||
#[serde(rename = "unrelated")]
|
|
||||||
Unrelated,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <recipeint> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Recipient {
|
|
||||||
#[serde(rename = "$value")]
|
|
||||||
pub recipient: Vec<RecipientType>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <business> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Business;
|
|
||||||
|
|
||||||
/// Type corresponding to <indefinite> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Indefinite;
|
|
||||||
|
|
||||||
/// Type corresponding to <legal> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Legal;
|
|
||||||
|
|
||||||
/// Type corresponding to <none> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct No;
|
|
||||||
|
|
||||||
/// Type corresponding to <stated> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Stated;
|
|
||||||
|
|
||||||
/// Type corresponding to possible <retention> type values
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub enum RetentionType {
|
|
||||||
/// Data for the <business> tag
|
|
||||||
#[serde(rename = "business")]
|
|
||||||
Business(Business),
|
|
||||||
/// Data for the <indefinite> tag
|
|
||||||
#[serde(rename = "indefinite")]
|
|
||||||
Indefinite(Indefinite),
|
|
||||||
/// Data for the <legal> tag
|
|
||||||
#[serde(rename = "legal")]
|
|
||||||
Legal(Legal),
|
|
||||||
/// Data for the <none> tag
|
|
||||||
#[serde(rename = "none")]
|
|
||||||
No(No),
|
|
||||||
/// Data for the <stated> tag
|
|
||||||
#[serde(rename = "stated")]
|
|
||||||
Stated(Stated),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <retention> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Retention {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ty: RetentionType,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation)
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Statement {
|
|
||||||
/// Data for the <purpose> tag
|
|
||||||
pub purpose: Purpose,
|
|
||||||
/// Data for the <recipient> tag
|
|
||||||
pub recipient: Recipient,
|
|
||||||
/// Data for the <retention> tag
|
|
||||||
pub retention: Retention,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <absolute> value in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Absolute {
|
|
||||||
#[serde(rename = "$value")]
|
|
||||||
pub absolute: StringValue,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <relative> value in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Relative {
|
|
||||||
#[serde(rename = "$value")]
|
|
||||||
pub relative: StringValue,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to possible <expiry> type values
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub enum ExpiryType {
|
|
||||||
/// Data for the <absolute> tag
|
|
||||||
#[serde(rename = "absolute")]
|
|
||||||
Absolute(Absolute),
|
|
||||||
/// Data for the <relative> tag
|
|
||||||
#[serde(rename = "relative")]
|
|
||||||
Relative(Relative),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <expiry> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Expiry {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub ty: ExpiryType,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to <dcp> in the EPP greeting XML
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
pub struct Dcp {
|
|
||||||
/// Data for the <access> tag
|
|
||||||
pub access: Access,
|
|
||||||
/// Data for the <statement> tags
|
|
||||||
pub statement: Vec<Statement>,
|
|
||||||
/// Data for the <expiry> tag
|
|
||||||
pub expiry: Option<Expiry>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
|
|
||||||
#[serde(rename_all = "lowercase")]
|
|
||||||
#[element_name(name = "greeting")]
|
|
||||||
/// Type corresponding to the <greeting> tag in the EPP greeting XML
|
|
||||||
pub struct Greeting {
|
|
||||||
/// The service ID
|
|
||||||
#[serde(rename = "svID")]
|
|
||||||
pub service_id: String,
|
|
||||||
/// The date from the EPP server
|
|
||||||
#[serde(rename = "svDate")]
|
|
||||||
pub service_date: String,
|
|
||||||
/// Data under the <svcMenu> element
|
|
||||||
#[serde(rename = "svcMenu")]
|
|
||||||
pub svc_menu: ServiceMenu,
|
|
||||||
/// Data under the <dcp> element
|
|
||||||
pub dcp: Dcp,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Type corresponding to the <undef> tag an EPP response XML
|
/// Type corresponding to the <undef> tag an EPP response XML
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||||
pub struct Undef;
|
pub struct Undef;
|
||||||
|
|
|
@ -20,6 +20,9 @@ mod response {
|
||||||
use crate::domain::transfer::EppDomainTransferRejectResponse;
|
use crate::domain::transfer::EppDomainTransferRejectResponse;
|
||||||
use crate::domain::transfer::EppDomainTransferRequestResponse;
|
use crate::domain::transfer::EppDomainTransferRequestResponse;
|
||||||
use crate::domain::update::EppDomainUpdateResponse;
|
use crate::domain::update::EppDomainUpdateResponse;
|
||||||
|
use crate::hello::EppGreeting;
|
||||||
|
use crate::hello::ExpiryType;
|
||||||
|
use crate::hello::Relative;
|
||||||
use crate::host::check::EppHostCheckResponse;
|
use crate::host::check::EppHostCheckResponse;
|
||||||
use crate::host::create::EppHostCreateResponse;
|
use crate::host::create::EppHostCreateResponse;
|
||||||
use crate::host::delete::EppHostDeleteResponse;
|
use crate::host::delete::EppHostDeleteResponse;
|
||||||
|
@ -27,11 +30,7 @@ mod response {
|
||||||
use crate::host::update::EppHostUpdateResponse;
|
use crate::host::update::EppHostUpdateResponse;
|
||||||
use crate::message::ack::EppMessageAckResponse;
|
use crate::message::ack::EppMessageAckResponse;
|
||||||
use crate::message::poll::EppMessagePollResponse;
|
use crate::message::poll::EppMessagePollResponse;
|
||||||
use crate::response::ExpiryType;
|
use crate::response::{EppCommandResponseError, EppLoginResponse, EppLogoutResponse};
|
||||||
use crate::response::Relative;
|
|
||||||
use crate::response::{
|
|
||||||
EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
|
||||||
};
|
|
||||||
use crate::xml::EppXml;
|
use crate::xml::EppXml;
|
||||||
|
|
||||||
const SVTRID: &str = "RO-6879-1627224678242975";
|
const SVTRID: &str = "RO-6879-1627224678242975";
|
||||||
|
|
|
@ -27,6 +27,7 @@ mod request {
|
||||||
use crate::domain::update::DomainAddRemove;
|
use crate::domain::update::DomainAddRemove;
|
||||||
use crate::domain::update::DomainChangeInfo;
|
use crate::domain::update::DomainChangeInfo;
|
||||||
use crate::domain::update::EppDomainUpdate;
|
use crate::domain::update::EppDomainUpdate;
|
||||||
|
use crate::hello::EppHello;
|
||||||
use crate::host::check::EppHostCheck;
|
use crate::host::check::EppHostCheck;
|
||||||
use crate::host::create::EppHostCreate;
|
use crate::host::create::EppHostCreate;
|
||||||
use crate::host::delete::EppHostDelete;
|
use crate::host::delete::EppHostDelete;
|
||||||
|
@ -36,7 +37,7 @@ mod request {
|
||||||
use crate::host::update::HostChangeInfo;
|
use crate::host::update::HostChangeInfo;
|
||||||
use crate::message::ack::EppMessageAck;
|
use crate::message::ack::EppMessageAck;
|
||||||
use crate::message::poll::EppMessagePoll;
|
use crate::message::poll::EppMessagePoll;
|
||||||
use crate::request::{EppHello, EppLogin, EppLogout};
|
use crate::request::{EppLogin, EppLogout};
|
||||||
use crate::xml::EppXml;
|
use crate::xml::EppXml;
|
||||||
use chrono::{DateTime, NaiveDate};
|
use chrono::{DateTime, NaiveDate};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
Loading…
Reference in New Issue