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