1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
//! Types for EPP message ack request use epp_client_macros::*; use crate::epp::object::{ElementName, EppObject}; use crate::epp::request::Command; use serde::{Deserialize, Serialize}; /// Type that represents the <epp> request for registry <poll op="ack"> command /// ## Usage /// /// ```ignore /// use epp_client::EppClient; /// use epp_client::epp::{EppMessageAck, EppMessageAckResponse}; /// use epp_client::epp::generate_client_tr_id; /// /// #[tokio::main] /// async fn main() { /// // Create an instance of EppClient, specifying the name of the registry as in /// // the config file /// let mut client = match EppClient::new("verisign").await { /// Ok(client) => client, /// Err(e) => panic!("Failed to create EppClient: {}", e) /// }; /// /// // Create an EppMessageAck instance /// let message_ack = EppMessageAck::new(12345, generate_client_tr_id(&client).as_str()); /// /// // send it to the registry and receive a response of type EppMessageAckResponse /// let response = client.transact::<_, EppMessageAckResponse>(&message_ack).await.unwrap(); /// /// println!("{:?}", response); /// } /// ``` pub type EppMessageAck = EppObject<Command<MessageAck>>; #[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, } 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::<MessageAck>::new( MessageAck { op: "ack".to_string(), message_id: message_id.to_string(), }, client_tr_id, )) } }