Refactor xml into root and disperse const values to relevant modules
This commit is contained in:
parent
8babf770c6
commit
5a480317e5
|
@ -56,7 +56,7 @@ use std::collections::HashMap;
|
|||
use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
use epp_client::EppClient;
|
||||
use epp_client::epp::{EppDomainCheck, EppDomainCheckResponse};
|
||||
use epp_client::epp::generate_client_tr_id;
|
||||
use epp_client::generate_client_tr_id;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
|
|
@ -56,7 +56,7 @@ use std::collections::HashMap;
|
|||
use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
use epp_client::EppClient;
|
||||
use epp_client::epp::{EppDomainCheck, EppDomainCheckResponse};
|
||||
use epp_client::epp::generate_client_tr_id;
|
||||
use epp_client::generate_client_tr_id;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//! use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
//! use epp_client::EppClient;
|
||||
//! use epp_client::domain::check::{EppDomainCheck, EppDomainCheckResponse};
|
||||
//! use epp_client::epp::generate_client_tr_id;
|
||||
//! use epp_client::generate_client_tr_id;
|
||||
//!
|
||||
//! #[tokio::main]
|
||||
//! async fn main() {
|
||||
|
@ -51,12 +51,12 @@ use std::{error::Error, fmt::Debug};
|
|||
|
||||
use crate::config::EppClientConfig;
|
||||
use crate::connection::registry::{epp_connect, EppConnection};
|
||||
use crate::epp::xml::EppXml;
|
||||
use crate::error;
|
||||
use crate::request::{generate_client_tr_id, EppHello, EppLogin, EppLogout};
|
||||
use crate::response::{
|
||||
EppCommandResponse, EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
||||
};
|
||||
use crate::xml::EppXml;
|
||||
/// Instances of the EppClient type are used to transact with the registry.
|
||||
/// Once initialized, the EppClient instance can serialize EPP requests to XML and send them
|
||||
/// to the registry and deserialize the XML responses from the registry to local types
|
||||
|
|
|
@ -3,3 +3,5 @@ pub mod create;
|
|||
pub mod delete;
|
||||
pub mod info;
|
||||
pub mod update;
|
||||
|
||||
pub const EPP_CONTACT_XMLNS: &str = "urn:ietf:params:xml:ns:contact-1.0";
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::contact::EPP_CONTACT_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Type that represents the <epp> request for contact <check> command
|
||||
|
@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::contact::check::{EppContactCheck, EppContactCheckResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ContactAuthInfo, ElementName, EppObject, Phone, PostalInfo, StringValue};
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::contact::EPP_CONTACT_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::EppClient;
|
||||
/// use epp_client::common::{Address, Phone, PostalInfo};
|
||||
/// use epp_client::contact::create::{EppContactCreate, EppContactCreateResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::contact::EPP_CONTACT_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::contact::delete::{EppContactDelete, EppContactDeleteResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -5,7 +5,7 @@ use epp_client_macros::*;
|
|||
use crate::common::{
|
||||
ContactAuthInfo, ContactStatus, ElementName, EppObject, Phone, PostalInfo, StringValue,
|
||||
};
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::contact::EPP_CONTACT_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -20,7 +20,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::contact::info::{EppContactInfo, EppContactInfoResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::common::{
|
|||
ContactAuthInfo, ContactStatus, ElementName, EppObject, Phone, PostalInfo, StringValue,
|
||||
};
|
||||
use crate::contact::info::EppContactInfoResponse;
|
||||
use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||
use crate::contact::EPP_CONTACT_XMLNS;
|
||||
use crate::error;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
|
@ -22,7 +22,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::contact::update::{EppContactUpdate, EppContactUpdateResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
/// use epp_client::common::ContactStatus;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
|
|
|
@ -6,3 +6,5 @@ pub mod renew;
|
|||
pub mod rgp;
|
||||
pub mod transfer;
|
||||
pub mod update;
|
||||
|
||||
pub const EPP_DOMAIN_XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0";
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
use epp_client_macros::*;
|
||||
|
||||
use super::EPP_DOMAIN_XMLNS;
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::check::{EppDomainCheck, EppDomainCheckResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
use epp_client_macros::*;
|
||||
|
||||
use super::EPP_DOMAIN_XMLNS;
|
||||
use crate::common::{
|
||||
DomainAuthInfo, DomainContact, ElementName, EppObject, HostAttr, HostAttrList, HostList,
|
||||
HostObjList, Period, StringValue,
|
||||
};
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::EppClient;
|
||||
/// use epp_client::common::DomainContact;
|
||||
/// use epp_client::domain::create::{EppDomainCreate, EppDomainCreateResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
use epp_client_macros::*;
|
||||
|
||||
use super::EPP_DOMAIN_XMLNS;
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::delete::{EppDomainDelete, EppDomainDeleteResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
use epp_client_macros::*;
|
||||
|
||||
use super::EPP_DOMAIN_XMLNS;
|
||||
use crate::common::{
|
||||
DomainAuthInfo, DomainContact, DomainStatus, ElementName, EppObject, HostAttr, StringValue,
|
||||
};
|
||||
use crate::domain::rgp::request::RgpRequestResponse;
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponseWithExtension;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::info::{EppDomainInfo, EppDomainInfoResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
use epp_client_macros::*;
|
||||
|
||||
use super::EPP_DOMAIN_XMLNS;
|
||||
use crate::common::{ElementName, EppObject, Period, StringValue};
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use chrono::NaiveDate;
|
||||
|
@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::renew::{EppDomainRenew, EppDomainRenewResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -2,3 +2,5 @@
|
|||
|
||||
pub mod report;
|
||||
pub mod request;
|
||||
|
||||
pub const EPP_DOMAIN_RGP_EXT_XMLNS: &str = "urn:ietf:params:xml:ns:rgp-1.0";
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, Extension, StringValue};
|
||||
use crate::domain::rgp::EPP_DOMAIN_RGP_EXT_XMLNS;
|
||||
use crate::domain::update::{DomainChangeInfo, DomainUpdateRequest, DomainUpdateRequestData};
|
||||
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
||||
use crate::domain::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::CommandWithExtension;
|
||||
use crate::response::EppCommandResponse;
|
||||
use chrono::{DateTime, SecondsFormat, Utc};
|
||||
|
@ -20,7 +21,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::rgp::report::{EppDomainRgpRestoreReport, EppDomainRgpRestoreReportResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
/// use chrono::{DateTime, NaiveDate};
|
||||
/// use std::str::FromStr;
|
||||
///
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EmptyTag, EppObject, Extension};
|
||||
use crate::domain::rgp::EPP_DOMAIN_RGP_EXT_XMLNS;
|
||||
use crate::domain::update::{DomainChangeInfo, DomainUpdateRequest, DomainUpdateRequestData};
|
||||
use crate::epp::xml::{EPP_DOMAIN_RGP_EXT_XMLNS, EPP_DOMAIN_XMLNS};
|
||||
use crate::domain::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::CommandWithExtension;
|
||||
use crate::response::CommandResponseWithExtension;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -19,7 +20,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::rgp::request::{EppDomainRgpRestoreRequest, EppDomainRgpRestoreRequestResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
use epp_client_macros::*;
|
||||
|
||||
use super::EPP_DOMAIN_XMLNS;
|
||||
use crate::common::{DomainAuthInfo, ElementName, EppObject, Period, StringValue};
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::{CommandResponse, EppCommandResponse};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::transfer::{EppDomainTransferRequest, EppDomainTransferRequestResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
@ -68,7 +68,7 @@ pub type EppDomainTransferRequest = EppObject<Command<DomainTransferRequest>>;
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::transfer::{EppDomainTransferApprove, EppDomainTransferApproveResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
@ -118,7 +118,7 @@ pub type EppDomainTransferApprove = EppObject<Command<DomainTransferRequest>>;
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::transfer::{EppDomainTransferReject, EppDomainTransferRejectResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
@ -168,7 +168,7 @@ pub type EppDomainTransferReject = EppObject<Command<DomainTransferRequest>>;
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::transfer::{EppDomainTransferCancel, EppDomainTransferCancelResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
@ -218,7 +218,7 @@ pub type EppDomainTransferCancel = EppObject<Command<DomainTransferRequest>>;
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::domain::transfer::{EppDomainTransferQuery, EppDomainTransferQueryResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::common::{
|
|||
DomainAuthInfo, DomainContact, DomainStatus, ElementName, EppObject, HostList, StringValue,
|
||||
};
|
||||
|
||||
use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||
use super::EPP_DOMAIN_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::EppClient;
|
||||
/// use epp_client::common::{DomainStatus, DomainContact};
|
||||
/// use epp_client::domain::update::{EppDomainUpdate, EppDomainUpdateResponse, DomainAddRemove};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
//! Types for EPP requests and responses
|
||||
|
||||
pub mod xml;
|
||||
|
||||
pub use crate::connection::client::default_client_tr_id_fn as generate_client_tr_id;
|
|
@ -1,26 +0,0 @@
|
|||
//! Types to use in serialization to and deserialization from EPP XML
|
||||
|
||||
pub mod quick_xml;
|
||||
|
||||
use std::{error::Error, fmt::Debug};
|
||||
|
||||
use crate::error;
|
||||
|
||||
pub const EPP_XML_HEADER: &str = r#"<?xml version="1.0" encoding="UTF-8" standalone="no"?>"#;
|
||||
|
||||
pub const EPP_DOMAIN_XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0";
|
||||
pub const EPP_CONTACT_XMLNS: &str = "urn:ietf:params:xml:ns:contact-1.0";
|
||||
pub const EPP_HOST_XMLNS: &str = "urn:ietf:params:xml:ns:host-1.0";
|
||||
|
||||
pub const EPP_DOMAIN_RGP_EXT_XMLNS: &str = "urn:ietf:params:xml:ns:rgp-1.0";
|
||||
|
||||
pub const EPP_VERSION: &str = "1.0";
|
||||
pub const EPP_LANG: &str = "en";
|
||||
|
||||
/// Trait to be implemented by serializers. Currently the only included serializer is `quick-xml`
|
||||
pub trait EppXml {
|
||||
type Output: Debug;
|
||||
|
||||
fn serialize(&self) -> Result<String, Box<dyn Error>>;
|
||||
fn deserialize(epp_xml: &str) -> Result<Self::Output, error::Error>;
|
||||
}
|
|
@ -3,3 +3,5 @@ pub mod create;
|
|||
pub mod delete;
|
||||
pub mod info;
|
||||
pub mod update;
|
||||
|
||||
pub const EPP_HOST_XMLNS: &str = "urn:ietf:params:xml:ns:host-1.0";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::host::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::host::check::{EppHostCheck, EppHostCheckResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, HostAddr, StringValue};
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::host::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::EppClient;
|
||||
/// use epp_client::common::HostAddr;
|
||||
/// use epp_client::host::create::{EppHostCreate, EppHostCreateResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, StringValue};
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::host::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::host::delete::{EppHostDelete, EppHostDeleteResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, HostAddr, HostStatus, StringValue};
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::host::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::CommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::host::info::{EppHostInfo, EppHostInfoResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use epp_client_macros::*;
|
||||
|
||||
use crate::common::{ElementName, EppObject, HostAddr, HostStatus, StringValue};
|
||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||
use crate::host::EPP_HOST_XMLNS;
|
||||
use crate::request::Command;
|
||||
use crate::response::EppCommandResponse;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::EppClient;
|
||||
/// use epp_client::common::{HostAddr, HostStatus};
|
||||
/// use epp_client::host::update::{EppHostUpdate, EppHostUpdateResponse, HostAddRemove, HostChangeInfo};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
//! use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
//! use epp_client::EppClient;
|
||||
//! use epp_client::domain::check::{EppDomainCheck, EppDomainCheckResponse};
|
||||
//! use epp_client::epp::generate_client_tr_id;
|
||||
//! use epp_client::generate_client_tr_id;
|
||||
//!
|
||||
//! #[tokio::main]
|
||||
//! async fn main() {
|
||||
|
@ -105,13 +105,15 @@ pub mod config;
|
|||
pub mod connection;
|
||||
pub mod contact;
|
||||
pub mod domain;
|
||||
pub mod epp;
|
||||
pub mod error;
|
||||
pub mod host;
|
||||
pub mod message;
|
||||
pub mod request;
|
||||
pub mod response;
|
||||
pub mod xml;
|
||||
pub use connection::client::EppClient;
|
||||
|
||||
pub use crate::connection::client::default_client_tr_id_fn as generate_client_tr_id;
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
|
|
@ -16,7 +16,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::message::ack::{EppMessageAck, EppMessageAckResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||
/// use epp_client::EppClient;
|
||||
/// use epp_client::message::poll::{EppMessagePoll, EppMessagePollResponse};
|
||||
/// use epp_client::epp::generate_client_tr_id;
|
||||
/// use epp_client::generate_client_tr_id;
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
|
|
|
@ -9,10 +9,15 @@ use crate::{
|
|||
ElementName, EmptyTag, EppObject, Extension, Options, ServiceExtension, Services,
|
||||
StringValue,
|
||||
},
|
||||
epp::xml::{EPP_CONTACT_XMLNS, EPP_DOMAIN_XMLNS, EPP_HOST_XMLNS, EPP_LANG, EPP_VERSION},
|
||||
contact::EPP_CONTACT_XMLNS,
|
||||
domain::EPP_DOMAIN_XMLNS,
|
||||
host::EPP_HOST_XMLNS,
|
||||
};
|
||||
use epp_client_macros::*;
|
||||
|
||||
pub const EPP_VERSION: &str = "1.0";
|
||||
pub const EPP_LANG: &str = "en";
|
||||
|
||||
/// Type corresponding to the <command> tag in an EPP XML request
|
||||
/// without an <extension> tag
|
||||
pub type Command<T> = CommandWithExtension<T, EmptyTag>;
|
||||
|
|
|
@ -20,7 +20,6 @@ mod response {
|
|||
use crate::domain::transfer::EppDomainTransferRejectResponse;
|
||||
use crate::domain::transfer::EppDomainTransferRequestResponse;
|
||||
use crate::domain::update::EppDomainUpdateResponse;
|
||||
use crate::epp::xml::EppXml;
|
||||
use crate::host::check::EppHostCheckResponse;
|
||||
use crate::host::create::EppHostCreateResponse;
|
||||
use crate::host::delete::EppHostDeleteResponse;
|
||||
|
@ -33,6 +32,7 @@ mod response {
|
|||
use crate::response::{
|
||||
EppCommandResponseError, EppGreeting, EppLoginResponse, EppLogoutResponse,
|
||||
};
|
||||
use crate::xml::EppXml;
|
||||
|
||||
const SVTRID: &str = "RO-6879-1627224678242975";
|
||||
const SUCCESS_MSG: &str = "Command completed successfully";
|
||||
|
|
|
@ -27,7 +27,6 @@ mod request {
|
|||
use crate::domain::update::DomainAddRemove;
|
||||
use crate::domain::update::DomainChangeInfo;
|
||||
use crate::domain::update::EppDomainUpdate;
|
||||
use crate::epp::xml::EppXml;
|
||||
use crate::host::check::EppHostCheck;
|
||||
use crate::host::create::EppHostCreate;
|
||||
use crate::host::delete::EppHostDelete;
|
||||
|
@ -38,6 +37,7 @@ mod request {
|
|||
use crate::message::ack::EppMessageAck;
|
||||
use crate::message::poll::EppMessagePoll;
|
||||
use crate::request::{EppHello, EppLogin, EppLogout};
|
||||
use crate::xml::EppXml;
|
||||
use chrono::{DateTime, NaiveDate};
|
||||
use std::str::FromStr;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! XML serialization using the `quick-xml` library
|
||||
//! Types to use in serialization to and deserialization from EPP XML
|
||||
|
||||
use quick_xml::de::from_str;
|
||||
use quick_xml::se;
|
||||
|
@ -6,9 +6,10 @@ use serde::{de::DeserializeOwned, Serialize};
|
|||
use std::{error::Error, fmt::Debug};
|
||||
|
||||
use crate::common::{ElementName, EppObject};
|
||||
use crate::epp::xml::{EppXml, EPP_XML_HEADER};
|
||||
use crate::error;
|
||||
|
||||
pub const EPP_XML_HEADER: &str = r#"<?xml version="1.0" encoding="UTF-8" standalone="no"?>"#;
|
||||
|
||||
impl<T: Serialize + DeserializeOwned + ElementName + Debug> EppXml for EppObject<T> {
|
||||
type Output = EppObject<T>;
|
||||
|
||||
|
@ -34,3 +35,11 @@ impl<T: Serialize + DeserializeOwned + ElementName + Debug> EppXml for EppObject
|
|||
Ok(object)
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait to be implemented by serializers. Currently the only included serializer is `quick-xml`
|
||||
pub trait EppXml {
|
||||
type Output: Debug;
|
||||
|
||||
fn serialize(&self) -> Result<String, Box<dyn Error>>;
|
||||
fn deserialize(epp_xml: &str) -> Result<Self::Output, error::Error>;
|
||||
}
|
Loading…
Reference in New Issue