@leonardo-ai/sdk 4.2.0 → 4.3.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 +30 -6
- package/README.md +19 -3
- package/docs/sdks/generation/README.md +181 -0
- 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 +28 -0
- package/sdk/generation.d.ts.map +1 -1
- package/sdk/generation.js +291 -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/models/operations/index.d.ts +4 -0
- package/sdk/models/operations/index.d.ts.map +1 -1
- package/sdk/models/operations/index.js +4 -0
- package/sdk/models/operations/index.js.map +1 -1
- package/sdk/models/operations/postgenerationslcm.d.ts +146 -0
- package/sdk/models/operations/postgenerationslcm.d.ts.map +1 -0
- package/sdk/models/operations/postgenerationslcm.js +194 -0
- package/sdk/models/operations/postgenerationslcm.js.map +1 -0
- package/sdk/models/operations/postlcminpainting.d.ts +152 -0
- package/sdk/models/operations/postlcminpainting.d.ts.map +1 -0
- package/sdk/models/operations/postlcminpainting.js +198 -0
- package/sdk/models/operations/postlcminpainting.js.map +1 -0
- package/sdk/models/operations/postlcminstantrefine.d.ts +146 -0
- package/sdk/models/operations/postlcminstantrefine.d.ts.map +1 -0
- package/sdk/models/operations/postlcminstantrefine.js +194 -0
- package/sdk/models/operations/postlcminstantrefine.js.map +1 -0
- package/sdk/models/operations/postlcmupscale.d.ts +167 -0
- package/sdk/models/operations/postlcmupscale.d.ts.map +1 -0
- package/sdk/models/operations/postlcmupscale.js +218 -0
- package/sdk/models/operations/postlcmupscale.js.map +1 -0
- package/sdk/models/shared/index.d.ts +1 -0
- package/sdk/models/shared/index.d.ts.map +1 -1
- package/sdk/models/shared/index.js +1 -0
- package/sdk/models/shared/index.js.map +1 -1
- package/sdk/models/shared/lcmgenerationstyle.d.ts +23 -0
- package/sdk/models/shared/lcmgenerationstyle.d.ts.map +1 -0
- package/sdk/models/shared/lcmgenerationstyle.js +30 -0
- package/sdk/models/shared/lcmgenerationstyle.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 +435 -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/models/operations/index.ts +4 -0
- package/src/sdk/models/operations/postgenerationslcm.ts +309 -0
- package/src/sdk/models/operations/postlcminpainting.ts +326 -0
- package/src/sdk/models/operations/postlcminstantrefine.ts +325 -0
- package/src/sdk/models/operations/postlcmupscale.ts +360 -0
- package/src/sdk/models/shared/index.ts +1 -0
- package/src/sdk/models/shared/lcmgenerationstyle.ts +28 -0
- package/src/sdk/user.ts +12 -6
- package/src/sdk/variation.ts +69 -32
package/src/sdk/generation.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 Generation 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.CreateGenerationRequestBody$.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("/generations")();
|
|
@@ -71,9 +76,8 @@ export class Generation extends ClientSDK {
|
|
|
71
76
|
|
|
72
77
|
const context = { operationID: "createGeneration" };
|
|
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 Generation 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.CreateGenerationResponse$.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 Generation 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.DeleteGenerationByIdRequest$.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 Generation extends ClientSDK {
|
|
|
144
158
|
|
|
145
159
|
const context = { operationID: "deleteGenerationById" };
|
|
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 Generation 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.DeleteGenerationByIdResponse$.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 Generation 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.DeleteGenerationsTextureIdRequest$.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 Generation extends ClientSDK {
|
|
|
220
243
|
|
|
221
244
|
const context = { operationID: "delete_/generations-texture/{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 Generation 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.DeleteGenerationsTextureIdResponse$.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 Generation 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.GetGenerationByIdRequest$.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 Generation extends ClientSDK {
|
|
|
293
325
|
|
|
294
326
|
const context = { operationID: "getGenerationById" };
|
|
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 Generation 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.GetGenerationByIdResponse$.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();
|
|
@@ -348,7 +385,11 @@ export class Generation extends ClientSDK {
|
|
|
348
385
|
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
349
386
|
headers$.set("Accept", "application/json");
|
|
350
387
|
|
|
351
|
-
const payload$ =
|
|
388
|
+
const payload$ = schemas$.parse(
|
|
389
|
+
input$,
|
|
390
|
+
(value$) => operations.GetGenerationsByUserIdRequest$.outboundSchema.parse(value$),
|
|
391
|
+
"Input validation failed"
|
|
392
|
+
);
|
|
352
393
|
const body$ = null;
|
|
353
394
|
|
|
354
395
|
const pathParams$ = {
|
|
@@ -378,9 +419,8 @@ export class Generation extends ClientSDK {
|
|
|
378
419
|
|
|
379
420
|
const context = { operationID: "getGenerationsByUserId" };
|
|
380
421
|
const doOptions = { context, errorCodes: [] };
|
|
381
|
-
const request =
|
|
422
|
+
const request = this.createRequest$(
|
|
382
423
|
{
|
|
383
|
-
context,
|
|
384
424
|
security: securitySettings$,
|
|
385
425
|
method: "GET",
|
|
386
426
|
path: path$,
|
|
@@ -401,10 +441,95 @@ export class Generation extends ClientSDK {
|
|
|
401
441
|
|
|
402
442
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
403
443
|
const responseBody = await response.json();
|
|
404
|
-
const result =
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
444
|
+
const result = schemas$.parse(
|
|
445
|
+
responseBody,
|
|
446
|
+
(val$) => {
|
|
447
|
+
return operations.GetGenerationsByUserIdResponse$.inboundSchema.parse({
|
|
448
|
+
...responseFields$,
|
|
449
|
+
object: val$,
|
|
450
|
+
});
|
|
451
|
+
},
|
|
452
|
+
"Response validation failed"
|
|
453
|
+
);
|
|
454
|
+
return result;
|
|
455
|
+
} else {
|
|
456
|
+
const responseBody = await response.text();
|
|
457
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Create LCM Generation
|
|
463
|
+
*
|
|
464
|
+
* @remarks
|
|
465
|
+
* This endpoint will generate a LCM image generation.
|
|
466
|
+
*/
|
|
467
|
+
async postGenerationsLcm(
|
|
468
|
+
input: operations.PostGenerationsLcmRequestBody | undefined,
|
|
469
|
+
options?: RequestOptions
|
|
470
|
+
): Promise<operations.PostGenerationsLcmResponse> {
|
|
471
|
+
const headers$ = new Headers();
|
|
472
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
473
|
+
headers$.set("Content-Type", "application/json");
|
|
474
|
+
headers$.set("Accept", "application/json");
|
|
475
|
+
|
|
476
|
+
const payload$ = schemas$.parse(
|
|
477
|
+
input,
|
|
478
|
+
(value$) =>
|
|
479
|
+
operations.PostGenerationsLcmRequestBody$.outboundSchema.optional().parse(value$),
|
|
480
|
+
"Input validation failed"
|
|
481
|
+
);
|
|
482
|
+
const body$ =
|
|
483
|
+
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
484
|
+
|
|
485
|
+
const path$ = this.templateURLComponent("/generations-lcm")();
|
|
486
|
+
|
|
487
|
+
const query$ = "";
|
|
488
|
+
|
|
489
|
+
let security$;
|
|
490
|
+
if (typeof this.options$.bearerAuth === "function") {
|
|
491
|
+
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
492
|
+
} else if (this.options$.bearerAuth) {
|
|
493
|
+
security$ = { bearerAuth: this.options$.bearerAuth };
|
|
494
|
+
} else {
|
|
495
|
+
security$ = {};
|
|
496
|
+
}
|
|
497
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
498
|
+
|
|
499
|
+
const context = { operationID: "post_/generations-lcm" };
|
|
500
|
+
const doOptions = { context, errorCodes: [] };
|
|
501
|
+
const request = this.createRequest$(
|
|
502
|
+
{
|
|
503
|
+
security: securitySettings$,
|
|
504
|
+
method: "POST",
|
|
505
|
+
path: path$,
|
|
506
|
+
headers: headers$,
|
|
507
|
+
query: query$,
|
|
508
|
+
body: body$,
|
|
509
|
+
},
|
|
510
|
+
options
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
const response = await this.do$(request, doOptions);
|
|
514
|
+
|
|
515
|
+
const responseFields$ = {
|
|
516
|
+
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
517
|
+
StatusCode: response.status,
|
|
518
|
+
RawResponse: response,
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
522
|
+
const responseBody = await response.json();
|
|
523
|
+
const result = schemas$.parse(
|
|
524
|
+
responseBody,
|
|
525
|
+
(val$) => {
|
|
526
|
+
return operations.PostGenerationsLcmResponse$.inboundSchema.parse({
|
|
527
|
+
...responseFields$,
|
|
528
|
+
object: val$,
|
|
529
|
+
});
|
|
530
|
+
},
|
|
531
|
+
"Response validation failed"
|
|
532
|
+
);
|
|
408
533
|
return result;
|
|
409
534
|
} else {
|
|
410
535
|
const responseBody = await response.text();
|
|
@@ -427,9 +552,14 @@ export class Generation extends ClientSDK {
|
|
|
427
552
|
headers$.set("Content-Type", "application/json");
|
|
428
553
|
headers$.set("Accept", "application/json");
|
|
429
554
|
|
|
430
|
-
const payload$ =
|
|
431
|
-
|
|
432
|
-
|
|
555
|
+
const payload$ = schemas$.parse(
|
|
556
|
+
input,
|
|
557
|
+
(value$) =>
|
|
558
|
+
operations.PostGenerationsMotionSvdRequestBody$.outboundSchema
|
|
559
|
+
.optional()
|
|
560
|
+
.parse(value$),
|
|
561
|
+
"Input validation failed"
|
|
562
|
+
);
|
|
433
563
|
const body$ =
|
|
434
564
|
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
435
565
|
|
|
@@ -449,9 +579,8 @@ export class Generation extends ClientSDK {
|
|
|
449
579
|
|
|
450
580
|
const context = { operationID: "post_/generations-motion-svd" };
|
|
451
581
|
const doOptions = { context, errorCodes: [] };
|
|
452
|
-
const request =
|
|
582
|
+
const request = this.createRequest$(
|
|
453
583
|
{
|
|
454
|
-
context,
|
|
455
584
|
security: securitySettings$,
|
|
456
585
|
method: "POST",
|
|
457
586
|
path: path$,
|
|
@@ -472,10 +601,16 @@ export class Generation extends ClientSDK {
|
|
|
472
601
|
|
|
473
602
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
474
603
|
const responseBody = await response.json();
|
|
475
|
-
const result =
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
604
|
+
const result = schemas$.parse(
|
|
605
|
+
responseBody,
|
|
606
|
+
(val$) => {
|
|
607
|
+
return operations.PostGenerationsMotionSvdResponse$.inboundSchema.parse({
|
|
608
|
+
...responseFields$,
|
|
609
|
+
object: val$,
|
|
610
|
+
});
|
|
611
|
+
},
|
|
612
|
+
"Response validation failed"
|
|
613
|
+
);
|
|
479
614
|
return result;
|
|
480
615
|
} else {
|
|
481
616
|
const responseBody = await response.text();
|
|
@@ -498,9 +633,14 @@ export class Generation extends ClientSDK {
|
|
|
498
633
|
headers$.set("Content-Type", "application/json");
|
|
499
634
|
headers$.set("Accept", "application/json");
|
|
500
635
|
|
|
501
|
-
const payload$ =
|
|
502
|
-
|
|
503
|
-
|
|
636
|
+
const payload$ = schemas$.parse(
|
|
637
|
+
input,
|
|
638
|
+
(value$) =>
|
|
639
|
+
operations.PostGenerationsTextureRequestBody$.outboundSchema
|
|
640
|
+
.optional()
|
|
641
|
+
.parse(value$),
|
|
642
|
+
"Input validation failed"
|
|
643
|
+
);
|
|
504
644
|
const body$ =
|
|
505
645
|
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
506
646
|
|
|
@@ -520,9 +660,245 @@ export class Generation extends ClientSDK {
|
|
|
520
660
|
|
|
521
661
|
const context = { operationID: "post_/generations-texture" };
|
|
522
662
|
const doOptions = { context, errorCodes: [] };
|
|
523
|
-
const request =
|
|
663
|
+
const request = this.createRequest$(
|
|
664
|
+
{
|
|
665
|
+
security: securitySettings$,
|
|
666
|
+
method: "POST",
|
|
667
|
+
path: path$,
|
|
668
|
+
headers: headers$,
|
|
669
|
+
query: query$,
|
|
670
|
+
body: body$,
|
|
671
|
+
},
|
|
672
|
+
options
|
|
673
|
+
);
|
|
674
|
+
|
|
675
|
+
const response = await this.do$(request, doOptions);
|
|
676
|
+
|
|
677
|
+
const responseFields$ = {
|
|
678
|
+
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
679
|
+
StatusCode: response.status,
|
|
680
|
+
RawResponse: response,
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
684
|
+
const responseBody = await response.json();
|
|
685
|
+
const result = schemas$.parse(
|
|
686
|
+
responseBody,
|
|
687
|
+
(val$) => {
|
|
688
|
+
return operations.PostGenerationsTextureResponse$.inboundSchema.parse({
|
|
689
|
+
...responseFields$,
|
|
690
|
+
object: val$,
|
|
691
|
+
});
|
|
692
|
+
},
|
|
693
|
+
"Response validation failed"
|
|
694
|
+
);
|
|
695
|
+
return result;
|
|
696
|
+
} else {
|
|
697
|
+
const responseBody = await response.text();
|
|
698
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Perform inpainting on a LCM image
|
|
704
|
+
*
|
|
705
|
+
* @remarks
|
|
706
|
+
* This endpoint will perform a inpainting on a LCM image
|
|
707
|
+
*/
|
|
708
|
+
async postLcmInpainting(
|
|
709
|
+
input: operations.PostLcmInpaintingRequestBody | undefined,
|
|
710
|
+
options?: RequestOptions
|
|
711
|
+
): Promise<operations.PostLcmInpaintingResponse> {
|
|
712
|
+
const headers$ = new Headers();
|
|
713
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
714
|
+
headers$.set("Content-Type", "application/json");
|
|
715
|
+
headers$.set("Accept", "application/json");
|
|
716
|
+
|
|
717
|
+
const payload$ = schemas$.parse(
|
|
718
|
+
input,
|
|
719
|
+
(value$) =>
|
|
720
|
+
operations.PostLcmInpaintingRequestBody$.outboundSchema.optional().parse(value$),
|
|
721
|
+
"Input validation failed"
|
|
722
|
+
);
|
|
723
|
+
const body$ =
|
|
724
|
+
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
725
|
+
|
|
726
|
+
const path$ = this.templateURLComponent("/lcm-inpainting")();
|
|
727
|
+
|
|
728
|
+
const query$ = "";
|
|
729
|
+
|
|
730
|
+
let security$;
|
|
731
|
+
if (typeof this.options$.bearerAuth === "function") {
|
|
732
|
+
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
733
|
+
} else if (this.options$.bearerAuth) {
|
|
734
|
+
security$ = { bearerAuth: this.options$.bearerAuth };
|
|
735
|
+
} else {
|
|
736
|
+
security$ = {};
|
|
737
|
+
}
|
|
738
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
739
|
+
|
|
740
|
+
const context = { operationID: "post_/lcm-inpainting" };
|
|
741
|
+
const doOptions = { context, errorCodes: [] };
|
|
742
|
+
const request = this.createRequest$(
|
|
743
|
+
{
|
|
744
|
+
security: securitySettings$,
|
|
745
|
+
method: "POST",
|
|
746
|
+
path: path$,
|
|
747
|
+
headers: headers$,
|
|
748
|
+
query: query$,
|
|
749
|
+
body: body$,
|
|
750
|
+
},
|
|
751
|
+
options
|
|
752
|
+
);
|
|
753
|
+
|
|
754
|
+
const response = await this.do$(request, doOptions);
|
|
755
|
+
|
|
756
|
+
const responseFields$ = {
|
|
757
|
+
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
758
|
+
StatusCode: response.status,
|
|
759
|
+
RawResponse: response,
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
763
|
+
const responseBody = await response.json();
|
|
764
|
+
const result = schemas$.parse(
|
|
765
|
+
responseBody,
|
|
766
|
+
(val$) => {
|
|
767
|
+
return operations.PostLcmInpaintingResponse$.inboundSchema.parse({
|
|
768
|
+
...responseFields$,
|
|
769
|
+
object: val$,
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
"Response validation failed"
|
|
773
|
+
);
|
|
774
|
+
return result;
|
|
775
|
+
} else {
|
|
776
|
+
const responseBody = await response.text();
|
|
777
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Perform instant refine on a LCM image
|
|
783
|
+
*
|
|
784
|
+
* @remarks
|
|
785
|
+
* This endpoint will perform instant refine on a LCM image
|
|
786
|
+
*/
|
|
787
|
+
async postLcmInstantRefine(
|
|
788
|
+
input: operations.PostLcmInstantRefineRequestBody | undefined,
|
|
789
|
+
options?: RequestOptions
|
|
790
|
+
): Promise<operations.PostLcmInstantRefineResponse> {
|
|
791
|
+
const headers$ = new Headers();
|
|
792
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
793
|
+
headers$.set("Content-Type", "application/json");
|
|
794
|
+
headers$.set("Accept", "application/json");
|
|
795
|
+
|
|
796
|
+
const payload$ = schemas$.parse(
|
|
797
|
+
input,
|
|
798
|
+
(value$) =>
|
|
799
|
+
operations.PostLcmInstantRefineRequestBody$.outboundSchema.optional().parse(value$),
|
|
800
|
+
"Input validation failed"
|
|
801
|
+
);
|
|
802
|
+
const body$ =
|
|
803
|
+
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
804
|
+
|
|
805
|
+
const path$ = this.templateURLComponent("/lcm-instant-refine")();
|
|
806
|
+
|
|
807
|
+
const query$ = "";
|
|
808
|
+
|
|
809
|
+
let security$;
|
|
810
|
+
if (typeof this.options$.bearerAuth === "function") {
|
|
811
|
+
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
812
|
+
} else if (this.options$.bearerAuth) {
|
|
813
|
+
security$ = { bearerAuth: this.options$.bearerAuth };
|
|
814
|
+
} else {
|
|
815
|
+
security$ = {};
|
|
816
|
+
}
|
|
817
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
818
|
+
|
|
819
|
+
const context = { operationID: "post_/lcm-instant-refine" };
|
|
820
|
+
const doOptions = { context, errorCodes: [] };
|
|
821
|
+
const request = this.createRequest$(
|
|
822
|
+
{
|
|
823
|
+
security: securitySettings$,
|
|
824
|
+
method: "POST",
|
|
825
|
+
path: path$,
|
|
826
|
+
headers: headers$,
|
|
827
|
+
query: query$,
|
|
828
|
+
body: body$,
|
|
829
|
+
},
|
|
830
|
+
options
|
|
831
|
+
);
|
|
832
|
+
|
|
833
|
+
const response = await this.do$(request, doOptions);
|
|
834
|
+
|
|
835
|
+
const responseFields$ = {
|
|
836
|
+
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
837
|
+
StatusCode: response.status,
|
|
838
|
+
RawResponse: response,
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
if (this.matchResponse(response, 200, "application/json")) {
|
|
842
|
+
const responseBody = await response.json();
|
|
843
|
+
const result = schemas$.parse(
|
|
844
|
+
responseBody,
|
|
845
|
+
(val$) => {
|
|
846
|
+
return operations.PostLcmInstantRefineResponse$.inboundSchema.parse({
|
|
847
|
+
...responseFields$,
|
|
848
|
+
object: val$,
|
|
849
|
+
});
|
|
850
|
+
},
|
|
851
|
+
"Response validation failed"
|
|
852
|
+
);
|
|
853
|
+
return result;
|
|
854
|
+
} else {
|
|
855
|
+
const responseBody = await response.text();
|
|
856
|
+
throw new errors.SDKError("Unexpected API response", response, responseBody);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* Perform Alchemy Upscale on a LCM image
|
|
862
|
+
*
|
|
863
|
+
* @remarks
|
|
864
|
+
* This endpoint will perform Alchemy Upscale on a LCM image
|
|
865
|
+
*/
|
|
866
|
+
async postLcmUpscale(
|
|
867
|
+
input: operations.PostLcmUpscaleRequestBody | undefined,
|
|
868
|
+
options?: RequestOptions
|
|
869
|
+
): Promise<operations.PostLcmUpscaleResponse> {
|
|
870
|
+
const headers$ = new Headers();
|
|
871
|
+
headers$.set("user-agent", SDK_METADATA.userAgent);
|
|
872
|
+
headers$.set("Content-Type", "application/json");
|
|
873
|
+
headers$.set("Accept", "application/json");
|
|
874
|
+
|
|
875
|
+
const payload$ = schemas$.parse(
|
|
876
|
+
input,
|
|
877
|
+
(value$) =>
|
|
878
|
+
operations.PostLcmUpscaleRequestBody$.outboundSchema.optional().parse(value$),
|
|
879
|
+
"Input validation failed"
|
|
880
|
+
);
|
|
881
|
+
const body$ =
|
|
882
|
+
payload$ === undefined ? null : enc$.encodeJSON("body", payload$, { explode: true });
|
|
883
|
+
|
|
884
|
+
const path$ = this.templateURLComponent("/lcm-upscale")();
|
|
885
|
+
|
|
886
|
+
const query$ = "";
|
|
887
|
+
|
|
888
|
+
let security$;
|
|
889
|
+
if (typeof this.options$.bearerAuth === "function") {
|
|
890
|
+
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
891
|
+
} else if (this.options$.bearerAuth) {
|
|
892
|
+
security$ = { bearerAuth: this.options$.bearerAuth };
|
|
893
|
+
} else {
|
|
894
|
+
security$ = {};
|
|
895
|
+
}
|
|
896
|
+
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
897
|
+
|
|
898
|
+
const context = { operationID: "post_/lcm-upscale" };
|
|
899
|
+
const doOptions = { context, errorCodes: [] };
|
|
900
|
+
const request = this.createRequest$(
|
|
524
901
|
{
|
|
525
|
-
context,
|
|
526
902
|
security: securitySettings$,
|
|
527
903
|
method: "POST",
|
|
528
904
|
path: path$,
|
|
@@ -543,10 +919,16 @@ export class Generation extends ClientSDK {
|
|
|
543
919
|
|
|
544
920
|
if (this.matchResponse(response, 200, "application/json")) {
|
|
545
921
|
const responseBody = await response.json();
|
|
546
|
-
const result =
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
922
|
+
const result = schemas$.parse(
|
|
923
|
+
responseBody,
|
|
924
|
+
(val$) => {
|
|
925
|
+
return operations.PostLcmUpscaleResponse$.inboundSchema.parse({
|
|
926
|
+
...responseFields$,
|
|
927
|
+
object: val$,
|
|
928
|
+
});
|
|
929
|
+
},
|
|
930
|
+
"Response validation failed"
|
|
931
|
+
);
|
|
550
932
|
return result;
|
|
551
933
|
} else {
|
|
552
934
|
const responseBody = await response.text();
|