@leonardo-ai/sdk 4.2.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.speakeasy/gen.lock +30 -6
- package/README.md +19 -3
- package/docs/sdks/generation/README.md +181 -0
- package/hooks/hooks.d.ts +4 -5
- package/hooks/hooks.d.ts.map +1 -1
- package/hooks/hooks.js +5 -7
- package/hooks/hooks.js.map +1 -1
- package/hooks/types.d.ts +12 -6
- package/hooks/types.d.ts.map +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/schemas.d.ts +7 -0
- package/lib/schemas.d.ts.map +1 -0
- package/lib/schemas.js +49 -0
- package/lib/schemas.js.map +1 -0
- package/lib/sdks.d.ts +1 -2
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +7 -7
- package/lib/sdks.js.map +1 -1
- package/package.json +1 -1
- package/sdk/dataset.d.ts.map +1 -1
- package/sdk/dataset.js +41 -35
- package/sdk/dataset.js.map +1 -1
- package/sdk/element.d.ts.map +1 -1
- package/sdk/element.js +8 -6
- package/sdk/element.js.map +1 -1
- package/sdk/generation.d.ts +28 -0
- package/sdk/generation.d.ts.map +1 -1
- package/sdk/generation.js +291 -51
- package/sdk/generation.js.map +1 -1
- package/sdk/initimage.d.ts.map +1 -1
- package/sdk/initimage.js +25 -21
- package/sdk/initimage.js.map +1 -1
- package/sdk/model.d.ts.map +1 -1
- package/sdk/model.js +48 -43
- package/sdk/model.js.map +1 -1
- package/sdk/models/errors/index.d.ts +1 -0
- package/sdk/models/errors/index.d.ts.map +1 -1
- package/sdk/models/errors/index.js +1 -0
- package/sdk/models/errors/index.js.map +1 -1
- package/sdk/models/errors/sdkvalidationerror.d.ts +17 -0
- package/sdk/models/errors/sdkvalidationerror.d.ts.map +1 -0
- package/sdk/models/errors/sdkvalidationerror.js +107 -0
- package/sdk/models/errors/sdkvalidationerror.js.map +1 -0
- package/sdk/models/operations/index.d.ts +4 -0
- package/sdk/models/operations/index.d.ts.map +1 -1
- package/sdk/models/operations/index.js +4 -0
- package/sdk/models/operations/index.js.map +1 -1
- package/sdk/models/operations/postgenerationslcm.d.ts +146 -0
- package/sdk/models/operations/postgenerationslcm.d.ts.map +1 -0
- package/sdk/models/operations/postgenerationslcm.js +194 -0
- package/sdk/models/operations/postgenerationslcm.js.map +1 -0
- package/sdk/models/operations/postlcminpainting.d.ts +152 -0
- package/sdk/models/operations/postlcminpainting.d.ts.map +1 -0
- package/sdk/models/operations/postlcminpainting.js +198 -0
- package/sdk/models/operations/postlcminpainting.js.map +1 -0
- package/sdk/models/operations/postlcminstantrefine.d.ts +146 -0
- package/sdk/models/operations/postlcminstantrefine.d.ts.map +1 -0
- package/sdk/models/operations/postlcminstantrefine.js +194 -0
- package/sdk/models/operations/postlcminstantrefine.js.map +1 -0
- package/sdk/models/operations/postlcmupscale.d.ts +167 -0
- package/sdk/models/operations/postlcmupscale.d.ts.map +1 -0
- package/sdk/models/operations/postlcmupscale.js +218 -0
- package/sdk/models/operations/postlcmupscale.js.map +1 -0
- package/sdk/models/shared/index.d.ts +1 -0
- package/sdk/models/shared/index.d.ts.map +1 -1
- package/sdk/models/shared/index.js +1 -0
- package/sdk/models/shared/index.js.map +1 -1
- package/sdk/models/shared/lcmgenerationstyle.d.ts +23 -0
- package/sdk/models/shared/lcmgenerationstyle.d.ts.map +1 -0
- package/sdk/models/shared/lcmgenerationstyle.js +30 -0
- package/sdk/models/shared/lcmgenerationstyle.js.map +1 -0
- package/sdk/user.d.ts.map +1 -1
- package/sdk/user.js +8 -6
- package/sdk/user.js.map +1 -1
- package/sdk/variation.d.ts.map +1 -1
- package/sdk/variation.js +34 -31
- package/sdk/variation.js.map +1 -1
- package/src/hooks/hooks.ts +8 -12
- package/src/hooks/types.ts +12 -6
- package/src/lib/config.ts +3 -3
- package/src/lib/schemas.ts +22 -0
- package/src/lib/sdks.ts +7 -9
- package/src/sdk/dataset.ts +81 -35
- package/src/sdk/element.ts +12 -6
- package/src/sdk/generation.ts +435 -53
- package/src/sdk/initimage.ts +49 -21
- package/src/sdk/model.ts +93 -43
- package/src/sdk/models/errors/index.ts +1 -0
- package/src/sdk/models/errors/sdkvalidationerror.ts +95 -0
- package/src/sdk/models/operations/index.ts +4 -0
- package/src/sdk/models/operations/postgenerationslcm.ts +309 -0
- package/src/sdk/models/operations/postlcminpainting.ts +326 -0
- package/src/sdk/models/operations/postlcminstantrefine.ts +325 -0
- package/src/sdk/models/operations/postlcmupscale.ts +360 -0
- package/src/sdk/models/shared/index.ts +1 -0
- package/src/sdk/models/shared/lcmgenerationstyle.ts +28 -0
- package/src/sdk/user.ts +12 -6
- package/src/sdk/variation.ts +69 -32
package/.speakeasy/gen.lock
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
lockVersion: 2.0.0
|
|
2
2
|
id: edadaac9-e645-4ef4-a6c7-a1f73bc19385
|
|
3
3
|
management:
|
|
4
|
-
docChecksum:
|
|
4
|
+
docChecksum: 8571286cd4dd1d9d09ba99677375f886
|
|
5
5
|
docVersion: v1.0.0
|
|
6
6
|
speakeasyVersion: internal
|
|
7
|
-
generationVersion: 2.
|
|
8
|
-
releaseVersion: 4.
|
|
9
|
-
configChecksum:
|
|
7
|
+
generationVersion: 2.272.7
|
|
8
|
+
releaseVersion: 4.3.1
|
|
9
|
+
configChecksum: d9f3304b154027d7ec1e7462db4a0c38
|
|
10
10
|
repoURL: https://github.com/Leonardo-Interactive/leonardo-ts-sdk.git
|
|
11
11
|
repoSubDirectory: .
|
|
12
12
|
installationURL: https://github.com/Leonardo-Interactive/leonardo-ts-sdk
|
|
@@ -14,10 +14,10 @@ management:
|
|
|
14
14
|
features:
|
|
15
15
|
typescript:
|
|
16
16
|
constsAndDefaults: 0.1.3
|
|
17
|
-
core: 3.
|
|
17
|
+
core: 3.6.1
|
|
18
18
|
devContainers: 2.90.0
|
|
19
19
|
flattening: 2.81.1
|
|
20
|
-
globalSecurity: 2.82.
|
|
20
|
+
globalSecurity: 2.82.4
|
|
21
21
|
globalServerURLs: 2.82.3
|
|
22
22
|
responseFormat: 0.1.0
|
|
23
23
|
generatedFiles:
|
|
@@ -40,11 +40,13 @@ generatedFiles:
|
|
|
40
40
|
- src/lib/event-streams.ts
|
|
41
41
|
- src/lib/http.ts
|
|
42
42
|
- src/lib/retries.ts
|
|
43
|
+
- src/lib/schemas.ts
|
|
43
44
|
- src/lib/sdks.ts
|
|
44
45
|
- src/lib/security.ts
|
|
45
46
|
- src/lib/url.ts
|
|
46
47
|
- src/sdk/index.ts
|
|
47
48
|
- src/sdk/models/errors/sdkerror.ts
|
|
49
|
+
- src/sdk/models/errors/sdkvalidationerror.ts
|
|
48
50
|
- src/sdk/types/blobs.ts
|
|
49
51
|
- src/sdk/types/decimal.ts
|
|
50
52
|
- src/sdk/types/index.ts
|
|
@@ -62,8 +64,12 @@ generatedFiles:
|
|
|
62
64
|
- src/sdk/models/operations/deletegenerationstextureid.ts
|
|
63
65
|
- src/sdk/models/operations/getgenerationbyid.ts
|
|
64
66
|
- src/sdk/models/operations/getgenerationsbyuserid.ts
|
|
67
|
+
- src/sdk/models/operations/postgenerationslcm.ts
|
|
65
68
|
- src/sdk/models/operations/postgenerationsmotionsvd.ts
|
|
66
69
|
- src/sdk/models/operations/postgenerationstexture.ts
|
|
70
|
+
- src/sdk/models/operations/postlcminpainting.ts
|
|
71
|
+
- src/sdk/models/operations/postlcminstantrefine.ts
|
|
72
|
+
- src/sdk/models/operations/postlcmupscale.ts
|
|
67
73
|
- src/sdk/models/operations/deleteinitimagebyid.ts
|
|
68
74
|
- src/sdk/models/operations/getinitimagebyid.ts
|
|
69
75
|
- src/sdk/models/operations/uploadinitimage.ts
|
|
@@ -85,6 +91,7 @@ generatedFiles:
|
|
|
85
91
|
- src/sdk/models/shared/controlnettype.ts
|
|
86
92
|
- src/sdk/models/shared/jobstatus.ts
|
|
87
93
|
- src/sdk/models/shared/variationtype.ts
|
|
94
|
+
- src/sdk/models/shared/lcmgenerationstyle.ts
|
|
88
95
|
- src/sdk/models/shared/strength.ts
|
|
89
96
|
- src/sdk/models/shared/custommodeltype.ts
|
|
90
97
|
- src/sdk/models/shared/security.ts
|
|
@@ -146,6 +153,10 @@ generatedFiles:
|
|
|
146
153
|
- docs/sdk/models/operations/getgenerationsbyuseridgenerations.md
|
|
147
154
|
- docs/sdk/models/operations/getgenerationsbyuseridresponsebody.md
|
|
148
155
|
- docs/sdk/models/operations/getgenerationsbyuseridresponse.md
|
|
156
|
+
- docs/sdk/models/operations/postgenerationslcmrequestbody.md
|
|
157
|
+
- docs/sdk/models/operations/lcmgenerationoutput.md
|
|
158
|
+
- docs/sdk/models/operations/postgenerationslcmresponsebody.md
|
|
159
|
+
- docs/sdk/models/operations/postgenerationslcmresponse.md
|
|
149
160
|
- docs/sdk/models/operations/postgenerationsmotionsvdrequestbody.md
|
|
150
161
|
- docs/sdk/models/operations/motionsvdgenerationoutput.md
|
|
151
162
|
- docs/sdk/models/operations/postgenerationsmotionsvdresponsebody.md
|
|
@@ -154,6 +165,18 @@ generatedFiles:
|
|
|
154
165
|
- docs/sdk/models/operations/texturegenerationjoboutput.md
|
|
155
166
|
- docs/sdk/models/operations/postgenerationstextureresponsebody.md
|
|
156
167
|
- docs/sdk/models/operations/postgenerationstextureresponse.md
|
|
168
|
+
- docs/sdk/models/operations/postlcminpaintingrequestbody.md
|
|
169
|
+
- docs/sdk/models/operations/postlcminpaintinglcmgenerationoutput.md
|
|
170
|
+
- docs/sdk/models/operations/postlcminpaintingresponsebody.md
|
|
171
|
+
- docs/sdk/models/operations/postlcminpaintingresponse.md
|
|
172
|
+
- docs/sdk/models/operations/postlcminstantrefinerequestbody.md
|
|
173
|
+
- docs/sdk/models/operations/postlcminstantrefinelcmgenerationoutput.md
|
|
174
|
+
- docs/sdk/models/operations/postlcminstantrefineresponsebody.md
|
|
175
|
+
- docs/sdk/models/operations/postlcminstantrefineresponse.md
|
|
176
|
+
- docs/sdk/models/operations/postlcmupscalerequestbody.md
|
|
177
|
+
- docs/sdk/models/operations/postlcmupscalelcmgenerationoutput.md
|
|
178
|
+
- docs/sdk/models/operations/postlcmupscaleresponsebody.md
|
|
179
|
+
- docs/sdk/models/operations/postlcmupscaleresponse.md
|
|
157
180
|
- docs/sdk/models/operations/deleteinitimagebyidrequest.md
|
|
158
181
|
- docs/sdk/models/operations/initimages.md
|
|
159
182
|
- docs/sdk/models/operations/deleteinitimagebyidresponsebody.md
|
|
@@ -218,6 +241,7 @@ generatedFiles:
|
|
|
218
241
|
- docs/sdk/models/shared/controlnettype.md
|
|
219
242
|
- docs/sdk/models/shared/jobstatus.md
|
|
220
243
|
- docs/sdk/models/shared/variationtype.md
|
|
244
|
+
- docs/sdk/models/shared/lcmgenerationstyle.md
|
|
221
245
|
- docs/sdk/models/shared/strength.md
|
|
222
246
|
- docs/sdk/models/shared/custommodeltype.md
|
|
223
247
|
- docs/sdk/models/shared/security.md
|
package/README.md
CHANGED
|
@@ -75,8 +75,12 @@ run();
|
|
|
75
75
|
* [deleteGenerationsTextureId](docs/sdks/generation/README.md#deletegenerationstextureid) - Delete Texture Generation by ID
|
|
76
76
|
* [getGenerationById](docs/sdks/generation/README.md#getgenerationbyid) - Get a Single Generation
|
|
77
77
|
* [getGenerationsByUserId](docs/sdks/generation/README.md#getgenerationsbyuserid) - Get generations by user ID
|
|
78
|
+
* [postGenerationsLcm](docs/sdks/generation/README.md#postgenerationslcm) - Create LCM Generation
|
|
78
79
|
* [postGenerationsMotionSvd](docs/sdks/generation/README.md#postgenerationsmotionsvd) - Create SVD Motion Generation
|
|
79
80
|
* [postGenerationsTexture](docs/sdks/generation/README.md#postgenerationstexture) - Create Texture Generation
|
|
81
|
+
* [postLcmInpainting](docs/sdks/generation/README.md#postlcminpainting) - Perform inpainting on a LCM image
|
|
82
|
+
* [postLcmInstantRefine](docs/sdks/generation/README.md#postlcminstantrefine) - Perform instant refine on a LCM image
|
|
83
|
+
* [postLcmUpscale](docs/sdks/generation/README.md#postlcmupscale) - Perform Alchemy Upscale on a LCM image
|
|
80
84
|
|
|
81
85
|
### [initImage](docs/sdks/initimage/README.md)
|
|
82
86
|
|
|
@@ -120,10 +124,12 @@ All SDK methods return a response object or throw an error. If Error objects are
|
|
|
120
124
|
| --------------- | --------------- | --------------- |
|
|
121
125
|
| errors.SDKError | 4xx-5xx | */* |
|
|
122
126
|
|
|
123
|
-
|
|
127
|
+
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted string since validation errors can list many issues and the plain error string may be difficult read when debugging.
|
|
128
|
+
|
|
124
129
|
|
|
125
130
|
```typescript
|
|
126
131
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
132
|
+
import * as errors from "@leonardo-ai/sdk/sdk/models/errors";
|
|
127
133
|
|
|
128
134
|
async function run() {
|
|
129
135
|
const sdk = new Leonardo({
|
|
@@ -136,8 +142,18 @@ async function run() {
|
|
|
136
142
|
name: "<value>",
|
|
137
143
|
});
|
|
138
144
|
} catch (err) {
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
switch (true) {
|
|
146
|
+
case err instanceof errors.SDKValidationError: {
|
|
147
|
+
// Validation errors can be pretty-printed
|
|
148
|
+
console.error(err.pretty());
|
|
149
|
+
// Raw value may also be inspected
|
|
150
|
+
console.error(err.rawValue);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
default: {
|
|
154
|
+
throw err;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
141
157
|
}
|
|
142
158
|
|
|
143
159
|
// Handle the result
|
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
* [deleteGenerationsTextureId](#deletegenerationstextureid) - Delete Texture Generation by ID
|
|
9
9
|
* [getGenerationById](#getgenerationbyid) - Get a Single Generation
|
|
10
10
|
* [getGenerationsByUserId](#getgenerationsbyuserid) - Get generations by user ID
|
|
11
|
+
* [postGenerationsLcm](#postgenerationslcm) - Create LCM Generation
|
|
11
12
|
* [postGenerationsMotionSvd](#postgenerationsmotionsvd) - Create SVD Motion Generation
|
|
12
13
|
* [postGenerationsTexture](#postgenerationstexture) - Create Texture Generation
|
|
14
|
+
* [postLcmInpainting](#postlcminpainting) - Perform inpainting on a LCM image
|
|
15
|
+
* [postLcmInstantRefine](#postlcminstantrefine) - Perform instant refine on a LCM image
|
|
16
|
+
* [postLcmUpscale](#postlcmupscale) - Perform Alchemy Upscale on a LCM image
|
|
13
17
|
|
|
14
18
|
## createGeneration
|
|
15
19
|
|
|
@@ -237,6 +241,50 @@ run();
|
|
|
237
241
|
| --------------- | --------------- | --------------- |
|
|
238
242
|
| errors.SDKError | 4xx-5xx | */* |
|
|
239
243
|
|
|
244
|
+
## postGenerationsLcm
|
|
245
|
+
|
|
246
|
+
This endpoint will generate a LCM image generation.
|
|
247
|
+
|
|
248
|
+
### Example Usage
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { Leonardo } from "@leonardo-ai/sdk";
|
|
252
|
+
|
|
253
|
+
async function run() {
|
|
254
|
+
const sdk = new Leonardo({
|
|
255
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
const result = await sdk.generation.postGenerationsLcm({
|
|
259
|
+
imageDataUrl: "<value>",
|
|
260
|
+
prompt: "<value>",
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// Handle the result
|
|
264
|
+
console.log(result)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
run();
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Parameters
|
|
271
|
+
|
|
272
|
+
| Parameter | Type | Required | Description |
|
|
273
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
274
|
+
| `request` | [operations.PostGenerationsLcmRequestBody](../../sdk/models/operations/postgenerationslcmrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
275
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
276
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
### Response
|
|
280
|
+
|
|
281
|
+
**Promise<[operations.PostGenerationsLcmResponse](../../sdk/models/operations/postgenerationslcmresponse.md)>**
|
|
282
|
+
### Errors
|
|
283
|
+
|
|
284
|
+
| Error Object | Status Code | Content Type |
|
|
285
|
+
| --------------- | --------------- | --------------- |
|
|
286
|
+
| errors.SDKError | 4xx-5xx | */* |
|
|
287
|
+
|
|
240
288
|
## postGenerationsMotionSvd
|
|
241
289
|
|
|
242
290
|
This endpoint will generate a SVD motion generation.
|
|
@@ -320,3 +368,136 @@ run();
|
|
|
320
368
|
| Error Object | Status Code | Content Type |
|
|
321
369
|
| --------------- | --------------- | --------------- |
|
|
322
370
|
| errors.SDKError | 4xx-5xx | */* |
|
|
371
|
+
|
|
372
|
+
## postLcmInpainting
|
|
373
|
+
|
|
374
|
+
This endpoint will perform a inpainting on a LCM image
|
|
375
|
+
|
|
376
|
+
### Example Usage
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
import { Leonardo } from "@leonardo-ai/sdk";
|
|
380
|
+
|
|
381
|
+
async function run() {
|
|
382
|
+
const sdk = new Leonardo({
|
|
383
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
const result = await sdk.generation.postLcmInpainting({
|
|
387
|
+
imageDataUrl: "<value>",
|
|
388
|
+
maskDataUrl: "<value>",
|
|
389
|
+
prompt: "<value>",
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
// Handle the result
|
|
393
|
+
console.log(result)
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
run();
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Parameters
|
|
400
|
+
|
|
401
|
+
| Parameter | Type | Required | Description |
|
|
402
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
403
|
+
| `request` | [operations.PostLcmInpaintingRequestBody](../../sdk/models/operations/postlcminpaintingrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
404
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
405
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
### Response
|
|
409
|
+
|
|
410
|
+
**Promise<[operations.PostLcmInpaintingResponse](../../sdk/models/operations/postlcminpaintingresponse.md)>**
|
|
411
|
+
### Errors
|
|
412
|
+
|
|
413
|
+
| Error Object | Status Code | Content Type |
|
|
414
|
+
| --------------- | --------------- | --------------- |
|
|
415
|
+
| errors.SDKError | 4xx-5xx | */* |
|
|
416
|
+
|
|
417
|
+
## postLcmInstantRefine
|
|
418
|
+
|
|
419
|
+
This endpoint will perform instant refine on a LCM image
|
|
420
|
+
|
|
421
|
+
### Example Usage
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
import { Leonardo } from "@leonardo-ai/sdk";
|
|
425
|
+
|
|
426
|
+
async function run() {
|
|
427
|
+
const sdk = new Leonardo({
|
|
428
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
const result = await sdk.generation.postLcmInstantRefine({
|
|
432
|
+
imageDataUrl: "<value>",
|
|
433
|
+
prompt: "<value>",
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// Handle the result
|
|
437
|
+
console.log(result)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
run();
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Parameters
|
|
444
|
+
|
|
445
|
+
| Parameter | Type | Required | Description |
|
|
446
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
447
|
+
| `request` | [operations.PostLcmInstantRefineRequestBody](../../sdk/models/operations/postlcminstantrefinerequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
448
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
449
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
### Response
|
|
453
|
+
|
|
454
|
+
**Promise<[operations.PostLcmInstantRefineResponse](../../sdk/models/operations/postlcminstantrefineresponse.md)>**
|
|
455
|
+
### Errors
|
|
456
|
+
|
|
457
|
+
| Error Object | Status Code | Content Type |
|
|
458
|
+
| --------------- | --------------- | --------------- |
|
|
459
|
+
| errors.SDKError | 4xx-5xx | */* |
|
|
460
|
+
|
|
461
|
+
## postLcmUpscale
|
|
462
|
+
|
|
463
|
+
This endpoint will perform Alchemy Upscale on a LCM image
|
|
464
|
+
|
|
465
|
+
### Example Usage
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
import { Leonardo } from "@leonardo-ai/sdk";
|
|
469
|
+
|
|
470
|
+
async function run() {
|
|
471
|
+
const sdk = new Leonardo({
|
|
472
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
const result = await sdk.generation.postLcmUpscale({
|
|
476
|
+
imageDataUrl: "<value>",
|
|
477
|
+
prompt: "<value>",
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// Handle the result
|
|
481
|
+
console.log(result)
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
run();
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### Parameters
|
|
488
|
+
|
|
489
|
+
| Parameter | Type | Required | Description |
|
|
490
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
491
|
+
| `request` | [operations.PostLcmUpscaleRequestBody](../../sdk/models/operations/postlcmupscalerequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
492
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
493
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
### Response
|
|
497
|
+
|
|
498
|
+
**Promise<[operations.PostLcmUpscaleResponse](../../sdk/models/operations/postlcmupscaleresponse.md)>**
|
|
499
|
+
### Errors
|
|
500
|
+
|
|
501
|
+
| Error Object | Status Code | Content Type |
|
|
502
|
+
| --------------- | --------------- | --------------- |
|
|
503
|
+
| errors.SDKError | 4xx-5xx | */* |
|
package/hooks/hooks.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { AfterErrorContext, AfterErrorHook, AfterSuccessContext, AfterSuccessHook, BeforeRequestContext, BeforeRequestHook,
|
|
2
|
-
import { HTTPClient } from "../lib/http";
|
|
1
|
+
import { AfterErrorContext, AfterErrorHook, AfterSuccessContext, AfterSuccessHook, BeforeRequestContext, BeforeRequestHook, Hooks, SDKInitHook, SDKInitOptions } from "./types";
|
|
3
2
|
export declare class SDKHooks implements Hooks {
|
|
4
|
-
|
|
3
|
+
sdkInitHooks: SDKInitHook[];
|
|
5
4
|
beforeRequestHooks: BeforeRequestHook[];
|
|
6
5
|
afterSuccessHooks: AfterSuccessHook[];
|
|
7
6
|
afterErrorHooks: AfterErrorHook[];
|
|
8
7
|
constructor();
|
|
9
|
-
|
|
8
|
+
registerSDKInitHook(hook: SDKInitHook): void;
|
|
10
9
|
registerBeforeRequestHook(hook: BeforeRequestHook): void;
|
|
11
10
|
registerAfterSuccessHook(hook: AfterSuccessHook): void;
|
|
12
11
|
registerAfterErrorHook(hook: AfterErrorHook): void;
|
|
13
|
-
|
|
12
|
+
sdkInit(opts: SDKInitOptions): SDKInitOptions;
|
|
14
13
|
beforeRequest(hookCtx: BeforeRequestContext, request: Request): Promise<Request>;
|
|
15
14
|
afterSuccess(hookCtx: AfterSuccessContext, response: Response): Promise<Response>;
|
|
16
15
|
afterError(hookCtx: AfterErrorContext, response: Response | null, error: unknown): Promise<{
|
package/hooks/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks/hooks.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks/hooks.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,cAAc,EACjB,MAAM,SAAS,CAAC;AAEjB,qBAAa,QAAS,YAAW,KAAK;IAClC,YAAY,EAAE,WAAW,EAAE,CAAM;IACjC,kBAAkB,EAAE,iBAAiB,EAAE,CAAM;IAC7C,iBAAiB,EAAE,gBAAgB,EAAE,CAAM;IAC3C,eAAe,EAAE,cAAc,EAAE,CAAM;;IAIvC,mBAAmB,CAAC,IAAI,EAAE,WAAW;IAIrC,yBAAyB,CAAC,IAAI,EAAE,iBAAiB;IAIjD,wBAAwB,CAAC,IAAI,EAAE,gBAAgB;IAI/C,sBAAsB,CAAC,IAAI,EAAE,cAAc;IAI3C,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;IAIvC,aAAa,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAUhF,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAUjF,UAAU,CACZ,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,KAAK,EAAE,OAAO,GACf,OAAO,CAAC;QAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;CAY5D"}
|
package/hooks/hooks.js
CHANGED
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SDKHooks = void 0;
|
|
7
|
-
const registration_1 = require("./registration");
|
|
8
7
|
class SDKHooks {
|
|
9
8
|
constructor() {
|
|
10
|
-
this.
|
|
9
|
+
this.sdkInitHooks = [];
|
|
11
10
|
this.beforeRequestHooks = [];
|
|
12
11
|
this.afterSuccessHooks = [];
|
|
13
12
|
this.afterErrorHooks = [];
|
|
14
|
-
(0, registration_1.initHooks)(this);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
this.
|
|
14
|
+
registerSDKInitHook(hook) {
|
|
15
|
+
this.sdkInitHooks.push(hook);
|
|
18
16
|
}
|
|
19
17
|
registerBeforeRequestHook(hook) {
|
|
20
18
|
this.beforeRequestHooks.push(hook);
|
|
@@ -25,8 +23,8 @@ class SDKHooks {
|
|
|
25
23
|
registerAfterErrorHook(hook) {
|
|
26
24
|
this.afterErrorHooks.push(hook);
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
return this.
|
|
26
|
+
sdkInit(opts) {
|
|
27
|
+
return this.sdkInitHooks.reduce((opts, hook) => hook.sdkInit(opts), opts);
|
|
30
28
|
}
|
|
31
29
|
async beforeRequest(hookCtx, request) {
|
|
32
30
|
let req = request;
|
package/hooks/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks/hooks.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAcH,
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks/hooks.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAcH,MAAa,QAAQ;IAMjB;QALA,iBAAY,GAAkB,EAAE,CAAC;QACjC,uBAAkB,GAAwB,EAAE,CAAC;QAC7C,sBAAiB,GAAuB,EAAE,CAAC;QAC3C,oBAAe,GAAqB,EAAE,CAAC;IAExB,CAAC;IAEhB,mBAAmB,CAAC,IAAiB;QACjC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,yBAAyB,CAAC,IAAuB;QAC7C,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,wBAAwB,CAAC,IAAsB;QAC3C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Q,CAAC;YACtB,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC;QACvB,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IACzC,CAAC;CACJ;AAhED,4BAgEC"}
|
package/hooks/types.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { HTTPClient } from "../lib/http";
|
|
2
2
|
export type HookContext = {
|
|
3
3
|
operationID: string;
|
|
4
|
+
oAuth2Scopes?: string[];
|
|
5
|
+
security?: string | (() => Promise<string>);
|
|
4
6
|
};
|
|
5
7
|
export type Awaitable<T> = T | Promise<T>;
|
|
8
|
+
export type SDKInitOptions = {
|
|
9
|
+
baseURL: URL | null;
|
|
10
|
+
client: HTTPClient;
|
|
11
|
+
};
|
|
6
12
|
export type BeforeRequestContext = HookContext & {};
|
|
7
13
|
export type AfterSuccessContext = HookContext & {};
|
|
8
14
|
export type AfterErrorContext = HookContext & {};
|
|
9
15
|
/**
|
|
10
|
-
*
|
|
11
|
-
* hook can return a new HTTP client to be used by the SDK.
|
|
16
|
+
* SDKInitHook is called when the SDK is initializing. The
|
|
17
|
+
* hook can return a new baseURL and HTTP client to be used by the SDK.
|
|
12
18
|
*/
|
|
13
|
-
export interface
|
|
14
|
-
|
|
19
|
+
export interface SDKInitHook {
|
|
20
|
+
sdkInit: (opts: SDKInitOptions) => SDKInitOptions;
|
|
15
21
|
}
|
|
16
22
|
/**
|
|
17
23
|
* BeforeRequestHook is called before the SDK sends a request. The hook can
|
|
@@ -41,8 +47,8 @@ export interface AfterErrorHook {
|
|
|
41
47
|
}>;
|
|
42
48
|
}
|
|
43
49
|
export interface Hooks {
|
|
44
|
-
/** Registers a hook to be used by the SDK for
|
|
45
|
-
|
|
50
|
+
/** Registers a hook to be used by the SDK for initialization event. */
|
|
51
|
+
registerSDKInitHook(hook: SDKInitHook): void;
|
|
46
52
|
/** Registers a hook to be used by the SDK for the before request event. */
|
|
47
53
|
registerBeforeRequestHook(hook: BeforeRequestHook): void;
|
|
48
54
|
/** Registers a hook to be used by the SDK for the after success event. */
|
package/hooks/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/hooks/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/hooks/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG;IACzB,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,EAAE,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,EAAE,CAAC;AACnD,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,EAAE,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,cAAc,CAAC;CACrD;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAC9B,aAAa,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,OAAO,CAAC,CAAC;CAC1F;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,YAAY,EAAE,CAAC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC3F;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,CACR,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,KAAK,EAAE,OAAO,KACb,SAAS,CAAC;QACX,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAC1B,KAAK,EAAE,OAAO,CAAC;KAClB,CAAC,CAAC;CACN;AAED,MAAM,WAAW,KAAK;IAClB,uEAAuE;IACvE,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7C,2EAA2E;IAC3E,yBAAyB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzD,0EAA0E;IAC1E,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvD,wEAAwE;IACxE,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;CACtD"}
|
package/lib/config.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
24
24
|
export declare const SDK_METADATA: Readonly<{
|
|
25
25
|
language: "typescript";
|
|
26
26
|
openapiDocVersion: "v1.0.0";
|
|
27
|
-
sdkVersion: "4.
|
|
28
|
-
genVersion: "2.
|
|
29
|
-
userAgent: "speakeasy-sdk/typescript 4.
|
|
27
|
+
sdkVersion: "4.3.1";
|
|
28
|
+
genVersion: "2.272.7";
|
|
29
|
+
userAgent: "speakeasy-sdk/typescript 4.3.1 2.272.7 v1.0.0 @leonardo-ai/sdk";
|
|
30
30
|
}>;
|
|
31
31
|
//# sourceMappingURL=config.d.ts.map
|
package/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ exports.serverURLFromOptions = serverURLFromOptions;
|
|
|
29
29
|
exports.SDK_METADATA = Object.freeze({
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "v1.0.0",
|
|
32
|
-
sdkVersion: "4.
|
|
33
|
-
genVersion: "2.
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 4.
|
|
32
|
+
sdkVersion: "4.3.1",
|
|
33
|
+
genVersion: "2.272.7",
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 4.3.1 2.272.7 v1.0.0 @leonardo-ai/sdk",
|
|
35
35
|
});
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
package/lib/schemas.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function that executes some code which may throw a ZodError. It
|
|
3
|
+
* intercepts this error and converts it to an SDKValidationError so as to not
|
|
4
|
+
* leak Zod implementation details to user code.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parse<Inp, Out>(rawValue: Inp, fn: (value: Inp) => Out, errorMessage: string): Out;
|
|
7
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/lib/schemas.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,YAAY,EAAE,MAAM,GAAG,GAAG,CASjG"}
|
package/lib/schemas.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.parse = void 0;
|
|
30
|
+
const zod_1 = require("zod");
|
|
31
|
+
const errors = __importStar(require("../sdk/models/errors"));
|
|
32
|
+
/**
|
|
33
|
+
* Utility function that executes some code which may throw a ZodError. It
|
|
34
|
+
* intercepts this error and converts it to an SDKValidationError so as to not
|
|
35
|
+
* leak Zod implementation details to user code.
|
|
36
|
+
*/
|
|
37
|
+
function parse(rawValue, fn, errorMessage) {
|
|
38
|
+
try {
|
|
39
|
+
return fn(rawValue);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
if (err instanceof zod_1.ZodError) {
|
|
43
|
+
throw new errors.SDKValidationError(errorMessage, err, rawValue);
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.parse = parse;
|
|
49
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/lib/schemas.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA+B;AAC/B,6DAA+C;AAE/C;;;;GAIG;AACH,SAAgB,KAAK,CAAW,QAAa,EAAE,EAAuB,EAAE,YAAoB;IACxF,IAAI,CAAC;QACD,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,IAAI,GAAG,YAAY,cAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,GAAG,CAAC;IACd,CAAC;AACL,CAAC;AATD,sBASC"}
|
package/lib/sdks.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export type RequestOptions = {
|
|
|
8
8
|
type RequestConfig = {
|
|
9
9
|
method: string;
|
|
10
10
|
path: string;
|
|
11
|
-
context: HookContext;
|
|
12
11
|
baseURL?: string | URL;
|
|
13
12
|
query?: string;
|
|
14
13
|
body?: RequestInit["body"];
|
|
@@ -24,7 +23,7 @@ export declare class ClientSDK {
|
|
|
24
23
|
baseURL: URL | null;
|
|
25
24
|
hooks: SDKHooks;
|
|
26
25
|
});
|
|
27
|
-
protected createRequest$(conf: RequestConfig, options?: RequestOptions):
|
|
26
|
+
protected createRequest$(conf: RequestConfig, options?: RequestOptions): Request;
|
|
28
27
|
protected do$(req: Request, options: {
|
|
29
28
|
context: HookContext;
|
|
30
29
|
errorCodes: number | string | (number | string)[];
|
package/lib/sdks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdks.d.ts","sourceR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