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 | // Generated by scripts/gen-api.py from spec/openapi.json — do not edit.
import Foundation
@testable import IrdAPI
/// Decode-then-encode closures for every typed body and response; nil when the operation has none.
struct SynthCase: Sendable {
let key: String
let body: (@Sendable (Data) throws -> Data)?
let response: (@Sendable (Data) throws -> Data)?
}
func roundTrip<T: Codable>(_ type: T.Type) -> @Sendable (Data) throws -> Data {
{ data in try JSONEncoder().encode(try JSONDecoder().decode(T.self, from: data)) }
}
enum GeneratedSynth {
static let auth: [SynthCase] = [
SynthCase(key: "POST /auth/device/start", body: nil, response: roundTrip(DeviceStartResponse.self)),
SynthCase(key: "POST /auth/device/poll", body: roundTrip(DevicePollBody.self), response: roundTrip(DevicePollResponse.self)),
SynthCase(key: "POST /auth/device/complete", body: roundTrip(DeviceCompleteBody.self), response: roundTrip(DeviceCompleteResponse.self)),
SynthCase(key: "GET /auth/api-keys", body: nil, response: roundTrip(ListApiKeysResponse.self)),
SynthCase(key: "POST /auth/api-keys", body: roundTrip(NameBody.self), response: roundTrip(CreateApiKeyResponse.self)),
SynthCase(key: "POST /auth/api-keys/{id}/revoke", body: nil, response: roundTrip(RevokeApiKeyResponse.self)),
]
static let credits: [SynthCase] = [
SynthCase(key: "GET /credits/balance", body: nil, response: roundTrip(BalanceResponse.self)),
SynthCase(key: "GET /credits/ledger", body: nil, response: roundTrip(LedgerResponse.self)),
SynthCase(key: "GET /credits/prices", body: nil, response: roundTrip(PricesResponse.self)),
]
static let support: [SynthCase] = [
SynthCase(key: "GET /contact/threads", body: nil, response: roundTrip(ListThreadsResponse.self)),
SynthCase(key: "POST /contact/threads", body: roundTrip(CreateThreadBody.self), response: roundTrip(CreateThreadResponse.self)),
SynthCase(key: "GET /contact/threads/{id}", body: nil, response: roundTrip(ThreadResponse.self)),
SynthCase(key: "POST /contact/threads/{id}/messages", body: roundTrip(ReplyBody.self), response: roundTrip(ThreadResponse.self)),
]
static let domains: [SynthCase] = [
SynthCase(key: "GET /domains/check", body: nil, response: roundTrip(CheckResponse.self)),
SynthCase(key: "GET /domains/info", body: nil, response: roundTrip(InfoResponse.self)),
SynthCase(key: "GET /domains/preflight", body: nil, response: roundTrip(PreflightResponse.self)),
SynthCase(key: "GET /domains/dns-snapshot", body: nil, response: roundTrip(DnsSnapshotResponse.self)),
SynthCase(key: "GET /domains/search", body: nil, response: roundTrip(SearchResponse.self)),
SynthCase(key: "POST /domains/search", body: roundTrip(SearchDescriptionsBody.self), response: roundTrip(SearchResponse.self)),
SynthCase(key: "GET /domains/example", body: nil, response: roundTrip(DomainNameResponse.self)),
SynthCase(key: "GET /domains/directory", body: nil, response: roundTrip(DirectoryResponse.self)),
SynthCase(key: "GET /domains/directory/{domain}", body: nil, response: roundTrip(DirectoryEntry.self)),
]
static let registrations: [SynthCase] = [
SynthCase(key: "GET /domains/registrations", body: nil, response: roundTrip(RegistrationListResponse.self)),
SynthCase(key: "POST /domains/registrations", body: roundTrip(RegisterBody.self), response: roundTrip(RegistrationActionResponse.self)),
SynthCase(key: "GET /domains/registrations/{id}", body: nil, response: roundTrip(RegistrationGetResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/renew", body: roundTrip(RenewBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "PUT /domains/registrations/{id}/auto-renew", body: roundTrip(EnabledBody.self), response: roundTrip(RegistrationResponse.self)),
SynthCase(key: "PUT /domains/registrations/{id}/sensitive", body: roundTrip(EnabledBody.self), response: roundTrip(RegistrationResponse.self)),
SynthCase(key: "PUT /domains/registrations/{id}/nameservers", body: roundTrip(SetNameserversBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "GET /domains/registrations/{id}/hosts", body: nil, response: roundTrip(ListHostsResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/hosts", body: roundTrip(CreateHostBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "PUT /domains/registrations/{id}/hosts/{host}", body: roundTrip(SetHostIpsBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "DELETE /domains/registrations/{id}/hosts/{host}", body: roundTrip(TotpCodeBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "GET /domains/registrations/{id}/dsdata", body: nil, response: roundTrip(ListDsDataResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/dsdata", body: roundTrip(PublishDsDataBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "DELETE /domains/registrations/{id}/dsdata", body: roundTrip(PublishDsDataBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/transfer-out", body: roundTrip(TotpCodeBody.self), response: roundTrip(TransferOutResponse.self)),
SynthCase(key: "PUT /domains/registrations/{id}/registrant", body: roundTrip(UpdateRegistrantBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/registrant-email/start", body: nil, response: roundTrip(StartRegistrantEmailVerificationResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/registrant-email/confirm", body: roundTrip(ConfirmRegistrantEmailBody.self), response: roundTrip(ConfirmRegistrantEmailResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/registrant-email/adopt", body: roundTrip(AdoptRegistrantEmailBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "GET /domains/registrations/{id}/trade", body: nil, response: roundTrip(QuoteTradeResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/trade", body: roundTrip(TradeBody.self), response: roundTrip(ActionResponse.self)),
SynthCase(key: "POST /domains/transfers-in", body: roundTrip(TransferInBody.self), response: roundTrip(RegistrationActionResponse.self)),
SynthCase(key: "POST /domains/trades-in", body: roundTrip(TradeInBody.self), response: roundTrip(RegistrationActionResponse.self)),
SynthCase(key: "POST /domains/adoptions", body: roundTrip(DomainNameResponse.self), response: roundTrip(RegistrationResponse.self)),
SynthCase(key: "GET /domains/actions", body: nil, response: roundTrip(ListActionsResponse.self)),
SynthCase(key: "GET /domains/actions/{id}", body: nil, response: roundTrip(ActionResponse.self)),
SynthCase(key: "POST /domains/actions/{id}/cancel", body: roundTrip(TotpCodeBody.self), response: roundTrip(ActionResponse.self)),
]
static let dns: [SynthCase] = [
SynthCase(key: "POST /domains/registrations/{id}/dns", body: roundTrip(EnableHostingBody.self), response: roundTrip(EnableHostingResponse.self)),
SynthCase(key: "DELETE /domains/registrations/{id}/dns", body: roundTrip(TotpCodeBody.self), response: roundTrip(DisableHostingResponse.self)),
SynthCase(key: "GET /domains/registrations/{id}/dns/dnssec", body: nil, response: roundTrip(DnssecResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/dns/dnssec", body: roundTrip(TotpCodeBody.self), response: roundTrip(DnssecResponse.self)),
SynthCase(key: "DELETE /domains/registrations/{id}/dns/dnssec", body: roundTrip(TotpCodeBody.self), response: roundTrip(DnssecResponse.self)),
SynthCase(key: "GET /domains/registrations/{id}/dns/nameservers", body: nil, response: roundTrip(HostedNameserversResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/dns/nameservers", body: roundTrip(SetHostedNameserversBody.self), response: roundTrip(SetHostedNameserversResponse.self)),
SynthCase(key: "GET /dns/domains", body: nil, response: roundTrip(ListZonesResponse.self)),
SynthCase(key: "GET /dns/domains/{domain}", body: nil, response: roundTrip(Zone.self)),
SynthCase(key: "PUT /dns/domains/{domain}/records", body: roundTrip(SetRecordBody.self), response: roundTrip(SetRecordResponse.self)),
SynthCase(key: "DELETE /dns/domains/{domain}/records", body: roundTrip(DeleteRecordBody.self), response: roundTrip(DeletedResponse.self)),
SynthCase(key: "GET /dns/claims", body: nil, response: roundTrip(ListClaimsResponse.self)),
SynthCase(key: "POST /dns/claims", body: roundTrip(DomainNameResponse.self), response: roundTrip(ClaimResponse.self)),
SynthCase(key: "GET /dns/claims/{id}", body: nil, response: roundTrip(ClaimResponse.self)),
SynthCase(key: "DELETE /dns/claims/{id}", body: nil, response: roundTrip(ClaimResponse.self)),
SynthCase(key: "PUT /dns/claims/{id}/seed", body: roundTrip(SeedClaimBody.self), response: roundTrip(ClaimResponse.self)),
SynthCase(key: "DELETE /dns/claims/{id}/seed", body: nil, response: roundTrip(ClaimResponse.self)),
SynthCase(key: "POST /dns/claims/{id}/verify", body: nil, response: roundTrip(VerifyClaimResponse.self)),
]
static let sharing: [SynthCase] = [
SynthCase(key: "GET /domains/registrations/{id}/grants", body: nil, response: roundTrip(GrantsResponse.self)),
SynthCase(key: "POST /domains/registrations/{id}/grants", body: roundTrip(InviteBody.self), response: roundTrip(GrantResponse.self)),
SynthCase(key: "DELETE /domains/registrations/{id}/grants/{grant-id}", body: nil, response: roundTrip(GrantResponse.self)),
SynthCase(key: "GET /grants", body: nil, response: roundTrip(GrantsResponse.self)),
SynthCase(key: "POST /grants/{id}/accept", body: nil, response: roundTrip(GrantResponse.self)),
SynthCase(key: "POST /grants/{id}/decline", body: nil, response: roundTrip(GrantResponse.self)),
SynthCase(key: "POST /grants/{id}/leave", body: nil, response: roundTrip(GrantResponse.self)),
]
static let vps: [SynthCase] = [
SynthCase(key: "GET /vps/tiers", body: nil, response: roundTrip(ListTiersResponse.self)),
SynthCase(key: "GET /vps/system-images", body: nil, response: roundTrip(ListSystemImagesResponse.self)),
SynthCase(key: "GET /vps/ssh-keys", body: nil, response: roundTrip(ListSshKeysResponse.self)),
SynthCase(key: "POST /vps/ssh-keys", body: roundTrip(AddSshKeyBody.self), response: roundTrip(AddSshKeyResponse.self)),
SynthCase(key: "DELETE /vps/ssh-keys/{id}", body: nil, response: nil),
SynthCase(key: "GET /vps/availability", body: nil, response: roundTrip(AvailabilityResponse.self)),
SynthCase(key: "GET /vps/instances", body: nil, response: roundTrip(ListInstancesResponse.self)),
SynthCase(key: "POST /vps/instances", body: roundTrip(CreateInstanceBody.self), response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "GET /vps/apps", body: nil, response: roundTrip(AppCatalogResponse.self)),
SynthCase(key: "GET /vps/apps/deployments", body: nil, response: roundTrip(ListAppDeploymentsResponse.self)),
SynthCase(key: "POST /vps/apps/deployments", body: roundTrip(DeployAppBody.self), response: roundTrip(DeployAppResponse.self)),
SynthCase(key: "GET /vps/apps/deployments/{id}", body: nil, response: roundTrip(GetAppDeploymentResponse.self)),
SynthCase(key: "POST /vps/apps/deployments/{id}/reveal-password", body: nil, response: roundTrip(RevealAppPasswordResponse.self)),
SynthCase(key: "GET /vps/instances/{id}", body: nil, response: roundTrip(GetInstanceResponse.self)),
SynthCase(key: "DELETE /vps/instances/{id}", body: nil, response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "GET /vps/instances/{id}/metrics", body: nil, response: roundTrip(GetMetricsResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/queue-notify", body: roundTrip(SetQueueNotifyBody.self), response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/images", body: roundTrip(NameBody.self), response: roundTrip(ImageActionResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/restart", body: nil, response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/reset", body: nil, response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/shutdown", body: nil, response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/power-off", body: nil, response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/power-on", body: nil, response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "PUT /vps/instances/{id}/rdns", body: roundTrip(SetRdnsBody.self), response: roundTrip(InstanceActionResponse.self)),
SynthCase(key: "GET /vps/instances/{id}/domains", body: nil, response: roundTrip(ListInstanceDomainsResponse.self)),
SynthCase(key: "POST /vps/instances/{id}/domains", body: roundTrip(ConnectDomainBody.self), response: roundTrip(ConnectDomainResponse.self)),
SynthCase(key: "DELETE /vps/instances/{id}/domains/{connection-id}", body: nil, response: roundTrip(DisconnectDomainResponse.self)),
SynthCase(key: "GET /vps/volumes", body: nil, response: roundTrip(ListVolumesResponse.self)),
SynthCase(key: "POST /vps/volumes", body: roundTrip(CreateVolumeBody.self), response: roundTrip(VolumeActionResponse.self)),
SynthCase(key: "DELETE /vps/volumes/{id}", body: nil, response: roundTrip(VolumeActionResponse.self)),
SynthCase(key: "GET /vps/images", body: nil, response: roundTrip(ListImagesResponse.self)),
SynthCase(key: "DELETE /vps/images/{id}", body: nil, response: roundTrip(ImageActionResponse.self)),
SynthCase(key: "GET /vps/actions/{id}", body: nil, response: roundTrip(GetActionResponse.self)),
SynthCase(key: "GET /vps/activity", body: nil, response: roundTrip(ListActivityResponse.self)),
]
static let transfers: [SynthCase] = [
SynthCase(key: "POST /vps/instances/{id}/transfer", body: roundTrip(EmailBody.self), response: roundTrip(TransferResponse.self)),
SynthCase(key: "DELETE /vps/instances/{id}/transfer", body: nil, response: roundTrip(TransferResponse.self)),
SynthCase(key: "POST /vps/volumes/{id}/transfer", body: roundTrip(EmailBody.self), response: roundTrip(TransferResponse.self)),
SynthCase(key: "DELETE /vps/volumes/{id}/transfer", body: nil, response: roundTrip(TransferResponse.self)),
SynthCase(key: "POST /vps/images/{id}/transfer", body: roundTrip(EmailBody.self), response: roundTrip(TransferResponse.self)),
SynthCase(key: "DELETE /vps/images/{id}/transfer", body: nil, response: roundTrip(TransferResponse.self)),
SynthCase(key: "GET /vps/transfers", body: nil, response: roundTrip(TransferListResponse.self)),
SynthCase(key: "POST /vps/transfers/{id}/accept", body: roundTrip(TotpCodeBody.self), response: roundTrip(TransferResponse.self)),
SynthCase(key: "POST /vps/transfers/{id}/decline", body: nil, response: roundTrip(TransferResponse.self)),
]
static let tunnels: [SynthCase] = [
SynthCase(key: "GET /tunnels", body: nil, response: roundTrip(TunnelListResponse.self)),
SynthCase(key: "POST /tunnels", body: roundTrip(CreateTunnelBody.self), response: roundTrip(TunnelResponse.self)),
SynthCase(key: "GET /tunnels/{id}", body: nil, response: roundTrip(TunnelResponse.self)),
SynthCase(key: "DELETE /tunnels/{id}", body: roundTrip(TotpCodeBody.self), response: roundTrip(TunnelResponse.self)),
SynthCase(key: "PATCH /tunnels/{id}", body: roundTrip(UpdateTunnelBody.self), response: roundTrip(TunnelResponse.self)),
SynthCase(key: "POST /tunnels/{id}/verify-dns", body: nil, response: roundTrip(TunnelResponse.self)),
]
static let ipfs: [SynthCase] = [
SynthCase(key: "GET /ipfs/pins", body: nil, response: roundTrip(ListPinsResponse.self)),
SynthCase(key: "POST /ipfs/pins", body: roundTrip(PinSpec.self), response: roundTrip(PinResponse.self)),
SynthCase(key: "GET /ipfs/pins/{id}", body: nil, response: roundTrip(PinResponse.self)),
SynthCase(key: "DELETE /ipfs/pins/{id}", body: nil, response: roundTrip(DeletedResponse.self)),
SynthCase(key: "POST /ipfs/uploads", body: roundTrip(StartUploadBody.self), response: roundTrip(UploadResponse.self)),
SynthCase(key: "GET /ipfs/uploads/{id}", body: nil, response: roundTrip(UploadResponse.self)),
SynthCase(key: "GET /ipfs/names", body: nil, response: roundTrip(ListNamesResponse.self)),
SynthCase(key: "POST /ipfs/names", body: roundTrip(CreateNameBody.self), response: roundTrip(CreateNameResponse.self)),
SynthCase(key: "GET /ipfs/names/{id}", body: nil, response: roundTrip(NameResponse.self)),
SynthCase(key: "DELETE /ipfs/names/{id}", body: nil, response: roundTrip(DeletedResponse.self)),
SynthCase(key: "PUT /ipfs/names/{id}/target", body: roundTrip(PublishTargetBody.self), response: roundTrip(NameResponse.self)),
SynthCase(key: "GET /ipfs/domains", body: nil, response: roundTrip(ListDomainsResponse.self)),
SynthCase(key: "POST /ipfs/domains", body: roundTrip(IPFSAttachDomainBody.self), response: roundTrip(GatewayDomainResponse.self)),
SynthCase(key: "GET /ipfs/domains/{id}", body: nil, response: roundTrip(GatewayDomainResponse.self)),
SynthCase(key: "GET /ipfs/domains/{id}/pins", body: nil, response: roundTrip(ListDomainPinsResponse.self)),
SynthCase(key: "POST /ipfs/domains/{id}/pins", body: roundTrip(UpdateDomainPinsBody.self), response: roundTrip(GatewayDomainResponse.self)),
SynthCase(key: "DELETE /ipfs/domains/{id}", body: nil, response: roundTrip(DeletedResponse.self)),
SynthCase(key: "GET /ipfs/usage", body: nil, response: roundTrip(IPFSUsageResponse.self)),
]
static let pins: [SynthCase] = [
SynthCase(key: "GET /pins", body: nil, response: roundTrip(PinResults.self)),
SynthCase(key: "POST /pins", body: roundTrip(PinSpec.self), response: roundTrip(PinStatus.self)),
SynthCase(key: "GET /pins/{requestid}", body: nil, response: roundTrip(PinStatus.self)),
SynthCase(key: "POST /pins/{requestid}", body: roundTrip(PinSpec.self), response: roundTrip(PinStatus.self)),
SynthCase(key: "DELETE /pins/{requestid}", body: nil, response: nil),
]
static let p2p: [SynthCase] = [
SynthCase(key: "GET /p2p/apps", body: nil, response: roundTrip(ListAppsResponse.self)),
SynthCase(key: "POST /p2p/apps", body: roundTrip(CreateAppBody.self), response: roundTrip(AppResponse.self)),
SynthCase(key: "GET /p2p/apps/{id}", body: nil, response: roundTrip(AppResponse.self)),
SynthCase(key: "DELETE /p2p/apps/{id}", body: nil, response: roundTrip(AppResponse.self)),
SynthCase(key: "PATCH /p2p/apps/{id}", body: roundTrip(UpdateAppBody.self), response: roundTrip(AppResponse.self)),
SynthCase(key: "POST /p2p/apps/{id}/turn-credentials", body: roundTrip(MintTurnCredentialsBody.self), response: roundTrip(MintTurnCredentialsResponse.self)),
SynthCase(key: "POST /p2p/apps/{id}/mailbox-credentials", body: roundTrip(MintMailboxCredentialsBody.self), response: roundTrip(MintMailboxCredentialsResponse.self)),
SynthCase(key: "GET /p2p/apps/{id}/domains", body: nil, response: roundTrip(ListAppDomainsResponse.self)),
SynthCase(key: "POST /p2p/apps/{id}/domains", body: roundTrip(P2PAttachDomainBody.self), response: roundTrip(DomainResponse.self)),
SynthCase(key: "DELETE /p2p/apps/{id}/domains/{domain-id}", body: nil, response: roundTrip(DomainResponse.self)),
SynthCase(key: "POST /p2p/apps/{id}/domains/{domain-id}/verify-dns", body: nil, response: roundTrip(DomainResponse.self)),
SynthCase(key: "GET /p2p/usage", body: nil, response: roundTrip(P2PUsageResponse.self)),
]
static let jobs: [SynthCase] = [
SynthCase(key: "POST /jobs", body: roundTrip(JobSpec.self), response: roundTrip(EnqueueResponse.self)),
SynthCase(key: "GET /jobs/{id}", body: nil, response: roundTrip(JobGetResponse.self)),
SynthCase(key: "GET /jobs/{id}/result", body: nil, response: roundTrip(JobResult.self)),
]
static let all: [SynthCase] = auth + credits + support + domains + registrations + dns + sharing + vps + transfers + tunnels + ipfs + pins + p2p + jobs
}
|