Refactor contact delete models
This commit is contained in:
parent
feedd6046f
commit
f163d35a45
|
@ -1,2 +1,3 @@
|
|||
pub mod check;
|
||||
pub mod create;
|
||||
pub mod delete;
|
||||
|
|
|
@ -4,6 +4,7 @@ use epp_client_macros::*;
|
|||
|
||||
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::request::Command;
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -16,7 +17,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::epp::{EppContactDelete, EppContactDeleteResponse};
|
||||
/// use epp_client::contact::delete::{EppContactDelete, EppContactDeleteResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
|
@ -56,11 +57,31 @@ use serde::{Deserialize, Serialize};
|
|||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppContactDelete = EppObject<Command<ContactDelete>>;
|
||||
pub type EppContactDelete = EppObject<Command<ContactDeleteRequest>>;
|
||||
|
||||
impl EppContactDelete {
|
||||
/// Creates a new EppObject for contact delete corresponding to the <epp> tag in EPP XML
|
||||
pub fn new(id: &str, client_tr_id: &str) -> EppContactDelete {
|
||||
let contact_delete = ContactDeleteRequest {
|
||||
contact: ContactDeleteRequestData {
|
||||
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
||||
id: id.into(),
|
||||
},
|
||||
};
|
||||
|
||||
EppObject::build(Command::<ContactDeleteRequest>::new(
|
||||
contact_delete,
|
||||
client_tr_id,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
/// Type that represents the <epp> tag for the EPP XML contact delete response
|
||||
pub type EppContactDeleteResponse = EppCommandResponse;
|
||||
|
||||
/// Type containing the data for the <delete> tag for contacts
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ContactDeleteData {
|
||||
pub struct ContactDeleteRequestData {
|
||||
/// XML namespace for the <delete> command for contacts
|
||||
#[serde(rename = "xmlns:contact", alias = "xmlns")]
|
||||
xmlns: String,
|
||||
|
@ -72,22 +93,8 @@ pub struct ContactDeleteData {
|
|||
#[derive(Serialize, Deserialize, Debug, ElementName)]
|
||||
#[element_name(name = "delete")]
|
||||
/// The <delete> type for the contact delete EPP command
|
||||
pub struct ContactDelete {
|
||||
pub struct ContactDeleteRequest {
|
||||
#[serde(rename = "contact:delete", alias = "delete")]
|
||||
/// The data for the <delete> tag for a contact delete command
|
||||
contact: ContactDeleteData,
|
||||
}
|
||||
|
||||
impl EppContactDelete {
|
||||
/// Creates a new EppObject for contact delete corresponding to the <epp> tag in EPP XML
|
||||
pub fn new(id: &str, client_tr_id: &str) -> EppContactDelete {
|
||||
let contact_delete = ContactDelete {
|
||||
contact: ContactDeleteData {
|
||||
xmlns: EPP_CONTACT_XMLNS.to_string(),
|
||||
id: id.into(),
|
||||
},
|
||||
};
|
||||
|
||||
EppObject::build(Command::<ContactDelete>::new(contact_delete, client_tr_id))
|
||||
}
|
||||
contact: ContactDeleteRequestData,
|
||||
}
|
|
@ -5,7 +5,6 @@ pub mod request;
|
|||
pub mod response;
|
||||
pub mod xml;
|
||||
|
||||
pub use request::contact::delete::*;
|
||||
pub use request::contact::info::*;
|
||||
pub use request::contact::update::*;
|
||||
pub use request::host::check::*;
|
||||
|
@ -16,7 +15,6 @@ pub use request::host::update::*;
|
|||
pub use request::message::ack::*;
|
||||
pub use request::message::poll::*;
|
||||
|
||||
pub use response::contact::delete::*;
|
||||
pub use response::contact::info::*;
|
||||
pub use response::contact::update::*;
|
||||
pub use response::host::check::*;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//! Types for EPP contact requests
|
||||
|
||||
pub mod delete;
|
||||
pub mod info;
|
||||
pub mod update;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//! Types for EPP contact responses
|
||||
|
||||
pub mod delete;
|
||||
pub mod info;
|
||||
pub mod update;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
//! Types for EPP contact delete response
|
||||
|
||||
use crate::epp::response::EppCommandResponse;
|
||||
|
||||
/// Type that represents the <epp> tag for the EPP XML contact delete response
|
||||
pub type EppContactDeleteResponse = EppCommandResponse;
|
|
@ -5,6 +5,7 @@ mod response {
|
|||
use super::super::CLTRID;
|
||||
use crate::contact::check::EppContactCheckResponse;
|
||||
use crate::contact::create::EppContactCreateResponse;
|
||||
use crate::contact::delete::EppContactDeleteResponse;
|
||||
use crate::domain::check::EppDomainCheckResponse;
|
||||
use crate::domain::create::EppDomainCreateResponse;
|
||||
use crate::domain::delete::EppDomainDeleteResponse;
|
||||
|
|
|
@ -5,6 +5,7 @@ mod request {
|
|||
use super::super::CLTRID;
|
||||
use crate::contact::check::EppContactCheck;
|
||||
use crate::contact::create::EppContactCreate;
|
||||
use crate::contact::delete::EppContactDelete;
|
||||
use crate::domain::check::EppDomainCheck;
|
||||
use crate::domain::create::EppDomainCreate;
|
||||
use crate::domain::delete::EppDomainDelete;
|
||||
|
|
Loading…
Reference in New Issue