@leonardo-ai/sdk 4.16.0 → 4.17.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 +16 -5
- 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 +30 -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 +30 -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 +36 -36
- 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 +30 -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 +30 -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 +30 -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 +32 -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 +31 -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 +30 -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 +31 -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 +32 -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 +32 -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 +32 -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 +32 -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 +32 -32
- 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 +32 -32
- 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 +31 -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 +30 -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 +30 -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 +32 -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 +32 -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 +34 -35
- 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 +35 -35
- package/src/funcs/imageDeleteGenerationById.ts +37 -37
- package/src/funcs/imageGetGenerationById.ts +36 -37
- package/src/funcs/imageGetGenerationsByUserId.ts +41 -44
- package/src/funcs/initImagesDeleteInitImageById.ts +37 -37
- package/src/funcs/initImagesGetInitImageById.ts +36 -36
- package/src/funcs/initImagesUploadCanvasInitImage.ts +35 -35
- package/src/funcs/initImagesUploadInitImage.ts +35 -35
- package/src/funcs/modelsCreateModel.ts +34 -34
- 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 +36 -36
- package/src/funcs/pricingCalculatorPricingCalculator.ts +36 -36
- package/src/funcs/promptPromptImprove.ts +34 -35
- package/src/funcs/promptPromptRandom.ts +23 -23
- package/src/funcs/realtimeCanvasCreateLCMGeneration.ts +36 -36
- package/src/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.ts +36 -36
- package/src/funcs/realtimeCanvasPerformInpaintingLCM.ts +36 -36
- package/src/funcs/realtimeCanvasPerformInstantRefine.ts +36 -36
- package/src/funcs/textureCreateTextureGeneration.ts +36 -36
- package/src/funcs/textureDeleteTextureGenerationById.ts +37 -42
- package/src/funcs/threeDModelAssetsDelete3DModelById.ts +36 -40
- package/src/funcs/threeDModelAssetsUploadModelAsset.ts +36 -36
- package/src/funcs/userGetUserSelf.ts +23 -23
- package/src/funcs/variationCreateUniversalUpscalerJob.ts +35 -35
- package/src/funcs/variationCreateVariationNoBG.ts +35 -35
- package/src/funcs/variationCreateVariationUnzoom.ts +36 -36
- package/src/funcs/variationCreateVariationUpscale.ts +36 -36
- 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 { encodeSimple
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import { encodeSimple } 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 deletes a specific generation
|
|
29
29
|
*/
|
|
30
30
|
export async function imageDeleteGenerationById(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
id: string,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,62 +43,62 @@ export async function imageDeleteGenerationById(
|
|
|
43
43
|
| ConnectionError
|
|
44
44
|
>
|
|
45
45
|
> {
|
|
46
|
-
const input
|
|
46
|
+
const input: operations.DeleteGenerationByIdRequest = {
|
|
47
47
|
id: id,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
const parsed
|
|
51
|
-
input
|
|
52
|
-
(value
|
|
53
|
-
operations.DeleteGenerationByIdRequest$outboundSchema.parse(value
|
|
50
|
+
const parsed = safeParse(
|
|
51
|
+
input,
|
|
52
|
+
(value) =>
|
|
53
|
+
operations.DeleteGenerationByIdRequest$outboundSchema.parse(value),
|
|
54
54
|
"Input validation failed",
|
|
55
55
|
);
|
|
56
|
-
if (!parsed
|
|
57
|
-
return parsed
|
|
56
|
+
if (!parsed.ok) {
|
|
57
|
+
return parsed;
|
|
58
58
|
}
|
|
59
|
-
const payload
|
|
60
|
-
const body
|
|
59
|
+
const payload = parsed.value;
|
|
60
|
+
const body = null;
|
|
61
61
|
|
|
62
|
-
const pathParams
|
|
63
|
-
id: encodeSimple
|
|
62
|
+
const pathParams = {
|
|
63
|
+
id: encodeSimple("id", payload.id, {
|
|
64
64
|
explode: false,
|
|
65
65
|
charEncoding: "percent",
|
|
66
66
|
}),
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
const path
|
|
69
|
+
const path = pathToFunc("/generations/{id}")(pathParams);
|
|
70
70
|
|
|
71
|
-
const headers
|
|
71
|
+
const headers = new Headers({
|
|
72
72
|
Accept: "application/json",
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
const
|
|
76
|
-
const
|
|
75
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
76
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
77
77
|
const context = {
|
|
78
78
|
operationID: "deleteGenerationById",
|
|
79
79
|
oAuth2Scopes: [],
|
|
80
|
-
securitySource: client
|
|
80
|
+
securitySource: client._options.bearerAuth,
|
|
81
81
|
};
|
|
82
|
-
const
|
|
82
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
83
83
|
|
|
84
|
-
const requestRes = client
|
|
85
|
-
security:
|
|
84
|
+
const requestRes = client._createRequest(context, {
|
|
85
|
+
security: requestSecurity,
|
|
86
86
|
method: "DELETE",
|
|
87
|
-
path: path
|
|
88
|
-
headers: headers
|
|
89
|
-
body: body
|
|
90
|
-
timeoutMs: options?.timeoutMs || client
|
|
87
|
+
path: path,
|
|
88
|
+
headers: headers,
|
|
89
|
+
body: body,
|
|
90
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
91
91
|
}, options);
|
|
92
92
|
if (!requestRes.ok) {
|
|
93
93
|
return requestRes;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
95
|
+
const req = requestRes.value;
|
|
96
96
|
|
|
97
|
-
const doResult = await client
|
|
97
|
+
const doResult = await client._do(req, {
|
|
98
98
|
context,
|
|
99
99
|
errorCodes: [],
|
|
100
100
|
retryConfig: options?.retries
|
|
101
|
-
|| client
|
|
101
|
+
|| client._options.retryConfig,
|
|
102
102
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
103
103
|
});
|
|
104
104
|
if (!doResult.ok) {
|
|
@@ -106,7 +106,7 @@ export async function imageDeleteGenerationById(
|
|
|
106
106
|
}
|
|
107
107
|
const response = doResult.value;
|
|
108
108
|
|
|
109
|
-
const responseFields
|
|
109
|
+
const responseFields = {
|
|
110
110
|
ContentType: response.headers.get("content-type")
|
|
111
111
|
?? "application/octet-stream",
|
|
112
112
|
StatusCode: response.status,
|
|
@@ -114,7 +114,7 @@ export async function imageDeleteGenerationById(
|
|
|
114
114
|
Headers: {},
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
const [result
|
|
117
|
+
const [result] = await M.match<
|
|
118
118
|
operations.DeleteGenerationByIdResponse,
|
|
119
119
|
| SDKError
|
|
120
120
|
| SDKValidationError
|
|
@@ -124,13 +124,13 @@ export async function imageDeleteGenerationById(
|
|
|
124
124
|
| RequestTimeoutError
|
|
125
125
|
| ConnectionError
|
|
126
126
|
>(
|
|
127
|
-
|
|
127
|
+
M.json(200, operations.DeleteGenerationByIdResponse$inboundSchema, {
|
|
128
128
|
key: "object",
|
|
129
129
|
}),
|
|
130
|
-
)(response, { extraFields: responseFields
|
|
131
|
-
if (!result
|
|
132
|
-
return result
|
|
130
|
+
)(response, { extraFields: responseFields });
|
|
131
|
+
if (!result.ok) {
|
|
132
|
+
return result;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
return result
|
|
135
|
+
return result;
|
|
136
136
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LeonardoCore } from "../core.js";
|
|
6
|
-
import { encodeSimple
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import { encodeSimple } 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 provide information about a specific generation
|
|
29
29
|
*/
|
|
30
30
|
export async function imageGetGenerationById(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
id: string,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,62 +43,61 @@ export async function imageGetGenerationById(
|
|
|
43
43
|
| ConnectionError
|
|
44
44
|
>
|
|
45
45
|
> {
|
|
46
|
-
const input
|
|
46
|
+
const input: operations.GetGenerationByIdRequest = {
|
|
47
47
|
id: id,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
const parsed
|
|
51
|
-
input
|
|
52
|
-
(value
|
|
53
|
-
operations.GetGenerationByIdRequest$outboundSchema.parse(value$),
|
|
50
|
+
const parsed = safeParse(
|
|
51
|
+
input,
|
|
52
|
+
(value) => operations.GetGenerationByIdRequest$outboundSchema.parse(value),
|
|
54
53
|
"Input validation failed",
|
|
55
54
|
);
|
|
56
|
-
if (!parsed
|
|
57
|
-
return parsed
|
|
55
|
+
if (!parsed.ok) {
|
|
56
|
+
return parsed;
|
|
58
57
|
}
|
|
59
|
-
const payload
|
|
60
|
-
const body
|
|
58
|
+
const payload = parsed.value;
|
|
59
|
+
const body = null;
|
|
61
60
|
|
|
62
|
-
const pathParams
|
|
63
|
-
id: encodeSimple
|
|
61
|
+
const pathParams = {
|
|
62
|
+
id: encodeSimple("id", payload.id, {
|
|
64
63
|
explode: false,
|
|
65
64
|
charEncoding: "percent",
|
|
66
65
|
}),
|
|
67
66
|
};
|
|
68
67
|
|
|
69
|
-
const path
|
|
68
|
+
const path = pathToFunc("/generations/{id}")(pathParams);
|
|
70
69
|
|
|
71
|
-
const headers
|
|
70
|
+
const headers = new Headers({
|
|
72
71
|
Accept: "application/json",
|
|
73
72
|
});
|
|
74
73
|
|
|
75
|
-
const
|
|
76
|
-
const
|
|
74
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
75
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
77
76
|
const context = {
|
|
78
77
|
operationID: "getGenerationById",
|
|
79
78
|
oAuth2Scopes: [],
|
|
80
|
-
securitySource: client
|
|
79
|
+
securitySource: client._options.bearerAuth,
|
|
81
80
|
};
|
|
82
|
-
const
|
|
81
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
83
82
|
|
|
84
|
-
const requestRes = client
|
|
85
|
-
security:
|
|
83
|
+
const requestRes = client._createRequest(context, {
|
|
84
|
+
security: requestSecurity,
|
|
86
85
|
method: "GET",
|
|
87
|
-
path: path
|
|
88
|
-
headers: headers
|
|
89
|
-
body: body
|
|
90
|
-
timeoutMs: options?.timeoutMs || client
|
|
86
|
+
path: path,
|
|
87
|
+
headers: headers,
|
|
88
|
+
body: body,
|
|
89
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
91
90
|
}, options);
|
|
92
91
|
if (!requestRes.ok) {
|
|
93
92
|
return requestRes;
|
|
94
93
|
}
|
|
95
|
-
const
|
|
94
|
+
const req = requestRes.value;
|
|
96
95
|
|
|
97
|
-
const doResult = await client
|
|
96
|
+
const doResult = await client._do(req, {
|
|
98
97
|
context,
|
|
99
98
|
errorCodes: [],
|
|
100
99
|
retryConfig: options?.retries
|
|
101
|
-
|| client
|
|
100
|
+
|| client._options.retryConfig,
|
|
102
101
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
103
102
|
});
|
|
104
103
|
if (!doResult.ok) {
|
|
@@ -106,7 +105,7 @@ export async function imageGetGenerationById(
|
|
|
106
105
|
}
|
|
107
106
|
const response = doResult.value;
|
|
108
107
|
|
|
109
|
-
const responseFields
|
|
108
|
+
const responseFields = {
|
|
110
109
|
ContentType: response.headers.get("content-type")
|
|
111
110
|
?? "application/octet-stream",
|
|
112
111
|
StatusCode: response.status,
|
|
@@ -114,7 +113,7 @@ export async function imageGetGenerationById(
|
|
|
114
113
|
Headers: {},
|
|
115
114
|
};
|
|
116
115
|
|
|
117
|
-
const [result
|
|
116
|
+
const [result] = await M.match<
|
|
118
117
|
operations.GetGenerationByIdResponse,
|
|
119
118
|
| SDKError
|
|
120
119
|
| SDKValidationError
|
|
@@ -124,13 +123,13 @@ export async function imageGetGenerationById(
|
|
|
124
123
|
| RequestTimeoutError
|
|
125
124
|
| ConnectionError
|
|
126
125
|
>(
|
|
127
|
-
|
|
126
|
+
M.json(200, operations.GetGenerationByIdResponse$inboundSchema, {
|
|
128
127
|
key: "object",
|
|
129
128
|
}),
|
|
130
|
-
)(response, { extraFields: responseFields
|
|
131
|
-
if (!result
|
|
132
|
-
return result
|
|
129
|
+
)(response, { extraFields: responseFields });
|
|
130
|
+
if (!result.ok) {
|
|
131
|
+
return result;
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
return result
|
|
134
|
+
return result;
|
|
136
135
|
}
|
|
@@ -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 { encodeFormQuery, 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 returns all generations by a specific user
|
|
32
29
|
*/
|
|
33
30
|
export async function imageGetGenerationsByUserId(
|
|
34
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
35
32
|
userId: string,
|
|
36
33
|
limit?: number | undefined,
|
|
37
34
|
offset?: number | undefined,
|
|
@@ -48,70 +45,70 @@ export async function imageGetGenerationsByUserId(
|
|
|
48
45
|
| ConnectionError
|
|
49
46
|
>
|
|
50
47
|
> {
|
|
51
|
-
const input
|
|
48
|
+
const input: operations.GetGenerationsByUserIdRequest = {
|
|
52
49
|
limit: limit,
|
|
53
50
|
offset: offset,
|
|
54
51
|
userId: userId,
|
|
55
52
|
};
|
|
56
53
|
|
|
57
|
-
const parsed
|
|
58
|
-
input
|
|
59
|
-
(value
|
|
60
|
-
operations.GetGenerationsByUserIdRequest$outboundSchema.parse(value
|
|
54
|
+
const parsed = safeParse(
|
|
55
|
+
input,
|
|
56
|
+
(value) =>
|
|
57
|
+
operations.GetGenerationsByUserIdRequest$outboundSchema.parse(value),
|
|
61
58
|
"Input validation failed",
|
|
62
59
|
);
|
|
63
|
-
if (!parsed
|
|
64
|
-
return parsed
|
|
60
|
+
if (!parsed.ok) {
|
|
61
|
+
return parsed;
|
|
65
62
|
}
|
|
66
|
-
const payload
|
|
67
|
-
const body
|
|
63
|
+
const payload = parsed.value;
|
|
64
|
+
const body = null;
|
|
68
65
|
|
|
69
|
-
const pathParams
|
|
70
|
-
userId: encodeSimple
|
|
66
|
+
const pathParams = {
|
|
67
|
+
userId: encodeSimple("userId", payload.userId, {
|
|
71
68
|
explode: false,
|
|
72
69
|
charEncoding: "percent",
|
|
73
70
|
}),
|
|
74
71
|
};
|
|
75
72
|
|
|
76
|
-
const path
|
|
73
|
+
const path = pathToFunc("/generations/user/{userId}")(pathParams);
|
|
77
74
|
|
|
78
|
-
const query
|
|
79
|
-
"limit": payload
|
|
80
|
-
"offset": payload
|
|
75
|
+
const query = encodeFormQuery({
|
|
76
|
+
"limit": payload.limit,
|
|
77
|
+
"offset": payload.offset,
|
|
81
78
|
});
|
|
82
79
|
|
|
83
|
-
const headers
|
|
80
|
+
const headers = new Headers({
|
|
84
81
|
Accept: "application/json",
|
|
85
82
|
});
|
|
86
83
|
|
|
87
|
-
const
|
|
88
|
-
const
|
|
84
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
85
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
89
86
|
const context = {
|
|
90
87
|
operationID: "getGenerationsByUserId",
|
|
91
88
|
oAuth2Scopes: [],
|
|
92
|
-
securitySource: client
|
|
89
|
+
securitySource: client._options.bearerAuth,
|
|
93
90
|
};
|
|
94
|
-
const
|
|
91
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
95
92
|
|
|
96
|
-
const requestRes = client
|
|
97
|
-
security:
|
|
93
|
+
const requestRes = client._createRequest(context, {
|
|
94
|
+
security: requestSecurity,
|
|
98
95
|
method: "GET",
|
|
99
|
-
path: path
|
|
100
|
-
headers: headers
|
|
101
|
-
query: query
|
|
102
|
-
body: body
|
|
103
|
-
timeoutMs: options?.timeoutMs || client
|
|
96
|
+
path: path,
|
|
97
|
+
headers: headers,
|
|
98
|
+
query: query,
|
|
99
|
+
body: body,
|
|
100
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
104
101
|
}, options);
|
|
105
102
|
if (!requestRes.ok) {
|
|
106
103
|
return requestRes;
|
|
107
104
|
}
|
|
108
|
-
const
|
|
105
|
+
const req = requestRes.value;
|
|
109
106
|
|
|
110
|
-
const doResult = await client
|
|
107
|
+
const doResult = await client._do(req, {
|
|
111
108
|
context,
|
|
112
109
|
errorCodes: [],
|
|
113
110
|
retryConfig: options?.retries
|
|
114
|
-
|| client
|
|
111
|
+
|| client._options.retryConfig,
|
|
115
112
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
116
113
|
});
|
|
117
114
|
if (!doResult.ok) {
|
|
@@ -119,7 +116,7 @@ export async function imageGetGenerationsByUserId(
|
|
|
119
116
|
}
|
|
120
117
|
const response = doResult.value;
|
|
121
118
|
|
|
122
|
-
const responseFields
|
|
119
|
+
const responseFields = {
|
|
123
120
|
ContentType: response.headers.get("content-type")
|
|
124
121
|
?? "application/octet-stream",
|
|
125
122
|
StatusCode: response.status,
|
|
@@ -127,7 +124,7 @@ export async function imageGetGenerationsByUserId(
|
|
|
127
124
|
Headers: {},
|
|
128
125
|
};
|
|
129
126
|
|
|
130
|
-
const [result
|
|
127
|
+
const [result] = await M.match<
|
|
131
128
|
operations.GetGenerationsByUserIdResponse,
|
|
132
129
|
| SDKError
|
|
133
130
|
| SDKValidationError
|
|
@@ -137,13 +134,13 @@ export async function imageGetGenerationsByUserId(
|
|
|
137
134
|
| RequestTimeoutError
|
|
138
135
|
| ConnectionError
|
|
139
136
|
>(
|
|
140
|
-
|
|
137
|
+
M.json(200, operations.GetGenerationsByUserIdResponse$inboundSchema, {
|
|
141
138
|
key: "object",
|
|
142
139
|
}),
|
|
143
|
-
)(response, { extraFields: responseFields
|
|
144
|
-
if (!result
|
|
145
|
-
return result
|
|
140
|
+
)(response, { extraFields: responseFields });
|
|
141
|
+
if (!result.ok) {
|
|
142
|
+
return result;
|
|
146
143
|
}
|
|
147
144
|
|
|
148
|
-
return result
|
|
145
|
+
return result;
|
|
149
146
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { LeonardoCore } from "../core.js";
|
|
6
|
-
import { encodeSimple
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import { encodeSimple } 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 deletes an init image
|
|
29
29
|
*/
|
|
30
30
|
export async function initImagesDeleteInitImageById(
|
|
31
|
-
client
|
|
31
|
+
client: LeonardoCore,
|
|
32
32
|
id: string,
|
|
33
33
|
options?: RequestOptions,
|
|
34
34
|
): Promise<
|
|
@@ -43,62 +43,62 @@ export async function initImagesDeleteInitImageById(
|
|
|
43
43
|
| ConnectionError
|
|
44
44
|
>
|
|
45
45
|
> {
|
|
46
|
-
const input
|
|
46
|
+
const input: operations.DeleteInitImageByIdRequest = {
|
|
47
47
|
id: id,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
const parsed
|
|
51
|
-
input
|
|
52
|
-
(value
|
|
53
|
-
operations.DeleteInitImageByIdRequest$outboundSchema.parse(value
|
|
50
|
+
const parsed = safeParse(
|
|
51
|
+
input,
|
|
52
|
+
(value) =>
|
|
53
|
+
operations.DeleteInitImageByIdRequest$outboundSchema.parse(value),
|
|
54
54
|
"Input validation failed",
|
|
55
55
|
);
|
|
56
|
-
if (!parsed
|
|
57
|
-
return parsed
|
|
56
|
+
if (!parsed.ok) {
|
|
57
|
+
return parsed;
|
|
58
58
|
}
|
|
59
|
-
const payload
|
|
60
|
-
const body
|
|
59
|
+
const payload = parsed.value;
|
|
60
|
+
const body = null;
|
|
61
61
|
|
|
62
|
-
const pathParams
|
|
63
|
-
id: encodeSimple
|
|
62
|
+
const pathParams = {
|
|
63
|
+
id: encodeSimple("id", payload.id, {
|
|
64
64
|
explode: false,
|
|
65
65
|
charEncoding: "percent",
|
|
66
66
|
}),
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
const path
|
|
69
|
+
const path = pathToFunc("/init-image/{id}")(pathParams);
|
|
70
70
|
|
|
71
|
-
const headers
|
|
71
|
+
const headers = new Headers({
|
|
72
72
|
Accept: "application/json",
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
const
|
|
76
|
-
const
|
|
75
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
76
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
77
77
|
const context = {
|
|
78
78
|
operationID: "deleteInitImageById",
|
|
79
79
|
oAuth2Scopes: [],
|
|
80
|
-
securitySource: client
|
|
80
|
+
securitySource: client._options.bearerAuth,
|
|
81
81
|
};
|
|
82
|
-
const
|
|
82
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
83
83
|
|
|
84
|
-
const requestRes = client
|
|
85
|
-
security:
|
|
84
|
+
const requestRes = client._createRequest(context, {
|
|
85
|
+
security: requestSecurity,
|
|
86
86
|
method: "DELETE",
|
|
87
|
-
path: path
|
|
88
|
-
headers: headers
|
|
89
|
-
body: body
|
|
90
|
-
timeoutMs: options?.timeoutMs || client
|
|
87
|
+
path: path,
|
|
88
|
+
headers: headers,
|
|
89
|
+
body: body,
|
|
90
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
91
91
|
}, options);
|
|
92
92
|
if (!requestRes.ok) {
|
|
93
93
|
return requestRes;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
95
|
+
const req = requestRes.value;
|
|
96
96
|
|
|
97
|
-
const doResult = await client
|
|
97
|
+
const doResult = await client._do(req, {
|
|
98
98
|
context,
|
|
99
99
|
errorCodes: [],
|
|
100
100
|
retryConfig: options?.retries
|
|
101
|
-
|| client
|
|
101
|
+
|| client._options.retryConfig,
|
|
102
102
|
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
103
103
|
});
|
|
104
104
|
if (!doResult.ok) {
|
|
@@ -106,7 +106,7 @@ export async function initImagesDeleteInitImageById(
|
|
|
106
106
|
}
|
|
107
107
|
const response = doResult.value;
|
|
108
108
|
|
|
109
|
-
const responseFields
|
|
109
|
+
const responseFields = {
|
|
110
110
|
ContentType: response.headers.get("content-type")
|
|
111
111
|
?? "application/octet-stream",
|
|
112
112
|
StatusCode: response.status,
|
|
@@ -114,7 +114,7 @@ export async function initImagesDeleteInitImageById(
|
|
|
114
114
|
Headers: {},
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
const [result
|
|
117
|
+
const [result] = await M.match<
|
|
118
118
|
operations.DeleteInitImageByIdResponse,
|
|
119
119
|
| SDKError
|
|
120
120
|
| SDKValidationError
|
|
@@ -124,13 +124,13 @@ export async function initImagesDeleteInitImageById(
|
|
|
124
124
|
| RequestTimeoutError
|
|
125
125
|
| ConnectionError
|
|
126
126
|
>(
|
|
127
|
-
|
|
127
|
+
M.json(200, operations.DeleteInitImageByIdResponse$inboundSchema, {
|
|
128
128
|
key: "object",
|
|
129
129
|
}),
|
|
130
|
-
)(response, { extraFields: responseFields
|
|
131
|
-
if (!result
|
|
132
|
-
return result
|
|
130
|
+
)(response, { extraFields: responseFields });
|
|
131
|
+
if (!result.ok) {
|
|
132
|
+
return result;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
return result
|
|
135
|
+
return result;
|
|
136
136
|
}
|