-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tsp
178 lines (142 loc) · 3.73 KB
/
main.tsp
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
import "@typespec/http";
import "@typespec/openapi3";
using TypeSpec.Http;
@service()
namespace rpp {
@route("/")
@get op Hello() : HelloResponse;
@route("/contacts")
interface contacts extends EntityCollection<ContactReference> {
}
@route("/domains")
interface domains extends EntityCollection<Domain>, EntityCollectionTransferrable<Domain> {
}
@route("/hosts")
interface hosts extends EntityCollection<Host> {
}
@route("/messages")
interface Messages {
@get op PollRequest() : Message[];
@route("/{id}")
@delete op AckPoll(id: string) : Message;
}
interface EntityCollection<T> {
// Check
@head op Check(...T) : T;
// Check
//@overload(Create) // this does not work as in https://typespec.io/docs/standard-library/built-in-decorators/
@post op Create(...T, @header Expect?: "100-continue") : T;
// Delete
@route("/{id}")
@delete op Delete(id: string) : T;
// Info
@route("/{id}")
@get op Get(id: string) : T;
// Renew
@route("/{id}/renewals")
@post op Renew(id: string) : T[];
// Update
@route("/{id}")
@patch op Update(id: string, entity: T) : T;
@route("/{id}/extension/{value}")
@get op GetExtension(id: string, value: string) : OkResponse;
@route("/{id}/extension/{value}")
@patch op UpdateExtension(id: string, value: string, entity: {}) : OkResponse;
}
interface EntityCollectionTransferrable<T> {
// Transfer Request
@route("/{id}/transfer")
@put op TransferRequest(id: string) : T[];
// Transfer Query
@route("/{id}/transfer")
@get op TransferQuery(id: string) : T;
// Cancel
@route("/{id}/transfer")
@delete op TransferCancel(id: string) : T;
// Approve
@route("/{id}/transfer/approval")
@put op TransferApprove(id: string) : T;
// Reject
@route("/{id}/transfer/rejection")
@put op TransferReject(id: string) : T;
}
model Domain {
name: string;
duration?: duration;
registrant?: string[];
authInfo?: {
pw?: string;
hash?: string;
};
ns?: {
hostObj?: HostInfo[];
hostAttr?: HostInfo[];
};
contacts?: ContactReference[];
dnsSEC? : DnsSec[];
}
model HostInfo {
name: string;
addr?: {
"ipv4": string[];
"ipv6": string[];
};
}
model Registrant {
id: string;
}
model DnsSec {
keyTag: string;
algorithm: string;
digestType: string;
digest: string;
}
model ContactReference {
value: string;
type: ContactType[];
}
model Contact {
id: string;
name: string;
address: string;
}
enum ContactType {
registrant,
admin,
tech,
billing
}
model Message {
}
model Host {
id: string;
name: string;
domain: Domain;
}
model HelloResponse {
svID: string;
svDate: string;
svcMenu: {
version: string;
lang: string[];
};
dcp: {
access: {
all: string;
};
statement: {
purpose: {
admin: string;
prov: string;
};
recipient: {
ours: string;
public: string;
};
retention: {
stated: string;
};
};
};
}
}