@leonardo-ai/sdk 4.2.0 → 4.3.0
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 +7 -5
- package/README.md +15 -3
- package/hooks/hooks.d.ts +4 -5
- package/hooks/hooks.d.ts.map +1 -1
- package/hooks/hooks.js +5 -7
- package/hooks/hooks.js.map +1 -1
- package/hooks/types.d.ts +12 -6
- package/hooks/types.d.ts.map +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/schemas.d.ts +7 -0
- package/lib/schemas.d.ts.map +1 -0
- package/lib/schemas.js +49 -0
- package/lib/schemas.js.map +1 -0
- package/lib/sdks.d.ts +1 -2
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +7 -7
- package/lib/sdks.js.map +1 -1
- package/package.json +1 -1
- package/sdk/dataset.d.ts.map +1 -1
- package/sdk/dataset.js +41 -35
- package/sdk/dataset.js.map +1 -1
- package/sdk/element.d.ts.map +1 -1
- package/sdk/element.js +8 -6
- package/sdk/element.js.map +1 -1
- package/sdk/generation.d.ts.map +1 -1
- package/sdk/generation.js +59 -51
- package/sdk/generation.js.map +1 -1
- package/sdk/initimage.d.ts.map +1 -1
- package/sdk/initimage.js +25 -21
- package/sdk/initimage.js.map +1 -1
- package/sdk/model.d.ts.map +1 -1
- package/sdk/model.js +48 -43
- package/sdk/model.js.map +1 -1
- package/sdk/models/errors/index.d.ts +1 -0
- package/sdk/models/errors/index.d.ts.map +1 -1
- package/sdk/models/errors/index.js +1 -0
- package/sdk/models/errors/index.js.map +1 -1
- package/sdk/models/errors/sdkvalidationerror.d.ts +17 -0
- package/sdk/models/errors/sdkvalidationerror.d.ts.map +1 -0
- package/sdk/models/errors/sdkvalidationerror.js +107 -0
- package/sdk/models/errors/sdkvalidationerror.js.map +1 -0
- package/sdk/user.d.ts.map +1 -1
- package/sdk/user.js +8 -6
- package/sdk/user.js.map +1 -1
- package/sdk/variation.d.ts.map +1 -1
- package/sdk/variation.js +34 -31
- package/sdk/variation.js.map +1 -1
- package/src/hooks/hooks.ts +8 -12
- package/src/hooks/types.ts +12 -6
- package/src/lib/config.ts +3 -3
- package/src/lib/schemas.ts +22 -0
- package/src/lib/sdks.ts +7 -9
- package/src/sdk/dataset.ts +81 -35
- package/src/sdk/element.ts +12 -6
- package/src/sdk/generation.ts +119 -53
- package/src/sdk/initimage.ts +49 -21
- package/src/sdk/model.ts +93 -43
- package/src/sdk/models/errors/index.ts +1 -0
- package/src/sdk/models/errors/sdkvalidationerror.ts +95 -0
- package/src/sdk/user.ts +12 -6
- package/src/sdk/variation.ts +69 -32
package/src/sdk/model.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { SDKHooks } from "../hooks";
|
|
|
6
6
|
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
7
7
|
import * as enc$ from "../lib/encodings";
|
|
8
8
|
import { HTTPClient } from "../lib/http";
|
|
9
|
+
import * as schemas$ from "../lib/schemas";
|
|
9
10
|
import { ClientSDK, RequestOptions } from "../lib/sdks";
|
|
10
11
|
import * as errors from "../sdk/models/errors";
|
|
11
12
|
import * as operations from "../sdk/models/operations";
|
|
@@ -52,7 +53,11 @@ export class Model extends ClientSDK {
|
|
|
52
53
|
headers$.set("Content-Type", "application/json");
|
|
53
54
|
headers$.set("Accept", "application/json");
|
|
54
55
|
|
|
55
|
-
const payload$ =
|
|
56
|
+
const payload$ = schemas$.parse(
|
|
57
|
+
input,
|
|
58
|
+
(value$) => operations.CreateModelRequestBody$.outboundSchema.parse(value$),
|
|
59
|
+
"Input validation failed"
|
|
60
|
+
);
|
|
56
61
|
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
57
62
|
|
|
58
63
|
const path$ = this.templateURLComponent("/models")();
|
|
@@ -71,9 +76,8 @@ export class Model extends ClientSDK {
|
|
|
71
76
|
|
|
72
77
|
const context = { operationID: "createModel" };
|
|
73
78
|
const doOptions = { context, errorCodes: [] };
|
|
74
|
-
const request =
|
|
79
|
+
const request = this.createRequest$(
|
|
75
80
|
{
|
|
76
|
-
context,
|
|
77
81
|
security: securitySettings$,
|
|
78
82
|
method: "POST",
|
|
79
83
|
path: path$,
|
|
@@ -94,10 +98,16 @@ export class Model extends ClientSDK {
|
|
|
94
98
|
|
|
95
99
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
96
100
|
const responseBody = await response.json();
|
|
97
|
-
const result =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
const result = schemas$.parse(
|
|
102
|
+
responseBody,
|
|
103
|
+
(val$) => {
|
|
104
|
+
return operations.CreateModelResponse$.inboundSchema.parse({
|
|
105
|
+
...responseFields$,
|
|
106
|
+
object: val$,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
"Response validation failed"
|
|
110
|
+
);
|
|
101
111
|
return result;
|
|
102
112
|
} else {
|
|
103
113
|
const responseBody = await response.text();
|
|
@@ -122,7 +132,11 @@ export class Model extends ClientSDK {
|
|
|
122
132
|
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
123
133
|
headers$.set("Accept", "application/json");
|
|
124
134
|
|
|
125
|
-
const payload$ =
|
|
135
|
+
const payload$ = schemas$.parse(
|
|
136
|
+
input$,
|
|
137
|
+
(value$) => operations.DeleteModelByIdRequest$.outboundSchema.parse(value$),
|
|
138
|
+
"Input validation failed"
|
|
139
|
+
);
|
|
126
140
|
const body$ = null;
|
|
127
141
|
|
|
128
142
|
const pathParams$ = {
|
|
@@ -144,9 +158,8 @@ export class Model extends ClientSDK {
|
|
|
144
158
|
|
|
145
159
|
const context = { operationID: "deleteModelById" };
|
|
146
160
|
const doOptions = { context, errorCodes: [] };
|
|
147
|
-
const request =
|
|
161
|
+
const request = this.createRequest$(
|
|
148
162
|
{
|
|
149
|
-
context,
|
|
150
163
|
security: securitySettings$,
|
|
151
164
|
method: "DELETE",
|
|
152
165
|
path: path$,
|
|
@@ -167,10 +180,16 @@ export class Model extends ClientSDK {
|
|
|
167
180
|
|
|
168
181
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
169
182
|
const responseBody = await response.json();
|
|
170
|
-
const result =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
183
|
+
const result = schemas$.parse(
|
|
184
|
+
responseBody,
|
|
185
|
+
(val$) => {
|
|
186
|
+
return operations.DeleteModelByIdResponse$.inboundSchema.parse({
|
|
187
|
+
...responseFields$,
|
|
188
|
+
object: val$,
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
"Response validation failed"
|
|
192
|
+
);
|
|
174
193
|
return result;
|
|
175
194
|
} else {
|
|
176
195
|
const responseBody = await response.text();
|
|
@@ -198,7 +217,11 @@ export class Model extends ClientSDK {
|
|
|
198
217
|
headers$.set("Content-Type", "application/json");
|
|
199
218
|
headers$.set("Accept", "application/json");
|
|
200
219
|
|
|
201
|
-
const payload$ =
|
|
220
|
+
const payload$ = schemas$.parse(
|
|
221
|
+
input$,
|
|
222
|
+
(value$) => operations.DeleteModels3dIdRequest$.outboundSchema.parse(value$),
|
|
223
|
+
"Input validation failed"
|
|
224
|
+
);
|
|
202
225
|
const body$ = enc$.encodeJSON("body", payload$.RequestBody, { explode: true });
|
|
203
226
|
|
|
204
227
|
const pathParams$ = {
|
|
@@ -220,9 +243,8 @@ export class Model extends ClientSDK {
|
|
|
220
243
|
|
|
221
244
|
const context = { operationID: "delete_/models-3d/{id}" };
|
|
222
245
|
const doOptions = { context, errorCodes: [] };
|
|
223
|
-
const request =
|
|
246
|
+
const request = this.createRequest$(
|
|
224
247
|
{
|
|
225
|
-
context,
|
|
226
248
|
security: securitySettings$,
|
|
227
249
|
method: "DELETE",
|
|
228
250
|
path: path$,
|
|
@@ -243,10 +265,16 @@ export class Model extends ClientSDK {
|
|
|
243
265
|
|
|
244
266
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
245
267
|
const responseBody = await response.json();
|
|
246
|
-
const result =
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
268
|
+
const result = schemas$.parse(
|
|
269
|
+
responseBody,
|
|
270
|
+
(val$) => {
|
|
271
|
+
return operations.DeleteModels3dIdResponse$.inboundSchema.parse({
|
|
272
|
+
...responseFields$,
|
|
273
|
+
object: val$,
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
"Response validation failed"
|
|
277
|
+
);
|
|
250
278
|
return result;
|
|
251
279
|
} else {
|
|
252
280
|
const responseBody = await response.text();
|
|
@@ -271,7 +299,11 @@ export class Model extends ClientSDK {
|
|
|
271
299
|
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
272
300
|
headers$.set("Accept", "application/json");
|
|
273
301
|
|
|
274
|
-
const payload$ =
|
|
302
|
+
const payload$ = schemas$.parse(
|
|
303
|
+
input$,
|
|
304
|
+
(value$) => operations.GetModelByIdRequest$.outboundSchema.parse(value$),
|
|
305
|
+
"Input validation failed"
|
|
306
|
+
);
|
|
275
307
|
const body$ = null;
|
|
276
308
|
|
|
277
309
|
const pathParams$ = {
|
|
@@ -293,9 +325,8 @@ export class Model extends ClientSDK {
|
|
|
293
325
|
|
|
294
326
|
const context = { operationID: "getModelById" };
|
|
295
327
|
const doOptions = { context, errorCodes: [] };
|
|
296
|
-
const request =
|
|
328
|
+
const request = this.createRequest$(
|
|
297
329
|
{
|
|
298
|
-
context,
|
|
299
330
|
security: securitySettings$,
|
|
300
331
|
method: "GET",
|
|
301
332
|
path: path$,
|
|
@@ -316,10 +347,16 @@ export class Model extends ClientSDK {
|
|
|
316
347
|
|
|
317
348
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
318
349
|
const responseBody = await response.json();
|
|
319
|
-
const result =
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
350
|
+
const result = schemas$.parse(
|
|
351
|
+
responseBody,
|
|
352
|
+
(val$) => {
|
|
353
|
+
return operations.GetModelByIdResponse$.inboundSchema.parse({
|
|
354
|
+
...responseFields$,
|
|
355
|
+
object: val$,
|
|
356
|
+
});
|
|
357
|
+
},
|
|
358
|
+
"Response validation failed"
|
|
359
|
+
);
|
|
323
360
|
return result;
|
|
324
361
|
} else {
|
|
325
362
|
const responseBody = await response.text();
|
|
@@ -356,9 +393,8 @@ export class Model extends ClientSDK {
|
|
|
356
393
|
|
|
357
394
|
const context = { operationID: "get_/platformModels" };
|
|
358
395
|
const doOptions = { context, errorCodes: [] };
|
|
359
|
-
const request =
|
|
396
|
+
const request = this.createRequest$(
|
|
360
397
|
{
|
|
361
|
-
context,
|
|
362
398
|
security: securitySettings$,
|
|
363
399
|
method: "GET",
|
|
364
400
|
path: path$,
|
|
@@ -378,10 +414,16 @@ export class Model extends ClientSDK {
|
|
|
378
414
|
|
|
379
415
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
380
416
|
const responseBody = await response.json();
|
|
381
|
-
const result =
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
417
|
+
const result = schemas$.parse(
|
|
418
|
+
responseBody,
|
|
419
|
+
(val$) => {
|
|
420
|
+
return operations.GetPlatformModelsResponse$.inboundSchema.parse({
|
|
421
|
+
...responseFields$,
|
|
422
|
+
object: val$,
|
|
423
|
+
});
|
|
424
|
+
},
|
|
425
|
+
"Response validation failed"
|
|
426
|
+
);
|
|
385
427
|
return result;
|
|
386
428
|
} else {
|
|
387
429
|
const responseBody = await response.text();
|
|
@@ -404,9 +446,12 @@ export class Model extends ClientSDK {
|
|
|
404
446
|
headers$.set("Content-Type", "application/json");
|
|
405
447
|
headers$.set("Accept", "application/json");
|
|
406
448
|
|
|
407
|
-
const payload$ =
|
|
408
|
-
|
|
409
|
-
|
|
449
|
+
const payload$ = schemas$.parse(
|
|
450
|
+
input,
|
|
451
|
+
(value$) =>
|
|
452
|
+
operations.PostModels3dUploadRequestBody$.outboundSchema.optional().parse(value$),
|
|
453
|
+
"Input validation failed"
|
|
454
|
+
);
|
|
410
455
|
const body$ =
|
|
411
456
|
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
412
457
|
|
|
@@ -426,9 +471,8 @@ export class Model extends ClientSDK {
|
|
|
426
471
|
|
|
427
472
|
const context = { operationID: "post_/models-3d/upload" };
|
|
428
473
|
const doOptions = { context, errorCodes: [] };
|
|
429
|
-
const request =
|
|
474
|
+
const request = this.createRequest$(
|
|
430
475
|
{
|
|
431
|
-
context,
|
|
432
476
|
security: securitySettings$,
|
|
433
477
|
method: "POST",
|
|
434
478
|
path: path$,
|
|
@@ -449,10 +493,16 @@ export class Model extends ClientSDK {
|
|
|
449
493
|
|
|
450
494
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
451
495
|
const responseBody = await response.json();
|
|
452
|
-
const result =
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
496
|
+
const result = schemas$.parse(
|
|
497
|
+
responseBody,
|
|
498
|
+
(val$) => {
|
|
499
|
+
return operations.PostModels3dUploadResponse$.inboundSchema.parse({
|
|
500
|
+
...responseFields$,
|
|
501
|
+
object: val$,
|
|
502
|
+
});
|
|
503
|
+
},
|
|
504
|
+
"Response validation failed"
|
|
505
|
+
);
|
|
456
506
|
return result;
|
|
457
507
|
} else {
|
|
458
508
|
const responseBody = await response.text();
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
|
|
7
|
+
export class SDKValidationError extends Error {
|
|
8
|
+
/**
|
|
9
|
+
* The raw value that failed validation.
|
|
10
|
+
*/
|
|
11
|
+
public readonly rawValue: unknown;
|
|
12
|
+
|
|
13
|
+
constructor(message: string, cause: unknown, rawValue: unknown) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "SDKValidationError";
|
|
16
|
+
this.cause = cause;
|
|
17
|
+
this.rawValue = rawValue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public override toString() {
|
|
21
|
+
return `${this.message}: ${this.cause}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Return a pretty-formatted error message if the underlying validation error
|
|
26
|
+
* is a ZodError or some other recognized error type, otherwise return the
|
|
27
|
+
* default error message.
|
|
28
|
+
*/
|
|
29
|
+
public pretty() {
|
|
30
|
+
if (this.cause instanceof z.ZodError) {
|
|
31
|
+
return `${this.message}\n${formatZodError(this.cause)}`;
|
|
32
|
+
} else {
|
|
33
|
+
return this.toString();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function formatZodError(err: z.ZodError, level = 0): string {
|
|
39
|
+
let pre = " ".repeat(level);
|
|
40
|
+
pre = level > 0 ? `│${pre}` : pre;
|
|
41
|
+
pre += " ".repeat(level);
|
|
42
|
+
|
|
43
|
+
let message = "";
|
|
44
|
+
const append = (str: string) => (message += `\n${pre}${str}`);
|
|
45
|
+
|
|
46
|
+
const len = err.issues.length;
|
|
47
|
+
const headline = len === 1 ? `${len} issue found` : `${len} issues found`;
|
|
48
|
+
|
|
49
|
+
if (len) {
|
|
50
|
+
append(`┌ ${headline}:`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (const issue of err.issues) {
|
|
54
|
+
let path = issue.path.join(".");
|
|
55
|
+
path = path ? `<root>.${path}` : "<root>";
|
|
56
|
+
append(`│ • [${path}]: ${issue.message} (${issue.code})`);
|
|
57
|
+
switch (issue.code) {
|
|
58
|
+
case "invalid_literal":
|
|
59
|
+
case "invalid_type": {
|
|
60
|
+
append(`│ Want: ${issue.expected}`);
|
|
61
|
+
append(`│ Got: ${issue.received}`);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "unrecognized_keys": {
|
|
65
|
+
append(`│ Keys: ${issue.keys.join(", ")}`);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "invalid_enum_value": {
|
|
69
|
+
append(`│ Allowed: ${issue.options.join(", ")}`);
|
|
70
|
+
append(`│ Got: ${issue.received}`);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case "invalid_union_discriminator": {
|
|
74
|
+
append(`│ Allowed: ${issue.options.join(", ")}`);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case "invalid_union": {
|
|
78
|
+
const len = issue.unionErrors.length;
|
|
79
|
+
append(
|
|
80
|
+
`│ ✖︎ Attemped to deserialize into one of ${len} union members:`,
|
|
81
|
+
);
|
|
82
|
+
issue.unionErrors.forEach((err, i) => {
|
|
83
|
+
append(`│ ✖︎ Member ${i + 1} of ${len}`);
|
|
84
|
+
append(`${formatZodError(err, level + 1)}`);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (err.issues.length) {
|
|
91
|
+
append(`└─*`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return message.slice(1);
|
|
95
|
+
}
|
package/src/sdk/user.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { SDKHooks } from "../hooks";
|
|
6
6
|
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
7
7
|
import { HTTPClient } from "../lib/http";
|
|
8
|
+
import * as schemas$ from "../lib/schemas";
|
|
8
9
|
import { ClientSDK, RequestOptions } from "../lib/sdks";
|
|
9
10
|
import * as errors from "../sdk/models/errors";
|
|
10
11
|
import * as operations from "../sdk/models/operations";
|
|
@@ -63,9 +64,8 @@ export class User extends ClientSDK {
|
|
|
63
64
|
|
|
64
65
|
const context = { operationID: "getUserSelf" };
|
|
65
66
|
const doOptions = { context, errorCodes: [] };
|
|
66
|
-
const request =
|
|
67
|
+
const request = this.createRequest$(
|
|
67
68
|
{
|
|
68
|
-
context,
|
|
69
69
|
security: securitySettings$,
|
|
70
70
|
method: "GET",
|
|
71
71
|
path: path$,
|
|
@@ -85,10 +85,16 @@ export class User extends ClientSDK {
|
|
|
85
85
|
|
|
86
86
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
87
87
|
const responseBody = await response.json();
|
|
88
|
-
const result =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
const result = schemas$.parse(
|
|
89
|
+
responseBody,
|
|
90
|
+
(val$) => {
|
|
91
|
+
return operations.GetUserSelfResponse$.inboundSchema.parse({
|
|
92
|
+
...responseFields$,
|
|
93
|
+
object: val$,
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
"Response validation failed"
|
|
97
|
+
);
|
|
92
98
|
return result;
|
|
93
99
|
} else {
|
|
94
100
|
const responseBody = await response.text();
|
package/src/sdk/variation.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { SDKHooks } from "../hooks";
|
|
|
6
6
|
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
7
7
|
import * as enc$ from "../lib/encodings";
|
|
8
8
|
import { HTTPClient } from "../lib/http";
|
|
9
|
+
import * as schemas$ from "../lib/schemas";
|
|
9
10
|
import { ClientSDK, RequestOptions } from "../lib/sdks";
|
|
10
11
|
import * as errors from "../sdk/models/errors";
|
|
11
12
|
import * as operations from "../sdk/models/operations";
|
|
@@ -52,7 +53,11 @@ export class Variation extends ClientSDK {
|
|
|
52
53
|
headers$.set("Content-Type", "application/json");
|
|
53
54
|
headers$.set("Accept", "application/json");
|
|
54
55
|
|
|
55
|
-
const payload$ =
|
|
56
|
+
const payload$ = schemas$.parse(
|
|
57
|
+
input,
|
|
58
|
+
(value$) => operations.CreateVariationNoBGRequestBody$.outboundSchema.parse(value$),
|
|
59
|
+
"Input validation failed"
|
|
60
|
+
);
|
|
56
61
|
const body$ = enc$.encodeJSON("body", payload$, { explode: true });
|
|
57
62
|
|
|
58
63
|
const path$ = this.templateURLComponent("/variations/nobg")();
|
|
@@ -71,9 +76,8 @@ export class Variation extends ClientSDK {
|
|
|
71
76
|
|
|
72
77
|
const context = { operationID: "createVariationNoBG" };
|
|
73
78
|
const doOptions = { context, errorCodes: [] };
|
|
74
|
-
const request =
|
|
79
|
+
const request = this.createRequest$(
|
|
75
80
|
{
|
|
76
|
-
context,
|
|
77
81
|
security: securitySettings$,
|
|
78
82
|
method: "POST",
|
|
79
83
|
path: path$,
|
|
@@ -94,10 +98,16 @@ export class Variation extends ClientSDK {
|
|
|
94
98
|
|
|
95
99
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
96
100
|
const responseBody = await response.json();
|
|
97
|
-
const result =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
const result = schemas$.parse(
|
|
102
|
+
responseBody,
|
|
103
|
+
(val$) => {
|
|
104
|
+
return operations.CreateVariationNoBGResponse$.inboundSchema.parse({
|
|
105
|
+
...responseFields$,
|
|
106
|
+
object: val$,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
"Response validation failed"
|
|
110
|
+
);
|
|
101
111
|
return result;
|
|
102
112
|
} else {
|
|
103
113
|
const responseBody = await response.text();
|
|
@@ -120,9 +130,14 @@ export class Variation extends ClientSDK {
|
|
|
120
130
|
headers$.set("Content-Type", "application/json");
|
|
121
131
|
headers$.set("Accept", "application/json");
|
|
122
132
|
|
|
123
|
-
const payload$ =
|
|
124
|
-
|
|
125
|
-
|
|
133
|
+
const payload$ = schemas$.parse(
|
|
134
|
+
input,
|
|
135
|
+
(value$) =>
|
|
136
|
+
operations.CreateVariationUpscaleRequestBody$.outboundSchema
|
|
137
|
+
.optional()
|
|
138
|
+
.parse(value$),
|
|
139
|
+
"Input validation failed"
|
|
140
|
+
);
|
|
126
141
|
const body$ =
|
|
127
142
|
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
128
143
|
|
|
@@ -142,9 +157,8 @@ export class Variation extends ClientSDK {
|
|
|
142
157
|
|
|
143
158
|
const context = { operationID: "createVariationUpscale" };
|
|
144
159
|
const doOptions = { context, errorCodes: [] };
|
|
145
|
-
const request =
|
|
160
|
+
const request = this.createRequest$(
|
|
146
161
|
{
|
|
147
|
-
context,
|
|
148
162
|
security: securitySettings$,
|
|
149
163
|
method: "POST",
|
|
150
164
|
path: path$,
|
|
@@ -165,10 +179,16 @@ export class Variation extends ClientSDK {
|
|
|
165
179
|
|
|
166
180
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
167
181
|
const responseBody = await response.json();
|
|
168
|
-
const result =
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
182
|
+
const result = schemas$.parse(
|
|
183
|
+
responseBody,
|
|
184
|
+
(val$) => {
|
|
185
|
+
return operations.CreateVariationUpscaleResponse$.inboundSchema.parse({
|
|
186
|
+
...responseFields$,
|
|
187
|
+
object: val$,
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
"Response validation failed"
|
|
191
|
+
);
|
|
172
192
|
return result;
|
|
173
193
|
} else {
|
|
174
194
|
const responseBody = await response.text();
|
|
@@ -193,7 +213,11 @@ export class Variation extends ClientSDK {
|
|
|
193
213
|
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
194
214
|
headers$.set("Accept", "application/json");
|
|
195
215
|
|
|
196
|
-
const payload$ =
|
|
216
|
+
const payload$ = schemas$.parse(
|
|
217
|
+
input$,
|
|
218
|
+
(value$) => operations.GetVariationByIdRequest$.outboundSchema.parse(value$),
|
|
219
|
+
"Input validation failed"
|
|
220
|
+
);
|
|
197
221
|
const body$ = null;
|
|
198
222
|
|
|
199
223
|
const pathParams$ = {
|
|
@@ -215,9 +239,8 @@ export class Variation extends ClientSDK {
|
|
|
215
239
|
|
|
216
240
|
const context = { operationID: "getVariationById" };
|
|
217
241
|
const doOptions = { context, errorCodes: [] };
|
|
218
|
-
const request =
|
|
242
|
+
const request = this.createRequest$(
|
|
219
243
|
{
|
|
220
|
-
context,
|
|
221
244
|
security: securitySettings$,
|
|
222
245
|
method: "GET",
|
|
223
246
|
path: path$,
|
|
@@ -238,10 +261,16 @@ export class Variation extends ClientSDK {
|
|
|
238
261
|
|
|
239
262
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
240
263
|
const responseBody = await response.json();
|
|
241
|
-
const result =
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
264
|
+
const result = schemas$.parse(
|
|
265
|
+
responseBody,
|
|
266
|
+
(val$) => {
|
|
267
|
+
return operations.GetVariationByIdResponse$.inboundSchema.parse({
|
|
268
|
+
...responseFields$,
|
|
269
|
+
object: val$,
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
"Response validation failed"
|
|
273
|
+
);
|
|
245
274
|
return result;
|
|
246
275
|
} else {
|
|
247
276
|
const responseBody = await response.text();
|
|
@@ -264,9 +293,12 @@ export class Variation extends ClientSDK {
|
|
|
264
293
|
headers$.set("Content-Type", "application/json");
|
|
265
294
|
headers$.set("Accept", "application/json");
|
|
266
295
|
|
|
267
|
-
const payload$ =
|
|
268
|
-
|
|
269
|
-
|
|
296
|
+
const payload$ = schemas$.parse(
|
|
297
|
+
input,
|
|
298
|
+
(value$) =>
|
|
299
|
+
operations.PostVariationsUnzoomRequestBody$.outboundSchema.optional().parse(value$),
|
|
300
|
+
"Input validation failed"
|
|
301
|
+
);
|
|
270
302
|
const body$ =
|
|
271
303
|
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
272
304
|
|
|
@@ -286,9 +318,8 @@ export class Variation extends ClientSDK {
|
|
|
286
318
|
|
|
287
319
|
const context = { operationID: "post_/variations/unzoom" };
|
|
288
320
|
const doOptions = { context, errorCodes: [] };
|
|
289
|
-
const request =
|
|
321
|
+
const request = this.createRequest$(
|
|
290
322
|
{
|
|
291
|
-
context,
|
|
292
323
|
security: securitySettings$,
|
|
293
324
|
method: "POST",
|
|
294
325
|
path: path$,
|
|
@@ -309,10 +340,16 @@ export class Variation extends ClientSDK {
|
|
|
309
340
|
|
|
310
341
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
311
342
|
const responseBody = await response.json();
|
|
312
|
-
const result =
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
343
|
+
const result = schemas$.parse(
|
|
344
|
+
responseBody,
|
|
345
|
+
(val$) => {
|
|
346
|
+
return operations.PostVariationsUnzoomResponse$.inboundSchema.parse({
|
|
347
|
+
...responseFields$,
|
|
348
|
+
object: val$,
|
|
349
|
+
});
|
|
350
|
+
},
|
|
351
|
+
"Response validation failed"
|
|
352
|
+
);
|
|
316
353
|
return result;
|
|
317
354
|
} else {
|
|
318
355
|
const responseBody = await response.text();
|