1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use super::{client, epp_proto};
pub fn env_from_i32(from: i32) -> Option<client::dac::DACEnv> {
epp_proto::dac::Environment::from_i32(from).map(|e| match e {
epp_proto::dac::Environment::RealTime => client::dac::DACEnv::RealTime,
epp_proto::dac::Environment::TimeDelay => client::dac::DACEnv::TimeDelay,
})
}
impl From<client::dac::DACUsageResponse> for epp_proto::dac::UsageResponse {
fn from(res: client::dac::DACUsageResponse) -> Self {
epp_proto::dac::UsageResponse {
usage_60: res.usage_60,
usage_24: res.usage_24,
}
}
}
impl From<client::dac::DACDomainResponse> for epp_proto::dac::DomainResponse {
fn from(res: client::dac::DACDomainResponse) -> Self {
epp_proto::dac::DomainResponse {
registration_state: match res.registration_state {
client::dac::DomainState::Registered => {
epp_proto::dac::DomainState::Registered.into()
}
client::dac::DomainState::Available => {
epp_proto::dac::DomainState::Available.into()
}
client::dac::DomainState::NotWithinRegistry => {
epp_proto::dac::DomainState::NotWithinRegistry.into()
}
client::dac::DomainState::RulesPrevent => {
epp_proto::dac::DomainState::RulesPrevent.into()
}
},
detagged: res.detagged,
created: super::utils::chrono_to_proto(Some(res.created.and_hms(0, 0, 0))),
expiry: super::utils::chrono_to_proto(Some(res.expiry.and_hms(0, 0, 0))),
status: match res.status {
client::dac::DomainStatus::Unknown => epp_proto::dac::DomainStatus::Unknown.into(),
client::dac::DomainStatus::RegisteredUntilExpiry => {
epp_proto::dac::DomainStatus::RegisteredUntilExpiry.into()
}
client::dac::DomainStatus::RenewalRequired => {
epp_proto::dac::DomainStatus::RenewalRequired.into()
}
client::dac::DomainStatus::NoLongerRequired => {
epp_proto::dac::DomainStatus::NoLongerRequired.into()
}
},
suspended: res.suspended,
tag: res.tag,
}
}
}