diff --git a/epp-client/src/domain/info.rs b/epp-client/src/domain/info.rs index c76132c..0c07a3f 100644 --- a/epp-client/src/domain/info.rs +++ b/epp-client/src/domain/info.rs @@ -2,12 +2,12 @@ use epp_client_macros::*; +use crate::domain::rgp::request::RgpRequestResponse; use crate::epp::object::data::{DomainAuthInfo, DomainContact, DomainStatus, HostAttr}; use crate::epp::object::{ElementName, EppObject, StringValue}; use crate::epp::request::Command; use crate::epp::response::CommandResponseWithExtension; use crate::epp::xml::EPP_DOMAIN_XMLNS; -use crate::epp::RgpRequestResult; use serde::{Deserialize, Serialize}; /// Type that represents the <epp> request for domain <info> command @@ -78,7 +78,7 @@ impl EppDomainInfo { /// Type that represents the <epp> tag for the EPP XML domain info response pub type EppDomainInfoResponse = - EppObject>; + EppObject>; // Request diff --git a/epp-client/src/domain/rgp.rs b/epp-client/src/domain/rgp.rs index 9a962e9..8775fb4 100644 --- a/epp-client/src/domain/rgp.rs +++ b/epp-client/src/domain/rgp.rs @@ -1,3 +1,4 @@ //! Types for EPP RGP restore requests pub mod report; +pub mod request; diff --git a/epp-client/src/epp/request/domain/rgp/request.rs b/epp-client/src/domain/rgp/request.rs similarity index 77% rename from epp-client/src/epp/request/domain/rgp/request.rs rename to epp-client/src/domain/rgp/request.rs index 80b98a8..9300eb1 100644 --- a/epp-client/src/epp/request/domain/rgp/request.rs +++ b/epp-client/src/domain/rgp/request.rs @@ -3,8 +3,9 @@ use epp_client_macros::*; use crate::domain::update::{DomainChangeInfo, DomainUpdateRequest, DomainUpdateRequestData}; -use crate::epp::object::{ElementName, EppObject}; -use crate::epp::request::{CommandWithExtension, Extension}; +use crate::epp::object::{ElementName, EmptyTag, EppObject, Extension}; +use crate::epp::request::CommandWithExtension; +use crate::epp::response::CommandResponseWithExtension; use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS}; use serde::{Deserialize, Serialize}; @@ -17,7 +18,7 @@ use serde::{Deserialize, Serialize}; /// /// use epp_client::config::{EppClientConfig, EppClientConnection}; /// use epp_client::EppClient; -/// use epp_client::epp::{EppDomainRgpRestoreRequest, EppDomainRgpRestoreRequestResponse}; +/// use epp_client::domain::rgp::request::{EppDomainRgpRestoreRequest, EppDomainRgpRestoreRequestResponse}; /// use epp_client::epp::generate_client_tr_id; /// /// #[tokio::main] @@ -60,25 +61,6 @@ use serde::{Deserialize, Serialize}; pub type EppDomainRgpRestoreRequest = EppObject>; -/// Type corresponding to the <restore> tag for an rgp restore request -#[derive(Serialize, Deserialize, Debug)] -pub struct RgpRestoreRequestData { - /// The value of the op attribute in the <restore> tag - pub op: String, -} - -#[derive(Serialize, Deserialize, Debug, ElementName)] -#[element_name(name = "rgp:update")] -/// Type for EPP XML <check> command for domains -pub struct RgpRestoreRequest { - /// XML namespace for the RGP restore extension - #[serde(rename = "xmlns:rgp", alias = "xmlns")] - xmlns: String, - /// The object holding the list of domains to be checked - #[serde(rename = "rgp:restore", alias = "restore")] - restore: RgpRestoreRequestData, -} - impl EppDomainRgpRestoreRequest { /// Creates a new EppObject for domain rgp restore request corresponding to the <epp> tag in EPP XML pub fn new(name: &str, client_tr_id: &str) -> EppDomainRgpRestoreRequest { @@ -109,3 +91,50 @@ impl EppDomainRgpRestoreRequest { EppObject::build(command) } } + +/// Type that represents the <epp> tag for the EPP XML rgp restore request response +pub type EppDomainRgpRestoreRequestResponse = + EppObject>; + +// Request + +/// Type corresponding to the <restore> tag for an rgp restore request +#[derive(Serialize, Deserialize, Debug)] +pub struct RgpRestoreRequestData { + /// The value of the op attribute in the <restore> tag + pub op: String, +} + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "rgp:update")] +/// Type for EPP XML <check> command for domains +pub struct RgpRestoreRequest { + /// XML namespace for the RGP restore extension + #[serde(rename = "xmlns:rgp", alias = "xmlns")] + xmlns: String, + /// The object holding the list of domains to be checked + #[serde(rename = "rgp:restore", alias = "restore")] + restore: RgpRestoreRequestData, +} + +// Response + +/// Type that represents the <rgpStatus> tag for domain rgp restore request response +#[derive(Serialize, Deserialize, Debug)] +pub struct RgpStatus { + /// The domain RGP status + #[serde(rename = "s")] + pub status: String, +} + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[serde(rename = "upData")] +#[element_name(name = "upData")] +/// Type that represents the <resData> tag for domain transfer response +pub struct RgpRequestResponse { + #[serde(rename = "xmlns:rgp")] + xmlns: String, + /// Data under the <rgpStatus> tag + #[serde(rename = "rgpStatus")] + pub rgp_status: RgpStatus, +} diff --git a/epp-client/src/epp.rs b/epp-client/src/epp.rs index 51f7bc6..21f7a26 100644 --- a/epp-client/src/epp.rs +++ b/epp-client/src/epp.rs @@ -10,7 +10,6 @@ pub use request::contact::create::*; pub use request::contact::delete::*; pub use request::contact::info::*; pub use request::contact::update::*; -pub use request::domain::rgp::request::*; pub use request::host::check::*; pub use request::host::create::*; pub use request::host::delete::*; @@ -24,7 +23,6 @@ pub use response::contact::create::*; pub use response::contact::delete::*; pub use response::contact::info::*; pub use response::contact::update::*; -pub use response::domain::rgp::request::*; pub use response::host::check::*; pub use response::host::create::*; pub use response::host::delete::*; diff --git a/epp-client/src/epp/request.rs b/epp-client/src/epp/request.rs index f819c32..e5c4f9c 100644 --- a/epp-client/src/epp/request.rs +++ b/epp-client/src/epp/request.rs @@ -1,7 +1,6 @@ //! Types for EPP requests pub mod contact; -pub mod domain; pub mod host; pub mod message; diff --git a/epp-client/src/epp/request/domain.rs b/epp-client/src/epp/request/domain.rs deleted file mode 100644 index 5908bf1..0000000 --- a/epp-client/src/epp/request/domain.rs +++ /dev/null @@ -1,3 +0,0 @@ -//! Types for EPP domain requests - -pub mod rgp; diff --git a/epp-client/src/epp/request/domain/rgp.rs b/epp-client/src/epp/request/domain/rgp.rs deleted file mode 100644 index aba4252..0000000 --- a/epp-client/src/epp/request/domain/rgp.rs +++ /dev/null @@ -1,3 +0,0 @@ -//! Types for EPP RGP restore requests - -pub mod request; diff --git a/epp-client/src/epp/response.rs b/epp-client/src/epp/response.rs index 25bde4a..0d06a0b 100644 --- a/epp-client/src/epp/response.rs +++ b/epp-client/src/epp/response.rs @@ -1,7 +1,6 @@ //! Types for EPP responses pub mod contact; -pub mod domain; pub mod host; pub mod message; diff --git a/epp-client/src/epp/response/domain.rs b/epp-client/src/epp/response/domain.rs deleted file mode 100644 index 1ff5a7c..0000000 --- a/epp-client/src/epp/response/domain.rs +++ /dev/null @@ -1,3 +0,0 @@ -//! Types for EPP domain responses - -pub mod rgp; diff --git a/epp-client/src/epp/response/domain/rgp.rs b/epp-client/src/epp/response/domain/rgp.rs deleted file mode 100644 index 78a00ea..0000000 --- a/epp-client/src/epp/response/domain/rgp.rs +++ /dev/null @@ -1,3 +0,0 @@ -//! Types for RGP restore responses - -pub mod request; diff --git a/epp-client/src/epp/response/domain/rgp/request.rs b/epp-client/src/epp/response/domain/rgp/request.rs deleted file mode 100644 index 3582897..0000000 --- a/epp-client/src/epp/response/domain/rgp/request.rs +++ /dev/null @@ -1,29 +0,0 @@ -use epp_client_macros::*; - -use crate::epp::object::{ElementName, EmptyTag, EppObject}; -use crate::epp::response::CommandResponseWithExtension; -use serde::{Deserialize, Serialize}; - -/// Type that represents the <epp> tag for the EPP XML rgp restore request response -pub type EppDomainRgpRestoreRequestResponse = - EppObject>; - -/// Type that represents the <rgpStatus> tag for domain rgp restore request response -#[derive(Serialize, Deserialize, Debug)] -pub struct RgpStatus { - /// The domain RGP status - #[serde(rename = "s")] - pub status: String, -} - -#[derive(Serialize, Deserialize, Debug, ElementName)] -#[serde(rename = "upData")] -#[element_name(name = "upData")] -/// Type that represents the <resData> tag for domain transfer response -pub struct RgpRequestResult { - #[serde(rename = "xmlns:rgp")] - xmlns: String, - /// Data under the <rgpStatus> tag - #[serde(rename = "rgpStatus")] - pub rgp_status: RgpStatus, -} diff --git a/epp-client/src/tests/de.rs b/epp-client/src/tests/de.rs index 01c66df..b3e2f9e 100644 --- a/epp-client/src/tests/de.rs +++ b/epp-client/src/tests/de.rs @@ -8,6 +8,7 @@ mod response { use crate::domain::delete::EppDomainDeleteResponse; use crate::domain::info::EppDomainInfoResponse; use crate::domain::renew::EppDomainRenewResponse; + use crate::domain::rgp::request::EppDomainRgpRestoreRequestResponse; use crate::domain::transfer::EppDomainTransferApproveResponse; use crate::domain::transfer::EppDomainTransferCancelResponse; use crate::domain::transfer::EppDomainTransferQueryResponse; diff --git a/epp-client/src/tests/se.rs b/epp-client/src/tests/se.rs index ce43e7f..6a0e6fc 100644 --- a/epp-client/src/tests/se.rs +++ b/epp-client/src/tests/se.rs @@ -9,6 +9,7 @@ mod request { use crate::domain::info::EppDomainInfo; use crate::domain::renew::EppDomainRenew; use crate::domain::rgp::report::EppDomainRgpRestoreReport; + use crate::domain::rgp::request::EppDomainRgpRestoreRequest; use crate::domain::transfer::EppDomainTransferApprove; use crate::domain::transfer::EppDomainTransferCancel; use crate::domain::transfer::EppDomainTransferQuery;