Use &'static str for namespace URLs in serialize types

This commit is contained in:
Dirkjan Ochtman 2021-12-14 09:52:08 +01:00 committed by masalachai
parent b0595511e4
commit a5f57fa836
20 changed files with 44 additions and 44 deletions

View File

@ -15,7 +15,7 @@ impl Transaction<NoExtension> for ContactCheck {}
pub struct ContactList { pub struct ContactList {
/// The XML namespace for the contact &lt;check&gt; /// The XML namespace for the contact &lt;check&gt;
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: String, xmlns: &'static str,
/// The list of contact ids to check for availability /// The list of contact ids to check for availability
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
pub contact_ids: Vec<StringValue>, pub contact_ids: Vec<StringValue>,
@ -38,7 +38,7 @@ impl ContactCheck {
Self { Self {
list: ContactList { list: ContactList {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
contact_ids, contact_ids,
}, },
} }

View File

@ -19,7 +19,7 @@ impl Command for ContactCreate {
pub struct Contact { pub struct Contact {
/// XML namespace for contact commands /// XML namespace for contact commands
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: String, xmlns: &'static str,
/// Contact &lt;id&gt; tag /// Contact &lt;id&gt; tag
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue,
@ -58,7 +58,7 @@ impl ContactCreate {
) -> Self { ) -> Self {
Self { Self {
contact: Contact { contact: Contact {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
id: id.into(), id: id.into(),
postal_info, postal_info,
voice, voice,

View File

@ -17,7 +17,7 @@ impl Command for ContactDelete {
pub struct ContactDeleteRequestData { pub struct ContactDeleteRequestData {
/// XML namespace for the &lt;delete&gt; command for contacts /// XML namespace for the &lt;delete&gt; command for contacts
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: String, xmlns: &'static str,
/// The id of the contact to be deleted /// The id of the contact to be deleted
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue,
@ -35,7 +35,7 @@ impl ContactDelete {
pub fn new(id: &str) -> ContactDelete { pub fn new(id: &str) -> ContactDelete {
Self { Self {
contact: ContactDeleteRequestData { contact: ContactDeleteRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
id: id.into(), id: id.into(),
}, },
} }

View File

@ -19,7 +19,7 @@ impl Command for ContactInfo {
pub struct ContactInfoRequestData { pub struct ContactInfoRequestData {
/// XML namespace for contact commands /// XML namespace for contact commands
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: String, xmlns: &'static str,
/// The contact id for the info command /// The contact id for the info command
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue,
@ -40,7 +40,7 @@ impl ContactInfo {
pub fn new(id: &str, auth_password: &str) -> ContactInfo { pub fn new(id: &str, auth_password: &str) -> ContactInfo {
Self { Self {
info: ContactInfoRequestData { info: ContactInfoRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
id: id.into(), id: id.into(),
auth_info: ContactAuthInfo::new(auth_password), auth_info: ContactAuthInfo::new(auth_password),
}, },

View File

@ -16,7 +16,7 @@ impl ContactUpdate {
pub fn new(id: &str) -> ContactUpdate { pub fn new(id: &str) -> ContactUpdate {
Self { Self {
contact: ContactUpdateRequestData { contact: ContactUpdateRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
id: id.into(), id: id.into(),
add_statuses: None, add_statuses: None,
remove_statuses: None, remove_statuses: None,
@ -86,7 +86,7 @@ pub struct StatusList {
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
pub struct ContactUpdateRequestData { pub struct ContactUpdateRequestData {
#[serde(rename = "xmlns:contact")] #[serde(rename = "xmlns:contact")]
xmlns: String, xmlns: &'static str,
#[serde(rename = "contact:id")] #[serde(rename = "contact:id")]
id: StringValue, id: StringValue,
#[serde(rename = "contact:add")] #[serde(rename = "contact:add")]

View File

@ -16,7 +16,7 @@ impl DomainCheck {
pub fn new(domains: Vec<&str>) -> Self { pub fn new(domains: Vec<&str>) -> Self {
Self { Self {
list: DomainList { list: DomainList {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
domains: domains domains: domains
.into_iter() .into_iter()
.map(|d| d.into()) .map(|d| d.into())
@ -33,7 +33,7 @@ impl DomainCheck {
pub struct DomainList { pub struct DomainList {
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
/// XML namespace for domain commands /// XML namespace for domain commands
pub xmlns: String, pub xmlns: &'static str,
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
/// List of domains to be checked for availability /// List of domains to be checked for availability
pub domains: Vec<StringValue>, pub domains: Vec<StringValue>,

View File

@ -20,7 +20,7 @@ impl Command for DomainCreate {
pub struct DomainCreateRequestData { pub struct DomainCreateRequestData {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
pub xmlns: String, pub xmlns: &'static str,
/// The domain name /// The domain name
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
pub name: StringValue, pub name: StringValue,
@ -63,7 +63,7 @@ impl DomainCreate {
) -> Self { ) -> Self {
Self { Self {
domain: DomainCreateRequestData { domain: DomainCreateRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
period: Period::new(period), period: Period::new(period),
ns, ns,

View File

@ -16,7 +16,7 @@ impl DomainDelete {
pub fn new(name: &str) -> Self { pub fn new(name: &str) -> Self {
Self { Self {
domain: DomainDeleteRequestData { domain: DomainDeleteRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
}, },
} }
@ -28,7 +28,7 @@ impl DomainDelete {
pub struct DomainDeleteRequestData { pub struct DomainDeleteRequestData {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: String, xmlns: &'static str,
/// The domain to be deleted /// The domain to be deleted
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
name: StringValue, name: StringValue,

View File

@ -16,7 +16,7 @@ impl DomainInfo {
pub fn new(name: &str, auth_password: Option<&str>) -> Self { pub fn new(name: &str, auth_password: Option<&str>) -> Self {
Self { Self {
info: DomainInfoRequestData { info: DomainInfoRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
domain: Domain { domain: Domain {
hosts: "all".to_string(), hosts: "all".to_string(),
name: name.to_string(), name: name.to_string(),
@ -46,7 +46,7 @@ pub struct Domain {
pub struct DomainInfoRequestData { pub struct DomainInfoRequestData {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: String, xmlns: &'static str,
/// The data for the domain to be queried /// The data for the domain to be queried
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
domain: Domain, domain: Domain,

View File

@ -18,7 +18,7 @@ impl DomainRenew {
let exp_date_str = current_expiry_date.format("%Y-%m-%d").to_string().into(); let exp_date_str = current_expiry_date.format("%Y-%m-%d").to_string().into();
Self { Self {
domain: DomainRenewRequestData { domain: DomainRenewRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
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),
@ -34,7 +34,7 @@ impl DomainRenew {
pub struct DomainRenewRequestData { pub struct DomainRenewRequestData {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: String, xmlns: &'static str,
/// The name of the domain to be renewed /// The name of the domain to be renewed
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
name: StringValue, name: StringValue,

View File

@ -17,7 +17,7 @@ impl DomainTransfer {
Self { Self {
operation: "request".to_string(), operation: "request".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
period: years.map(Period::new), period: years.map(Period::new),
auth_info: Some(DomainAuthInfo::new(auth_password)), auth_info: Some(DomainAuthInfo::new(auth_password)),
@ -29,7 +29,7 @@ impl DomainTransfer {
Self { Self {
operation: "query".to_string(), operation: "query".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: Some(DomainAuthInfo::new(auth_password)), auth_info: Some(DomainAuthInfo::new(auth_password)),
@ -41,7 +41,7 @@ impl DomainTransfer {
Self { Self {
operation: "approve".to_string(), operation: "approve".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: None, auth_info: None,
@ -53,7 +53,7 @@ impl DomainTransfer {
Self { Self {
operation: "reject".to_string(), operation: "reject".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: None, auth_info: None,
@ -65,7 +65,7 @@ impl DomainTransfer {
Self { Self {
operation: "cancel".to_string(), operation: "cancel".to_string(),
domain: DomainTransferReqData { domain: DomainTransferReqData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
period: None, period: None,
auth_info: None, auth_info: None,
@ -81,7 +81,7 @@ impl DomainTransfer {
pub struct DomainTransferReqData { pub struct DomainTransferReqData {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: String, xmlns: &'static str,
/// The name of the domain under transfer /// The name of the domain under transfer
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
name: StringValue, name: StringValue,

View File

@ -19,7 +19,7 @@ impl DomainUpdate {
pub fn new(name: &str) -> Self { pub fn new(name: &str) -> Self {
Self { Self {
domain: DomainUpdateRequestData { domain: DomainUpdateRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
add: None, add: None,
remove: None, remove: None,
@ -75,7 +75,7 @@ pub struct DomainAddRemove {
pub struct DomainUpdateRequestData { pub struct DomainUpdateRequestData {
/// XML namespace for domain commands /// XML namespace for domain commands
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
pub xmlns: String, pub xmlns: &'static str,
/// The name of the domain to update /// The name of the domain to update
#[serde(rename = "domain:name")] #[serde(rename = "domain:name")]
pub name: StringValue, pub name: StringValue,

View File

@ -63,7 +63,7 @@ impl Update {
pub fn new(expiration: GMonthDay) -> Self { pub fn new(expiration: GMonthDay) -> Self {
Self { Self {
data: UpdateData { data: UpdateData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
exp: expiration.to_string().into(), exp: expiration.to_string().into(),
}, },
} }
@ -81,7 +81,7 @@ pub struct Update {
pub struct UpdateData { pub struct UpdateData {
/// XML namespace for the consolidate extension /// XML namespace for the consolidate extension
#[serde(rename = "xmlns:sync")] #[serde(rename = "xmlns:sync")]
pub xmlns: String, pub xmlns: &'static str,
/// The expiry date of the domain /// The expiry date of the domain
#[serde(rename = "sync:expMonthDay")] #[serde(rename = "sync:expMonthDay")]
pub exp: StringValue, pub exp: StringValue,

View File

@ -24,7 +24,7 @@ impl RgpRestoreReport {
let statements = statements.iter().map(|&s| s.into()).collect(); let statements = statements.iter().map(|&s| s.into()).collect();
RgpRestoreReport { RgpRestoreReport {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
restore: RgpRestoreReportSection { restore: RgpRestoreReportSection {
op: "report".to_string(), op: "report".to_string(),
report: RgpRestoreReportSectionData { report: RgpRestoreReportSectionData {
@ -90,7 +90,7 @@ pub struct RgpRestoreReportSection {
pub struct RgpRestoreReport { pub struct RgpRestoreReport {
/// XML namespace for the RGP restore extension /// XML namespace for the RGP restore extension
#[serde(rename = "xmlns:rgp")] #[serde(rename = "xmlns:rgp")]
xmlns: String, xmlns: &'static str,
/// The object holding the list of domains to be checked /// The object holding the list of domains to be checked
#[serde(rename = "rgp:restore")] #[serde(rename = "rgp:restore")]
restore: RgpRestoreReportSection, restore: RgpRestoreReportSection,

View File

@ -31,7 +31,7 @@ pub struct RgpRestoreRequestData {
pub struct RgpRestoreRequest { pub struct RgpRestoreRequest {
/// XML namespace for the RGP restore extension /// XML namespace for the RGP restore extension
#[serde(rename = "xmlns:rgp")] #[serde(rename = "xmlns:rgp")]
xmlns: String, xmlns: &'static str,
/// The object holding the list of domains to be checked /// The object holding the list of domains to be checked
#[serde(rename = "rgp:restore")] #[serde(rename = "rgp:restore")]
restore: RgpRestoreRequestData, restore: RgpRestoreRequestData,
@ -40,7 +40,7 @@ pub struct RgpRestoreRequest {
impl Default for RgpRestoreRequest { impl Default for RgpRestoreRequest {
fn default() -> Self { fn default() -> Self {
Self { Self {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
restore: RgpRestoreRequestData { restore: RgpRestoreRequestData {
op: "request".to_string(), op: "request".to_string(),
}, },

View File

@ -20,7 +20,7 @@ impl HostCheck {
Self { Self {
list: HostList { list: HostList {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
hosts, hosts,
}, },
} }
@ -34,7 +34,7 @@ impl HostCheck {
pub struct HostList { pub struct HostList {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: String, xmlns: &'static str,
/// List of hosts to be checked for availability /// List of hosts to be checked for availability
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
pub hosts: Vec<StringValue>, pub hosts: Vec<StringValue>,

View File

@ -16,7 +16,7 @@ impl HostCreate {
pub fn new(host: &str, addresses: Vec<HostAddr>) -> Self { pub fn new(host: &str, addresses: Vec<HostAddr>) -> Self {
Self { Self {
host: HostCreateRequestData { host: HostCreateRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: host.into(), name: host.into(),
addresses: Some(addresses), addresses: Some(addresses),
}, },
@ -31,7 +31,7 @@ impl HostCreate {
pub struct HostCreateRequestData { pub struct HostCreateRequestData {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: String, xmlns: &'static str,
/// The name of the host to be created /// The name of the host to be created
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
pub name: StringValue, pub name: StringValue,

View File

@ -16,7 +16,7 @@ impl HostDelete {
pub fn new(name: &str) -> Self { pub fn new(name: &str) -> Self {
Self { Self {
host: HostDeleteRequestData { host: HostDeleteRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
}, },
} }
@ -28,7 +28,7 @@ impl HostDelete {
pub struct HostDeleteRequestData { pub struct HostDeleteRequestData {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: String, xmlns: &'static str,
/// The host to be deleted /// The host to be deleted
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
name: StringValue, name: StringValue,

View File

@ -16,7 +16,7 @@ impl HostInfo {
pub fn new(name: &str) -> Self { pub fn new(name: &str) -> Self {
Self { Self {
info: HostInfoRequestData { info: HostInfoRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
}, },
} }
@ -30,7 +30,7 @@ impl HostInfo {
pub struct HostInfoRequestData { pub struct HostInfoRequestData {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: String, xmlns: &'static str,
/// The name of the host to be queried /// The name of the host to be queried
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
name: StringValue, name: StringValue,

View File

@ -16,7 +16,7 @@ impl HostUpdate {
pub fn new(name: &str) -> Self { pub fn new(name: &str) -> Self {
Self { Self {
host: HostUpdateRequestData { host: HostUpdateRequestData {
xmlns: XMLNS.to_string(), xmlns: XMLNS,
name: name.into(), name: name.into(),
add: None, add: None,
remove: None, remove: None,
@ -65,7 +65,7 @@ pub struct HostAddRemove {
pub struct HostUpdateRequestData { pub struct HostUpdateRequestData {
/// XML namespace for host commands /// XML namespace for host commands
#[serde(rename = "xmlns:host")] #[serde(rename = "xmlns:host")]
xmlns: String, xmlns: &'static str,
/// The name of the host /// The name of the host
#[serde(rename = "host:name")] #[serde(rename = "host:name")]
name: StringValue, name: StringValue,