instant_epp/host/
delete.rs1use instant_xml::ToXml;
4
5use super::XMLNS;
6use crate::common::{NoExtension, EPP_XMLNS};
7use crate::request::{Command, Transaction};
8
9impl<'a> Transaction<NoExtension> for HostDelete<'a> {}
10
11impl<'a> Command for HostDelete<'a> {
12 type Response = ();
13 const COMMAND: &'static str = "delete";
14}
15
16impl<'a> HostDelete<'a> {
17 pub fn new(name: &'a str) -> Self {
18 Self {
19 host: HostDeleteRequest { name },
20 }
21 }
22}
23
24#[derive(Debug, ToXml)]
26#[xml(rename = "delete", ns(XMLNS))]
27pub struct HostDeleteRequest<'a> {
28 name: &'a str,
30}
31
32#[derive(Debug, ToXml)]
34#[xml(rename = "delete", ns(EPP_XMLNS))]
35pub struct HostDelete<'a> {
36 host: HostDeleteRequest<'a>,
38}
39
40#[cfg(test)]
41mod tests {
42 use super::HostDelete;
43 use crate::response::ResultCode;
44 use crate::tests::{assert_serialized, response_from_file, CLTRID, SUCCESS_MSG, SVTRID};
45
46 #[test]
47 fn command() {
48 let object = HostDelete::new("ns1.eppdev-1.com");
49 assert_serialized("request/host/delete.xml", &object);
50 }
51
52 #[test]
53 fn response() {
54 let object = response_from_file::<HostDelete>("response/host/delete.xml");
55 assert_eq!(object.result.code, ResultCode::CommandCompletedSuccessfully);
56 assert_eq!(object.result.message, SUCCESS_MSG);
57 assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID);
58 assert_eq!(object.tr_ids.server_tr_id, SVTRID);
59 }
60}