@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,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 3D Model
|
|
32
29
|
*/
|
|
33
30
|
export async function threeDModelAssetsDelete3DModelById(
|
|
34
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
35
32
|
id: string,
|
|
36
33
|
requestBody?: operations.Delete3DModelByIdRequestBody | undefined,
|
|
37
34
|
options?: RequestOptions,
|
|
@@ -47,64 +44,63 @@ export async function threeDModelAssetsDelete3DModelById(
|
|
|
47
44
|
| ConnectionError
|
|
48
45
|
>
|
|
49
46
|
> {
|
|
50
|
-
const input
|
|
51
|
-
requestBody: requestBody,
|
|
47
|
+
const input: operations.Delete3DModelByIdRequest = {
|
|
52
48
|
id: id,
|
|
49
|
+
requestBody: requestBody,
|
|
53
50
|
};
|
|
54
51
|
|
|
55
|
-
const parsed
|
|
56
|
-
input
|
|
57
|
-
(value
|
|
58
|
-
operations.Delete3DModelByIdRequest$outboundSchema.parse(value$),
|
|
52
|
+
const parsed = safeParse(
|
|
53
|
+
input,
|
|
54
|
+
(value) => operations.Delete3DModelByIdRequest$outboundSchema.parse(value),
|
|
59
55
|
"Input validation failed",
|
|
60
56
|
);
|
|
61
|
-
if (!parsed
|
|
62
|
-
return parsed
|
|
57
|
+
if (!parsed.ok) {
|
|
58
|
+
return parsed;
|
|
63
59
|
}
|
|
64
|
-
const payload
|
|
65
|
-
const body
|
|
60
|
+
const payload = parsed.value;
|
|
61
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
66
62
|
|
|
67
|
-
const pathParams
|
|
68
|
-
id: encodeSimple
|
|
63
|
+
const pathParams = {
|
|
64
|
+
id: encodeSimple("id", payload.id, {
|
|
69
65
|
explode: false,
|
|
70
66
|
charEncoding: "percent",
|
|
71
67
|
}),
|
|
72
68
|
};
|
|
73
69
|
|
|
74
|
-
const path
|
|
70
|
+
const path = pathToFunc("/models-3d/{id}")(pathParams);
|
|
75
71
|
|
|
76
|
-
const headers
|
|
72
|
+
const headers = new Headers({
|
|
77
73
|
"Content-Type": "application/json",
|
|
78
74
|
Accept: "application/json",
|
|
79
75
|
});
|
|
80
76
|
|
|
81
|
-
const
|
|
82
|
-
const
|
|
77
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
78
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
83
79
|
const context = {
|
|
84
80
|
operationID: "delete3DModelById",
|
|
85
81
|
oAuth2Scopes: [],
|
|
86
|
-
securitySource: client
|
|
82
|
+
securitySource: client._options.bearerAuth,
|
|
87
83
|
};
|
|
88
|
-
const
|
|
84
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
89
85
|
|
|
90
|
-
const requestRes = client
|
|
91
|
-
security:
|
|
86
|
+
const requestRes = client._createRequest(context, {
|
|
87
|
+
security: requestSecurity,
|
|
92
88
|
method: "DELETE",
|
|
93
|
-
path: path
|
|
94
|
-
headers: headers
|
|
95
|
-
body: body
|
|
96
|
-
timeoutMs: options?.timeoutMs || client
|
|
89
|
+
path: path,
|
|
90
|
+
headers: headers,
|
|
91
|
+
body: body,
|
|
92
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
97
93
|
}, options);
|
|
98
94
|
if (!requestRes.ok) {
|
|
99
95
|
return requestRes;
|
|
100
96
|
}
|
|
101
|
-
const
|
|
97
|
+
const req = requestRes.value;
|
|
102
98
|
|
|
103
|
-
const doResult = await client
|
|
99
|
+
const doResult = await client._do(req, {
|
|
104
100
|
context,
|
|
105
101
|
errorCodes: [],
|
|
106
102
|
retryConfig: options?.retries
|
|
107
|
-
|| client
|
|
103
|
+
|| client._options.retryConfig,
|
|
108
104
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
109
105
|
});
|
|
110
106
|
if (!doResult.ok) {
|
|
@@ -112,7 +108,7 @@ export async function threeDModelAssetsDelete3DModelById(
|
|
|
112
108
|
}
|
|
113
109
|
const response = doResult.value;
|
|
114
110
|
|
|
115
|
-
const responseFields
|
|
111
|
+
const responseFields = {
|
|
116
112
|
ContentType: response.headers.get("content-type")
|
|
117
113
|
?? "application/octet-stream",
|
|
118
114
|
StatusCode: response.status,
|
|
@@ -120,7 +116,7 @@ export async function threeDModelAssetsDelete3DModelById(
|
|
|
120
116
|
Headers: {},
|
|
121
117
|
};
|
|
122
118
|
|
|
123
|
-
const [result
|
|
119
|
+
const [result] = await M.match<
|
|
124
120
|
operations.Delete3DModelByIdResponse,
|
|
125
121
|
| SDKError
|
|
126
122
|
| SDKValidationError
|
|
@@ -130,13 +126,13 @@ export async function threeDModelAssetsDelete3DModelById(
|
|
|
130
126
|
| RequestTimeoutError
|
|
131
127
|
| ConnectionError
|
|
132
128
|
>(
|
|
133
|
-
|
|
129
|
+
M.json(200, operations.Delete3DModelByIdResponse$inboundSchema, {
|
|
134
130
|
key: "object",
|
|
135
131
|
}),
|
|
136
|
-
)(response, { extraFields: responseFields
|
|
137
|
-
if (!result
|
|
138
|
-
return result
|
|
132
|
+
)(response, { extraFields: responseFields });
|
|
133
|
+
if (!result.ok) {
|
|
134
|
+
return result;
|
|
139
135
|
}
|
|
140
136
|
|
|
141
|
-
return result
|
|
137
|
+
return result;
|
|
142
138
|
}
|
|
@@ -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 returns presigned details to upload a 3D model to S3
|
|
29
29
|
*/
|
|
30
30
|
export async function threeDModelAssetsUploadModelAsset(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
request?: operations.UploadModelAssetRequestBody | undefined,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,58 +43,56 @@ export async function threeDModelAssetsUploadModelAsset(
|
|
|
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.UploadModelAssetRequestBody$outboundSchema.optional().parse(
|
|
52
|
-
value
|
|
50
|
+
value,
|
|
53
51
|
),
|
|
54
52
|
"Input validation failed",
|
|
55
53
|
);
|
|
56
|
-
if (!parsed
|
|
57
|
-
return parsed
|
|
54
|
+
if (!parsed.ok) {
|
|
55
|
+
return parsed;
|
|
58
56
|
}
|
|
59
|
-
const payload
|
|
60
|
-
const body
|
|
57
|
+
const payload = parsed.value;
|
|
58
|
+
const body = payload === undefined
|
|
61
59
|
? null
|
|
62
|
-
: encodeJSON
|
|
60
|
+
: encodeJSON("body", payload, { explode: true });
|
|
63
61
|
|
|
64
|
-
const path
|
|
62
|
+
const path = pathToFunc("/models-3d/upload")();
|
|
65
63
|
|
|
66
|
-
const headers
|
|
64
|
+
const headers = new Headers({
|
|
67
65
|
"Content-Type": "application/json",
|
|
68
66
|
Accept: "application/json",
|
|
69
67
|
});
|
|
70
68
|
|
|
71
|
-
const
|
|
72
|
-
const
|
|
69
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
70
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
73
71
|
const context = {
|
|
74
72
|
operationID: "uploadModelAsset",
|
|
75
73
|
oAuth2Scopes: [],
|
|
76
|
-
securitySource: client
|
|
74
|
+
securitySource: client._options.bearerAuth,
|
|
77
75
|
};
|
|
78
|
-
const
|
|
76
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
79
77
|
|
|
80
|
-
const requestRes = client
|
|
81
|
-
security:
|
|
78
|
+
const requestRes = client._createRequest(context, {
|
|
79
|
+
security: requestSecurity,
|
|
82
80
|
method: "POST",
|
|
83
|
-
path: path
|
|
84
|
-
headers: headers
|
|
85
|
-
body: body
|
|
86
|
-
timeoutMs: options?.timeoutMs || client
|
|
81
|
+
path: path,
|
|
82
|
+
headers: headers,
|
|
83
|
+
body: body,
|
|
84
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
87
85
|
}, options);
|
|
88
86
|
if (!requestRes.ok) {
|
|
89
87
|
return requestRes;
|
|
90
88
|
}
|
|
91
|
-
const
|
|
89
|
+
const req = requestRes.value;
|
|
92
90
|
|
|
93
|
-
const doResult = await client
|
|
91
|
+
const doResult = await client._do(req, {
|
|
94
92
|
context,
|
|
95
93
|
errorCodes: [],
|
|
96
94
|
retryConfig: options?.retries
|
|
97
|
-
|| client
|
|
95
|
+
|| client._options.retryConfig,
|
|
98
96
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
99
97
|
});
|
|
100
98
|
if (!doResult.ok) {
|
|
@@ -102,7 +100,7 @@ export async function threeDModelAssetsUploadModelAsset(
|
|
|
102
100
|
}
|
|
103
101
|
const response = doResult.value;
|
|
104
102
|
|
|
105
|
-
const responseFields
|
|
103
|
+
const responseFields = {
|
|
106
104
|
ContentType: response.headers.get("content-type")
|
|
107
105
|
?? "application/octet-stream",
|
|
108
106
|
StatusCode: response.status,
|
|
@@ -110,7 +108,7 @@ export async function threeDModelAssetsUploadModelAsset(
|
|
|
110
108
|
Headers: {},
|
|
111
109
|
};
|
|
112
110
|
|
|
113
|
-
const [result
|
|
111
|
+
const [result] = await M.match<
|
|
114
112
|
operations.UploadModelAssetResponse,
|
|
115
113
|
| SDKError
|
|
116
114
|
| SDKValidationError
|
|
@@ -120,13 +118,13 @@ export async function threeDModelAssetsUploadModelAsset(
|
|
|
120
118
|
| RequestTimeoutError
|
|
121
119
|
| ConnectionError
|
|
122
120
|
>(
|
|
123
|
-
|
|
121
|
+
M.json(200, operations.UploadModelAssetResponse$inboundSchema, {
|
|
124
122
|
key: "object",
|
|
125
123
|
}),
|
|
126
|
-
)(response, { extraFields: responseFields
|
|
127
|
-
if (!result
|
|
128
|
-
return result
|
|
124
|
+
)(response, { extraFields: responseFields });
|
|
125
|
+
if (!result.ok) {
|
|
126
|
+
return result;
|
|
129
127
|
}
|
|
130
128
|
|
|
131
|
-
return result
|
|
129
|
+
return result;
|
|
132
130
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LeonardoCore } from "../core.js";
|
|
6
|
-
import * as
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
7
|
import { RequestOptions } from "../lib/sdks.js";
|
|
8
8
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
9
9
|
import { pathToFunc } from "../lib/url.js";
|
|
@@ -26,7 +26,7 @@ import { Result } from "../sdk/types/fp.js";
|
|
|
26
26
|
* This endpoint will return your user information such as your user id, username, token renewal date and current amounts of the following: subscription tokens, gpt (prompt generation) tokens, and model training tokens
|
|
27
27
|
*/
|
|
28
28
|
export async function userGetUserSelf(
|
|
29
|
-
client
|
|
29
|
+
client: LeonardoCore,
|
|
30
30
|
options?: RequestOptions,
|
|
31
31
|
): Promise<
|
|
32
32
|
Result<
|
|
@@ -40,38 +40,38 @@ export async function userGetUserSelf(
|
|
|
40
40
|
| ConnectionError
|
|
41
41
|
>
|
|
42
42
|
> {
|
|
43
|
-
const path
|
|
43
|
+
const path = pathToFunc("/me")();
|
|
44
44
|
|
|
45
|
-
const headers
|
|
45
|
+
const headers = new Headers({
|
|
46
46
|
Accept: "application/json",
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
const
|
|
50
|
-
const
|
|
49
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
50
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
51
51
|
const context = {
|
|
52
52
|
operationID: "getUserSelf",
|
|
53
53
|
oAuth2Scopes: [],
|
|
54
|
-
securitySource: client
|
|
54
|
+
securitySource: client._options.bearerAuth,
|
|
55
55
|
};
|
|
56
|
-
const
|
|
56
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
57
57
|
|
|
58
|
-
const requestRes = client
|
|
59
|
-
security:
|
|
58
|
+
const requestRes = client._createRequest(context, {
|
|
59
|
+
security: requestSecurity,
|
|
60
60
|
method: "GET",
|
|
61
|
-
path: path
|
|
62
|
-
headers: headers
|
|
63
|
-
timeoutMs: options?.timeoutMs || client
|
|
61
|
+
path: path,
|
|
62
|
+
headers: headers,
|
|
63
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
64
64
|
}, options);
|
|
65
65
|
if (!requestRes.ok) {
|
|
66
66
|
return requestRes;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const req = requestRes.value;
|
|
69
69
|
|
|
70
|
-
const doResult = await client
|
|
70
|
+
const doResult = await client._do(req, {
|
|
71
71
|
context,
|
|
72
72
|
errorCodes: [],
|
|
73
73
|
retryConfig: options?.retries
|
|
74
|
-
|| client
|
|
74
|
+
|| client._options.retryConfig,
|
|
75
75
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
76
76
|
});
|
|
77
77
|
if (!doResult.ok) {
|
|
@@ -79,7 +79,7 @@ export async function userGetUserSelf(
|
|
|
79
79
|
}
|
|
80
80
|
const response = doResult.value;
|
|
81
81
|
|
|
82
|
-
const responseFields
|
|
82
|
+
const responseFields = {
|
|
83
83
|
ContentType: response.headers.get("content-type")
|
|
84
84
|
?? "application/octet-stream",
|
|
85
85
|
StatusCode: response.status,
|
|
@@ -87,7 +87,7 @@ export async function userGetUserSelf(
|
|
|
87
87
|
Headers: {},
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
const [result
|
|
90
|
+
const [result] = await M.match<
|
|
91
91
|
operations.GetUserSelfResponse,
|
|
92
92
|
| SDKError
|
|
93
93
|
| SDKValidationError
|
|
@@ -97,13 +97,13 @@ export async function userGetUserSelf(
|
|
|
97
97
|
| RequestTimeoutError
|
|
98
98
|
| ConnectionError
|
|
99
99
|
>(
|
|
100
|
-
|
|
100
|
+
M.json(200, operations.GetUserSelfResponse$inboundSchema, {
|
|
101
101
|
key: "object",
|
|
102
102
|
}),
|
|
103
|
-
)(response, { extraFields: responseFields
|
|
104
|
-
if (!result
|
|
105
|
-
return result
|
|
103
|
+
)(response, { extraFields: responseFields });
|
|
104
|
+
if (!result.ok) {
|
|
105
|
+
return result;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
return result
|
|
108
|
+
return result;
|
|
109
109
|
}
|
|
@@ -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 create a high resolution image using Universal Upscaler
|
|
29
29
|
*/
|
|
30
30
|
export async function variationCreateUniversalUpscalerJob(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
request: operations.CreateUniversalUpscalerJobRequestBody,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,56 +43,54 @@ export async function variationCreateUniversalUpscalerJob(
|
|
|
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.CreateUniversalUpscalerJobRequestBody$outboundSchema.parse(
|
|
52
|
-
value
|
|
50
|
+
value,
|
|
53
51
|
),
|
|
54
52
|
"Input validation failed",
|
|
55
53
|
);
|
|
56
|
-
if (!parsed
|
|
57
|
-
return parsed
|
|
54
|
+
if (!parsed.ok) {
|
|
55
|
+
return parsed;
|
|
58
56
|
}
|
|
59
|
-
const payload
|
|
60
|
-
const body
|
|
57
|
+
const payload = parsed.value;
|
|
58
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
61
59
|
|
|
62
|
-
const path
|
|
60
|
+
const path = pathToFunc("/variations/universal-upscaler")();
|
|
63
61
|
|
|
64
|
-
const headers
|
|
62
|
+
const headers = new Headers({
|
|
65
63
|
"Content-Type": "application/json",
|
|
66
64
|
Accept: "application/json",
|
|
67
65
|
});
|
|
68
66
|
|
|
69
|
-
const
|
|
70
|
-
const
|
|
67
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
68
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
71
69
|
const context = {
|
|
72
70
|
operationID: "CreateUniversalUpscalerJob",
|
|
73
71
|
oAuth2Scopes: [],
|
|
74
|
-
securitySource: client
|
|
72
|
+
securitySource: client._options.bearerAuth,
|
|
75
73
|
};
|
|
76
|
-
const
|
|
74
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
77
75
|
|
|
78
|
-
const requestRes = client
|
|
79
|
-
security:
|
|
76
|
+
const requestRes = client._createRequest(context, {
|
|
77
|
+
security: requestSecurity,
|
|
80
78
|
method: "POST",
|
|
81
|
-
path: path
|
|
82
|
-
headers: headers
|
|
83
|
-
body: body
|
|
84
|
-
timeoutMs: options?.timeoutMs || client
|
|
79
|
+
path: path,
|
|
80
|
+
headers: headers,
|
|
81
|
+
body: body,
|
|
82
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
85
83
|
}, options);
|
|
86
84
|
if (!requestRes.ok) {
|
|
87
85
|
return requestRes;
|
|
88
86
|
}
|
|
89
|
-
const
|
|
87
|
+
const req = requestRes.value;
|
|
90
88
|
|
|
91
|
-
const doResult = await client
|
|
89
|
+
const doResult = await client._do(req, {
|
|
92
90
|
context,
|
|
93
91
|
errorCodes: [],
|
|
94
92
|
retryConfig: options?.retries
|
|
95
|
-
|| client
|
|
93
|
+
|| client._options.retryConfig,
|
|
96
94
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
97
95
|
});
|
|
98
96
|
if (!doResult.ok) {
|
|
@@ -100,7 +98,7 @@ export async function variationCreateUniversalUpscalerJob(
|
|
|
100
98
|
}
|
|
101
99
|
const response = doResult.value;
|
|
102
100
|
|
|
103
|
-
const responseFields
|
|
101
|
+
const responseFields = {
|
|
104
102
|
ContentType: response.headers.get("content-type")
|
|
105
103
|
?? "application/octet-stream",
|
|
106
104
|
StatusCode: response.status,
|
|
@@ -108,7 +106,7 @@ export async function variationCreateUniversalUpscalerJob(
|
|
|
108
106
|
Headers: {},
|
|
109
107
|
};
|
|
110
108
|
|
|
111
|
-
const [result
|
|
109
|
+
const [result] = await M.match<
|
|
112
110
|
operations.CreateUniversalUpscalerJobResponse,
|
|
113
111
|
| SDKError
|
|
114
112
|
| SDKValidationError
|
|
@@ -118,13 +116,13 @@ export async function variationCreateUniversalUpscalerJob(
|
|
|
118
116
|
| RequestTimeoutError
|
|
119
117
|
| ConnectionError
|
|
120
118
|
>(
|
|
121
|
-
|
|
119
|
+
M.json(200, operations.CreateUniversalUpscalerJobResponse$inboundSchema, {
|
|
122
120
|
key: "object",
|
|
123
121
|
}),
|
|
124
|
-
)(response, { extraFields: responseFields
|
|
125
|
-
if (!result
|
|
126
|
-
return result
|
|
122
|
+
)(response, { extraFields: responseFields });
|
|
123
|
+
if (!result.ok) {
|
|
124
|
+
return result;
|
|
127
125
|
}
|
|
128
126
|
|
|
129
|
-
return result
|
|
127
|
+
return result;
|
|
130
128
|
}
|
|
@@ -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 create a no background variation of the provided image ID
|
|
29
29
|
*/
|
|
30
30
|
export async function variationCreateVariationNoBG(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
request: operations.CreateVariationNoBGRequestBody,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,54 +43,52 @@ export async function variationCreateVariationNoBG(
|
|
|
43
43
|
| ConnectionError
|
|
44
44
|
>
|
|
45
45
|
> {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(value$) =>
|
|
51
|
-
operations.CreateVariationNoBGRequestBody$outboundSchema.parse(value$),
|
|
46
|
+
const parsed = safeParse(
|
|
47
|
+
request,
|
|
48
|
+
(value) =>
|
|
49
|
+
operations.CreateVariationNoBGRequestBody$outboundSchema.parse(value),
|
|
52
50
|
"Input validation failed",
|
|
53
51
|
);
|
|
54
|
-
if (!parsed
|
|
55
|
-
return parsed
|
|
52
|
+
if (!parsed.ok) {
|
|
53
|
+
return parsed;
|
|
56
54
|
}
|
|
57
|
-
const payload
|
|
58
|
-
const body
|
|
55
|
+
const payload = parsed.value;
|
|
56
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
59
57
|
|
|
60
|
-
const path
|
|
58
|
+
const path = pathToFunc("/variations/nobg")();
|
|
61
59
|
|
|
62
|
-
const headers
|
|
60
|
+
const headers = new Headers({
|
|
63
61
|
"Content-Type": "application/json",
|
|
64
62
|
Accept: "application/json",
|
|
65
63
|
});
|
|
66
64
|
|
|
67
|
-
const
|
|
68
|
-
const
|
|
65
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
66
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
69
67
|
const context = {
|
|
70
68
|
operationID: "createVariationNoBG",
|
|
71
69
|
oAuth2Scopes: [],
|
|
72
|
-
securitySource: client
|
|
70
|
+
securitySource: client._options.bearerAuth,
|
|
73
71
|
};
|
|
74
|
-
const
|
|
72
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
75
73
|
|
|
76
|
-
const requestRes = client
|
|
77
|
-
security:
|
|
74
|
+
const requestRes = client._createRequest(context, {
|
|
75
|
+
security: requestSecurity,
|
|
78
76
|
method: "POST",
|
|
79
|
-
path: path
|
|
80
|
-
headers: headers
|
|
81
|
-
body: body
|
|
82
|
-
timeoutMs: options?.timeoutMs || client
|
|
77
|
+
path: path,
|
|
78
|
+
headers: headers,
|
|
79
|
+
body: body,
|
|
80
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
83
81
|
}, options);
|
|
84
82
|
if (!requestRes.ok) {
|
|
85
83
|
return requestRes;
|
|
86
84
|
}
|
|
87
|
-
const
|
|
85
|
+
const req = requestRes.value;
|
|
88
86
|
|
|
89
|
-
const doResult = await client
|
|
87
|
+
const doResult = await client._do(req, {
|
|
90
88
|
context,
|
|
91
89
|
errorCodes: [],
|
|
92
90
|
retryConfig: options?.retries
|
|
93
|
-
|| client
|
|
91
|
+
|| client._options.retryConfig,
|
|
94
92
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
95
93
|
});
|
|
96
94
|
if (!doResult.ok) {
|
|
@@ -98,7 +96,7 @@ export async function variationCreateVariationNoBG(
|
|
|
98
96
|
}
|
|
99
97
|
const response = doResult.value;
|
|
100
98
|
|
|
101
|
-
const responseFields
|
|
99
|
+
const responseFields = {
|
|
102
100
|
ContentType: response.headers.get("content-type")
|
|
103
101
|
?? "application/octet-stream",
|
|
104
102
|
StatusCode: response.status,
|
|
@@ -106,7 +104,7 @@ export async function variationCreateVariationNoBG(
|
|
|
106
104
|
Headers: {},
|
|
107
105
|
};
|
|
108
106
|
|
|
109
|
-
const [result
|
|
107
|
+
const [result] = await M.match<
|
|
110
108
|
operations.CreateVariationNoBGResponse,
|
|
111
109
|
| SDKError
|
|
112
110
|
| SDKValidationError
|
|
@@ -116,13 +114,13 @@ export async function variationCreateVariationNoBG(
|
|
|
116
114
|
| RequestTimeoutError
|
|
117
115
|
| ConnectionError
|
|
118
116
|
>(
|
|
119
|
-
|
|
117
|
+
M.json(200, operations.CreateVariationNoBGResponse$inboundSchema, {
|
|
120
118
|
key: "object",
|
|
121
119
|
}),
|
|
122
|
-
)(response, { extraFields: responseFields
|
|
123
|
-
if (!result
|
|
124
|
-
return result
|
|
120
|
+
)(response, { extraFields: responseFields });
|
|
121
|
+
if (!result.ok) {
|
|
122
|
+
return result;
|
|
125
123
|
}
|
|
126
124
|
|
|
127
|
-
return result
|
|
125
|
+
return result;
|
|
128
126
|
}
|