Refactor request and response into root
This commit is contained in:
parent
fce6c7a2eb
commit
8babf770c6
|
@ -51,12 +51,12 @@ use std::{error::Error, fmt::Debug};
|
|||
|
||||
use crate::config::EppClientConfig;
|
||||
use crate::connection::registry::{epp_connect, EppConnection};
|
||||
use crate::epp::request::{generate_client_tr_id, EppHello, EppLogin, EppLogout};
|
||||
use crate::epp::response::{
|
||||
EppCommandResponse, EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
||||
};
|
||||
use crate::epp::xml::EppXml;
|
||||
use crate::error;
|
||||
use crate::request::{generate_client_tr_id, EppHello, EppLogin, EppLogout};
|
||||
use crate::response::{
|
||||
EppCommandResponse, EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
||||
};
|
||||
/// Instances of the EppClient type are used to transact with the registry.
|
||||
/// Once initialized, the EppClient instance can serialize EPP requests to XML and send them
|
||||
/// to the registry and deserialize the XML responses from the registry to local types
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ContactAuthInfo, ElementName, EppObject, Phone, PostalInfo, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for contact <create> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type for the <epp> request for contact <delete> command
|
||||
|
|
|
@ -5,9 +5,9 @@ use epp_client_macros::*;
|
|||
use crate::common::{
|
||||
ContactAuthInfo, ContactStatus, ElementName, EppObject, Phone, PostalInfo, StringValue,
|
||||
};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type for the <epp> request for contact <info> command
|
||||
|
|
|
@ -6,10 +6,10 @@ use crate::common::{
|
|||
ContactAuthInfo, ContactStatus, ElementName, EppObject, Phone, PostalInfo, StringValue,
|
||||
};
|
||||
use crate::contact::info::EppContactInfoResponse;
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::error;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for contact <update> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for domain <check> command
|
||||
|
|
|
@ -6,9 +6,9 @@ use crate::common::{
|
|||
DomainAuthInfo, DomainContact, ElementName, EppObject, HostAttr, HostAttrList, HostList,
|
||||
HostObjList, Period, StringValue,
|
||||
};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for domain <create> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for domain <delete> command
|
||||
|
|
|
@ -6,9 +6,9 @@ use crate::common::{
|
|||
DomainAuthInfo, DomainContact, DomainStatus, ElementName, EppObject, HostAttr, StringValue,
|
||||
};
|
||||
use crate::domain::rgp::request::RgpRequestResponse;
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponseWithExtension;
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponseWithExtension;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for domain <info> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, Period, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use chrono::NaiveDate;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ use epp_client_macros::*;
|
|||
|
||||
use crate::common::{ElementName, EppObject, Extension, StringValue};
|
||||
use crate::domain::update::{DomainChangeInfo, DomainUpdateRequest, DomainUpdateRequestData};
|
||||
use crate::epp::request::CommandWithExtension;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
||||
use crate::request::CommandWithExtension;
|
||||
use crate::response::EppCommandResponse;
|
||||
use chrono::{DateTime, SecondsFormat, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ use epp_client_macros::*;
|
|||
|
||||
use crate::common::{ElementName, EmptyTag, EppObject, Extension};
|
||||
use crate::domain::update::{DomainChangeInfo, DomainUpdateRequest, DomainUpdateRequestData};
|
||||
use crate::epp::request::CommandWithExtension;
|
||||
use crate::epp::response::CommandResponseWithExtension;
|
||||
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
||||
use crate::request::CommandWithExtension;
|
||||
use crate::response::CommandResponseWithExtension;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for a domain rgp restore request command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{DomainAuthInfo, ElementName, EppObject, Period, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::{CommandResponse, EppCommandResponse};
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::{CommandResponse, EppCommandResponse};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for transfer request for domain
|
||||
|
|
|
@ -6,9 +6,9 @@ use crate::common::{
|
|||
DomainAuthInfo, DomainContact, DomainStatus, ElementName, EppObject, HostList, StringValue,
|
||||
};
|
||||
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for domain <update> command
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//! Types for EPP requests and responses
|
||||
|
||||
pub mod request;
|
||||
pub mod response;
|
||||
pub mod xml;
|
||||
|
||||
pub use crate::connection::client::default_client_tr_id_fn as generate_client_tr_id;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Error types to wrap internal errors and make EPP errors easier to read
|
||||
|
||||
use crate::epp::response::EppCommandResponseError;
|
||||
use crate::response::EppCommandResponseError;
|
||||
use std::fmt::Display;
|
||||
|
||||
/// Error enum holding the possible error types
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for host <check> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, HostAddr, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for host <create> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for host <delete> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, HostAddr, HostStatus, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for host <info> command
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, HostAddr, HostStatus, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for host <update> command
|
||||
|
|
|
@ -109,6 +109,8 @@ pub mod epp;
|
|||
pub mod error;
|
||||
pub mod host;
|
||||
pub mod message;
|
||||
pub mod request;
|
||||
pub mod response;
|
||||
pub use connection::client::EppClient;
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for registry <poll op="ack"> command
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::CommandResponse;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for registry <poll op="req"> command
|
||||
|
|
|
@ -20,11 +20,6 @@ mod response {
|
|||
use crate::domain::transfer::EppDomainTransferRejectResponse;
|
||||
use crate::domain::transfer::EppDomainTransferRequestResponse;
|
||||
use crate::domain::update::EppDomainUpdateResponse;
|
||||
use crate::epp::response::ExpiryType;
|
||||
use crate::epp::response::Relative;
|
||||
use crate::epp::response::{
|
||||
EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
||||
};
|
||||
use crate::epp::xml::EppXml;
|
||||
use crate::host::check::EppHostCheckResponse;
|
||||
use crate::host::create::EppHostCreateResponse;
|
||||
|
@ -33,6 +28,11 @@ mod response {
|
|||
use crate::host::update::EppHostUpdateResponse;
|
||||
use crate::message::ack::EppMessageAckResponse;
|
||||
use crate::message::poll::EppMessagePollResponse;
|
||||
use crate::response::ExpiryType;
|
||||
use crate::response::Relative;
|
||||
use crate::response::{
|
||||
EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
||||
};
|
||||
|
||||
const SVTRID: &str = "RO-6879-1627224678242975";
|
||||
const SUCCESS_MSG: &str = "Command completed successfully";
|
||||
|
|
|
@ -27,7 +27,6 @@ mod request {
|
|||
use crate::domain::update::DomainAddRemove;
|
||||
use crate::domain::update::DomainChangeInfo;
|
||||
use crate::domain::update::EppDomainUpdate;
|
||||
use crate::epp::request::{EppHello, EppLogin, EppLogout};
|
||||
use crate::epp::xml::EppXml;
|
||||
use crate::host::check::EppHostCheck;
|
||||
use crate::host::create::EppHostCreate;
|
||||
|
@ -38,6 +37,7 @@ mod request {
|
|||
use crate::host::update::HostChangeInfo;
|
||||
use crate::message::ack::EppMessageAck;
|
||||
use crate::message::poll::EppMessagePoll;
|
||||
use crate::request::{EppHello, EppLogin, EppLogout};
|
||||
use chrono::{DateTime, NaiveDate};
|
||||
use std::str::FromStr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue