mirror of
https://github.com/masalachai/epp-client.git
synced 2025-02-16 11:22:02 +00:00
Refactor host delete models
This commit is contained in:
parent
63c5aae4a9
commit
fc21db3cac
@ -5,13 +5,11 @@ pub mod request;
|
|||||||
pub mod response;
|
pub mod response;
|
||||||
pub mod xml;
|
pub mod xml;
|
||||||
|
|
||||||
pub use request::host::delete::*;
|
|
||||||
pub use request::host::info::*;
|
pub use request::host::info::*;
|
||||||
pub use request::host::update::*;
|
pub use request::host::update::*;
|
||||||
pub use request::message::ack::*;
|
pub use request::message::ack::*;
|
||||||
pub use request::message::poll::*;
|
pub use request::message::poll::*;
|
||||||
|
|
||||||
pub use response::host::delete::*;
|
|
||||||
pub use response::host::info::*;
|
pub use response::host::info::*;
|
||||||
pub use response::host::update::*;
|
pub use response::host::update::*;
|
||||||
pub use response::message::ack::*;
|
pub use response::message::ack::*;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
//! Types for EPP host requests
|
//! Types for EPP host requests
|
||||||
|
|
||||||
pub mod delete;
|
|
||||||
pub mod info;
|
pub mod info;
|
||||||
pub mod update;
|
pub mod update;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
//! Types for EPP host responses
|
//! Types for EPP host responses
|
||||||
|
|
||||||
pub mod delete;
|
|
||||||
pub mod info;
|
pub mod info;
|
||||||
pub mod update;
|
pub mod update;
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
//! Types for EPP host delete response
|
|
||||||
|
|
||||||
use crate::epp::response::EppCommandResponse;
|
|
||||||
|
|
||||||
/// Type that represents the <epp> tag for the EPP XML host delete response
|
|
||||||
pub type EppHostDeleteResponse = EppCommandResponse;
|
|
@ -1,2 +1,3 @@
|
|||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod create;
|
pub mod create;
|
||||||
|
pub mod delete;
|
||||||
|
@ -4,6 +4,7 @@ use epp_client_macros::*;
|
|||||||
|
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue};
|
use crate::epp::object::{ElementName, EppObject, StringValue};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
|
use crate::epp::response::EppCommandResponse;
|
||||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
///
|
///
|
||||||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||||
/// use epp_client::EppClient;
|
/// use epp_client::EppClient;
|
||||||
/// use epp_client::epp::{EppHostDelete, EppHostDeleteResponse};
|
/// use epp_client::host::delete::{EppHostDelete, EppHostDeleteResponse};
|
||||||
/// use epp_client::epp::generate_client_tr_id;
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
///
|
///
|
||||||
/// #[tokio::main]
|
/// #[tokio::main]
|
||||||
@ -53,11 +54,29 @@ use serde::{Deserialize, Serialize};
|
|||||||
/// client.logout().await.unwrap();
|
/// client.logout().await.unwrap();
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub type EppHostDelete = EppObject<Command<HostDelete>>;
|
pub type EppHostDelete = EppObject<Command<HostDeleteRequest>>;
|
||||||
|
|
||||||
|
impl EppHostDelete {
|
||||||
|
/// Creates a new EppObject for host delete corresponding to the <epp> tag in EPP XML
|
||||||
|
pub fn new(name: &str, client_tr_id: &str) -> EppHostDelete {
|
||||||
|
EppObject::build(Command::<HostDeleteRequest>::new(
|
||||||
|
HostDeleteRequest {
|
||||||
|
host: HostDeleteRequestData {
|
||||||
|
xmlns: EPP_HOST_XMLNS.to_string(),
|
||||||
|
name: name.into(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
client_tr_id,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Type that represents the <epp> tag for the EPP XML host delete response
|
||||||
|
pub type EppHostDeleteResponse = EppCommandResponse;
|
||||||
|
|
||||||
/// Type for data under the host <delete> tag
|
/// Type for data under the host <delete> tag
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct HostDeleteData {
|
pub struct HostDeleteRequestData {
|
||||||
/// XML namespace for host commands
|
/// XML namespace for host commands
|
||||||
#[serde(rename = "xmlns:host", alias = "xmlns")]
|
#[serde(rename = "xmlns:host", alias = "xmlns")]
|
||||||
xmlns: String,
|
xmlns: String,
|
||||||
@ -69,23 +88,8 @@ pub struct HostDeleteData {
|
|||||||
#[derive(Serialize, Deserialize, Debug, ElementName)]
|
#[derive(Serialize, Deserialize, Debug, ElementName)]
|
||||||
#[element_name(name = "delete")]
|
#[element_name(name = "delete")]
|
||||||
/// Type for EPP XML <delete> command for hosts
|
/// Type for EPP XML <delete> command for hosts
|
||||||
pub struct HostDelete {
|
pub struct HostDeleteRequest {
|
||||||
/// The instance holding the data for the host to be deleted
|
/// The instance holding the data for the host to be deleted
|
||||||
#[serde(rename = "host:delete", alias = "delete")]
|
#[serde(rename = "host:delete", alias = "delete")]
|
||||||
host: HostDeleteData,
|
host: HostDeleteRequestData,
|
||||||
}
|
|
||||||
|
|
||||||
impl EppHostDelete {
|
|
||||||
/// Creates a new EppObject for host delete corresponding to the <epp> tag in EPP XML
|
|
||||||
pub fn new(name: &str, client_tr_id: &str) -> EppHostDelete {
|
|
||||||
EppObject::build(Command::<HostDelete>::new(
|
|
||||||
HostDelete {
|
|
||||||
host: HostDeleteData {
|
|
||||||
xmlns: EPP_HOST_XMLNS.to_string(),
|
|
||||||
name: name.into(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
client_tr_id,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -29,6 +29,7 @@ mod response {
|
|||||||
use crate::epp::*;
|
use crate::epp::*;
|
||||||
use crate::host::check::EppHostCheckResponse;
|
use crate::host::check::EppHostCheckResponse;
|
||||||
use crate::host::create::EppHostCreateResponse;
|
use crate::host::create::EppHostCreateResponse;
|
||||||
|
use crate::host::delete::EppHostDeleteResponse;
|
||||||
|
|
||||||
const SVTRID: &str = "RO-6879-1627224678242975";
|
const SVTRID: &str = "RO-6879-1627224678242975";
|
||||||
const SUCCESS_MSG: &str = "Command completed successfully";
|
const SUCCESS_MSG: &str = "Command completed successfully";
|
||||||
|
@ -32,6 +32,7 @@ mod request {
|
|||||||
use crate::epp::*;
|
use crate::epp::*;
|
||||||
use crate::host::check::EppHostCheck;
|
use crate::host::check::EppHostCheck;
|
||||||
use crate::host::create::EppHostCreate;
|
use crate::host::create::EppHostCreate;
|
||||||
|
use crate::host::delete::EppHostDelete;
|
||||||
use chrono::{DateTime, NaiveDate};
|
use chrono::{DateTime, NaiveDate};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user