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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228 | (ns ird.registrations
"Register, renew, transfer, trade and manage .ro domains. Registrations
charge credits up front (refunded on failure); see GET /credits/prices for
current amounts. Mutations are subject to the client's domain gate
(ird.gate) when configured. Every function returns a channel (see
ird.async)."
(:require [ird.async :refer [go-try <?]]
[ird.gate :as gate]
[ird.transport :as transport]))
(defn list-registrations
"GET /domains/registrations — List your domains.
Optional QUERY keys include :cursor, :limit."
([client] (list-registrations client nil))
([client query]
(transport/request client :get "/domains/registrations" {:query query})))
(defn list-all-registrations
"Every registration under :registrations, following cursor pagination.
QUERY may include filters; :cursor is managed automatically. Delivers a
vector."
([client] (list-all-registrations client nil))
([client query]
(transport/paginate client :get "/domains/registrations" :registrations query)))
(defn register
"POST /domains/registrations — Register a .ro domain (202; charges
credits). BODY keys include :domain, :years, :auto_renew, :nameservers,
:use_our_dns. Subject to the client's domain gate on :domain."
[client body]
(gate/request client "POST /domains/registrations" {:domain (:domain body)}
:post "/domains/registrations" {:body body}))
(defn get-registration
"GET /domains/registrations/{id} — Get a domain."
[client id]
(transport/request client :get ["domains" "registrations" id]))
(defn renew
"POST /domains/registrations/{id}/renew — Renew a domain (202; charges
credits). BODY keys include :years, :totp_code."
([client id] (renew client id nil))
([client id body]
(gate/request client "POST /domains/registrations/{id}/renew" {:registration-id id}
:post ["domains" "registrations" id "renew"] (when body {:body body}))))
(defn set-auto-renew
"PUT /domains/registrations/{id}/auto-renew — Toggle auto-renew.
BODY is a plain map with :enabled and optional :totp_code."
[client id body]
(gate/request client "PUT /domains/registrations/{id}/auto-renew" {:registration-id id}
:put ["domains" "registrations" id "auto-renew"] {:body body}))
(defn set-sensitive
"PUT /domains/registrations/{id}/sensitive — Toggle the sensitive-domain
protection. BODY is a plain map with :enabled and optional :totp_code."
[client id body]
(gate/request client "PUT /domains/registrations/{id}/sensitive" {:registration-id id}
:put ["domains" "registrations" id "sensitive"] {:body body}))
(defn set-nameservers
"PUT /domains/registrations/{id}/nameservers — Replace nameservers (202).
BODY is a plain map with :nameservers and optional :totp_code."
[client id body]
(gate/request client "PUT /domains/registrations/{id}/nameservers" {:registration-id id}
:put ["domains" "registrations" id "nameservers"] {:body body}))
(defn list-hosts
"GET /domains/registrations/{id}/hosts — List the domain's hosts (glue
records). Optional QUERY keys include :refresh."
([client id] (list-hosts client id nil))
([client id query]
(transport/request client :get ["domains" "registrations" id "hosts"] {:query query})))
(defn create-host
"POST /domains/registrations/{id}/hosts — Create a host (glue record,
202). BODY keys include :host, :ips, :totp_code."
[client id body]
(gate/request client "POST /domains/registrations/{id}/hosts" {:registration-id id}
:post ["domains" "registrations" id "hosts"] {:body body}))
(defn set-host-ips
"PUT /domains/registrations/{id}/hosts/{host} — Replace a host's IPs
(202). BODY is a plain map with :ips and optional :totp_code."
[client id host body]
(gate/request client "PUT /domains/registrations/{id}/hosts/{host}" {:registration-id id}
:put ["domains" "registrations" id "hosts" host] {:body body}))
(defn delete-host
"DELETE /domains/registrations/{id}/hosts/{host} — Delete a host (glue
record, 202). Optional BODY carries :totp_code."
([client id host] (delete-host client id host nil))
([client id host body]
(gate/request client "DELETE /domains/registrations/{id}/hosts/{host}" {:registration-id id}
:delete ["domains" "registrations" id "hosts" host] (when body {:body body}))))
(defn list-dsdata
"GET /domains/registrations/{id}/dsdata — List the domain's DS records.
Optional QUERY keys include :refresh."
([client id] (list-dsdata client id nil))
([client id query]
(transport/request client :get ["domains" "registrations" id "dsdata"] {:query query})))
(defn publish-dsdata
"POST /domains/registrations/{id}/dsdata — Publish a DS record (202).
BODY keys include :keytag, :alg, :digest_type, :digest, :totp_code."
[client id body]
(gate/request client "POST /domains/registrations/{id}/dsdata" {:registration-id id}
:post ["domains" "registrations" id "dsdata"] {:body body}))
(defn withdraw-dsdata
"DELETE /domains/registrations/{id}/dsdata — Withdraw a DS record (202).
BODY keys include :keytag, :alg, :digest_type, :digest, :totp_code."
[client id body]
(gate/request client "DELETE /domains/registrations/{id}/dsdata" {:registration-id id}
:delete ["domains" "registrations" id "dsdata"] {:body body}))
(defn transfer-out
"POST /domains/registrations/{id}/transfer-out — Start moving a domain
away. Optional BODY carries :totp_code."
([client id] (transfer-out client id nil))
([client id body]
(gate/request client "POST /domains/registrations/{id}/transfer-out" {:registration-id id}
:post ["domains" "registrations" id "transfer-out"] (when body {:body body}))))
(defn update-registrant
"PUT /domains/registrations/{id}/registrant — Update the registrant's
contact details (202). BODY keys include :email, :phone, :address1,
:address2, :address3, :city, :state_province, :postal_code, :country_code,
:fax, :totp_code."
[client id body]
(gate/request client "PUT /domains/registrations/{id}/registrant" {:registration-id id}
:put ["domains" "registrations" id "registrant"] {:body body}))
(defn start-registrant-email-verification
"POST /domains/registrations/{id}/registrant-email/start — Start
registrant-email ownership verification."
[client id]
(gate/request client "POST /domains/registrations/{id}/registrant-email/start" {:registration-id id}
:post ["domains" "registrations" id "registrant-email" "start"]))
(defn confirm-registrant-email
"POST /domains/registrations/{id}/registrant-email/confirm — Confirm the
registrant-email code. BODY is a plain map with :token and :code."
[client id body]
(gate/request client "POST /domains/registrations/{id}/registrant-email/confirm" {:registration-id id}
:post ["domains" "registrations" id "registrant-email" "confirm"] {:body body}))
(defn adopt-registrant-email
"POST /domains/registrations/{id}/registrant-email/adopt — Adopt the
registrant contact email (transferred-in domains, 202). BODY is a plain
map with :email and optional :totp_code."
[client id body]
(gate/request client "POST /domains/registrations/{id}/registrant-email/adopt" {:registration-id id}
:post ["domains" "registrations" id "registrant-email" "adopt"] {:body body}))
(defn quote-trade
"GET /domains/registrations/{id}/trade — Quote a registrant change
(trade)."
[client id]
(transport/request client :get ["domains" "registrations" id "trade"]))
(defn trade
"POST /domains/registrations/{id}/trade — Change a domain's registrant
(trade, 202; charges credits). BODY keys include :auth_key, :years,
:totp_code."
[client id body]
(gate/request client "POST /domains/registrations/{id}/trade" {:registration-id id}
:post ["domains" "registrations" id "trade"] {:body body}))
(defn transfer-in
"POST /domains/transfers-in — Transfer a .ro domain to ird (202).
BODY keys include :domain, :auth_key, :keep_nameservers, :copy_dns,
:use_ird_dns, :then_trade. Subject to the client's domain gate on :domain."
[client body]
(gate/request client "POST /domains/transfers-in" {:domain (:domain body)}
:post "/domains/transfers-in" {:body body}))
(defn trade-in
"POST /domains/trades-in — Trade a .ro domain into ird (become the
holder, 202; charges credits). BODY keys include :domain, :auth_key,
:years, :keep_nameservers, :copy_dns, :use_ird_dns. Subject to the
client's domain gate on :domain."
[client body]
(gate/request client "POST /domains/trades-in" {:domain (:domain body)}
:post "/domains/trades-in" {:body body}))
(defn adopt
"POST /domains/adoptions — Adopt an ird-sponsored domain you already own.
BODY is a plain map with :domain. Subject to the client's domain gate on
:domain."
[client body]
(gate/request client "POST /domains/adoptions" {:domain (:domain body)}
:post "/domains/adoptions" {:body body}))
(defn list-actions
"GET /domains/actions — List your registry actions.
Optional QUERY keys include :state, :cursor, :limit."
([client] (list-actions client nil))
([client query]
(transport/request client :get "/domains/actions" {:query query})))
(defn list-all-actions
"Every registry action under :actions, following cursor pagination. QUERY
may include filters; :cursor is managed automatically. Delivers a vector."
([client] (list-all-actions client nil))
([client query]
(transport/paginate client :get "/domains/actions" :actions query)))
(defn get-action
"GET /domains/actions/{id} — Poll a registry action."
[client id]
(transport/request client :get ["domains" "actions" id]))
(defn- action-target
"Gate target for an action: its registration, resolved via `get-action`.
Called only when the client has a gate."
[client id]
(go-try {:registration-id (get-in (<? (get-action client id)) [:action :registration_id])}))
(defn cancel-action
"POST /domains/actions/{id}/cancel — Cancel a queued action.
Optional BODY carries :totp_code. Subject to the client's domain gate on
the action's registration (resolved via `get-action` when a gate is set)."
([client id] (cancel-action client id nil))
([client id body]
(gate/request client "POST /domains/actions/{id}/cancel" #(action-target client id)
:post ["domains" "actions" id "cancel"] (when body {:body body}))))
|