Share the Available type across domain and host
This commit is contained in:
parent
a6dfe70361
commit
999149ba31
|
@ -39,6 +39,17 @@ impl Extension for NoExtension {
|
|||
type Response = NoExtension;
|
||||
}
|
||||
|
||||
/// Type that represents the <name> tag for host check response
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct Available {
|
||||
/// The resource name
|
||||
#[serde(rename = "$value")]
|
||||
pub name: StringValue<'static>,
|
||||
/// The resource (un)availability
|
||||
#[serde(rename = "avail")]
|
||||
pub available: bool,
|
||||
}
|
||||
|
||||
/// The <option> type in EPP XML login requests
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
#[serde(rename = "options")]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Types for EPP domain check request
|
||||
|
||||
use super::XMLNS;
|
||||
use crate::common::{NoExtension, StringValue};
|
||||
use crate::common::{NoExtension, StringValue, Available};
|
||||
use crate::request::{Command, Transaction};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -46,23 +46,12 @@ pub struct DomainCheck<'a> {
|
|||
|
||||
// Response
|
||||
|
||||
/// Type that represents the <name> tag for domain check response
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct DomainAvailable {
|
||||
/// The domain name
|
||||
#[serde(rename = "$value")]
|
||||
pub name: StringValue<'static>,
|
||||
/// The domain (un)availability
|
||||
#[serde(rename = "avail")]
|
||||
pub available: bool,
|
||||
}
|
||||
|
||||
/// Type that represents the <cd> tag for domain check response
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct DomainCheckResponseDataItem {
|
||||
/// Data under the <name> tag
|
||||
#[serde(rename = "name")]
|
||||
pub domain: DomainAvailable,
|
||||
pub domain: Available,
|
||||
/// The reason for (un)availability
|
||||
pub reason: Option<StringValue<'static>>,
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
use super::XMLNS;
|
||||
use crate::common::{NoExtension, StringValue};
|
||||
use crate::common::{NoExtension, StringValue, Available};
|
||||
use crate::request::{Command, Transaction};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -50,23 +50,12 @@ pub struct HostCheck<'a> {
|
|||
|
||||
// Response
|
||||
|
||||
/// Type that represents the <name> tag for host check response
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct HostAvailable {
|
||||
/// The host name
|
||||
#[serde(rename = "$value")]
|
||||
pub name: StringValue<'static>,
|
||||
/// The host (un)availability
|
||||
#[serde(rename = "avail")]
|
||||
pub available: bool,
|
||||
}
|
||||
|
||||
/// Type that represents the <cd> tag for host check response
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct HostCheckDataItem {
|
||||
/// Data under the <name> tag
|
||||
#[serde(rename = "name")]
|
||||
pub host: HostAvailable,
|
||||
pub host: Available,
|
||||
/// The reason for (un)availability
|
||||
pub reason: Option<StringValue<'static>>,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue