Refactor rgp request models
This commit is contained in:
parent
c198a7345b
commit
dc90f91b8f
|
@ -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<CommandResponseWithExtension<DomainInfoResponse, RgpRequestResult>>;
|
||||
EppObject<CommandResponseWithExtension<DomainInfoResponse, RgpRequestResponse>>;
|
||||
|
||||
// Request
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//! Types for EPP RGP restore requests
|
||||
|
||||
pub mod report;
|
||||
pub mod request;
|
||||
|
|
|
@ -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<CommandWithExtension<DomainUpdateRequest, RgpRestoreRequest>>;
|
||||
|
||||
/// 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<CommandResponseWithExtension<EmptyTag, RgpRequestResponse>>;
|
||||
|
||||
// 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,
|
||||
}
|
|
@ -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::*;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//! Types for EPP requests
|
||||
|
||||
pub mod contact;
|
||||
pub mod domain;
|
||||
pub mod host;
|
||||
pub mod message;
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
//! Types for EPP domain requests
|
||||
|
||||
pub mod rgp;
|
|
@ -1,3 +0,0 @@
|
|||
//! Types for EPP RGP restore requests
|
||||
|
||||
pub mod request;
|
|
@ -1,7 +1,6 @@
|
|||
//! Types for EPP responses
|
||||
|
||||
pub mod contact;
|
||||
pub mod domain;
|
||||
pub mod host;
|
||||
pub mod message;
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
//! Types for EPP domain responses
|
||||
|
||||
pub mod rgp;
|
|
@ -1,3 +0,0 @@
|
|||
//! Types for RGP restore responses
|
||||
|
||||
pub mod request;
|
|
@ -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<CommandResponseWithExtension<EmptyTag, RgpRequestResult>>;
|
||||
|
||||
/// 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,
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue