@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.
Files changed (62) hide show
  1. package/.speakeasy/gen.lock +7 -5
  2. package/README.md +15 -3
  3. package/hooks/hooks.d.ts +4 -5
  4. package/hooks/hooks.d.ts.map +1 -1
  5. package/hooks/hooks.js +5 -7
  6. package/hooks/hooks.js.map +1 -1
  7. package/hooks/types.d.ts +12 -6
  8. package/hooks/types.d.ts.map +1 -1
  9. package/lib/config.d.ts +3 -3
  10. package/lib/config.js +3 -3
  11. package/lib/schemas.d.ts +7 -0
  12. package/lib/schemas.d.ts.map +1 -0
  13. package/lib/schemas.js +49 -0
  14. package/lib/schemas.js.map +1 -0
  15. package/lib/sdks.d.ts +1 -2
  16. package/lib/sdks.d.ts.map +1 -1
  17. package/lib/sdks.js +7 -7
  18. package/lib/sdks.js.map +1 -1
  19. package/package.json +1 -1
  20. package/sdk/dataset.d.ts.map +1 -1
  21. package/sdk/dataset.js +41 -35
  22. package/sdk/dataset.js.map +1 -1
  23. package/sdk/element.d.ts.map +1 -1
  24. package/sdk/element.js +8 -6
  25. package/sdk/element.js.map +1 -1
  26. package/sdk/generation.d.ts.map +1 -1
  27. package/sdk/generation.js +59 -51
  28. package/sdk/generation.js.map +1 -1
  29. package/sdk/initimage.d.ts.map +1 -1
  30. package/sdk/initimage.js +25 -21
  31. package/sdk/initimage.js.map +1 -1
  32. package/sdk/model.d.ts.map +1 -1
  33. package/sdk/model.js +48 -43
  34. package/sdk/model.js.map +1 -1
  35. package/sdk/models/errors/index.d.ts +1 -0
  36. package/sdk/models/errors/index.d.ts.map +1 -1
  37. package/sdk/models/errors/index.js +1 -0
  38. package/sdk/models/errors/index.js.map +1 -1
  39. package/sdk/models/errors/sdkvalidationerror.d.ts +17 -0
  40. package/sdk/models/errors/sdkvalidationerror.d.ts.map +1 -0
  41. package/sdk/models/errors/sdkvalidationerror.js +107 -0
  42. package/sdk/models/errors/sdkvalidationerror.js.map +1 -0
  43. package/sdk/user.d.ts.map +1 -1
  44. package/sdk/user.js +8 -6
  45. package/sdk/user.js.map +1 -1
  46. package/sdk/variation.d.ts.map +1 -1
  47. package/sdk/variation.js +34 -31
  48. package/sdk/variation.js.map +1 -1
  49. package/src/hooks/hooks.ts +8 -12
  50. package/src/hooks/types.ts +12 -6
  51. package/src/lib/config.ts +3 -3
  52. package/src/lib/schemas.ts +22 -0
  53. package/src/lib/sdks.ts +7 -9
  54. package/src/sdk/dataset.ts +81 -35
  55. package/src/sdk/element.ts +12 -6
  56. package/src/sdk/generation.ts +119 -53
  57. package/src/sdk/initimage.ts +49 -21
  58. package/src/sdk/model.ts +93 -43
  59. package/src/sdk/models/errors/index.ts +1 -0
  60. package/src/sdk/models/errors/sdkvalidationerror.ts +95 -0
  61. package/src/sdk/user.ts +12 -6
  62. 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$ = operations.CreateModelRequestBody$.outboundSchema.parse(input);
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 = await this.createRequest$(
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 = operations.CreateModelResponse$.inboundSchema.parse({
98
- ...responseFields$,
99
- object: responseBody,
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$ = operations.DeleteModelByIdRequest$.outboundSchema.parse(input$);
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 = await this.createRequest$(
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 = operations.DeleteModelByIdResponse$.inboundSchema.parse({
171
- ...responseFields$,
172
- object: responseBody,
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$ = operations.DeleteModels3dIdRequest$.outboundSchema.parse(input$);
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 = await this.createRequest$(
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 = operations.DeleteModels3dIdResponse$.inboundSchema.parse({
247
- ...responseFields$,
248
- object: responseBody,
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$ = operations.GetModelByIdRequest$.outboundSchema.parse(input$);
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 = await this.createRequest$(
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 = operations.GetModelByIdResponse$.inboundSchema.parse({
320
- ...responseFields$,
321
- object: responseBody,
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 = await this.createRequest$(
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 = operations.GetPlatformModelsResponse$.inboundSchema.parse({
382
- ...responseFields$,
383
- object: responseBody,
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$ = operations.PostModels3dUploadRequestBody$.outboundSchema
408
- .optional()
409
- .parse(input);
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 = await this.createRequest$(
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 = operations.PostModels3dUploadResponse$.inboundSchema.parse({
453
- ...responseFields$,
454
- object: responseBody,
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();
@@ -3,3 +3,4 @@
3
3
  */
4
4
 
5
5
  export * from "./sdkerror";
6
+ export * from "./sdkvalidationerror";
@@ -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 = await this.createRequest$(
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 = operations.GetUserSelfResponse$.inboundSchema.parse({
89
- ...responseFields$,
90
- object: responseBody,
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();
@@ -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$ = operations.CreateVariationNoBGRequestBody$.outboundSchema.parse(input);
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 = await this.createRequest$(
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 = operations.CreateVariationNoBGResponse$.inboundSchema.parse({
98
- ...responseFields$,
99
- object: responseBody,
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$ = operations.CreateVariationUpscaleRequestBody$.outboundSchema
124
- .optional()
125
- .parse(input);
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 = await this.createRequest$(
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 = operations.CreateVariationUpscaleResponse$.inboundSchema.parse({
169
- ...responseFields$,
170
- object: responseBody,
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$ = operations.GetVariationByIdRequest$.outboundSchema.parse(input$);
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 = await this.createRequest$(
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 = operations.GetVariationByIdResponse$.inboundSchema.parse({
242
- ...responseFields$,
243
- object: responseBody,
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$ = operations.PostVariationsUnzoomRequestBody$.outboundSchema
268
- .optional()
269
- .parse(input);
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 = await this.createRequest$(
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 = operations.PostVariationsUnzoomResponse$.inboundSchema.parse({
313
- ...responseFields$,
314
- object: responseBody,
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();