dub 0.22.3 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.speakeasy/gen.lock +36 -6
- package/.speakeasy/gen.yaml +2 -1
- package/.speakeasy/workflow.lock +21 -0
- package/.speakeasy/workflow.yaml +1 -0
- package/README.md +18 -7
- package/docs/sdks/analytics/README.md +10 -10
- package/docs/sdks/domains/README.md +331 -0
- package/docs/sdks/links/README.md +17 -13
- package/docs/sdks/metatags/README.md +1 -1
- package/docs/sdks/qrcodes/README.md +1 -1
- package/docs/sdks/tags/README.md +2 -2
- package/docs/sdks/workspaces/README.md +3 -3
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/workspaceschema.d.ts +4 -4
- package/models/components/workspaceschema.d.ts.map +1 -1
- package/models/components/workspaceschema.js +2 -2
- package/models/components/workspaceschema.js.map +1 -1
- package/models/operations/adddomain.d.ts +149 -0
- package/models/operations/adddomain.d.ts.map +1 -0
- package/models/operations/adddomain.js +145 -0
- package/models/operations/adddomain.js.map +1 -0
- package/models/operations/bulkcreatelinks.d.ts +1 -751
- package/models/operations/bulkcreatelinks.d.ts.map +1 -1
- package/models/operations/bulkcreatelinks.js.map +1 -1
- package/models/operations/createlink.d.ts +1 -751
- package/models/operations/createlink.d.ts.map +1 -1
- package/models/operations/createlink.js.map +1 -1
- package/models/operations/deletedomain.d.ts +39 -0
- package/models/operations/deletedomain.d.ts.map +1 -0
- package/models/operations/deletedomain.js +75 -0
- package/models/operations/deletedomain.js.map +1 -0
- package/models/operations/editdomain.d.ts +169 -0
- package/models/operations/editdomain.d.ts.map +1 -0
- package/models/operations/editdomain.js +171 -0
- package/models/operations/editdomain.js.map +1 -0
- package/models/operations/editlink.d.ts +1 -751
- package/models/operations/editlink.d.ts.map +1 -1
- package/models/operations/editlink.js.map +1 -1
- package/models/operations/getmetatags.d.ts +9 -9
- package/models/operations/getmetatags.d.ts.map +1 -1
- package/models/operations/getmetatags.js +12 -12
- package/models/operations/getmetatags.js.map +1 -1
- package/models/operations/index.d.ts +6 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +6 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/listdomains.d.ts +91 -0
- package/models/operations/listdomains.d.ts.map +1 -0
- package/models/operations/listdomains.js +100 -0
- package/models/operations/listdomains.js.map +1 -0
- package/models/operations/setprimarydomain.d.ts +103 -0
- package/models/operations/setprimarydomain.d.ts.map +1 -0
- package/models/operations/setprimarydomain.js +116 -0
- package/models/operations/setprimarydomain.js.map +1 -0
- package/models/operations/transferdomain.d.ts +123 -0
- package/models/operations/transferdomain.d.ts.map +1 -0
- package/models/operations/transferdomain.js +142 -0
- package/models/operations/transferdomain.js.map +1 -0
- package/package.json +2 -3
- package/sdk/domains.d.ts +50 -0
- package/sdk/domains.d.ts.map +1 -0
- package/sdk/domains.js +1130 -0
- package/sdk/domains.js.map +1 -0
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +5 -0
- package/sdk/sdk.js.map +1 -1
- package/src/lib/config.ts +3 -3
- package/src/models/components/workspaceschema.ts +6 -6
- package/src/models/operations/adddomain.ts +244 -0
- package/src/models/operations/bulkcreatelinks.ts +1 -751
- package/src/models/operations/createlink.ts +1 -751
- package/src/models/operations/deletedomain.ts +84 -0
- package/src/models/operations/editdomain.ts +290 -0
- package/src/models/operations/editlink.ts +1 -751
- package/src/models/operations/getmetatags.ts +21 -21
- package/src/models/operations/index.ts +6 -0
- package/src/models/operations/listdomains.ts +153 -0
- package/src/models/operations/setprimarydomain.ts +179 -0
- package/src/models/operations/transferdomain.ts +224 -0
- package/src/sdk/domains.ts +1387 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,1387 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKHooks } from "../hooks";
|
|
6
|
+
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
7
|
+
import * as enc$ from "../lib/encodings";
|
|
8
|
+
import { HTTPClient } from "../lib/http";
|
|
9
|
+
import * as schemas$ from "../lib/schemas";
|
|
10
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks";
|
|
11
|
+
import * as errors from "../models/errors";
|
|
12
|
+
import * as operations from "../models/operations";
|
|
13
|
+
import * as z from "zod";
|
|
14
|
+
|
|
15
|
+
export class Domains extends ClientSDK {
|
|
16
|
+
private readonly options$: SDKOptions & { hooks?: SDKHooks };
|
|
17
|
+
|
|
18
|
+
constructor(options: SDKOptions = {}) {
|
|
19
|
+
const opt = options as unknown;
|
|
20
|
+
let hooks: SDKHooks;
|
|
21
|
+
if (
|
|
22
|
+
typeof opt === "object" &&
|
|
23
|
+
opt != null &&
|
|
24
|
+
"hooks" in opt &&
|
|
25
|
+
opt.hooks instanceof SDKHooks
|
|
26
|
+
) {
|
|
27
|
+
hooks = opt.hooks;
|
|
28
|
+
} else {
|
|
29
|
+
hooks = new SDKHooks();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
super({
|
|
33
|
+
client: options.httpClient || new HTTPClient(),
|
|
34
|
+
baseURL: serverURLFromOptions(options),
|
|
35
|
+
hooks,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
this.options$ = { ...options, hooks };
|
|
39
|
+
void this.options$;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Retrieve a list of domains
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Retrieve a list of domains associated with the authenticated workspace.
|
|
47
|
+
*/
|
|
48
|
+
async list(
|
|
49
|
+
_input: operations.ListDomainsRequest,
|
|
50
|
+
options?: RequestOptions
|
|
51
|
+
): Promise<Array<operations.ListDomainsResponseBody>> {
|
|
52
|
+
const headers$ = new Headers();
|
|
53
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
54
|
+
headers$.set("Accept", "application/json");
|
|
55
|
+
|
|
56
|
+
const path$ = this.templateURLComponent("/domains")();
|
|
57
|
+
|
|
58
|
+
const query$ = [
|
|
59
|
+
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
|
|
60
|
+
explode: true,
|
|
61
|
+
charEncoding: "percent",
|
|
62
|
+
}),
|
|
63
|
+
enc$.encodeForm("workspaceId", this.options$.workspaceId, {
|
|
64
|
+
explode: true,
|
|
65
|
+
charEncoding: "percent",
|
|
66
|
+
}),
|
|
67
|
+
]
|
|
68
|
+
.filter(Boolean)
|
|
69
|
+
.join("&");
|
|
70
|
+
|
|
71
|
+
let security$;
|
|
72
|
+
if (typeof this.options$.token === "function") {
|
|
73
|
+
security$ = { token: await this.options$.token() };
|
|
74
|
+
} else if (this.options$.token) {
|
|
75
|
+
security$ = { token: this.options$.token };
|
|
76
|
+
} else {
|
|
77
|
+
security$ = {};
|
|
78
|
+
}
|
|
79
|
+
const context = {
|
|
80
|
+
operationID: "listDomains",
|
|
81
|
+
oAuth2Scopes: [],
|
|
82
|
+
securitySource: this.options$.token,
|
|
83
|
+
};
|
|
84
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
85
|
+
|
|
86
|
+
const doOptions = {
|
|
87
|
+
context,
|
|
88
|
+
errorCodes: [
|
|
89
|
+
"400",
|
|
90
|
+
"401",
|
|
91
|
+
"403",
|
|
92
|
+
"404",
|
|
93
|
+
"409",
|
|
94
|
+
"410",
|
|
95
|
+
"422",
|
|
96
|
+
"429",
|
|
97
|
+
"4XX",
|
|
98
|
+
"500",
|
|
99
|
+
"5XX",
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
const request = this.createRequest$(
|
|
103
|
+
{
|
|
104
|
+
security: securitySettings$,
|
|
105
|
+
method: "GET",
|
|
106
|
+
path: path$,
|
|
107
|
+
headers: headers$,
|
|
108
|
+
query: query$,
|
|
109
|
+
},
|
|
110
|
+
options
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const response = await this.do$(request, doOptions);
|
|
114
|
+
|
|
115
|
+
const responseFields$ = {
|
|
116
|
+
HttpMeta: {
|
|
117
|
+
Response: response,
|
|
118
|
+
Request: request,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
123
|
+
const responseBody = await response.json();
|
|
124
|
+
const result = schemas$.parse(
|
|
125
|
+
responseBody,
|
|
126
|
+
(val$) => {
|
|
127
|
+
return z.array(operations.ListDomainsResponseBody$.inboundSchema).parse(val$);
|
|
128
|
+
},
|
|
129
|
+
"Response validation failed"
|
|
130
|
+
);
|
|
131
|
+
return result;
|
|
132
|
+
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
133
|
+
const responseBody = await response.json();
|
|
134
|
+
const result = schemas$.parse(
|
|
135
|
+
responseBody,
|
|
136
|
+
(val$) => {
|
|
137
|
+
return errors.BadRequest$.inboundSchema.parse({
|
|
138
|
+
...responseFields$,
|
|
139
|
+
...val$,
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
"Response validation failed"
|
|
143
|
+
);
|
|
144
|
+
throw result;
|
|
145
|
+
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
146
|
+
const responseBody = await response.json();
|
|
147
|
+
const result = schemas$.parse(
|
|
148
|
+
responseBody,
|
|
149
|
+
(val$) => {
|
|
150
|
+
return errors.Unauthorized$.inboundSchema.parse({
|
|
151
|
+
...responseFields$,
|
|
152
|
+
...val$,
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
"Response validation failed"
|
|
156
|
+
);
|
|
157
|
+
throw result;
|
|
158
|
+
} else if (this.matchResponse(response, 403, "application/json")) {
|
|
159
|
+
const responseBody = await response.json();
|
|
160
|
+
const result = schemas$.parse(
|
|
161
|
+
responseBody,
|
|
162
|
+
(val$) => {
|
|
163
|
+
return errors.Forbidden$.inboundSchema.parse({
|
|
164
|
+
...responseFields$,
|
|
165
|
+
...val$,
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
"Response validation failed"
|
|
169
|
+
);
|
|
170
|
+
throw result;
|
|
171
|
+
} else if (this.matchResponse(response, 404, "application/json")) {
|
|
172
|
+
const responseBody = await response.json();
|
|
173
|
+
const result = schemas$.parse(
|
|
174
|
+
responseBody,
|
|
175
|
+
(val$) => {
|
|
176
|
+
return errors.NotFound$.inboundSchema.parse({
|
|
177
|
+
...responseFields$,
|
|
178
|
+
...val$,
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
"Response validation failed"
|
|
182
|
+
);
|
|
183
|
+
throw result;
|
|
184
|
+
} else if (this.matchResponse(response, 409, "application/json")) {
|
|
185
|
+
const responseBody = await response.json();
|
|
186
|
+
const result = schemas$.parse(
|
|
187
|
+
responseBody,
|
|
188
|
+
(val$) => {
|
|
189
|
+
return errors.Conflict$.inboundSchema.parse({
|
|
190
|
+
...responseFields$,
|
|
191
|
+
...val$,
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
"Response validation failed"
|
|
195
|
+
);
|
|
196
|
+
throw result;
|
|
197
|
+
} else if (this.matchResponse(response, 410, "application/json")) {
|
|
198
|
+
const responseBody = await response.json();
|
|
199
|
+
const result = schemas$.parse(
|
|
200
|
+
responseBody,
|
|
201
|
+
(val$) => {
|
|
202
|
+
return errors.InviteExpired$.inboundSchema.parse({
|
|
203
|
+
...responseFields$,
|
|
204
|
+
...val$,
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
"Response validation failed"
|
|
208
|
+
);
|
|
209
|
+
throw result;
|
|
210
|
+
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
211
|
+
const responseBody = await response.json();
|
|
212
|
+
const result = schemas$.parse(
|
|
213
|
+
responseBody,
|
|
214
|
+
(val$) => {
|
|
215
|
+
return errors.UnprocessableEntity$.inboundSchema.parse({
|
|
216
|
+
...responseFields$,
|
|
217
|
+
...val$,
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
"Response validation failed"
|
|
221
|
+
);
|
|
222
|
+
throw result;
|
|
223
|
+
} else if (this.matchResponse(response, 429, "application/json")) {
|
|
224
|
+
const responseBody = await response.json();
|
|
225
|
+
const result = schemas$.parse(
|
|
226
|
+
responseBody,
|
|
227
|
+
(val$) => {
|
|
228
|
+
return errors.RateLimitExceeded$.inboundSchema.parse({
|
|
229
|
+
...responseFields$,
|
|
230
|
+
...val$,
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
"Response validation failed"
|
|
234
|
+
);
|
|
235
|
+
throw result;
|
|
236
|
+
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
237
|
+
const responseBody = await response.json();
|
|
238
|
+
const result = schemas$.parse(
|
|
239
|
+
responseBody,
|
|
240
|
+
(val$) => {
|
|
241
|
+
return errors.InternalServerError$.inboundSchema.parse({
|
|
242
|
+
...responseFields$,
|
|
243
|
+
...val$,
|
|
244
|
+
});
|
|
245
|
+
},
|
|
246
|
+
"Response validation failed"
|
|
247
|
+
);
|
|
248
|
+
throw result;
|
|
249
|
+
} else {
|
|
250
|
+
const responseBody = await response.text();
|
|
251
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Add a domain
|
|
257
|
+
*
|
|
258
|
+
* @remarks
|
|
259
|
+
* Add a domain to the authenticated workspace.
|
|
260
|
+
*/
|
|
261
|
+
async add(
|
|
262
|
+
input: operations.AddDomainRequestBody | undefined,
|
|
263
|
+
options?: RequestOptions
|
|
264
|
+
): Promise<operations.AddDomainResponseBody> {
|
|
265
|
+
const headers$ = new Headers();
|
|
266
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
267
|
+
headers$.set("Content-Type", "application/json");
|
|
268
|
+
headers$.set("Accept", "application/json");
|
|
269
|
+
|
|
270
|
+
const payload$ = schemas$.parse(
|
|
271
|
+
input,
|
|
272
|
+
(value$) => operations.AddDomainRequestBody$.outboundSchema.optional().parse(value$),
|
|
273
|
+
"Input validation failed"
|
|
274
|
+
);
|
|
275
|
+
const body$ =
|
|
276
|
+
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
277
|
+
|
|
278
|
+
const path$ = this.templateURLComponent("/domains")();
|
|
279
|
+
|
|
280
|
+
const query$ = [
|
|
281
|
+
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
|
|
282
|
+
explode: true,
|
|
283
|
+
charEncoding: "percent",
|
|
284
|
+
}),
|
|
285
|
+
enc$.encodeForm("workspaceId", this.options$.workspaceId, {
|
|
286
|
+
explode: true,
|
|
287
|
+
charEncoding: "percent",
|
|
288
|
+
}),
|
|
289
|
+
]
|
|
290
|
+
.filter(Boolean)
|
|
291
|
+
.join("&");
|
|
292
|
+
|
|
293
|
+
let security$;
|
|
294
|
+
if (typeof this.options$.token === "function") {
|
|
295
|
+
security$ = { token: await this.options$.token() };
|
|
296
|
+
} else if (this.options$.token) {
|
|
297
|
+
security$ = { token: this.options$.token };
|
|
298
|
+
} else {
|
|
299
|
+
security$ = {};
|
|
300
|
+
}
|
|
301
|
+
const context = {
|
|
302
|
+
operationID: "addDomain",
|
|
303
|
+
oAuth2Scopes: [],
|
|
304
|
+
securitySource: this.options$.token,
|
|
305
|
+
};
|
|
306
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
307
|
+
|
|
308
|
+
const doOptions = {
|
|
309
|
+
context,
|
|
310
|
+
errorCodes: [
|
|
311
|
+
"400",
|
|
312
|
+
"401",
|
|
313
|
+
"403",
|
|
314
|
+
"404",
|
|
315
|
+
"409",
|
|
316
|
+
"410",
|
|
317
|
+
"422",
|
|
318
|
+
"429",
|
|
319
|
+
"4XX",
|
|
320
|
+
"500",
|
|
321
|
+
"5XX",
|
|
322
|
+
],
|
|
323
|
+
};
|
|
324
|
+
const request = this.createRequest$(
|
|
325
|
+
{
|
|
326
|
+
security: securitySettings$,
|
|
327
|
+
method: "POST",
|
|
328
|
+
path: path$,
|
|
329
|
+
headers: headers$,
|
|
330
|
+
query: query$,
|
|
331
|
+
body: body$,
|
|
332
|
+
},
|
|
333
|
+
options
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
const response = await this.do$(request, doOptions);
|
|
337
|
+
|
|
338
|
+
const responseFields$ = {
|
|
339
|
+
HttpMeta: {
|
|
340
|
+
Response: response,
|
|
341
|
+
Request: request,
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
346
|
+
const responseBody = await response.json();
|
|
347
|
+
const result = schemas$.parse(
|
|
348
|
+
responseBody,
|
|
349
|
+
(val$) => {
|
|
350
|
+
return operations.AddDomainResponseBody$.inboundSchema.parse(val$);
|
|
351
|
+
},
|
|
352
|
+
"Response validation failed"
|
|
353
|
+
);
|
|
354
|
+
return result;
|
|
355
|
+
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
356
|
+
const responseBody = await response.json();
|
|
357
|
+
const result = schemas$.parse(
|
|
358
|
+
responseBody,
|
|
359
|
+
(val$) => {
|
|
360
|
+
return errors.BadRequest$.inboundSchema.parse({
|
|
361
|
+
...responseFields$,
|
|
362
|
+
...val$,
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
"Response validation failed"
|
|
366
|
+
);
|
|
367
|
+
throw result;
|
|
368
|
+
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
369
|
+
const responseBody = await response.json();
|
|
370
|
+
const result = schemas$.parse(
|
|
371
|
+
responseBody,
|
|
372
|
+
(val$) => {
|
|
373
|
+
return errors.Unauthorized$.inboundSchema.parse({
|
|
374
|
+
...responseFields$,
|
|
375
|
+
...val$,
|
|
376
|
+
});
|
|
377
|
+
},
|
|
378
|
+
"Response validation failed"
|
|
379
|
+
);
|
|
380
|
+
throw result;
|
|
381
|
+
} else if (this.matchResponse(response, 403, "application/json")) {
|
|
382
|
+
const responseBody = await response.json();
|
|
383
|
+
const result = schemas$.parse(
|
|
384
|
+
responseBody,
|
|
385
|
+
(val$) => {
|
|
386
|
+
return errors.Forbidden$.inboundSchema.parse({
|
|
387
|
+
...responseFields$,
|
|
388
|
+
...val$,
|
|
389
|
+
});
|
|
390
|
+
},
|
|
391
|
+
"Response validation failed"
|
|
392
|
+
);
|
|
393
|
+
throw result;
|
|
394
|
+
} else if (this.matchResponse(response, 404, "application/json")) {
|
|
395
|
+
const responseBody = await response.json();
|
|
396
|
+
const result = schemas$.parse(
|
|
397
|
+
responseBody,
|
|
398
|
+
(val$) => {
|
|
399
|
+
return errors.NotFound$.inboundSchema.parse({
|
|
400
|
+
...responseFields$,
|
|
401
|
+
...val$,
|
|
402
|
+
});
|
|
403
|
+
},
|
|
404
|
+
"Response validation failed"
|
|
405
|
+
);
|
|
406
|
+
throw result;
|
|
407
|
+
} else if (this.matchResponse(response, 409, "application/json")) {
|
|
408
|
+
const responseBody = await response.json();
|
|
409
|
+
const result = schemas$.parse(
|
|
410
|
+
responseBody,
|
|
411
|
+
(val$) => {
|
|
412
|
+
return errors.Conflict$.inboundSchema.parse({
|
|
413
|
+
...responseFields$,
|
|
414
|
+
...val$,
|
|
415
|
+
});
|
|
416
|
+
},
|
|
417
|
+
"Response validation failed"
|
|
418
|
+
);
|
|
419
|
+
throw result;
|
|
420
|
+
} else if (this.matchResponse(response, 410, "application/json")) {
|
|
421
|
+
const responseBody = await response.json();
|
|
422
|
+
const result = schemas$.parse(
|
|
423
|
+
responseBody,
|
|
424
|
+
(val$) => {
|
|
425
|
+
return errors.InviteExpired$.inboundSchema.parse({
|
|
426
|
+
...responseFields$,
|
|
427
|
+
...val$,
|
|
428
|
+
});
|
|
429
|
+
},
|
|
430
|
+
"Response validation failed"
|
|
431
|
+
);
|
|
432
|
+
throw result;
|
|
433
|
+
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
434
|
+
const responseBody = await response.json();
|
|
435
|
+
const result = schemas$.parse(
|
|
436
|
+
responseBody,
|
|
437
|
+
(val$) => {
|
|
438
|
+
return errors.UnprocessableEntity$.inboundSchema.parse({
|
|
439
|
+
...responseFields$,
|
|
440
|
+
...val$,
|
|
441
|
+
});
|
|
442
|
+
},
|
|
443
|
+
"Response validation failed"
|
|
444
|
+
);
|
|
445
|
+
throw result;
|
|
446
|
+
} else if (this.matchResponse(response, 429, "application/json")) {
|
|
447
|
+
const responseBody = await response.json();
|
|
448
|
+
const result = schemas$.parse(
|
|
449
|
+
responseBody,
|
|
450
|
+
(val$) => {
|
|
451
|
+
return errors.RateLimitExceeded$.inboundSchema.parse({
|
|
452
|
+
...responseFields$,
|
|
453
|
+
...val$,
|
|
454
|
+
});
|
|
455
|
+
},
|
|
456
|
+
"Response validation failed"
|
|
457
|
+
);
|
|
458
|
+
throw result;
|
|
459
|
+
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
460
|
+
const responseBody = await response.json();
|
|
461
|
+
const result = schemas$.parse(
|
|
462
|
+
responseBody,
|
|
463
|
+
(val$) => {
|
|
464
|
+
return errors.InternalServerError$.inboundSchema.parse({
|
|
465
|
+
...responseFields$,
|
|
466
|
+
...val$,
|
|
467
|
+
});
|
|
468
|
+
},
|
|
469
|
+
"Response validation failed"
|
|
470
|
+
);
|
|
471
|
+
throw result;
|
|
472
|
+
} else {
|
|
473
|
+
const responseBody = await response.text();
|
|
474
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Delete a domain
|
|
480
|
+
*
|
|
481
|
+
* @remarks
|
|
482
|
+
* Delete a domain from a workspace.
|
|
483
|
+
*/
|
|
484
|
+
async delete(
|
|
485
|
+
input: operations.DeleteDomainRequest,
|
|
486
|
+
options?: RequestOptions
|
|
487
|
+
): Promise<operations.DeleteDomainResponseBody> {
|
|
488
|
+
const headers$ = new Headers();
|
|
489
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
490
|
+
headers$.set("Accept", "application/json");
|
|
491
|
+
|
|
492
|
+
const payload$ = schemas$.parse(
|
|
493
|
+
input,
|
|
494
|
+
(value$) => operations.DeleteDomainRequest$.outboundSchema.parse(value$),
|
|
495
|
+
"Input validation failed"
|
|
496
|
+
);
|
|
497
|
+
const body$ = null;
|
|
498
|
+
|
|
499
|
+
const pathParams$ = {
|
|
500
|
+
slug: enc$.encodeSimple("slug", payload$.slug, {
|
|
501
|
+
explode: false,
|
|
502
|
+
charEncoding: "percent",
|
|
503
|
+
}),
|
|
504
|
+
};
|
|
505
|
+
const path$ = this.templateURLComponent("/domains/{slug}")(pathParams$);
|
|
506
|
+
|
|
507
|
+
const query$ = [
|
|
508
|
+
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
|
|
509
|
+
explode: true,
|
|
510
|
+
charEncoding: "percent",
|
|
511
|
+
}),
|
|
512
|
+
enc$.encodeForm("workspaceId", this.options$.workspaceId, {
|
|
513
|
+
explode: true,
|
|
514
|
+
charEncoding: "percent",
|
|
515
|
+
}),
|
|
516
|
+
]
|
|
517
|
+
.filter(Boolean)
|
|
518
|
+
.join("&");
|
|
519
|
+
|
|
520
|
+
let security$;
|
|
521
|
+
if (typeof this.options$.token === "function") {
|
|
522
|
+
security$ = { token: await this.options$.token() };
|
|
523
|
+
} else if (this.options$.token) {
|
|
524
|
+
security$ = { token: this.options$.token };
|
|
525
|
+
} else {
|
|
526
|
+
security$ = {};
|
|
527
|
+
}
|
|
528
|
+
const context = {
|
|
529
|
+
operationID: "deleteDomain",
|
|
530
|
+
oAuth2Scopes: [],
|
|
531
|
+
securitySource: this.options$.token,
|
|
532
|
+
};
|
|
533
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
534
|
+
|
|
535
|
+
const doOptions = {
|
|
536
|
+
context,
|
|
537
|
+
errorCodes: [
|
|
538
|
+
"400",
|
|
539
|
+
"401",
|
|
540
|
+
"403",
|
|
541
|
+
"404",
|
|
542
|
+
"409",
|
|
543
|
+
"410",
|
|
544
|
+
"422",
|
|
545
|
+
"429",
|
|
546
|
+
"4XX",
|
|
547
|
+
"500",
|
|
548
|
+
"5XX",
|
|
549
|
+
],
|
|
550
|
+
};
|
|
551
|
+
const request = this.createRequest$(
|
|
552
|
+
{
|
|
553
|
+
security: securitySettings$,
|
|
554
|
+
method: "DELETE",
|
|
555
|
+
path: path$,
|
|
556
|
+
headers: headers$,
|
|
557
|
+
query: query$,
|
|
558
|
+
body: body$,
|
|
559
|
+
},
|
|
560
|
+
options
|
|
561
|
+
);
|
|
562
|
+
|
|
563
|
+
const response = await this.do$(request, doOptions);
|
|
564
|
+
|
|
565
|
+
const responseFields$ = {
|
|
566
|
+
HttpMeta: {
|
|
567
|
+
Response: response,
|
|
568
|
+
Request: request,
|
|
569
|
+
},
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
573
|
+
const responseBody = await response.json();
|
|
574
|
+
const result = schemas$.parse(
|
|
575
|
+
responseBody,
|
|
576
|
+
(val$) => {
|
|
577
|
+
return operations.DeleteDomainResponseBody$.inboundSchema.parse(val$);
|
|
578
|
+
},
|
|
579
|
+
"Response validation failed"
|
|
580
|
+
);
|
|
581
|
+
return result;
|
|
582
|
+
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
583
|
+
const responseBody = await response.json();
|
|
584
|
+
const result = schemas$.parse(
|
|
585
|
+
responseBody,
|
|
586
|
+
(val$) => {
|
|
587
|
+
return errors.BadRequest$.inboundSchema.parse({
|
|
588
|
+
...responseFields$,
|
|
589
|
+
...val$,
|
|
590
|
+
});
|
|
591
|
+
},
|
|
592
|
+
"Response validation failed"
|
|
593
|
+
);
|
|
594
|
+
throw result;
|
|
595
|
+
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
596
|
+
const responseBody = await response.json();
|
|
597
|
+
const result = schemas$.parse(
|
|
598
|
+
responseBody,
|
|
599
|
+
(val$) => {
|
|
600
|
+
return errors.Unauthorized$.inboundSchema.parse({
|
|
601
|
+
...responseFields$,
|
|
602
|
+
...val$,
|
|
603
|
+
});
|
|
604
|
+
},
|
|
605
|
+
"Response validation failed"
|
|
606
|
+
);
|
|
607
|
+
throw result;
|
|
608
|
+
} else if (this.matchResponse(response, 403, "application/json")) {
|
|
609
|
+
const responseBody = await response.json();
|
|
610
|
+
const result = schemas$.parse(
|
|
611
|
+
responseBody,
|
|
612
|
+
(val$) => {
|
|
613
|
+
return errors.Forbidden$.inboundSchema.parse({
|
|
614
|
+
...responseFields$,
|
|
615
|
+
...val$,
|
|
616
|
+
});
|
|
617
|
+
},
|
|
618
|
+
"Response validation failed"
|
|
619
|
+
);
|
|
620
|
+
throw result;
|
|
621
|
+
} else if (this.matchResponse(response, 404, "application/json")) {
|
|
622
|
+
const responseBody = await response.json();
|
|
623
|
+
const result = schemas$.parse(
|
|
624
|
+
responseBody,
|
|
625
|
+
(val$) => {
|
|
626
|
+
return errors.NotFound$.inboundSchema.parse({
|
|
627
|
+
...responseFields$,
|
|
628
|
+
...val$,
|
|
629
|
+
});
|
|
630
|
+
},
|
|
631
|
+
"Response validation failed"
|
|
632
|
+
);
|
|
633
|
+
throw result;
|
|
634
|
+
} else if (this.matchResponse(response, 409, "application/json")) {
|
|
635
|
+
const responseBody = await response.json();
|
|
636
|
+
const result = schemas$.parse(
|
|
637
|
+
responseBody,
|
|
638
|
+
(val$) => {
|
|
639
|
+
return errors.Conflict$.inboundSchema.parse({
|
|
640
|
+
...responseFields$,
|
|
641
|
+
...val$,
|
|
642
|
+
});
|
|
643
|
+
},
|
|
644
|
+
"Response validation failed"
|
|
645
|
+
);
|
|
646
|
+
throw result;
|
|
647
|
+
} else if (this.matchResponse(response, 410, "application/json")) {
|
|
648
|
+
const responseBody = await response.json();
|
|
649
|
+
const result = schemas$.parse(
|
|
650
|
+
responseBody,
|
|
651
|
+
(val$) => {
|
|
652
|
+
return errors.InviteExpired$.inboundSchema.parse({
|
|
653
|
+
...responseFields$,
|
|
654
|
+
...val$,
|
|
655
|
+
});
|
|
656
|
+
},
|
|
657
|
+
"Response validation failed"
|
|
658
|
+
);
|
|
659
|
+
throw result;
|
|
660
|
+
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
661
|
+
const responseBody = await response.json();
|
|
662
|
+
const result = schemas$.parse(
|
|
663
|
+
responseBody,
|
|
664
|
+
(val$) => {
|
|
665
|
+
return errors.UnprocessableEntity$.inboundSchema.parse({
|
|
666
|
+
...responseFields$,
|
|
667
|
+
...val$,
|
|
668
|
+
});
|
|
669
|
+
},
|
|
670
|
+
"Response validation failed"
|
|
671
|
+
);
|
|
672
|
+
throw result;
|
|
673
|
+
} else if (this.matchResponse(response, 429, "application/json")) {
|
|
674
|
+
const responseBody = await response.json();
|
|
675
|
+
const result = schemas$.parse(
|
|
676
|
+
responseBody,
|
|
677
|
+
(val$) => {
|
|
678
|
+
return errors.RateLimitExceeded$.inboundSchema.parse({
|
|
679
|
+
...responseFields$,
|
|
680
|
+
...val$,
|
|
681
|
+
});
|
|
682
|
+
},
|
|
683
|
+
"Response validation failed"
|
|
684
|
+
);
|
|
685
|
+
throw result;
|
|
686
|
+
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
687
|
+
const responseBody = await response.json();
|
|
688
|
+
const result = schemas$.parse(
|
|
689
|
+
responseBody,
|
|
690
|
+
(val$) => {
|
|
691
|
+
return errors.InternalServerError$.inboundSchema.parse({
|
|
692
|
+
...responseFields$,
|
|
693
|
+
...val$,
|
|
694
|
+
});
|
|
695
|
+
},
|
|
696
|
+
"Response validation failed"
|
|
697
|
+
);
|
|
698
|
+
throw result;
|
|
699
|
+
} else {
|
|
700
|
+
const responseBody = await response.text();
|
|
701
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Edit a domain
|
|
707
|
+
*
|
|
708
|
+
* @remarks
|
|
709
|
+
* Edit a domain for the authenticated workspace.
|
|
710
|
+
*/
|
|
711
|
+
async update(
|
|
712
|
+
input: operations.EditDomainRequest,
|
|
713
|
+
options?: RequestOptions
|
|
714
|
+
): Promise<operations.EditDomainResponseBody> {
|
|
715
|
+
const headers$ = new Headers();
|
|
716
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
717
|
+
headers$.set("Content-Type", "application/json");
|
|
718
|
+
headers$.set("Accept", "application/json");
|
|
719
|
+
|
|
720
|
+
const payload$ = schemas$.parse(
|
|
721
|
+
input,
|
|
722
|
+
(value$) => operations.EditDomainRequest$.outboundSchema.parse(value$),
|
|
723
|
+
"Input validation failed"
|
|
724
|
+
);
|
|
725
|
+
const body$ = enc$.encodeJSON("body", payload$.RequestBody, { explode: true });
|
|
726
|
+
|
|
727
|
+
const pathParams$ = {
|
|
728
|
+
slug: enc$.encodeSimple("slug", payload$.slug, {
|
|
729
|
+
explode: false,
|
|
730
|
+
charEncoding: "percent",
|
|
731
|
+
}),
|
|
732
|
+
};
|
|
733
|
+
const path$ = this.templateURLComponent("/domains/{slug}")(pathParams$);
|
|
734
|
+
|
|
735
|
+
const query$ = [
|
|
736
|
+
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
|
|
737
|
+
explode: true,
|
|
738
|
+
charEncoding: "percent",
|
|
739
|
+
}),
|
|
740
|
+
enc$.encodeForm("workspaceId", this.options$.workspaceId, {
|
|
741
|
+
explode: true,
|
|
742
|
+
charEncoding: "percent",
|
|
743
|
+
}),
|
|
744
|
+
]
|
|
745
|
+
.filter(Boolean)
|
|
746
|
+
.join("&");
|
|
747
|
+
|
|
748
|
+
let security$;
|
|
749
|
+
if (typeof this.options$.token === "function") {
|
|
750
|
+
security$ = { token: await this.options$.token() };
|
|
751
|
+
} else if (this.options$.token) {
|
|
752
|
+
security$ = { token: this.options$.token };
|
|
753
|
+
} else {
|
|
754
|
+
security$ = {};
|
|
755
|
+
}
|
|
756
|
+
const context = {
|
|
757
|
+
operationID: "editDomain",
|
|
758
|
+
oAuth2Scopes: [],
|
|
759
|
+
securitySource: this.options$.token,
|
|
760
|
+
};
|
|
761
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
762
|
+
|
|
763
|
+
const doOptions = {
|
|
764
|
+
context,
|
|
765
|
+
errorCodes: [
|
|
766
|
+
"400",
|
|
767
|
+
"401",
|
|
768
|
+
"403",
|
|
769
|
+
"404",
|
|
770
|
+
"409",
|
|
771
|
+
"410",
|
|
772
|
+
"422",
|
|
773
|
+
"429",
|
|
774
|
+
"4XX",
|
|
775
|
+
"500",
|
|
776
|
+
"5XX",
|
|
777
|
+
],
|
|
778
|
+
};
|
|
779
|
+
const request = this.createRequest$(
|
|
780
|
+
{
|
|
781
|
+
security: securitySettings$,
|
|
782
|
+
method: "PATCH",
|
|
783
|
+
path: path$,
|
|
784
|
+
headers: headers$,
|
|
785
|
+
query: query$,
|
|
786
|
+
body: body$,
|
|
787
|
+
},
|
|
788
|
+
options
|
|
789
|
+
);
|
|
790
|
+
|
|
791
|
+
const response = await this.do$(request, doOptions);
|
|
792
|
+
|
|
793
|
+
const responseFields$ = {
|
|
794
|
+
HttpMeta: {
|
|
795
|
+
Response: response,
|
|
796
|
+
Request: request,
|
|
797
|
+
},
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
801
|
+
const responseBody = await response.json();
|
|
802
|
+
const result = schemas$.parse(
|
|
803
|
+
responseBody,
|
|
804
|
+
(val$) => {
|
|
805
|
+
return operations.EditDomainResponseBody$.inboundSchema.parse(val$);
|
|
806
|
+
},
|
|
807
|
+
"Response validation failed"
|
|
808
|
+
);
|
|
809
|
+
return result;
|
|
810
|
+
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
811
|
+
const responseBody = await response.json();
|
|
812
|
+
const result = schemas$.parse(
|
|
813
|
+
responseBody,
|
|
814
|
+
(val$) => {
|
|
815
|
+
return errors.BadRequest$.inboundSchema.parse({
|
|
816
|
+
...responseFields$,
|
|
817
|
+
...val$,
|
|
818
|
+
});
|
|
819
|
+
},
|
|
820
|
+
"Response validation failed"
|
|
821
|
+
);
|
|
822
|
+
throw result;
|
|
823
|
+
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
824
|
+
const responseBody = await response.json();
|
|
825
|
+
const result = schemas$.parse(
|
|
826
|
+
responseBody,
|
|
827
|
+
(val$) => {
|
|
828
|
+
return errors.Unauthorized$.inboundSchema.parse({
|
|
829
|
+
...responseFields$,
|
|
830
|
+
...val$,
|
|
831
|
+
});
|
|
832
|
+
},
|
|
833
|
+
"Response validation failed"
|
|
834
|
+
);
|
|
835
|
+
throw result;
|
|
836
|
+
} else if (this.matchResponse(response, 403, "application/json")) {
|
|
837
|
+
const responseBody = await response.json();
|
|
838
|
+
const result = schemas$.parse(
|
|
839
|
+
responseBody,
|
|
840
|
+
(val$) => {
|
|
841
|
+
return errors.Forbidden$.inboundSchema.parse({
|
|
842
|
+
...responseFields$,
|
|
843
|
+
...val$,
|
|
844
|
+
});
|
|
845
|
+
},
|
|
846
|
+
"Response validation failed"
|
|
847
|
+
);
|
|
848
|
+
throw result;
|
|
849
|
+
} else if (this.matchResponse(response, 404, "application/json")) {
|
|
850
|
+
const responseBody = await response.json();
|
|
851
|
+
const result = schemas$.parse(
|
|
852
|
+
responseBody,
|
|
853
|
+
(val$) => {
|
|
854
|
+
return errors.NotFound$.inboundSchema.parse({
|
|
855
|
+
...responseFields$,
|
|
856
|
+
...val$,
|
|
857
|
+
});
|
|
858
|
+
},
|
|
859
|
+
"Response validation failed"
|
|
860
|
+
);
|
|
861
|
+
throw result;
|
|
862
|
+
} else if (this.matchResponse(response, 409, "application/json")) {
|
|
863
|
+
const responseBody = await response.json();
|
|
864
|
+
const result = schemas$.parse(
|
|
865
|
+
responseBody,
|
|
866
|
+
(val$) => {
|
|
867
|
+
return errors.Conflict$.inboundSchema.parse({
|
|
868
|
+
...responseFields$,
|
|
869
|
+
...val$,
|
|
870
|
+
});
|
|
871
|
+
},
|
|
872
|
+
"Response validation failed"
|
|
873
|
+
);
|
|
874
|
+
throw result;
|
|
875
|
+
} else if (this.matchResponse(response, 410, "application/json")) {
|
|
876
|
+
const responseBody = await response.json();
|
|
877
|
+
const result = schemas$.parse(
|
|
878
|
+
responseBody,
|
|
879
|
+
(val$) => {
|
|
880
|
+
return errors.InviteExpired$.inboundSchema.parse({
|
|
881
|
+
...responseFields$,
|
|
882
|
+
...val$,
|
|
883
|
+
});
|
|
884
|
+
},
|
|
885
|
+
"Response validation failed"
|
|
886
|
+
);
|
|
887
|
+
throw result;
|
|
888
|
+
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
889
|
+
const responseBody = await response.json();
|
|
890
|
+
const result = schemas$.parse(
|
|
891
|
+
responseBody,
|
|
892
|
+
(val$) => {
|
|
893
|
+
return errors.UnprocessableEntity$.inboundSchema.parse({
|
|
894
|
+
...responseFields$,
|
|
895
|
+
...val$,
|
|
896
|
+
});
|
|
897
|
+
},
|
|
898
|
+
"Response validation failed"
|
|
899
|
+
);
|
|
900
|
+
throw result;
|
|
901
|
+
} else if (this.matchResponse(response, 429, "application/json")) {
|
|
902
|
+
const responseBody = await response.json();
|
|
903
|
+
const result = schemas$.parse(
|
|
904
|
+
responseBody,
|
|
905
|
+
(val$) => {
|
|
906
|
+
return errors.RateLimitExceeded$.inboundSchema.parse({
|
|
907
|
+
...responseFields$,
|
|
908
|
+
...val$,
|
|
909
|
+
});
|
|
910
|
+
},
|
|
911
|
+
"Response validation failed"
|
|
912
|
+
);
|
|
913
|
+
throw result;
|
|
914
|
+
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
915
|
+
const responseBody = await response.json();
|
|
916
|
+
const result = schemas$.parse(
|
|
917
|
+
responseBody,
|
|
918
|
+
(val$) => {
|
|
919
|
+
return errors.InternalServerError$.inboundSchema.parse({
|
|
920
|
+
...responseFields$,
|
|
921
|
+
...val$,
|
|
922
|
+
});
|
|
923
|
+
},
|
|
924
|
+
"Response validation failed"
|
|
925
|
+
);
|
|
926
|
+
throw result;
|
|
927
|
+
} else {
|
|
928
|
+
const responseBody = await response.text();
|
|
929
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Set a domain as primary
|
|
935
|
+
*
|
|
936
|
+
* @remarks
|
|
937
|
+
* Set a domain as primary for the authenticated workspace.
|
|
938
|
+
*/
|
|
939
|
+
async setPrimary(
|
|
940
|
+
input: operations.SetPrimaryDomainRequest,
|
|
941
|
+
options?: RequestOptions
|
|
942
|
+
): Promise<operations.SetPrimaryDomainResponseBody> {
|
|
943
|
+
const headers$ = new Headers();
|
|
944
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
945
|
+
headers$.set("Accept", "application/json");
|
|
946
|
+
|
|
947
|
+
const payload$ = schemas$.parse(
|
|
948
|
+
input,
|
|
949
|
+
(value$) => operations.SetPrimaryDomainRequest$.outboundSchema.parse(value$),
|
|
950
|
+
"Input validation failed"
|
|
951
|
+
);
|
|
952
|
+
const body$ = null;
|
|
953
|
+
|
|
954
|
+
const pathParams$ = {
|
|
955
|
+
slug: enc$.encodeSimple("slug", payload$.slug, {
|
|
956
|
+
explode: false,
|
|
957
|
+
charEncoding: "percent",
|
|
958
|
+
}),
|
|
959
|
+
};
|
|
960
|
+
const path$ = this.templateURLComponent("/domains/{slug}/primary")(pathParams$);
|
|
961
|
+
|
|
962
|
+
const query$ = [
|
|
963
|
+
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
|
|
964
|
+
explode: true,
|
|
965
|
+
charEncoding: "percent",
|
|
966
|
+
}),
|
|
967
|
+
enc$.encodeForm("workspaceId", this.options$.workspaceId, {
|
|
968
|
+
explode: true,
|
|
969
|
+
charEncoding: "percent",
|
|
970
|
+
}),
|
|
971
|
+
]
|
|
972
|
+
.filter(Boolean)
|
|
973
|
+
.join("&");
|
|
974
|
+
|
|
975
|
+
let security$;
|
|
976
|
+
if (typeof this.options$.token === "function") {
|
|
977
|
+
security$ = { token: await this.options$.token() };
|
|
978
|
+
} else if (this.options$.token) {
|
|
979
|
+
security$ = { token: this.options$.token };
|
|
980
|
+
} else {
|
|
981
|
+
security$ = {};
|
|
982
|
+
}
|
|
983
|
+
const context = {
|
|
984
|
+
operationID: "setPrimaryDomain",
|
|
985
|
+
oAuth2Scopes: [],
|
|
986
|
+
securitySource: this.options$.token,
|
|
987
|
+
};
|
|
988
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
989
|
+
|
|
990
|
+
const doOptions = {
|
|
991
|
+
context,
|
|
992
|
+
errorCodes: [
|
|
993
|
+
"400",
|
|
994
|
+
"401",
|
|
995
|
+
"403",
|
|
996
|
+
"404",
|
|
997
|
+
"409",
|
|
998
|
+
"410",
|
|
999
|
+
"422",
|
|
1000
|
+
"429",
|
|
1001
|
+
"4XX",
|
|
1002
|
+
"500",
|
|
1003
|
+
"5XX",
|
|
1004
|
+
],
|
|
1005
|
+
};
|
|
1006
|
+
const request = this.createRequest$(
|
|
1007
|
+
{
|
|
1008
|
+
security: securitySettings$,
|
|
1009
|
+
method: "POST",
|
|
1010
|
+
path: path$,
|
|
1011
|
+
headers: headers$,
|
|
1012
|
+
query: query$,
|
|
1013
|
+
body: body$,
|
|
1014
|
+
},
|
|
1015
|
+
options
|
|
1016
|
+
);
|
|
1017
|
+
|
|
1018
|
+
const response = await this.do$(request, doOptions);
|
|
1019
|
+
|
|
1020
|
+
const responseFields$ = {
|
|
1021
|
+
HttpMeta: {
|
|
1022
|
+
Response: response,
|
|
1023
|
+
Request: request,
|
|
1024
|
+
},
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
1028
|
+
const responseBody = await response.json();
|
|
1029
|
+
const result = schemas$.parse(
|
|
1030
|
+
responseBody,
|
|
1031
|
+
(val$) => {
|
|
1032
|
+
return operations.SetPrimaryDomainResponseBody$.inboundSchema.parse(val$);
|
|
1033
|
+
},
|
|
1034
|
+
"Response validation failed"
|
|
1035
|
+
);
|
|
1036
|
+
return result;
|
|
1037
|
+
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
1038
|
+
const responseBody = await response.json();
|
|
1039
|
+
const result = schemas$.parse(
|
|
1040
|
+
responseBody,
|
|
1041
|
+
(val$) => {
|
|
1042
|
+
return errors.BadRequest$.inboundSchema.parse({
|
|
1043
|
+
...responseFields$,
|
|
1044
|
+
...val$,
|
|
1045
|
+
});
|
|
1046
|
+
},
|
|
1047
|
+
"Response validation failed"
|
|
1048
|
+
);
|
|
1049
|
+
throw result;
|
|
1050
|
+
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
1051
|
+
const responseBody = await response.json();
|
|
1052
|
+
const result = schemas$.parse(
|
|
1053
|
+
responseBody,
|
|
1054
|
+
(val$) => {
|
|
1055
|
+
return errors.Unauthorized$.inboundSchema.parse({
|
|
1056
|
+
...responseFields$,
|
|
1057
|
+
...val$,
|
|
1058
|
+
});
|
|
1059
|
+
},
|
|
1060
|
+
"Response validation failed"
|
|
1061
|
+
);
|
|
1062
|
+
throw result;
|
|
1063
|
+
} else if (this.matchResponse(response, 403, "application/json")) {
|
|
1064
|
+
const responseBody = await response.json();
|
|
1065
|
+
const result = schemas$.parse(
|
|
1066
|
+
responseBody,
|
|
1067
|
+
(val$) => {
|
|
1068
|
+
return errors.Forbidden$.inboundSchema.parse({
|
|
1069
|
+
...responseFields$,
|
|
1070
|
+
...val$,
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
"Response validation failed"
|
|
1074
|
+
);
|
|
1075
|
+
throw result;
|
|
1076
|
+
} else if (this.matchResponse(response, 404, "application/json")) {
|
|
1077
|
+
const responseBody = await response.json();
|
|
1078
|
+
const result = schemas$.parse(
|
|
1079
|
+
responseBody,
|
|
1080
|
+
(val$) => {
|
|
1081
|
+
return errors.NotFound$.inboundSchema.parse({
|
|
1082
|
+
...responseFields$,
|
|
1083
|
+
...val$,
|
|
1084
|
+
});
|
|
1085
|
+
},
|
|
1086
|
+
"Response validation failed"
|
|
1087
|
+
);
|
|
1088
|
+
throw result;
|
|
1089
|
+
} else if (this.matchResponse(response, 409, "application/json")) {
|
|
1090
|
+
const responseBody = await response.json();
|
|
1091
|
+
const result = schemas$.parse(
|
|
1092
|
+
responseBody,
|
|
1093
|
+
(val$) => {
|
|
1094
|
+
return errors.Conflict$.inboundSchema.parse({
|
|
1095
|
+
...responseFields$,
|
|
1096
|
+
...val$,
|
|
1097
|
+
});
|
|
1098
|
+
},
|
|
1099
|
+
"Response validation failed"
|
|
1100
|
+
);
|
|
1101
|
+
throw result;
|
|
1102
|
+
} else if (this.matchResponse(response, 410, "application/json")) {
|
|
1103
|
+
const responseBody = await response.json();
|
|
1104
|
+
const result = schemas$.parse(
|
|
1105
|
+
responseBody,
|
|
1106
|
+
(val$) => {
|
|
1107
|
+
return errors.InviteExpired$.inboundSchema.parse({
|
|
1108
|
+
...responseFields$,
|
|
1109
|
+
...val$,
|
|
1110
|
+
});
|
|
1111
|
+
},
|
|
1112
|
+
"Response validation failed"
|
|
1113
|
+
);
|
|
1114
|
+
throw result;
|
|
1115
|
+
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
1116
|
+
const responseBody = await response.json();
|
|
1117
|
+
const result = schemas$.parse(
|
|
1118
|
+
responseBody,
|
|
1119
|
+
(val$) => {
|
|
1120
|
+
return errors.UnprocessableEntity$.inboundSchema.parse({
|
|
1121
|
+
...responseFields$,
|
|
1122
|
+
...val$,
|
|
1123
|
+
});
|
|
1124
|
+
},
|
|
1125
|
+
"Response validation failed"
|
|
1126
|
+
);
|
|
1127
|
+
throw result;
|
|
1128
|
+
} else if (this.matchResponse(response, 429, "application/json")) {
|
|
1129
|
+
const responseBody = await response.json();
|
|
1130
|
+
const result = schemas$.parse(
|
|
1131
|
+
responseBody,
|
|
1132
|
+
(val$) => {
|
|
1133
|
+
return errors.RateLimitExceeded$.inboundSchema.parse({
|
|
1134
|
+
...responseFields$,
|
|
1135
|
+
...val$,
|
|
1136
|
+
});
|
|
1137
|
+
},
|
|
1138
|
+
"Response validation failed"
|
|
1139
|
+
);
|
|
1140
|
+
throw result;
|
|
1141
|
+
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
1142
|
+
const responseBody = await response.json();
|
|
1143
|
+
const result = schemas$.parse(
|
|
1144
|
+
responseBody,
|
|
1145
|
+
(val$) => {
|
|
1146
|
+
return errors.InternalServerError$.inboundSchema.parse({
|
|
1147
|
+
...responseFields$,
|
|
1148
|
+
...val$,
|
|
1149
|
+
});
|
|
1150
|
+
},
|
|
1151
|
+
"Response validation failed"
|
|
1152
|
+
);
|
|
1153
|
+
throw result;
|
|
1154
|
+
} else {
|
|
1155
|
+
const responseBody = await response.text();
|
|
1156
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* Transfer a domain
|
|
1162
|
+
*
|
|
1163
|
+
* @remarks
|
|
1164
|
+
* Transfer a domain to another workspace within the authenticated account.
|
|
1165
|
+
*/
|
|
1166
|
+
async transfer(
|
|
1167
|
+
input: operations.TransferDomainRequest,
|
|
1168
|
+
options?: RequestOptions
|
|
1169
|
+
): Promise<operations.TransferDomainResponseBody> {
|
|
1170
|
+
const headers$ = new Headers();
|
|
1171
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
1172
|
+
headers$.set("Content-Type", "application/json");
|
|
1173
|
+
headers$.set("Accept", "application/json");
|
|
1174
|
+
|
|
1175
|
+
const payload$ = schemas$.parse(
|
|
1176
|
+
input,
|
|
1177
|
+
(value$) => operations.TransferDomainRequest$.outboundSchema.parse(value$),
|
|
1178
|
+
"Input validation failed"
|
|
1179
|
+
);
|
|
1180
|
+
const body$ = enc$.encodeJSON("body", payload$.RequestBody, { explode: true });
|
|
1181
|
+
|
|
1182
|
+
const pathParams$ = {
|
|
1183
|
+
slug: enc$.encodeSimple("slug", payload$.slug, {
|
|
1184
|
+
explode: false,
|
|
1185
|
+
charEncoding: "percent",
|
|
1186
|
+
}),
|
|
1187
|
+
};
|
|
1188
|
+
const path$ = this.templateURLComponent("/domains/{slug}/transfer")(pathParams$);
|
|
1189
|
+
|
|
1190
|
+
const query$ = [
|
|
1191
|
+
enc$.encodeForm("projectSlug", this.options$.projectSlug, {
|
|
1192
|
+
explode: true,
|
|
1193
|
+
charEncoding: "percent",
|
|
1194
|
+
}),
|
|
1195
|
+
enc$.encodeForm("workspaceId", this.options$.workspaceId, {
|
|
1196
|
+
explode: true,
|
|
1197
|
+
charEncoding: "percent",
|
|
1198
|
+
}),
|
|
1199
|
+
]
|
|
1200
|
+
.filter(Boolean)
|
|
1201
|
+
.join("&");
|
|
1202
|
+
|
|
1203
|
+
let security$;
|
|
1204
|
+
if (typeof this.options$.token === "function") {
|
|
1205
|
+
security$ = { token: await this.options$.token() };
|
|
1206
|
+
} else if (this.options$.token) {
|
|
1207
|
+
security$ = { token: this.options$.token };
|
|
1208
|
+
} else {
|
|
1209
|
+
security$ = {};
|
|
1210
|
+
}
|
|
1211
|
+
const context = {
|
|
1212
|
+
operationID: "transferDomain",
|
|
1213
|
+
oAuth2Scopes: [],
|
|
1214
|
+
securitySource: this.options$.token,
|
|
1215
|
+
};
|
|
1216
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
1217
|
+
|
|
1218
|
+
const doOptions = {
|
|
1219
|
+
context,
|
|
1220
|
+
errorCodes: [
|
|
1221
|
+
"400",
|
|
1222
|
+
"401",
|
|
1223
|
+
"403",
|
|
1224
|
+
"404",
|
|
1225
|
+
"409",
|
|
1226
|
+
"410",
|
|
1227
|
+
"422",
|
|
1228
|
+
"429",
|
|
1229
|
+
"4XX",
|
|
1230
|
+
"500",
|
|
1231
|
+
"5XX",
|
|
1232
|
+
],
|
|
1233
|
+
};
|
|
1234
|
+
const request = this.createRequest$(
|
|
1235
|
+
{
|
|
1236
|
+
security: securitySettings$,
|
|
1237
|
+
method: "POST",
|
|
1238
|
+
path: path$,
|
|
1239
|
+
headers: headers$,
|
|
1240
|
+
query: query$,
|
|
1241
|
+
body: body$,
|
|
1242
|
+
},
|
|
1243
|
+
options
|
|
1244
|
+
);
|
|
1245
|
+
|
|
1246
|
+
const response = await this.do$(request, doOptions);
|
|
1247
|
+
|
|
1248
|
+
const responseFields$ = {
|
|
1249
|
+
HttpMeta: {
|
|
1250
|
+
Response: response,
|
|
1251
|
+
Request: request,
|
|
1252
|
+
},
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
1256
|
+
const responseBody = await response.json();
|
|
1257
|
+
const result = schemas$.parse(
|
|
1258
|
+
responseBody,
|
|
1259
|
+
(val$) => {
|
|
1260
|
+
return operations.TransferDomainResponseBody$.inboundSchema.parse(val$);
|
|
1261
|
+
},
|
|
1262
|
+
"Response validation failed"
|
|
1263
|
+
);
|
|
1264
|
+
return result;
|
|
1265
|
+
} else if (this.matchResponse(response, 400, "application/json")) {
|
|
1266
|
+
const responseBody = await response.json();
|
|
1267
|
+
const result = schemas$.parse(
|
|
1268
|
+
responseBody,
|
|
1269
|
+
(val$) => {
|
|
1270
|
+
return errors.BadRequest$.inboundSchema.parse({
|
|
1271
|
+
...responseFields$,
|
|
1272
|
+
...val$,
|
|
1273
|
+
});
|
|
1274
|
+
},
|
|
1275
|
+
"Response validation failed"
|
|
1276
|
+
);
|
|
1277
|
+
throw result;
|
|
1278
|
+
} else if (this.matchResponse(response, 401, "application/json")) {
|
|
1279
|
+
const responseBody = await response.json();
|
|
1280
|
+
const result = schemas$.parse(
|
|
1281
|
+
responseBody,
|
|
1282
|
+
(val$) => {
|
|
1283
|
+
return errors.Unauthorized$.inboundSchema.parse({
|
|
1284
|
+
...responseFields$,
|
|
1285
|
+
...val$,
|
|
1286
|
+
});
|
|
1287
|
+
},
|
|
1288
|
+
"Response validation failed"
|
|
1289
|
+
);
|
|
1290
|
+
throw result;
|
|
1291
|
+
} else if (this.matchResponse(response, 403, "application/json")) {
|
|
1292
|
+
const responseBody = await response.json();
|
|
1293
|
+
const result = schemas$.parse(
|
|
1294
|
+
responseBody,
|
|
1295
|
+
(val$) => {
|
|
1296
|
+
return errors.Forbidden$.inboundSchema.parse({
|
|
1297
|
+
...responseFields$,
|
|
1298
|
+
...val$,
|
|
1299
|
+
});
|
|
1300
|
+
},
|
|
1301
|
+
"Response validation failed"
|
|
1302
|
+
);
|
|
1303
|
+
throw result;
|
|
1304
|
+
} else if (this.matchResponse(response, 404, "application/json")) {
|
|
1305
|
+
const responseBody = await response.json();
|
|
1306
|
+
const result = schemas$.parse(
|
|
1307
|
+
responseBody,
|
|
1308
|
+
(val$) => {
|
|
1309
|
+
return errors.NotFound$.inboundSchema.parse({
|
|
1310
|
+
...responseFields$,
|
|
1311
|
+
...val$,
|
|
1312
|
+
});
|
|
1313
|
+
},
|
|
1314
|
+
"Response validation failed"
|
|
1315
|
+
);
|
|
1316
|
+
throw result;
|
|
1317
|
+
} else if (this.matchResponse(response, 409, "application/json")) {
|
|
1318
|
+
const responseBody = await response.json();
|
|
1319
|
+
const result = schemas$.parse(
|
|
1320
|
+
responseBody,
|
|
1321
|
+
(val$) => {
|
|
1322
|
+
return errors.Conflict$.inboundSchema.parse({
|
|
1323
|
+
...responseFields$,
|
|
1324
|
+
...val$,
|
|
1325
|
+
});
|
|
1326
|
+
},
|
|
1327
|
+
"Response validation failed"
|
|
1328
|
+
);
|
|
1329
|
+
throw result;
|
|
1330
|
+
} else if (this.matchResponse(response, 410, "application/json")) {
|
|
1331
|
+
const responseBody = await response.json();
|
|
1332
|
+
const result = schemas$.parse(
|
|
1333
|
+
responseBody,
|
|
1334
|
+
(val$) => {
|
|
1335
|
+
return errors.InviteExpired$.inboundSchema.parse({
|
|
1336
|
+
...responseFields$,
|
|
1337
|
+
...val$,
|
|
1338
|
+
});
|
|
1339
|
+
},
|
|
1340
|
+
"Response validation failed"
|
|
1341
|
+
);
|
|
1342
|
+
throw result;
|
|
1343
|
+
} else if (this.matchResponse(response, 422, "application/json")) {
|
|
1344
|
+
const responseBody = await response.json();
|
|
1345
|
+
const result = schemas$.parse(
|
|
1346
|
+
responseBody,
|
|
1347
|
+
(val$) => {
|
|
1348
|
+
return errors.UnprocessableEntity$.inboundSchema.parse({
|
|
1349
|
+
...responseFields$,
|
|
1350
|
+
...val$,
|
|
1351
|
+
});
|
|
1352
|
+
},
|
|
1353
|
+
"Response validation failed"
|
|
1354
|
+
);
|
|
1355
|
+
throw result;
|
|
1356
|
+
} else if (this.matchResponse(response, 429, "application/json")) {
|
|
1357
|
+
const responseBody = await response.json();
|
|
1358
|
+
const result = schemas$.parse(
|
|
1359
|
+
responseBody,
|
|
1360
|
+
(val$) => {
|
|
1361
|
+
return errors.RateLimitExceeded$.inboundSchema.parse({
|
|
1362
|
+
...responseFields$,
|
|
1363
|
+
...val$,
|
|
1364
|
+
});
|
|
1365
|
+
},
|
|
1366
|
+
"Response validation failed"
|
|
1367
|
+
);
|
|
1368
|
+
throw result;
|
|
1369
|
+
} else if (this.matchResponse(response, 500, "application/json")) {
|
|
1370
|
+
const responseBody = await response.json();
|
|
1371
|
+
const result = schemas$.parse(
|
|
1372
|
+
responseBody,
|
|
1373
|
+
(val$) => {
|
|
1374
|
+
return errors.InternalServerError$.inboundSchema.parse({
|
|
1375
|
+
...responseFields$,
|
|
1376
|
+
...val$,
|
|
1377
|
+
});
|
|
1378
|
+
},
|
|
1379
|
+
"Response validation failed"
|
|
1380
|
+
);
|
|
1381
|
+
throw result;
|
|
1382
|
+
} else {
|
|
1383
|
+
const responseBody = await response.text();
|
|
1384
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|