Refactor request and response into root

This commit is contained in:
Nicholas Rempel 2021-11-26 11:22:44 -08:00 committed by masalachai
parent fce6c7a2eb
commit 8babf770c6
29 changed files with 55 additions and 55 deletions

View File

@ -51,12 +51,12 @@ 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::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::epp::xml::EppXml;
use crate::error; 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. /// 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 /// 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 /// to the registry and deserialize the XML responses from the registry to local types

View File

@ -2,8 +2,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, StringValue}; use crate::common::{ElementName, EppObject, StringValue};
use crate::epp::request::Command; use crate::request::Command;
use crate::epp::response::CommandResponse; use crate::response::CommandResponse;
use crate::epp::xml::EPP_CONTACT_XMLNS; use crate::epp::xml::EPP_CONTACT_XMLNS;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ContactAuthInfo, ElementName, EppObject, Phone, PostalInfo, StringValue}; 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::epp::xml::EPP_CONTACT_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for contact <create> command /// Type that represents the <epp> request for contact <create> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, StringValue}; 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::epp::xml::EPP_CONTACT_XMLNS;
use crate::request::Command;
use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type for the <epp> request for contact <delete> command /// Type for the <epp> request for contact <delete> command

View File

@ -5,9 +5,9 @@ use epp_client_macros::*;
use crate::common::{ use crate::common::{
ContactAuthInfo, ContactStatus, ElementName, EppObject, Phone, PostalInfo, StringValue, 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::epp::xml::EPP_CONTACT_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type for the <epp> request for contact <info> command /// Type for the <epp> request for contact <info> command

View File

@ -6,10 +6,10 @@ use crate::common::{
ContactAuthInfo, ContactStatus, ElementName, EppObject, Phone, PostalInfo, StringValue, ContactAuthInfo, ContactStatus, ElementName, EppObject, Phone, PostalInfo, StringValue,
}; };
use crate::contact::info::EppContactInfoResponse; use crate::contact::info::EppContactInfoResponse;
use crate::epp::request::Command;
use crate::epp::response::EppCommandResponse;
use crate::epp::xml::EPP_CONTACT_XMLNS; use crate::epp::xml::EPP_CONTACT_XMLNS;
use crate::error; use crate::error;
use crate::request::Command;
use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for contact <update> command /// Type that represents the <epp> request for contact <update> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, StringValue}; 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::epp::xml::EPP_DOMAIN_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for domain <check> command /// Type that represents the <epp> request for domain <check> command

View File

@ -6,9 +6,9 @@ use crate::common::{
DomainAuthInfo, DomainContact, ElementName, EppObject, HostAttr, HostAttrList, HostList, DomainAuthInfo, DomainContact, ElementName, EppObject, HostAttr, HostAttrList, HostList,
HostObjList, Period, StringValue, HostObjList, Period, StringValue,
}; };
use crate::epp::request::Command;
use crate::epp::response::CommandResponse;
use crate::epp::xml::EPP_DOMAIN_XMLNS; use crate::epp::xml::EPP_DOMAIN_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for domain <create> command /// Type that represents the <epp> request for domain <create> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, StringValue}; 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::epp::xml::EPP_DOMAIN_XMLNS;
use crate::request::Command;
use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for domain <delete> command /// Type that represents the <epp> request for domain <delete> command

View File

@ -6,9 +6,9 @@ use crate::common::{
DomainAuthInfo, DomainContact, DomainStatus, ElementName, EppObject, HostAttr, StringValue, DomainAuthInfo, DomainContact, DomainStatus, ElementName, EppObject, HostAttr, StringValue,
}; };
use crate::domain::rgp::request::RgpRequestResponse; 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::epp::xml::EPP_DOMAIN_XMLNS;
use crate::request::Command;
use crate::response::CommandResponseWithExtension;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for domain <info> command /// Type that represents the <epp> request for domain <info> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, Period, StringValue}; 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::epp::xml::EPP_DOMAIN_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use chrono::NaiveDate; use chrono::NaiveDate;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@ -4,9 +4,9 @@ use epp_client_macros::*;
use crate::common::{ElementName, EppObject, Extension, StringValue}; use crate::common::{ElementName, EppObject, Extension, StringValue};
use crate::domain::update::{DomainChangeInfo, DomainUpdateRequest, DomainUpdateRequestData}; 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::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
use crate::request::CommandWithExtension;
use crate::response::EppCommandResponse;
use chrono::{DateTime, SecondsFormat, Utc}; use chrono::{DateTime, SecondsFormat, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@ -4,9 +4,9 @@ use epp_client_macros::*;
use crate::common::{ElementName, EmptyTag, EppObject, Extension}; use crate::common::{ElementName, EmptyTag, EppObject, Extension};
use crate::domain::update::{DomainChangeInfo, DomainUpdateRequest, DomainUpdateRequestData}; 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::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
use crate::request::CommandWithExtension;
use crate::response::CommandResponseWithExtension;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for a domain rgp restore request command /// Type that represents the <epp> request for a domain rgp restore request command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{DomainAuthInfo, ElementName, EppObject, Period, StringValue}; 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::epp::xml::EPP_DOMAIN_XMLNS;
use crate::request::Command;
use crate::response::{CommandResponse, EppCommandResponse};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for transfer request for domain /// Type that represents the <epp> request for transfer request for domain

View File

@ -6,9 +6,9 @@ use crate::common::{
DomainAuthInfo, DomainContact, DomainStatus, ElementName, EppObject, HostList, StringValue, 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::epp::xml::EPP_DOMAIN_XMLNS;
use crate::request::Command;
use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for domain <update> command /// Type that represents the <epp> request for domain <update> command

View File

@ -1,7 +1,5 @@
//! Types for EPP requests and responses //! Types for EPP requests and responses
pub mod request;
pub mod response;
pub mod xml; pub mod xml;
pub use crate::connection::client::default_client_tr_id_fn as generate_client_tr_id; pub use crate::connection::client::default_client_tr_id_fn as generate_client_tr_id;

View File

@ -1,6 +1,6 @@
//! Error types to wrap internal errors and make EPP errors easier to read //! 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; use std::fmt::Display;
/// Error enum holding the possible error types /// Error enum holding the possible error types

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, StringValue}; 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::epp::xml::EPP_HOST_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for host <check> command /// Type that represents the <epp> request for host <check> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, HostAddr, StringValue}; 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::epp::xml::EPP_HOST_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for host <create> command /// Type that represents the <epp> request for host <create> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, StringValue}; 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::epp::xml::EPP_HOST_XMLNS;
use crate::request::Command;
use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for host <delete> command /// Type that represents the <epp> request for host <delete> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, HostAddr, HostStatus, StringValue}; 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::epp::xml::EPP_HOST_XMLNS;
use crate::request::Command;
use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for host <info> command /// Type that represents the <epp> request for host <info> command

View File

@ -3,9 +3,9 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, HostAddr, HostStatus, StringValue}; 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::epp::xml::EPP_HOST_XMLNS;
use crate::request::Command;
use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the <epp> request for host <update> command /// Type that represents the <epp> request for host <update> command

View File

@ -109,6 +109,8 @@ pub mod epp;
pub mod error; pub mod error;
pub mod host; pub mod host;
pub mod message; pub mod message;
pub mod request;
pub mod response;
pub use connection::client::EppClient; pub use connection::client::EppClient;
#[cfg(test)] #[cfg(test)]

View File

@ -3,8 +3,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject}; use crate::common::{ElementName, EppObject};
use crate::epp::request::Command; use crate::request::Command;
use crate::epp::response::CommandResponse; use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the &lt;epp&gt; request for registry <poll op="ack"> command /// Type that represents the &lt;epp&gt; request for registry <poll op="ack"> command

View File

@ -3,8 +3,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use crate::common::{ElementName, EppObject, StringValue}; use crate::common::{ElementName, EppObject, StringValue};
use crate::epp::request::Command; use crate::request::Command;
use crate::epp::response::CommandResponse; use crate::response::CommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Type that represents the &lt;epp&gt; request for registry <poll op="req"> command /// Type that represents the &lt;epp&gt; request for registry <poll op="req"> command

View File

@ -20,11 +20,6 @@ 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::epp::response::ExpiryType;
use crate::epp::response::Relative;
use crate::epp::response::{
EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
};
use crate::epp::xml::EppXml; use crate::epp::xml::EppXml;
use crate::host::check::EppHostCheckResponse; use crate::host::check::EppHostCheckResponse;
use crate::host::create::EppHostCreateResponse; use crate::host::create::EppHostCreateResponse;
@ -33,6 +28,11 @@ 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::Relative;
use crate::response::{
EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
};
const SVTRID: &str = "RO-6879-1627224678242975"; const SVTRID: &str = "RO-6879-1627224678242975";
const SUCCESS_MSG: &str = "Command completed successfully"; const SUCCESS_MSG: &str = "Command completed successfully";

View File

@ -27,7 +27,6 @@ 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::epp::request::{EppHello, EppLogin, EppLogout};
use crate::epp::xml::EppXml; use crate::epp::xml::EppXml;
use crate::host::check::EppHostCheck; use crate::host::check::EppHostCheck;
use crate::host::create::EppHostCreate; use crate::host::create::EppHostCreate;
@ -38,6 +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 chrono::{DateTime, NaiveDate}; use chrono::{DateTime, NaiveDate};
use std::str::FromStr; use std::str::FromStr;