Simplify XMLNS constant names to reduce stuttering

Since these are mostly used within the relevant modules, there is not
much point in having a name that replicates the module path.
This commit is contained in:
Dirkjan Ochtman 2021-12-02 11:00:33 +01:00 committed by masalachai
parent ef25041cce
commit 716412bbcf
19 changed files with 45 additions and 47 deletions

View File

@ -3,8 +3,8 @@ use std::fmt::Debug;
/// Types for EPP contact check request /// Types for EPP contact check request
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue}; use crate::common::{ElementName, NoExtension, StringValue};
use crate::contact::EPP_CONTACT_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -82,7 +82,7 @@ impl<E: EppExtension> ContactCheck<E> {
ContactCheck { ContactCheck {
request: ContactCheckRequest { request: ContactCheckRequest {
list: ContactList { list: ContactList {
xmlns: EPP_CONTACT_XMLNS.to_string(), xmlns: XMLNS.to_string(),
contact_ids, contact_ids,
}, },
}, },

View File

@ -2,8 +2,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ContactAuthInfo, ElementName, NoExtension, Phone, PostalInfo, StringValue}; use crate::common::{ContactAuthInfo, ElementName, NoExtension, Phone, PostalInfo, StringValue};
use crate::contact::EPP_CONTACT_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -97,7 +97,7 @@ impl<E: EppExtension> ContactCreate<E> {
ContactCreate { ContactCreate {
request: ContactCreateRequest { request: ContactCreateRequest {
contact: Contact { contact: Contact {
xmlns: EPP_CONTACT_XMLNS.to_string(), xmlns: XMLNS.to_string(),
id: id.into(), id: id.into(),
postal_info, postal_info,
voice, voice,

View File

@ -2,8 +2,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue}; use crate::common::{ElementName, NoExtension, StringValue};
use crate::contact::EPP_CONTACT_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use crate::response::EppCommandResponse; use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -77,7 +77,7 @@ impl<E: EppExtension> ContactDelete<E> {
ContactDelete { ContactDelete {
request: ContactDeleteRequest { request: ContactDeleteRequest {
contact: ContactDeleteRequestData { contact: ContactDeleteRequestData {
xmlns: EPP_CONTACT_XMLNS.to_string(), xmlns: XMLNS.to_string(),
id: id.into(), id: id.into(),
}, },
}, },

View File

@ -2,10 +2,10 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ use crate::common::{
ContactAuthInfo, ContactStatus, ElementName, NoExtension, Phone, PostalInfo, StringValue, ContactAuthInfo, ContactStatus, ElementName, NoExtension, Phone, PostalInfo, StringValue,
}; };
use crate::contact::EPP_CONTACT_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -79,7 +79,7 @@ impl<E: EppExtension> ContactInfo<E> {
ContactInfo { ContactInfo {
request: ContactInfoRequest { request: ContactInfoRequest {
info: ContactInfoRequestData { info: ContactInfoRequestData {
xmlns: EPP_CONTACT_XMLNS.to_string(), xmlns: XMLNS.to_string(),
id: id.into(), id: id.into(),
auth_info: ContactAuthInfo::new(auth_password), auth_info: ContactAuthInfo::new(auth_password),
}, },

View File

@ -2,10 +2,10 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ use crate::common::{
ContactAuthInfo, ContactStatus, ElementName, NoExtension, Phone, PostalInfo, StringValue, ContactAuthInfo, ContactStatus, ElementName, NoExtension, Phone, PostalInfo, StringValue,
}; };
use crate::contact::EPP_CONTACT_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use crate::response::EppCommandResponse; use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -88,7 +88,7 @@ impl<E: EppExtension> ContactUpdate<E> {
ContactUpdate { ContactUpdate {
request: ContactUpdateRequest { request: ContactUpdateRequest {
contact: ContactUpdateRequestData { contact: ContactUpdateRequestData {
xmlns: EPP_CONTACT_XMLNS.to_string(), xmlns: XMLNS.to_string(),
id: id.into(), id: id.into(),
add_statuses: None, add_statuses: None,
remove_statuses: None, remove_statuses: None,

View File

@ -2,7 +2,7 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::EPP_DOMAIN_XMLNS; use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue}; use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -76,7 +76,7 @@ impl<E: EppExtension> DomainCheck<E> {
DomainCheck { DomainCheck {
request: DomainCheckRequest { request: DomainCheckRequest {
list: DomainList { list: DomainList {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
domains: domains domains: domains
.into_iter() .into_iter()
.map(|d| d.into()) .map(|d| d.into())

View File

@ -2,7 +2,7 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::EPP_DOMAIN_XMLNS; use super::XMLNS;
use crate::common::{ use crate::common::{
DomainAuthInfo, DomainContact, ElementName, HostList, NoExtension, Period, StringValue, DomainAuthInfo, DomainContact, ElementName, HostList, NoExtension, Period, StringValue,
}; };
@ -113,7 +113,7 @@ impl<E: EppExtension> DomainCreate<E> {
let registrant = registrant_id.map(|id| id.into()); let registrant = registrant_id.map(|id| id.into());
let domain_create = DomainCreateRequest { let domain_create = DomainCreateRequest {
domain: DomainCreateRequestData { domain: DomainCreateRequestData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
period: Period::new(period), period: Period::new(period),
ns, ns,

View File

@ -2,7 +2,7 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::EPP_DOMAIN_XMLNS; use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue}; use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use crate::response::EppCommandResponse; use crate::response::EppCommandResponse;
@ -75,7 +75,7 @@ impl<E: EppExtension> DomainDelete<E> {
DomainDelete { DomainDelete {
request: DomainDeleteRequest { request: DomainDeleteRequest {
domain: DomainDeleteRequestData { domain: DomainDeleteRequestData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
}, },
}, },

View File

@ -2,7 +2,7 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::EPP_DOMAIN_XMLNS; use super::XMLNS;
use crate::common::{ use crate::common::{
DomainAuthInfo, DomainContact, DomainStatus, ElementName, HostAttr, NoExtension, StringValue, DomainAuthInfo, DomainContact, DomainStatus, ElementName, HostAttr, NoExtension, StringValue,
}; };
@ -76,7 +76,7 @@ impl<E: EppExtension> DomainInfo<E> {
DomainInfo { DomainInfo {
request: DomainInfoRequest { request: DomainInfoRequest {
info: DomainInfoRequestData { info: DomainInfoRequestData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
domain: Domain { domain: Domain {
hosts: "all".to_string(), hosts: "all".to_string(),
name: name.to_string(), name: name.to_string(),

View File

@ -2,7 +2,7 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::EPP_DOMAIN_XMLNS; use super::XMLNS;
use crate::common::{ElementName, NoExtension, Period, StringValue}; use crate::common::{ElementName, NoExtension, Period, StringValue};
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use chrono::NaiveDate; use chrono::NaiveDate;
@ -81,7 +81,7 @@ impl<E: EppExtension> DomainRenew<E> {
DomainRenew { DomainRenew {
request: DomainRenewRequest { request: DomainRenewRequest {
domain: DomainRenewRequestData { domain: DomainRenewRequestData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
current_expiry_date: exp_date_str, current_expiry_date: exp_date_str,
period: Period::new(years), period: Period::new(years),

View File

@ -2,7 +2,7 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::EPP_DOMAIN_XMLNS; use super::XMLNS;
use crate::common::{DomainAuthInfo, ElementName, NoExtension, Period, StringValue}; use crate::common::{DomainAuthInfo, ElementName, NoExtension, Period, StringValue};
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use crate::response::EppCommandResponse; use crate::response::EppCommandResponse;
@ -138,7 +138,7 @@ impl<E: EppExtension> DomainTransferRequest<E> {
request: DomainTransferReq { request: DomainTransferReq {
operation: "request".to_string(), operation: "request".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
period: Some(Period::new(years)), period: Some(Period::new(years)),
auth_info: Some(DomainAuthInfo::new(auth_password)), auth_info: Some(DomainAuthInfo::new(auth_password)),
@ -211,7 +211,7 @@ impl<E: EppExtension> DomainTransferApprove<E> {
request: DomainTransferReq { request: DomainTransferReq {
operation: "approve".to_string(), operation: "approve".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: None, auth_info: None,
@ -284,7 +284,7 @@ impl<E: EppExtension> DomainTransferReject<E> {
request: DomainTransferReq { request: DomainTransferReq {
operation: "reject".to_string(), operation: "reject".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: None, auth_info: None,
@ -357,7 +357,7 @@ impl<E: EppExtension> DomainTransferCancel<E> {
request: DomainTransferReq { request: DomainTransferReq {
operation: "cancel".to_string(), operation: "cancel".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: None, auth_info: None,
@ -430,7 +430,7 @@ impl<E: EppExtension> DomainTransferQuery<E> {
request: DomainTransferReq { request: DomainTransferReq {
operation: "query".to_string(), operation: "query".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: Some(DomainAuthInfo::new(auth_password)), auth_info: Some(DomainAuthInfo::new(auth_password)),

View File

@ -10,7 +10,7 @@ use crate::{
request::{EppExtension, EppRequest}, request::{EppExtension, EppRequest},
}; };
use super::EPP_DOMAIN_XMLNS; use super::XMLNS;
use crate::response::EppCommandResponse; use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -108,7 +108,7 @@ impl<E: EppExtension> DomainUpdate<E> {
DomainUpdate { DomainUpdate {
request: DomainUpdateRequest { request: DomainUpdateRequest {
domain: DomainUpdateRequestData { domain: DomainUpdateRequestData {
xmlns: EPP_DOMAIN_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
add: None, add: None,
remove: None, remove: None,

View File

@ -4,8 +4,8 @@ use std::fmt::Debug;
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue}; use crate::common::{ElementName, NoExtension, StringValue};
use crate::host::EPP_HOST_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -80,7 +80,7 @@ impl<E: EppExtension> HostCheck<E> {
HostCheck { HostCheck {
request: HostCheckRequest { request: HostCheckRequest {
list: HostList { list: HostList {
xmlns: EPP_HOST_XMLNS.to_string(), xmlns: XMLNS.to_string(),
hosts, hosts,
}, },
}, },

View File

@ -2,8 +2,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, HostAddr, NoExtension, StringValue}; use crate::common::{ElementName, HostAddr, NoExtension, StringValue};
use crate::host::EPP_HOST_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -81,7 +81,7 @@ impl<E: EppExtension> HostCreate<E> {
HostCreate { HostCreate {
request: HostCreateRequest { request: HostCreateRequest {
host: HostCreateRequestData { host: HostCreateRequestData {
xmlns: EPP_HOST_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: host.into(), name: host.into(),
addresses: Some(addresses), addresses: Some(addresses),
}, },

View File

@ -2,8 +2,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue}; use crate::common::{ElementName, NoExtension, StringValue};
use crate::host::EPP_HOST_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use crate::response::EppCommandResponse; use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -75,7 +75,7 @@ impl<E: EppExtension> HostDelete<E> {
HostDelete { HostDelete {
request: HostDeleteRequest { request: HostDeleteRequest {
host: HostDeleteRequestData { host: HostDeleteRequestData {
xmlns: EPP_HOST_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
}, },
}, },

View File

@ -2,8 +2,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, HostAddr, HostStatus, NoExtension, StringValue}; use crate::common::{ElementName, HostAddr, HostStatus, NoExtension, StringValue};
use crate::host::EPP_HOST_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -74,7 +74,7 @@ impl<E: EppExtension> HostInfo<E> {
HostInfo { HostInfo {
request: HostInfoRequest { request: HostInfoRequest {
info: HostInfoRequestData { info: HostInfoRequestData {
xmlns: EPP_HOST_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
}, },
}, },

View File

@ -2,8 +2,8 @@
use epp_client_macros::*; use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, HostAddr, HostStatus, NoExtension, StringValue}; use crate::common::{ElementName, HostAddr, HostStatus, NoExtension, StringValue};
use crate::host::EPP_HOST_XMLNS;
use crate::request::{EppExtension, EppRequest}; use crate::request::{EppExtension, EppRequest};
use crate::response::EppCommandResponse; use crate::response::EppCommandResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -97,7 +97,7 @@ impl<E: EppExtension> HostUpdate<E> {
HostUpdate { HostUpdate {
request: HostUpdateRequest { request: HostUpdateRequest {
host: HostUpdateRequestData { host: HostUpdateRequestData {
xmlns: EPP_HOST_XMLNS.to_string(), xmlns: XMLNS.to_string(),
name: name.into(), name: name.into(),
add: None, add: None,
remove: None, remove: None,

View File

@ -119,7 +119,7 @@ pub mod contact {
pub mod info; pub mod info;
pub mod update; pub mod update;
pub const EPP_CONTACT_XMLNS: &str = "urn:ietf:params:xml:ns:contact-1.0"; pub const XMLNS: &str = "urn:ietf:params:xml:ns:contact-1.0";
} }
pub mod domain { pub mod domain {
@ -132,7 +132,7 @@ pub mod domain {
pub mod transfer; pub mod transfer;
pub mod update; pub mod update;
pub const EPP_DOMAIN_XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0"; pub const XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0";
} }
pub mod host { pub mod host {
@ -142,7 +142,7 @@ pub mod host {
pub mod info; pub mod info;
pub mod update; pub mod update;
pub const EPP_HOST_XMLNS: &str = "urn:ietf:params:xml:ns:host-1.0"; pub const XMLNS: &str = "urn:ietf:params:xml:ns:host-1.0";
} }
pub mod message { pub mod message {

View File

@ -5,9 +5,7 @@ use serde::{Deserialize, Serialize};
use crate::{ use crate::{
common::{ElementName, NoExtension, Options, ServiceExtension, Services, StringValue}, common::{ElementName, NoExtension, Options, ServiceExtension, Services, StringValue},
contact::EPP_CONTACT_XMLNS, contact, domain, host,
domain::EPP_DOMAIN_XMLNS,
host::EPP_HOST_XMLNS,
request::{EppExtension, EppRequest, EPP_LANG, EPP_VERSION}, request::{EppExtension, EppRequest, EPP_LANG, EPP_VERSION},
response::EppCommandResponse, response::EppCommandResponse,
}; };
@ -47,9 +45,9 @@ impl<E: EppExtension> Login<E> {
}, },
services: Services { services: Services {
obj_uris: vec![ obj_uris: vec![
EPP_HOST_XMLNS.into(), host::XMLNS.into(),
EPP_CONTACT_XMLNS.into(), contact::XMLNS.into(),
EPP_DOMAIN_XMLNS.into(), domain::XMLNS.into(),
], ],
svc_ext: Some(ServiceExtension { ext_uris }), svc_ext: Some(ServiceExtension { ext_uris }),
}, },