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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
use chrono::prelude::*;
use super::{CommandResponse, RequestMessage, Sender};
#[derive(Debug)]
pub struct PollRequest {
pub return_path: Sender<Option<PollResponse>>,
}
#[derive(Debug)]
pub struct PollResponse {
pub count: u64,
pub id: String,
pub enqueue_time: DateTime<Utc>,
pub message: String,
pub data: PollData,
}
#[derive(Debug)]
pub enum PollData {
DomainInfoData {
data: Box<super::domain::InfoResponse>,
change_data: Option<ChangeData>,
},
ContactInfoData {
data: Box<super::contact::InfoResponse>,
change_data: Option<ChangeData>,
},
HostInfoData {
data: Box<super::host::InfoResponse>,
change_data: Option<ChangeData>,
},
DomainTransferData {
data: super::domain::TransferResponse,
change_data: Option<ChangeData>,
},
ContactTransferData {
data: super::contact::TransferResponse,
change_data: Option<ChangeData>,
},
DomainCreateData {
data: super::domain::CreateResponse,
change_data: Option<ChangeData>,
},
DomainPanData {
data: super::domain::PanData,
change_data: Option<ChangeData>,
},
ContactPanData {
data: super::contact::PanData,
change_data: Option<ChangeData>,
},
DomainRenewData {
data: super::domain::RenewResponse,
change_data: Option<ChangeData>,
},
NominetDomainCancelData {
data: super::nominet::CancelData,
change_data: Option<ChangeData>,
},
NominetDomainReleaseData {
data: super::nominet::ReleaseData,
change_data: Option<ChangeData>,
},
NominetDomainRegistrarChangeData {
data: super::nominet::RegistrarChangeData,
change_data: Option<ChangeData>,
},
NominetHostCancelData {
data: super::nominet::HostCancelData,
change_data: Option<ChangeData>,
},
NominetProcessData {
data: super::nominet::ProcessData,
change_data: Option<ChangeData>,
},
NominetSuspendData {
data: super::nominet::SuspendData,
change_data: Option<ChangeData>,
},
NominetDomainFailData {
data: super::nominet::DomainFailData,
change_data: Option<ChangeData>,
},
NominetRegistrantTransferData {
data: super::nominet::RegistrantTransferData,
change_data: Option<ChangeData>,
},
VerisignLowBalanceData(super::verisign::LowBalanceData),
TraficomTrnData(super::traficom::TrnData),
MaintenanceData(super::maintenance::InfoResponse),
EURIDPoll(super::eurid::PollResponse),
None,
}
#[derive(Debug)]
pub struct ChangeData {
pub state: ChangeState,
pub operation: ChangeOperation,
pub date: DateTime<Utc>,
pub server_transaction_id: String,
pub who: String,
pub case_id: Option<ChangeCaseId>,
pub reason: Option<String>,
}
#[derive(PartialEq, Debug)]
pub enum ChangeState {
Before,
After,
}
#[derive(Debug)]
pub struct ChangeOperation {
pub operation: Option<String>,
pub op_type: ChangeOperationType,
}
#[derive(PartialEq, Debug)]
pub enum ChangeOperationType {
Create,
Delete,
Renew,
Transfer,
Update,
Restore,
AutoRenew,
AutoDelete,
AutoPurge,
Custom,
}
#[derive(Debug)]
pub struct ChangeCaseId {
pub case_type: ChangeCaseIdType,
pub name: Option<String>,
pub case_id: String,
}
#[derive(Debug)]
pub enum ChangeCaseIdType {
Udrp,
Urs,
Custom,
}
#[derive(Debug)]
pub struct PollAckRequest {
pub(super) id: String,
pub return_path: Sender<PollAckResponse>,
}
#[derive(Debug)]
pub struct PollAckResponse {
pub count: Option<u64>,
pub next_id: Option<String>,
}
pub async fn poll(
client_sender: &mut futures::channel::mpsc::Sender<RequestMessage>,
) -> Result<CommandResponse<Option<PollResponse>>, super::Error> {
let (sender, receiver) = futures::channel::oneshot::channel();
super::send_epp_client_request(
client_sender,
RequestMessage::Poll(Box::new(PollRequest {
return_path: sender,
})),
receiver,
)
.await
}
pub async fn poll_ack(
id: &str,
client_sender: &mut futures::channel::mpsc::Sender<RequestMessage>,
) -> Result<CommandResponse<PollAckResponse>, super::Error> {
let (sender, receiver) = futures::channel::oneshot::channel();
super::send_epp_client_request(
client_sender,
RequestMessage::PollAck(Box::new(PollAckRequest {
id: id.to_string(),
return_path: sender,
})),
receiver,
)
.await
}