diff --git a/epp-client/src/epp.rs b/epp-client/src/epp.rs index e50c171..332a201 100644 --- a/epp-client/src/epp.rs +++ b/epp-client/src/epp.rs @@ -5,10 +5,8 @@ pub mod request; pub mod response; pub mod xml; -pub use request::message::ack::*; pub use request::message::poll::*; -pub use response::message::ack::*; pub use response::message::poll::*; pub use crate::connection::client::default_client_tr_id_fn as generate_client_tr_id; diff --git a/epp-client/src/epp/request/message.rs b/epp-client/src/epp/request/message.rs index bc692a1..547c027 100644 --- a/epp-client/src/epp/request/message.rs +++ b/epp-client/src/epp/request/message.rs @@ -1,4 +1,3 @@ //! Types for EPP message requests -pub mod ack; pub mod poll; diff --git a/epp-client/src/epp/response/message.rs b/epp-client/src/epp/response/message.rs index ecf5953..ec7957f 100644 --- a/epp-client/src/epp/response/message.rs +++ b/epp-client/src/epp/response/message.rs @@ -1,4 +1,3 @@ //! Types for EPP message responses -pub mod ack; pub mod poll; diff --git a/epp-client/src/epp/response/message/ack.rs b/epp-client/src/epp/response/message/ack.rs deleted file mode 100644 index fb08d40..0000000 --- a/epp-client/src/epp/response/message/ack.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Types for EPP message ack response - -use crate::epp::object::EppObject; -use crate::epp::response::CommandResponse; - -/// Type that represents the <epp> tag for the EPP XML message ack response -pub type EppMessageAckResponse = EppObject>; diff --git a/epp-client/src/lib.rs b/epp-client/src/lib.rs index f2a4569..6e1fe38 100644 --- a/epp-client/src/lib.rs +++ b/epp-client/src/lib.rs @@ -107,6 +107,7 @@ pub mod domain; pub mod epp; pub mod error; pub mod host; +pub mod message; pub use connection::client::EppClient; #[cfg(test)] diff --git a/epp-client/src/message.rs b/epp-client/src/message.rs new file mode 100644 index 0000000..ef98272 --- /dev/null +++ b/epp-client/src/message.rs @@ -0,0 +1 @@ +pub mod ack; diff --git a/epp-client/src/epp/request/message/ack.rs b/epp-client/src/message/ack.rs similarity index 84% rename from epp-client/src/epp/request/message/ack.rs rename to epp-client/src/message/ack.rs index 63f22ee..b9b2903 100644 --- a/epp-client/src/epp/request/message/ack.rs +++ b/epp-client/src/message/ack.rs @@ -4,6 +4,7 @@ use epp_client_macros::*; use crate::epp::object::{ElementName, EppObject}; use crate::epp::request::Command; +use crate::epp::response::CommandResponse; use serde::{Deserialize, Serialize}; /// Type that represents the <epp> request for registry command @@ -14,7 +15,7 @@ use serde::{Deserialize, Serialize}; /// /// use epp_client::config::{EppClientConfig, EppClientConnection}; /// use epp_client::EppClient; -/// use epp_client::epp::{EppMessageAck, EppMessageAckResponse}; +/// use epp_client::message::ack::{EppMessageAck, EppMessageAckResponse}; /// use epp_client::epp::generate_client_tr_id; /// /// #[tokio::main] @@ -51,25 +52,13 @@ use serde::{Deserialize, Serialize}; /// client.logout().await.unwrap(); /// } /// ``` -pub type EppMessageAck = EppObject>; - -#[derive(Serialize, Deserialize, Debug, ElementName)] -#[element_name(name = "poll")] -/// Type for EPP XML <poll> command for message ack -pub struct MessageAck { - /// The type of operation to perform - /// The value is "ack" for message acknowledgement - op: String, - /// The ID of the message to be acknowledged - #[serde(rename = "msgID")] - message_id: String, -} +pub type EppMessageAck = EppObject>; impl EppMessageAck { /// Creates a new EppObject for <poll> ack corresponding to the <epp> tag in EPP XML pub fn new(message_id: u32, client_tr_id: &str) -> EppMessageAck { - EppObject::build(Command::::new( - MessageAck { + EppObject::build(Command::::new( + MessageAckRequest { op: "ack".to_string(), message_id: message_id.to_string(), }, @@ -77,3 +66,18 @@ impl EppMessageAck { )) } } + +/// Type that represents the <epp> tag for the EPP XML message ack response +pub type EppMessageAckResponse = EppObject>; + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "poll")] +/// Type for EPP XML <poll> command for message ack +pub struct MessageAckRequest { + /// The type of operation to perform + /// The value is "ack" for message acknowledgement + op: String, + /// The ID of the message to be acknowledged + #[serde(rename = "msgID")] + message_id: String, +} diff --git a/epp-client/src/tests/de.rs b/epp-client/src/tests/de.rs index 1db3835..a4bf1ff 100644 --- a/epp-client/src/tests/de.rs +++ b/epp-client/src/tests/de.rs @@ -32,6 +32,7 @@ mod response { use crate::host::delete::EppHostDeleteResponse; use crate::host::info::EppHostInfoResponse; use crate::host::update::EppHostUpdateResponse; + use crate::message::ack::EppMessageAckResponse; const SVTRID: &str = "RO-6879-1627224678242975"; const SUCCESS_MSG: &str = "Command completed successfully"; diff --git a/epp-client/src/tests/se.rs b/epp-client/src/tests/se.rs index ade3955..46de6a3 100644 --- a/epp-client/src/tests/se.rs +++ b/epp-client/src/tests/se.rs @@ -37,6 +37,7 @@ mod request { use crate::host::update::EppHostUpdate; use crate::host::update::HostAddRemove; use crate::host::update::HostChangeInfo; + use crate::message::ack::EppMessageAck; use chrono::{DateTime, NaiveDate}; use std::str::FromStr;