epp_client/message/
ack.rs1use crate::common::NoExtension;
4use crate::request::{Command, Transaction};
5use serde::Serialize;
6
7impl<'a> Transaction<NoExtension> for MessageAck<'a> {}
8
9impl<'a> Command for MessageAck<'a> {
10 type Response = String;
11 const COMMAND: &'static str = "poll";
12}
13
14#[derive(Serialize, Debug)]
15pub struct MessageAck<'a> {
17 op: &'a str,
20 #[serde(rename = "msgID")]
22 message_id: &'a str,
23}
24
25impl<'a> MessageAck<'a> {
26 pub fn new(message_id: &'a str) -> Self {
27 Self {
28 op: "ack",
29 message_id,
30 }
31 }
32}
33
34#[cfg(test)]
35mod tests {
36 use super::MessageAck;
37 use crate::response::ResultCode;
38 use crate::tests::{assert_serialized, response_from_file, SUCCESS_MSG, SVTRID};
39
40 #[test]
41 fn command() {
42 let object = MessageAck::new("12345");
43 assert_serialized("request/message/ack.xml", &object);
44 }
45
46 #[test]
47 fn response() {
48 let object = response_from_file::<MessageAck>("response/message/ack.xml");
49 let msg = object.message_queue().unwrap();
50
51 assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
52 assert_eq!(object.result.message, SUCCESS_MSG.into());
53 assert_eq!(msg.count, 4);
54 assert_eq!(msg.id, "12345".to_string());
55 assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
56 }
57}