@leonardo-ai/sdk 4.16.0 → 4.18.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/README.md +52 -42
- package/docs/sdks/dataset/README.md +25 -29
- package/docs/sdks/elements/README.md +5 -5
- package/docs/sdks/image/README.md +20 -23
- package/docs/sdks/initimages/README.md +20 -23
- package/docs/sdks/models/README.md +20 -23
- package/docs/sdks/motion/README.md +5 -5
- package/docs/sdks/pricingcalculator/README.md +5 -5
- package/docs/sdks/prompt/README.md +10 -11
- package/docs/sdks/realtimecanvas/README.md +20 -23
- package/docs/sdks/texture/README.md +10 -11
- package/docs/sdks/threedmodelassets/README.md +10 -11
- package/docs/sdks/user/README.md +5 -5
- package/docs/sdks/variation/README.md +25 -29
- package/funcs/datasetCreateDataset.d.ts +1 -1
- package/funcs/datasetCreateDataset.d.ts.map +1 -1
- package/funcs/datasetCreateDataset.js +29 -30
- package/funcs/datasetCreateDataset.js.map +1 -1
- package/funcs/datasetDeleteDatasetById.d.ts +1 -1
- package/funcs/datasetDeleteDatasetById.d.ts.map +1 -1
- package/funcs/datasetDeleteDatasetById.js +32 -32
- package/funcs/datasetDeleteDatasetById.js.map +1 -1
- package/funcs/datasetGetDatasetById.d.ts +1 -1
- package/funcs/datasetGetDatasetById.d.ts.map +1 -1
- package/funcs/datasetGetDatasetById.js +32 -32
- package/funcs/datasetGetDatasetById.js.map +1 -1
- package/funcs/datasetUploadDatasetImage.d.ts +1 -1
- package/funcs/datasetUploadDatasetImage.d.ts.map +1 -1
- package/funcs/datasetUploadDatasetImage.js +32 -32
- package/funcs/datasetUploadDatasetImage.js.map +1 -1
- package/funcs/datasetUploadDatasetImageFromGen.d.ts +1 -1
- package/funcs/datasetUploadDatasetImageFromGen.d.ts.map +1 -1
- package/funcs/datasetUploadDatasetImageFromGen.js +32 -32
- package/funcs/datasetUploadDatasetImageFromGen.js.map +1 -1
- package/funcs/elementsListElements.d.ts +1 -1
- package/funcs/elementsListElements.d.ts.map +1 -1
- package/funcs/elementsListElements.js +22 -22
- package/funcs/elementsListElements.js.map +1 -1
- package/funcs/imageCreateGeneration.d.ts +1 -1
- package/funcs/imageCreateGeneration.d.ts.map +1 -1
- package/funcs/imageCreateGeneration.js +29 -30
- package/funcs/imageCreateGeneration.js.map +1 -1
- package/funcs/imageDeleteGenerationById.d.ts +1 -1
- package/funcs/imageDeleteGenerationById.d.ts.map +1 -1
- package/funcs/imageDeleteGenerationById.js +32 -32
- package/funcs/imageDeleteGenerationById.js.map +1 -1
- package/funcs/imageGetGenerationById.d.ts +1 -1
- package/funcs/imageGetGenerationById.d.ts.map +1 -1
- package/funcs/imageGetGenerationById.js +32 -32
- package/funcs/imageGetGenerationById.js.map +1 -1
- package/funcs/imageGetGenerationsByUserId.d.ts +1 -1
- package/funcs/imageGetGenerationsByUserId.d.ts.map +1 -1
- package/funcs/imageGetGenerationsByUserId.js +37 -37
- package/funcs/imageGetGenerationsByUserId.js.map +1 -1
- package/funcs/initImagesDeleteInitImageById.d.ts +1 -1
- package/funcs/initImagesDeleteInitImageById.d.ts.map +1 -1
- package/funcs/initImagesDeleteInitImageById.js +32 -32
- package/funcs/initImagesDeleteInitImageById.js.map +1 -1
- package/funcs/initImagesGetInitImageById.d.ts +1 -1
- package/funcs/initImagesGetInitImageById.d.ts.map +1 -1
- package/funcs/initImagesGetInitImageById.js +32 -32
- package/funcs/initImagesGetInitImageById.js.map +1 -1
- package/funcs/initImagesUploadCanvasInitImage.d.ts +1 -1
- package/funcs/initImagesUploadCanvasInitImage.d.ts.map +1 -1
- package/funcs/initImagesUploadCanvasInitImage.js +29 -30
- package/funcs/initImagesUploadCanvasInitImage.js.map +1 -1
- package/funcs/initImagesUploadInitImage.d.ts +1 -1
- package/funcs/initImagesUploadInitImage.d.ts.map +1 -1
- package/funcs/initImagesUploadInitImage.js +29 -30
- package/funcs/initImagesUploadInitImage.js.map +1 -1
- package/funcs/modelsCreateModel.d.ts +1 -1
- package/funcs/modelsCreateModel.d.ts.map +1 -1
- package/funcs/modelsCreateModel.js +29 -30
- package/funcs/modelsCreateModel.js.map +1 -1
- package/funcs/modelsDeleteModelById.d.ts +1 -1
- package/funcs/modelsDeleteModelById.d.ts.map +1 -1
- package/funcs/modelsDeleteModelById.js +32 -32
- package/funcs/modelsDeleteModelById.js.map +1 -1
- package/funcs/modelsGetModelById.d.ts +1 -1
- package/funcs/modelsGetModelById.d.ts.map +1 -1
- package/funcs/modelsGetModelById.js +32 -32
- package/funcs/modelsGetModelById.js.map +1 -1
- package/funcs/modelsListPlatformModels.d.ts +1 -1
- package/funcs/modelsListPlatformModels.d.ts.map +1 -1
- package/funcs/modelsListPlatformModels.js +22 -22
- package/funcs/modelsListPlatformModels.js.map +1 -1
- package/funcs/motionCreateSVDMotionGeneration.d.ts +1 -1
- package/funcs/motionCreateSVDMotionGeneration.d.ts.map +1 -1
- package/funcs/motionCreateSVDMotionGeneration.js +31 -32
- package/funcs/motionCreateSVDMotionGeneration.js.map +1 -1
- package/funcs/pricingCalculatorPricingCalculator.d.ts +1 -1
- package/funcs/pricingCalculatorPricingCalculator.d.ts.map +1 -1
- package/funcs/pricingCalculatorPricingCalculator.js +30 -31
- package/funcs/pricingCalculatorPricingCalculator.js.map +1 -1
- package/funcs/promptPromptImprove.d.ts +1 -1
- package/funcs/promptPromptImprove.d.ts.map +1 -1
- package/funcs/promptPromptImprove.js +29 -30
- package/funcs/promptPromptImprove.js.map +1 -1
- package/funcs/promptPromptRandom.d.ts +1 -1
- package/funcs/promptPromptRandom.d.ts.map +1 -1
- package/funcs/promptPromptRandom.js +22 -22
- package/funcs/promptPromptRandom.js.map +1 -1
- package/funcs/realtimeCanvasCreateLCMGeneration.d.ts +1 -1
- package/funcs/realtimeCanvasCreateLCMGeneration.d.ts.map +1 -1
- package/funcs/realtimeCanvasCreateLCMGeneration.js +30 -31
- package/funcs/realtimeCanvasCreateLCMGeneration.js.map +1 -1
- package/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.d.ts +1 -1
- package/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.d.ts.map +1 -1
- package/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.js +31 -32
- package/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.js.map +1 -1
- package/funcs/realtimeCanvasPerformInpaintingLCM.d.ts +1 -1
- package/funcs/realtimeCanvasPerformInpaintingLCM.d.ts.map +1 -1
- package/funcs/realtimeCanvasPerformInpaintingLCM.js +31 -32
- package/funcs/realtimeCanvasPerformInpaintingLCM.js.map +1 -1
- package/funcs/realtimeCanvasPerformInstantRefine.d.ts +1 -1
- package/funcs/realtimeCanvasPerformInstantRefine.d.ts.map +1 -1
- package/funcs/realtimeCanvasPerformInstantRefine.js +31 -32
- package/funcs/realtimeCanvasPerformInstantRefine.js.map +1 -1
- package/funcs/textureCreateTextureGeneration.d.ts +1 -1
- package/funcs/textureCreateTextureGeneration.d.ts.map +1 -1
- package/funcs/textureCreateTextureGeneration.js +31 -32
- package/funcs/textureCreateTextureGeneration.js.map +1 -1
- package/funcs/textureDeleteTextureGenerationById.d.ts +1 -1
- package/funcs/textureDeleteTextureGenerationById.d.ts.map +1 -1
- package/funcs/textureDeleteTextureGenerationById.js +33 -33
- package/funcs/textureDeleteTextureGenerationById.js.map +1 -1
- package/funcs/threeDModelAssetsDelete3DModelById.d.ts +1 -1
- package/funcs/threeDModelAssetsDelete3DModelById.d.ts.map +1 -1
- package/funcs/threeDModelAssetsDelete3DModelById.js +33 -33
- package/funcs/threeDModelAssetsDelete3DModelById.js.map +1 -1
- package/funcs/threeDModelAssetsUploadModelAsset.d.ts +1 -1
- package/funcs/threeDModelAssetsUploadModelAsset.d.ts.map +1 -1
- package/funcs/threeDModelAssetsUploadModelAsset.js +30 -31
- package/funcs/threeDModelAssetsUploadModelAsset.js.map +1 -1
- package/funcs/userGetUserSelf.d.ts +1 -1
- package/funcs/userGetUserSelf.d.ts.map +1 -1
- package/funcs/userGetUserSelf.js +22 -22
- package/funcs/userGetUserSelf.js.map +1 -1
- package/funcs/variationCreateUniversalUpscalerJob.d.ts +1 -1
- package/funcs/variationCreateUniversalUpscalerJob.d.ts.map +1 -1
- package/funcs/variationCreateUniversalUpscalerJob.js +29 -30
- package/funcs/variationCreateUniversalUpscalerJob.js.map +1 -1
- package/funcs/variationCreateVariationNoBG.d.ts +1 -1
- package/funcs/variationCreateVariationNoBG.d.ts.map +1 -1
- package/funcs/variationCreateVariationNoBG.js +29 -30
- package/funcs/variationCreateVariationNoBG.js.map +1 -1
- package/funcs/variationCreateVariationUnzoom.d.ts +1 -1
- package/funcs/variationCreateVariationUnzoom.d.ts.map +1 -1
- package/funcs/variationCreateVariationUnzoom.js +31 -32
- package/funcs/variationCreateVariationUnzoom.js.map +1 -1
- package/funcs/variationCreateVariationUpscale.d.ts +1 -1
- package/funcs/variationCreateVariationUpscale.d.ts.map +1 -1
- package/funcs/variationCreateVariationUpscale.js +31 -32
- package/funcs/variationCreateVariationUpscale.js.map +1 -1
- package/funcs/variationGetVariationById.d.ts +1 -1
- package/funcs/variationGetVariationById.d.ts.map +1 -1
- package/funcs/variationGetVariationById.js +32 -32
- package/funcs/variationGetVariationById.js.map +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/sdks.d.ts +5 -8
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +34 -18
- package/lib/sdks.js.map +1 -1
- package/package.json +1 -1
- package/sdk/models/operations/creategeneration.d.ts +2 -2
- package/sdk/sdk.js +13 -13
- package/src/funcs/datasetCreateDataset.ts +33 -36
- package/src/funcs/datasetDeleteDatasetById.ts +36 -37
- package/src/funcs/datasetGetDatasetById.ts +36 -36
- package/src/funcs/datasetUploadDatasetImage.ts +36 -40
- package/src/funcs/datasetUploadDatasetImageFromGen.ts +37 -40
- package/src/funcs/elementsListElements.ts +23 -23
- package/src/funcs/imageCreateGeneration.ts +34 -36
- package/src/funcs/imageDeleteGenerationById.ts +37 -37
- package/src/funcs/imageGetGenerationById.ts +36 -37
- package/src/funcs/imageGetGenerationsByUserId.ts +42 -45
- package/src/funcs/initImagesDeleteInitImageById.ts +37 -37
- package/src/funcs/initImagesGetInitImageById.ts +36 -36
- package/src/funcs/initImagesUploadCanvasInitImage.ts +34 -36
- package/src/funcs/initImagesUploadInitImage.ts +34 -36
- package/src/funcs/modelsCreateModel.ts +33 -35
- package/src/funcs/modelsDeleteModelById.ts +36 -36
- package/src/funcs/modelsGetModelById.ts +36 -36
- package/src/funcs/modelsListPlatformModels.ts +23 -23
- package/src/funcs/motionCreateSVDMotionGeneration.ts +35 -37
- package/src/funcs/pricingCalculatorPricingCalculator.ts +35 -37
- package/src/funcs/promptPromptImprove.ts +33 -36
- package/src/funcs/promptPromptRandom.ts +23 -23
- package/src/funcs/realtimeCanvasCreateLCMGeneration.ts +35 -37
- package/src/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.ts +35 -37
- package/src/funcs/realtimeCanvasPerformInpaintingLCM.ts +35 -37
- package/src/funcs/realtimeCanvasPerformInstantRefine.ts +35 -37
- package/src/funcs/textureCreateTextureGeneration.ts +35 -37
- package/src/funcs/textureDeleteTextureGenerationById.ts +38 -43
- package/src/funcs/threeDModelAssetsDelete3DModelById.ts +37 -41
- package/src/funcs/threeDModelAssetsUploadModelAsset.ts +35 -37
- package/src/funcs/userGetUserSelf.ts +23 -23
- package/src/funcs/variationCreateUniversalUpscalerJob.ts +34 -36
- package/src/funcs/variationCreateVariationNoBG.ts +34 -36
- package/src/funcs/variationCreateVariationUnzoom.ts +35 -37
- package/src/funcs/variationCreateVariationUpscale.ts +35 -37
- package/src/funcs/variationGetVariationById.ts +36 -36
- package/src/lib/config.ts +3 -3
- package/src/lib/sdks.ts +24 -24
- package/src/sdk/models/operations/creategeneration.ts +2 -2
- package/src/sdk/sdk.ts +13 -13
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LeonardoCore } from "../core.js";
|
|
6
|
-
import { encodeJSON
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
@@ -28,7 +28,7 @@ import { Result } from "../sdk/types/fp.js";
|
|
|
28
28
|
* This endpoint will perform a inpainting on a LCM image
|
|
29
29
|
*/
|
|
30
30
|
export async function realtimeCanvasPerformInpaintingLCM(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
request?: operations.PerformInpaintingLCMRequestBody | undefined,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,57 +43,55 @@ export async function realtimeCanvasPerformInpaintingLCM(
|
|
|
43
43
|
| ConnectionError
|
|
44
44
|
>
|
|
45
45
|
> {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
input$,
|
|
50
|
-
(value$) =>
|
|
46
|
+
const parsed = safeParse(
|
|
47
|
+
request,
|
|
48
|
+
(value) =>
|
|
51
49
|
operations.PerformInpaintingLCMRequestBody$outboundSchema.optional()
|
|
52
|
-
.parse(value
|
|
50
|
+
.parse(value),
|
|
53
51
|
"Input validation failed",
|
|
54
52
|
);
|
|
55
|
-
if (!parsed
|
|
56
|
-
return parsed
|
|
53
|
+
if (!parsed.ok) {
|
|
54
|
+
return parsed;
|
|
57
55
|
}
|
|
58
|
-
const payload
|
|
59
|
-
const body
|
|
56
|
+
const payload = parsed.value;
|
|
57
|
+
const body = payload === undefined
|
|
60
58
|
? null
|
|
61
|
-
: encodeJSON
|
|
59
|
+
: encodeJSON("body", payload, { explode: true });
|
|
62
60
|
|
|
63
|
-
const path
|
|
61
|
+
const path = pathToFunc("/lcm-inpainting")();
|
|
64
62
|
|
|
65
|
-
const headers
|
|
63
|
+
const headers = new Headers({
|
|
66
64
|
"Content-Type": "application/json",
|
|
67
65
|
Accept: "application/json",
|
|
68
66
|
});
|
|
69
67
|
|
|
70
|
-
const
|
|
71
|
-
const
|
|
68
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
69
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
72
70
|
const context = {
|
|
73
71
|
operationID: "performInpaintingLCM",
|
|
74
72
|
oAuth2Scopes: [],
|
|
75
|
-
securitySource: client
|
|
73
|
+
securitySource: client._options.bearerAuth,
|
|
76
74
|
};
|
|
77
|
-
const
|
|
75
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
78
76
|
|
|
79
|
-
const requestRes = client
|
|
80
|
-
security:
|
|
77
|
+
const requestRes = client._createRequest(context, {
|
|
78
|
+
security: requestSecurity,
|
|
81
79
|
method: "POST",
|
|
82
|
-
path: path
|
|
83
|
-
headers: headers
|
|
84
|
-
body: body
|
|
85
|
-
timeoutMs: options?.timeoutMs || client
|
|
80
|
+
path: path,
|
|
81
|
+
headers: headers,
|
|
82
|
+
body: body,
|
|
83
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
86
84
|
}, options);
|
|
87
85
|
if (!requestRes.ok) {
|
|
88
86
|
return requestRes;
|
|
89
87
|
}
|
|
90
|
-
const
|
|
88
|
+
const req = requestRes.value;
|
|
91
89
|
|
|
92
|
-
const doResult = await client
|
|
90
|
+
const doResult = await client._do(req, {
|
|
93
91
|
context,
|
|
94
92
|
errorCodes: [],
|
|
95
93
|
retryConfig: options?.retries
|
|
96
|
-
|| client
|
|
94
|
+
|| client._options.retryConfig,
|
|
97
95
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
98
96
|
});
|
|
99
97
|
if (!doResult.ok) {
|
|
@@ -101,7 +99,7 @@ export async function realtimeCanvasPerformInpaintingLCM(
|
|
|
101
99
|
}
|
|
102
100
|
const response = doResult.value;
|
|
103
101
|
|
|
104
|
-
const responseFields
|
|
102
|
+
const responseFields = {
|
|
105
103
|
ContentType: response.headers.get("content-type")
|
|
106
104
|
?? "application/octet-stream",
|
|
107
105
|
StatusCode: response.status,
|
|
@@ -109,7 +107,7 @@ export async function realtimeCanvasPerformInpaintingLCM(
|
|
|
109
107
|
Headers: {},
|
|
110
108
|
};
|
|
111
109
|
|
|
112
|
-
const [result
|
|
110
|
+
const [result] = await M.match<
|
|
113
111
|
operations.PerformInpaintingLCMResponse,
|
|
114
112
|
| SDKError
|
|
115
113
|
| SDKValidationError
|
|
@@ -119,13 +117,13 @@ export async function realtimeCanvasPerformInpaintingLCM(
|
|
|
119
117
|
| RequestTimeoutError
|
|
120
118
|
| ConnectionError
|
|
121
119
|
>(
|
|
122
|
-
|
|
120
|
+
M.json(200, operations.PerformInpaintingLCMResponse$inboundSchema, {
|
|
123
121
|
key: "object",
|
|
124
122
|
}),
|
|
125
|
-
)(response, { extraFields: responseFields
|
|
126
|
-
if (!result
|
|
127
|
-
return result
|
|
123
|
+
)(response, { extraFields: responseFields });
|
|
124
|
+
if (!result.ok) {
|
|
125
|
+
return result;
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
return result
|
|
128
|
+
return result;
|
|
131
129
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LeonardoCore } from "../core.js";
|
|
6
|
-
import { encodeJSON
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
@@ -28,7 +28,7 @@ import { Result } from "../sdk/types/fp.js";
|
|
|
28
28
|
* This endpoint will perform instant refine on a LCM image
|
|
29
29
|
*/
|
|
30
30
|
export async function realtimeCanvasPerformInstantRefine(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
request?: operations.PerformInstantRefineRequestBody | undefined,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,57 +43,55 @@ export async function realtimeCanvasPerformInstantRefine(
|
|
|
43
43
|
| ConnectionError
|
|
44
44
|
>
|
|
45
45
|
> {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
input$,
|
|
50
|
-
(value$) =>
|
|
46
|
+
const parsed = safeParse(
|
|
47
|
+
request,
|
|
48
|
+
(value) =>
|
|
51
49
|
operations.PerformInstantRefineRequestBody$outboundSchema.optional()
|
|
52
|
-
.parse(value
|
|
50
|
+
.parse(value),
|
|
53
51
|
"Input validation failed",
|
|
54
52
|
);
|
|
55
|
-
if (!parsed
|
|
56
|
-
return parsed
|
|
53
|
+
if (!parsed.ok) {
|
|
54
|
+
return parsed;
|
|
57
55
|
}
|
|
58
|
-
const payload
|
|
59
|
-
const body
|
|
56
|
+
const payload = parsed.value;
|
|
57
|
+
const body = payload === undefined
|
|
60
58
|
? null
|
|
61
|
-
: encodeJSON
|
|
59
|
+
: encodeJSON("body", payload, { explode: true });
|
|
62
60
|
|
|
63
|
-
const path
|
|
61
|
+
const path = pathToFunc("/lcm-instant-refine")();
|
|
64
62
|
|
|
65
|
-
const headers
|
|
63
|
+
const headers = new Headers({
|
|
66
64
|
"Content-Type": "application/json",
|
|
67
65
|
Accept: "application/json",
|
|
68
66
|
});
|
|
69
67
|
|
|
70
|
-
const
|
|
71
|
-
const
|
|
68
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
69
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
72
70
|
const context = {
|
|
73
71
|
operationID: "performInstantRefine",
|
|
74
72
|
oAuth2Scopes: [],
|
|
75
|
-
securitySource: client
|
|
73
|
+
securitySource: client._options.bearerAuth,
|
|
76
74
|
};
|
|
77
|
-
const
|
|
75
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
78
76
|
|
|
79
|
-
const requestRes = client
|
|
80
|
-
security:
|
|
77
|
+
const requestRes = client._createRequest(context, {
|
|
78
|
+
security: requestSecurity,
|
|
81
79
|
method: "POST",
|
|
82
|
-
path: path
|
|
83
|
-
headers: headers
|
|
84
|
-
body: body
|
|
85
|
-
timeoutMs: options?.timeoutMs || client
|
|
80
|
+
path: path,
|
|
81
|
+
headers: headers,
|
|
82
|
+
body: body,
|
|
83
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
86
84
|
}, options);
|
|
87
85
|
if (!requestRes.ok) {
|
|
88
86
|
return requestRes;
|
|
89
87
|
}
|
|
90
|
-
const
|
|
88
|
+
const req = requestRes.value;
|
|
91
89
|
|
|
92
|
-
const doResult = await client
|
|
90
|
+
const doResult = await client._do(req, {
|
|
93
91
|
context,
|
|
94
92
|
errorCodes: [],
|
|
95
93
|
retryConfig: options?.retries
|
|
96
|
-
|| client
|
|
94
|
+
|| client._options.retryConfig,
|
|
97
95
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
98
96
|
});
|
|
99
97
|
if (!doResult.ok) {
|
|
@@ -101,7 +99,7 @@ export async function realtimeCanvasPerformInstantRefine(
|
|
|
101
99
|
}
|
|
102
100
|
const response = doResult.value;
|
|
103
101
|
|
|
104
|
-
const responseFields
|
|
102
|
+
const responseFields = {
|
|
105
103
|
ContentType: response.headers.get("content-type")
|
|
106
104
|
?? "application/octet-stream",
|
|
107
105
|
StatusCode: response.status,
|
|
@@ -109,7 +107,7 @@ export async function realtimeCanvasPerformInstantRefine(
|
|
|
109
107
|
Headers: {},
|
|
110
108
|
};
|
|
111
109
|
|
|
112
|
-
const [result
|
|
110
|
+
const [result] = await M.match<
|
|
113
111
|
operations.PerformInstantRefineResponse,
|
|
114
112
|
| SDKError
|
|
115
113
|
| SDKValidationError
|
|
@@ -119,13 +117,13 @@ export async function realtimeCanvasPerformInstantRefine(
|
|
|
119
117
|
| RequestTimeoutError
|
|
120
118
|
| ConnectionError
|
|
121
119
|
>(
|
|
122
|
-
|
|
120
|
+
M.json(200, operations.PerformInstantRefineResponse$inboundSchema, {
|
|
123
121
|
key: "object",
|
|
124
122
|
}),
|
|
125
|
-
)(response, { extraFields: responseFields
|
|
126
|
-
if (!result
|
|
127
|
-
return result
|
|
123
|
+
)(response, { extraFields: responseFields });
|
|
124
|
+
if (!result.ok) {
|
|
125
|
+
return result;
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
return result
|
|
128
|
+
return result;
|
|
131
129
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LeonardoCore } from "../core.js";
|
|
6
|
-
import { encodeJSON
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
@@ -28,7 +28,7 @@ import { Result } from "../sdk/types/fp.js";
|
|
|
28
28
|
* This endpoint will generate a texture generation.
|
|
29
29
|
*/
|
|
30
30
|
export async function textureCreateTextureGeneration(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
request?: operations.CreateTextureGenerationRequestBody | undefined,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,57 +43,55 @@ export async function textureCreateTextureGeneration(
|
|
|
43
43
|
| ConnectionError
|
|
44
44
|
>
|
|
45
45
|
> {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
input$,
|
|
50
|
-
(value$) =>
|
|
46
|
+
const parsed = safeParse(
|
|
47
|
+
request,
|
|
48
|
+
(value) =>
|
|
51
49
|
operations.CreateTextureGenerationRequestBody$outboundSchema.optional()
|
|
52
|
-
.parse(value
|
|
50
|
+
.parse(value),
|
|
53
51
|
"Input validation failed",
|
|
54
52
|
);
|
|
55
|
-
if (!parsed
|
|
56
|
-
return parsed
|
|
53
|
+
if (!parsed.ok) {
|
|
54
|
+
return parsed;
|
|
57
55
|
}
|
|
58
|
-
const payload
|
|
59
|
-
const body
|
|
56
|
+
const payload = parsed.value;
|
|
57
|
+
const body = payload === undefined
|
|
60
58
|
? null
|
|
61
|
-
: encodeJSON
|
|
59
|
+
: encodeJSON("body", payload, { explode: true });
|
|
62
60
|
|
|
63
|
-
const path
|
|
61
|
+
const path = pathToFunc("/generations-texture")();
|
|
64
62
|
|
|
65
|
-
const headers
|
|
63
|
+
const headers = new Headers({
|
|
66
64
|
"Content-Type": "application/json",
|
|
67
65
|
Accept: "application/json",
|
|
68
66
|
});
|
|
69
67
|
|
|
70
|
-
const
|
|
71
|
-
const
|
|
68
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
69
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
72
70
|
const context = {
|
|
73
71
|
operationID: "createTextureGeneration",
|
|
74
72
|
oAuth2Scopes: [],
|
|
75
|
-
securitySource: client
|
|
73
|
+
securitySource: client._options.bearerAuth,
|
|
76
74
|
};
|
|
77
|
-
const
|
|
75
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
78
76
|
|
|
79
|
-
const requestRes = client
|
|
80
|
-
security:
|
|
77
|
+
const requestRes = client._createRequest(context, {
|
|
78
|
+
security: requestSecurity,
|
|
81
79
|
method: "POST",
|
|
82
|
-
path: path
|
|
83
|
-
headers: headers
|
|
84
|
-
body: body
|
|
85
|
-
timeoutMs: options?.timeoutMs || client
|
|
80
|
+
path: path,
|
|
81
|
+
headers: headers,
|
|
82
|
+
body: body,
|
|
83
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
86
84
|
}, options);
|
|
87
85
|
if (!requestRes.ok) {
|
|
88
86
|
return requestRes;
|
|
89
87
|
}
|
|
90
|
-
const
|
|
88
|
+
const req = requestRes.value;
|
|
91
89
|
|
|
92
|
-
const doResult = await client
|
|
90
|
+
const doResult = await client._do(req, {
|
|
93
91
|
context,
|
|
94
92
|
errorCodes: [],
|
|
95
93
|
retryConfig: options?.retries
|
|
96
|
-
|| client
|
|
94
|
+
|| client._options.retryConfig,
|
|
97
95
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
98
96
|
});
|
|
99
97
|
if (!doResult.ok) {
|
|
@@ -101,7 +99,7 @@ export async function textureCreateTextureGeneration(
|
|
|
101
99
|
}
|
|
102
100
|
const response = doResult.value;
|
|
103
101
|
|
|
104
|
-
const responseFields
|
|
102
|
+
const responseFields = {
|
|
105
103
|
ContentType: response.headers.get("content-type")
|
|
106
104
|
?? "application/octet-stream",
|
|
107
105
|
StatusCode: response.status,
|
|
@@ -109,7 +107,7 @@ export async function textureCreateTextureGeneration(
|
|
|
109
107
|
Headers: {},
|
|
110
108
|
};
|
|
111
109
|
|
|
112
|
-
const [result
|
|
110
|
+
const [result] = await M.match<
|
|
113
111
|
operations.CreateTextureGenerationResponse,
|
|
114
112
|
| SDKError
|
|
115
113
|
| SDKValidationError
|
|
@@ -119,13 +117,13 @@ export async function textureCreateTextureGeneration(
|
|
|
119
117
|
| RequestTimeoutError
|
|
120
118
|
| ConnectionError
|
|
121
119
|
>(
|
|
122
|
-
|
|
120
|
+
M.json(200, operations.CreateTextureGenerationResponse$inboundSchema, {
|
|
123
121
|
key: "object",
|
|
124
122
|
}),
|
|
125
|
-
)(response, { extraFields: responseFields
|
|
126
|
-
if (!result
|
|
127
|
-
return result
|
|
123
|
+
)(response, { extraFields: responseFields });
|
|
124
|
+
if (!result.ok) {
|
|
125
|
+
return result;
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
return result
|
|
128
|
+
return result;
|
|
131
129
|
}
|
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LeonardoCore } from "../core.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "../lib/encodings.js";
|
|
10
|
-
import * as m$ from "../lib/matchers.js";
|
|
11
|
-
import * as schemas$ from "../lib/schemas.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
13
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
11
|
import { pathToFunc } from "../lib/url.js";
|
|
@@ -31,7 +28,7 @@ import { Result } from "../sdk/types/fp.js";
|
|
|
31
28
|
* This endpoint deletes the specific texture generation.
|
|
32
29
|
*/
|
|
33
30
|
export async function textureDeleteTextureGenerationById(
|
|
34
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
35
32
|
id: string,
|
|
36
33
|
requestBody?: operations.DeleteTextureGenerationByIdRequestBody | undefined,
|
|
37
34
|
options?: RequestOptions,
|
|
@@ -47,66 +44,64 @@ export async function textureDeleteTextureGenerationById(
|
|
|
47
44
|
| ConnectionError
|
|
48
45
|
>
|
|
49
46
|
> {
|
|
50
|
-
const input
|
|
51
|
-
requestBody: requestBody,
|
|
47
|
+
const input: operations.DeleteTextureGenerationByIdRequest = {
|
|
52
48
|
id: id,
|
|
49
|
+
requestBody: requestBody,
|
|
53
50
|
};
|
|
54
51
|
|
|
55
|
-
const parsed
|
|
56
|
-
input
|
|
57
|
-
(value
|
|
58
|
-
operations.DeleteTextureGenerationByIdRequest$outboundSchema.parse(
|
|
59
|
-
value$,
|
|
60
|
-
),
|
|
52
|
+
const parsed = safeParse(
|
|
53
|
+
input,
|
|
54
|
+
(value) =>
|
|
55
|
+
operations.DeleteTextureGenerationByIdRequest$outboundSchema.parse(value),
|
|
61
56
|
"Input validation failed",
|
|
62
57
|
);
|
|
63
|
-
if (!parsed
|
|
64
|
-
return parsed
|
|
58
|
+
if (!parsed.ok) {
|
|
59
|
+
return parsed;
|
|
65
60
|
}
|
|
66
|
-
const payload
|
|
67
|
-
const body
|
|
61
|
+
const payload = parsed.value;
|
|
62
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
68
63
|
|
|
69
|
-
const pathParams
|
|
70
|
-
id: encodeSimple
|
|
64
|
+
const pathParams = {
|
|
65
|
+
id: encodeSimple("id", payload.id, {
|
|
71
66
|
explode: false,
|
|
72
67
|
charEncoding: "percent",
|
|
73
68
|
}),
|
|
74
69
|
};
|
|
75
70
|
|
|
76
|
-
const path
|
|
71
|
+
const path = pathToFunc("/generations-texture/{id}")(pathParams);
|
|
77
72
|
|
|
78
|
-
const headers
|
|
73
|
+
const headers = new Headers({
|
|
79
74
|
"Content-Type": "application/json",
|
|
80
75
|
Accept: "application/json",
|
|
81
76
|
});
|
|
82
77
|
|
|
83
|
-
const
|
|
84
|
-
const
|
|
78
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
79
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
85
80
|
const context = {
|
|
86
81
|
operationID: "deleteTextureGenerationById",
|
|
87
82
|
oAuth2Scopes: [],
|
|
88
|
-
securitySource: client
|
|
83
|
+
securitySource: client._options.bearerAuth,
|
|
89
84
|
};
|
|
90
|
-
const
|
|
85
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
91
86
|
|
|
92
|
-
const requestRes = client
|
|
93
|
-
security:
|
|
87
|
+
const requestRes = client._createRequest(context, {
|
|
88
|
+
security: requestSecurity,
|
|
94
89
|
method: "DELETE",
|
|
95
|
-
path: path
|
|
96
|
-
headers: headers
|
|
97
|
-
body: body
|
|
98
|
-
timeoutMs: options?.timeoutMs || client
|
|
90
|
+
path: path,
|
|
91
|
+
headers: headers,
|
|
92
|
+
body: body,
|
|
93
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
99
94
|
}, options);
|
|
100
95
|
if (!requestRes.ok) {
|
|
101
96
|
return requestRes;
|
|
102
97
|
}
|
|
103
|
-
const
|
|
98
|
+
const req = requestRes.value;
|
|
104
99
|
|
|
105
|
-
const doResult = await client
|
|
100
|
+
const doResult = await client._do(req, {
|
|
106
101
|
context,
|
|
107
102
|
errorCodes: [],
|
|
108
103
|
retryConfig: options?.retries
|
|
109
|
-
|| client
|
|
104
|
+
|| client._options.retryConfig,
|
|
110
105
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
111
106
|
});
|
|
112
107
|
if (!doResult.ok) {
|
|
@@ -114,7 +109,7 @@ export async function textureDeleteTextureGenerationById(
|
|
|
114
109
|
}
|
|
115
110
|
const response = doResult.value;
|
|
116
111
|
|
|
117
|
-
const responseFields
|
|
112
|
+
const responseFields = {
|
|
118
113
|
ContentType: response.headers.get("content-type")
|
|
119
114
|
?? "application/octet-stream",
|
|
120
115
|
StatusCode: response.status,
|
|
@@ -122,7 +117,7 @@ export async function textureDeleteTextureGenerationById(
|
|
|
122
117
|
Headers: {},
|
|
123
118
|
};
|
|
124
119
|
|
|
125
|
-
const [result
|
|
120
|
+
const [result] = await M.match<
|
|
126
121
|
operations.DeleteTextureGenerationByIdResponse,
|
|
127
122
|
| SDKError
|
|
128
123
|
| SDKValidationError
|
|
@@ -132,13 +127,13 @@ export async function textureDeleteTextureGenerationById(
|
|
|
132
127
|
| RequestTimeoutError
|
|
133
128
|
| ConnectionError
|
|
134
129
|
>(
|
|
135
|
-
|
|
130
|
+
M.json(200, operations.DeleteTextureGenerationByIdResponse$inboundSchema, {
|
|
136
131
|
key: "object",
|
|
137
132
|
}),
|
|
138
|
-
)(response, { extraFields: responseFields
|
|
139
|
-
if (!result
|
|
140
|
-
return result
|
|
133
|
+
)(response, { extraFields: responseFields });
|
|
134
|
+
if (!result.ok) {
|
|
135
|
+
return result;
|
|
141
136
|
}
|
|
142
137
|
|
|
143
|
-
return result
|
|
138
|
+
return result;
|
|
144
139
|
}
|