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
use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::contact::EPP_CONTACT_XMLNS;
use crate::request::{EppExtension, EppRequest};
use serde::{Deserialize, Serialize};
@ -82,7 +82,7 @@ impl<E: EppExtension> ContactCheck<E> {
ContactCheck {
request: ContactCheckRequest {
list: ContactList {
xmlns: EPP_CONTACT_XMLNS.to_string(),
xmlns: XMLNS.to_string(),
contact_ids,
},
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
use epp_client_macros::*;
use super::EPP_DOMAIN_XMLNS;
use super::XMLNS;
use crate::common::{
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 domain_create = DomainCreateRequest {
domain: DomainCreateRequestData {
xmlns: EPP_DOMAIN_XMLNS.to_string(),
xmlns: XMLNS.to_string(),
name: name.into(),
period: Period::new(period),
ns,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -119,7 +119,7 @@ pub mod contact {
pub mod info;
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 {
@ -132,7 +132,7 @@ pub mod domain {
pub mod transfer;
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 {
@ -142,7 +142,7 @@ pub mod host {
pub mod info;
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 {

View File

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