@leonardo-ai/sdk 2.1.4 → 2.2.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 +49 -56
- package/dist/sdk/sdk.js +3 -3
- package/docs/sdk/models/shared/security.md +3 -3
- package/docs/sdks/dataset/README.md +35 -25
- package/docs/sdks/element/README.md +5 -3
- package/docs/sdks/generation/README.md +35 -23
- package/docs/sdks/initimage/README.md +15 -9
- package/docs/sdks/model/README.md +35 -23
- package/docs/sdks/user/README.md +5 -3
- package/docs/sdks/variation/README.md +20 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<a href="https://codespaces.new/Leonardo-Interactive/leonardo-ts-sdk.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
<!-- Start SDK Installation -->
|
|
11
|
+
<!-- Start SDK Installation [installation] -->
|
|
12
12
|
## SDK Installation
|
|
13
13
|
|
|
14
14
|
### NPM
|
|
@@ -22,22 +22,23 @@ npm add @leonardo-ai/sdk
|
|
|
22
22
|
```bash
|
|
23
23
|
yarn add @leonardo-ai/sdk
|
|
24
24
|
```
|
|
25
|
-
<!-- End SDK Installation -->
|
|
25
|
+
<!-- End SDK Installation [installation] -->
|
|
26
26
|
|
|
27
27
|
## Authentication
|
|
28
28
|
|
|
29
29
|
To get access to the API and fetch an API key, please sign up for [access](https://leonardo.ai/).
|
|
30
30
|
|
|
31
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
31
32
|
## SDK Example Usage
|
|
32
|
-
|
|
33
|
+
|
|
33
34
|
### Example
|
|
34
35
|
|
|
35
36
|
```typescript
|
|
36
37
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
async function run() {
|
|
39
40
|
const sdk = new Leonardo({
|
|
40
|
-
bearerAuth: "",
|
|
41
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
const res = await sdk.dataset.createDataset({
|
|
@@ -47,15 +48,16 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
47
48
|
if (res.statusCode == 200) {
|
|
48
49
|
// handle response
|
|
49
50
|
}
|
|
50
|
-
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
run();
|
|
51
54
|
|
|
52
55
|
```
|
|
53
|
-
<!-- End SDK Example Usage -->
|
|
56
|
+
<!-- End SDK Example Usage [usage] -->
|
|
54
57
|
|
|
55
|
-
<!-- Start
|
|
58
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
56
59
|
## Available Resources and Operations
|
|
57
60
|
|
|
58
|
-
|
|
59
61
|
### [dataset](docs/sdks/dataset/README.md)
|
|
60
62
|
|
|
61
63
|
* [createDataset](docs/sdks/dataset/README.md#createdataset) - Create a Dataset
|
|
@@ -102,37 +104,15 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
102
104
|
* [createVariationUpscale](docs/sdks/variation/README.md#createvariationupscale) - Create upscale
|
|
103
105
|
* [getVariationById](docs/sdks/variation/README.md#getvariationbyid) - Get variation by ID
|
|
104
106
|
* [postVariationsUnzoom](docs/sdks/variation/README.md#postvariationsunzoom) - Create unzoom
|
|
105
|
-
<!-- End
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<!-- Start Dev Containers -->
|
|
110
|
-
# Dev Containers
|
|
111
|
-
<div align="left">
|
|
112
|
-
<a href="https://codespaces.new/Leonardo-Interactive/leonardo-ts-sdk.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
|
|
113
|
-
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
Experience our SDK in an enhanced sandbox environment. Try it now in **GitHub Codespaces**!
|
|
107
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
117
108
|
|
|
118
|
-
* [Explore Dev Containers](.devcontainer/README.md)
|
|
119
|
-
<!-- End Dev Containers -->
|
|
120
109
|
|
|
121
110
|
|
|
122
111
|
|
|
123
|
-
<!-- Start Pagination -->
|
|
124
|
-
# Pagination
|
|
125
112
|
|
|
126
|
-
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
|
|
127
|
-
returned response object will have a `next` method that can be called to pull down the next group of results. If the
|
|
128
|
-
return value of `next` is `null`, then there are no more pages to be fetched.
|
|
129
113
|
|
|
130
|
-
Here's an example of one such pagination call:
|
|
131
|
-
<!-- End Pagination -->
|
|
132
114
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<!-- Start Error Handling -->
|
|
115
|
+
<!-- Start Error Handling [errors] -->
|
|
136
116
|
## Error Handling
|
|
137
117
|
|
|
138
118
|
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
|
|
@@ -146,9 +126,9 @@ Example
|
|
|
146
126
|
```typescript
|
|
147
127
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
148
128
|
|
|
149
|
-
|
|
129
|
+
async function run() {
|
|
150
130
|
const sdk = new Leonardo({
|
|
151
|
-
bearerAuth: "",
|
|
131
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
152
132
|
});
|
|
153
133
|
|
|
154
134
|
let res;
|
|
@@ -156,28 +136,35 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
156
136
|
res = await sdk.dataset.createDataset({
|
|
157
137
|
name: "string",
|
|
158
138
|
});
|
|
159
|
-
} catch (
|
|
139
|
+
} catch (err) {
|
|
140
|
+
if (err instanceof errors.SDKError) {
|
|
141
|
+
console.error(err); // handle exception
|
|
142
|
+
throw err;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
160
145
|
|
|
161
146
|
if (res.statusCode == 200) {
|
|
162
147
|
// handle response
|
|
163
148
|
}
|
|
164
|
-
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
run();
|
|
165
152
|
|
|
166
153
|
```
|
|
167
|
-
<!-- End Error Handling -->
|
|
154
|
+
<!-- End Error Handling [errors] -->
|
|
168
155
|
|
|
169
156
|
|
|
170
157
|
|
|
171
|
-
<!-- Start Custom HTTP Client -->
|
|
158
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
172
159
|
## Custom HTTP Client
|
|
173
160
|
|
|
174
|
-
The Typescript SDK makes API calls using the (
|
|
161
|
+
The Typescript SDK makes API calls using the [axios](https://axios-http.com/docs/intro) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `AxiosInstance` object.
|
|
175
162
|
|
|
176
163
|
For example, you could specify a header for every request that your sdk makes as follows:
|
|
177
164
|
|
|
178
165
|
```typescript
|
|
179
|
-
|
|
180
|
-
import axios;
|
|
166
|
+
import { @leonardo-ai/sdk } from "Leonardo";
|
|
167
|
+
import axios from "axios";
|
|
181
168
|
|
|
182
169
|
const httpClient = axios.create({
|
|
183
170
|
headers: {'x-custom-header': 'someValue'}
|
|
@@ -185,11 +172,11 @@ const httpClient = axios.create({
|
|
|
185
172
|
|
|
186
173
|
const sdk = new Leonardo({defaultClient: httpClient});
|
|
187
174
|
```
|
|
188
|
-
<!-- End Custom HTTP Client -->
|
|
175
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
189
176
|
|
|
190
177
|
|
|
191
178
|
|
|
192
|
-
<!-- Start Server Selection -->
|
|
179
|
+
<!-- Start Server Selection [server] -->
|
|
193
180
|
## Server Selection
|
|
194
181
|
|
|
195
182
|
### Select Server by Index
|
|
@@ -205,10 +192,10 @@ You can override the default server globally by passing a server index to the `s
|
|
|
205
192
|
```typescript
|
|
206
193
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
207
194
|
|
|
208
|
-
|
|
195
|
+
async function run() {
|
|
209
196
|
const sdk = new Leonardo({
|
|
210
197
|
serverIdx: 0,
|
|
211
|
-
bearerAuth: "",
|
|
198
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
212
199
|
});
|
|
213
200
|
|
|
214
201
|
const res = await sdk.dataset.createDataset({
|
|
@@ -218,7 +205,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
218
205
|
if (res.statusCode == 200) {
|
|
219
206
|
// handle response
|
|
220
207
|
}
|
|
221
|
-
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
run();
|
|
222
211
|
|
|
223
212
|
```
|
|
224
213
|
|
|
@@ -229,10 +218,10 @@ The default server can also be overridden globally by passing a URL to the `serv
|
|
|
229
218
|
```typescript
|
|
230
219
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
231
220
|
|
|
232
|
-
|
|
221
|
+
async function run() {
|
|
233
222
|
const sdk = new Leonardo({
|
|
234
223
|
serverURL: "https://cloud.leonardo.ai/api/rest/v1",
|
|
235
|
-
bearerAuth: "",
|
|
224
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
236
225
|
});
|
|
237
226
|
|
|
238
227
|
const res = await sdk.dataset.createDataset({
|
|
@@ -242,14 +231,16 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
242
231
|
if (res.statusCode == 200) {
|
|
243
232
|
// handle response
|
|
244
233
|
}
|
|
245
|
-
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
run();
|
|
246
237
|
|
|
247
238
|
```
|
|
248
|
-
<!-- End Server Selection -->
|
|
239
|
+
<!-- End Server Selection [server] -->
|
|
249
240
|
|
|
250
241
|
|
|
251
242
|
|
|
252
|
-
<!-- Start Authentication -->
|
|
243
|
+
<!-- Start Authentication [security] -->
|
|
253
244
|
## Authentication
|
|
254
245
|
|
|
255
246
|
### Per-Client Security Schemes
|
|
@@ -264,9 +255,9 @@ To authenticate with the API the `bearerAuth` parameter must be set when initial
|
|
|
264
255
|
```typescript
|
|
265
256
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
266
257
|
|
|
267
|
-
|
|
258
|
+
async function run() {
|
|
268
259
|
const sdk = new Leonardo({
|
|
269
|
-
bearerAuth: "",
|
|
260
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
270
261
|
});
|
|
271
262
|
|
|
272
263
|
const res = await sdk.dataset.createDataset({
|
|
@@ -276,10 +267,12 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
276
267
|
if (res.statusCode == 200) {
|
|
277
268
|
// handle response
|
|
278
269
|
}
|
|
279
|
-
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
run();
|
|
280
273
|
|
|
281
274
|
```
|
|
282
|
-
<!-- End Authentication -->
|
|
275
|
+
<!-- End Authentication [security] -->
|
|
283
276
|
|
|
284
277
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
285
278
|
|
package/dist/sdk/sdk.js
CHANGED
|
@@ -52,9 +52,9 @@ var SDKConfiguration = /** @class */ (function () {
|
|
|
52
52
|
function SDKConfiguration(init) {
|
|
53
53
|
this.language = "typescript";
|
|
54
54
|
this.openapiDocVersion = "v1.0.0";
|
|
55
|
-
this.sdkVersion = "2.
|
|
56
|
-
this.genVersion = "2.
|
|
57
|
-
this.userAgent = "speakeasy-sdk/typescript 2.
|
|
55
|
+
this.sdkVersion = "2.2.0";
|
|
56
|
+
this.genVersion = "2.213.3";
|
|
57
|
+
this.userAgent = "speakeasy-sdk/typescript 2.2.0 2.213.3 v1.0.0 @leonardo-ai/sdk";
|
|
58
58
|
Object.assign(this, init);
|
|
59
59
|
}
|
|
60
60
|
return SDKConfiguration;
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
## Fields
|
|
5
5
|
|
|
6
|
-
| Field | Type | Required | Description |
|
|
7
|
-
| ------------------ | ------------------ | ------------------ | ------------------ |
|
|
8
|
-
| `bearerAuth` | *string* | :heavy_check_mark: | N/A |
|
|
6
|
+
| Field | Type | Required | Description |
|
|
7
|
+
| ------------------ | ------------------ | ------------------ | ------------------ |
|
|
8
|
+
| `bearerAuth` | *string* | :heavy_check_mark: | N/A |
|
|
@@ -18,9 +18,9 @@ This endpoint creates a new dataset
|
|
|
18
18
|
```typescript
|
|
19
19
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
async function run() {
|
|
22
22
|
const sdk = new Leonardo({
|
|
23
|
-
bearerAuth: "",
|
|
23
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
const res = await sdk.dataset.createDataset({
|
|
@@ -30,7 +30,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
30
30
|
if (res.statusCode == 200) {
|
|
31
31
|
// handle response
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
run();
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
### Parameters
|
|
@@ -60,9 +62,9 @@ This endpoint deletes the specific dataset
|
|
|
60
62
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
61
63
|
import { DeleteDatasetByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
async function run() {
|
|
64
66
|
const sdk = new Leonardo({
|
|
65
|
-
bearerAuth: "",
|
|
67
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
66
68
|
});
|
|
67
69
|
const id: string = "string";
|
|
68
70
|
|
|
@@ -71,7 +73,9 @@ const id: string = "string";
|
|
|
71
73
|
if (res.statusCode == 200) {
|
|
72
74
|
// handle response
|
|
73
75
|
}
|
|
74
|
-
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
run();
|
|
75
79
|
```
|
|
76
80
|
|
|
77
81
|
### Parameters
|
|
@@ -101,9 +105,9 @@ This endpoint gets the specific dataset
|
|
|
101
105
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
102
106
|
import { GetDatasetByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
async function run() {
|
|
105
109
|
const sdk = new Leonardo({
|
|
106
|
-
bearerAuth: "",
|
|
110
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
107
111
|
});
|
|
108
112
|
const id: string = "string";
|
|
109
113
|
|
|
@@ -112,7 +116,9 @@ const id: string = "string";
|
|
|
112
116
|
if (res.statusCode == 200) {
|
|
113
117
|
// handle response
|
|
114
118
|
}
|
|
115
|
-
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
run();
|
|
116
122
|
```
|
|
117
123
|
|
|
118
124
|
### Parameters
|
|
@@ -142,9 +148,9 @@ This endpoint returns presigned details to upload a dataset image to S3
|
|
|
142
148
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
143
149
|
import { UploadDatasetImageRequest, UploadDatasetImageRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
144
150
|
|
|
145
|
-
|
|
151
|
+
async function run() {
|
|
146
152
|
const sdk = new Leonardo({
|
|
147
|
-
bearerAuth: "",
|
|
153
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
148
154
|
});
|
|
149
155
|
const requestBody: UploadDatasetImageRequestBody = {
|
|
150
156
|
extension: "mpg4",
|
|
@@ -156,16 +162,18 @@ const datasetId: string = "string";
|
|
|
156
162
|
if (res.statusCode == 200) {
|
|
157
163
|
// handle response
|
|
158
164
|
}
|
|
159
|
-
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
run();
|
|
160
168
|
```
|
|
161
169
|
|
|
162
170
|
### Parameters
|
|
163
171
|
|
|
164
|
-
| Parameter
|
|
165
|
-
|
|
|
166
|
-
| `requestBody`
|
|
167
|
-
| `datasetId`
|
|
168
|
-
| `config`
|
|
172
|
+
| Parameter | Type | Required | Description |
|
|
173
|
+
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| `requestBody` | [operations.UploadDatasetImageRequestBody](../../sdk/models/operations/uploaddatasetimagerequestbody.md) | :heavy_check_mark: | Query parameters provided in the request body as a JSON object |
|
|
175
|
+
| `datasetId` | *string* | :heavy_check_mark: | _"datasetId" is required |
|
|
176
|
+
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |
|
|
169
177
|
|
|
170
178
|
|
|
171
179
|
### Response
|
|
@@ -187,9 +195,9 @@ This endpoint will upload a previously generated image to the dataset
|
|
|
187
195
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
188
196
|
import { UploadDatasetImageFromGenRequest, UploadDatasetImageFromGenRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
189
197
|
|
|
190
|
-
|
|
198
|
+
async function run() {
|
|
191
199
|
const sdk = new Leonardo({
|
|
192
|
-
bearerAuth: "",
|
|
200
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
193
201
|
});
|
|
194
202
|
const requestBody: UploadDatasetImageFromGenRequestBody = {
|
|
195
203
|
generatedImageId: "string",
|
|
@@ -201,16 +209,18 @@ const datasetId: string = "string";
|
|
|
201
209
|
if (res.statusCode == 200) {
|
|
202
210
|
// handle response
|
|
203
211
|
}
|
|
204
|
-
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
run();
|
|
205
215
|
```
|
|
206
216
|
|
|
207
217
|
### Parameters
|
|
208
218
|
|
|
209
|
-
| Parameter
|
|
210
|
-
|
|
|
211
|
-
| `requestBody`
|
|
212
|
-
| `datasetId`
|
|
213
|
-
| `config`
|
|
219
|
+
| Parameter | Type | Required | Description |
|
|
220
|
+
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
221
|
+
| `requestBody` | [operations.UploadDatasetImageFromGenRequestBody](../../sdk/models/operations/uploaddatasetimagefromgenrequestbody.md) | :heavy_check_mark: | Query parameters to be provided in the request body as a JSON object |
|
|
222
|
+
| `datasetId` | *string* | :heavy_check_mark: | The ID of the dataset to upload the image to. |
|
|
223
|
+
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |
|
|
214
224
|
|
|
215
225
|
|
|
216
226
|
### Response
|
|
@@ -14,9 +14,9 @@ Get a list of public Elements available for use with generations.
|
|
|
14
14
|
```typescript
|
|
15
15
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
async function run() {
|
|
18
18
|
const sdk = new Leonardo({
|
|
19
|
-
bearerAuth: "",
|
|
19
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const res = await sdk.element.getElements();
|
|
@@ -24,7 +24,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
24
24
|
if (res.statusCode == 200) {
|
|
25
25
|
// handle response
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
run();
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
### Parameters
|
|
@@ -20,9 +20,9 @@ This endpoint will generate images
|
|
|
20
20
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
21
21
|
import { ControlnetType, SdGenerationSchedulers, SdGenerationStyle, SdVersions } from "@leonardo-ai/sdk/dist/sdk/models/shared";
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
async function run() {
|
|
24
24
|
const sdk = new Leonardo({
|
|
25
|
-
bearerAuth: "",
|
|
25
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const res = await sdk.generation.createGeneration({
|
|
@@ -37,7 +37,9 @@ import { ControlnetType, SdGenerationSchedulers, SdGenerationStyle, SdVersions }
|
|
|
37
37
|
if (res.statusCode == 200) {
|
|
38
38
|
// handle response
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
run();
|
|
41
43
|
```
|
|
42
44
|
|
|
43
45
|
### Parameters
|
|
@@ -67,9 +69,9 @@ This endpoint deletes a specific generation
|
|
|
67
69
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
68
70
|
import { DeleteGenerationByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
async function run() {
|
|
71
73
|
const sdk = new Leonardo({
|
|
72
|
-
bearerAuth: "",
|
|
74
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
73
75
|
});
|
|
74
76
|
const id: string = "string";
|
|
75
77
|
|
|
@@ -78,7 +80,9 @@ const id: string = "string";
|
|
|
78
80
|
if (res.statusCode == 200) {
|
|
79
81
|
// handle response
|
|
80
82
|
}
|
|
81
|
-
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
run();
|
|
82
86
|
```
|
|
83
87
|
|
|
84
88
|
### Parameters
|
|
@@ -108,9 +112,9 @@ This endpoint deletes the specific texture generation.
|
|
|
108
112
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
109
113
|
import { DeleteGenerationsTextureIdRequest, DeleteGenerationsTextureIdRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
110
114
|
|
|
111
|
-
|
|
115
|
+
async function run() {
|
|
112
116
|
const sdk = new Leonardo({
|
|
113
|
-
bearerAuth: "",
|
|
117
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
114
118
|
});
|
|
115
119
|
const id: string = "string";
|
|
116
120
|
const requestBody: DeleteGenerationsTextureIdRequestBody = {};
|
|
@@ -120,16 +124,18 @@ const requestBody: DeleteGenerationsTextureIdRequestBody = {};
|
|
|
120
124
|
if (res.statusCode == 200) {
|
|
121
125
|
// handle response
|
|
122
126
|
}
|
|
123
|
-
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
run();
|
|
124
130
|
```
|
|
125
131
|
|
|
126
132
|
### Parameters
|
|
127
133
|
|
|
128
|
-
| Parameter
|
|
129
|
-
|
|
|
130
|
-
| `id`
|
|
131
|
-
| `requestBody`
|
|
132
|
-
| `config`
|
|
134
|
+
| Parameter | Type | Required | Description |
|
|
135
|
+
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
|
136
|
+
| `id` | *string* | :heavy_check_mark: | _"id" is required (enter it either in parameters or request body)_ |
|
|
137
|
+
| `requestBody` | [operations.DeleteGenerationsTextureIdRequestBody](../../sdk/models/operations/deletegenerationstextureidrequestbody.md) | :heavy_minus_sign: | Query parameters can also be provided in the request body as a JSON object |
|
|
138
|
+
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |
|
|
133
139
|
|
|
134
140
|
|
|
135
141
|
### Response
|
|
@@ -151,9 +157,9 @@ This endpoint will provide information about a specific generation
|
|
|
151
157
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
152
158
|
import { GetGenerationByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
153
159
|
|
|
154
|
-
|
|
160
|
+
async function run() {
|
|
155
161
|
const sdk = new Leonardo({
|
|
156
|
-
bearerAuth: "",
|
|
162
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
157
163
|
});
|
|
158
164
|
const id: string = "string";
|
|
159
165
|
|
|
@@ -162,7 +168,9 @@ const id: string = "string";
|
|
|
162
168
|
if (res.statusCode == 200) {
|
|
163
169
|
// handle response
|
|
164
170
|
}
|
|
165
|
-
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
run();
|
|
166
174
|
```
|
|
167
175
|
|
|
168
176
|
### Parameters
|
|
@@ -192,9 +200,9 @@ This endpoint returns all generations by a specific user
|
|
|
192
200
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
193
201
|
import { GetGenerationsByUserIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
194
202
|
|
|
195
|
-
|
|
203
|
+
async function run() {
|
|
196
204
|
const sdk = new Leonardo({
|
|
197
|
-
bearerAuth: "",
|
|
205
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
198
206
|
});
|
|
199
207
|
const userId: string = "string";
|
|
200
208
|
const limit: number = 270501;
|
|
@@ -205,7 +213,9 @@ const offset: number = 770121;
|
|
|
205
213
|
if (res.statusCode == 200) {
|
|
206
214
|
// handle response
|
|
207
215
|
}
|
|
208
|
-
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
run();
|
|
209
219
|
```
|
|
210
220
|
|
|
211
221
|
### Parameters
|
|
@@ -236,9 +246,9 @@ This endpoint will generate a texture generation.
|
|
|
236
246
|
```typescript
|
|
237
247
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
238
248
|
|
|
239
|
-
|
|
249
|
+
async function run() {
|
|
240
250
|
const sdk = new Leonardo({
|
|
241
|
-
bearerAuth: "",
|
|
251
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
242
252
|
});
|
|
243
253
|
|
|
244
254
|
const res = await sdk.generation.postGenerationsTexture({});
|
|
@@ -246,7 +256,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
246
256
|
if (res.statusCode == 200) {
|
|
247
257
|
// handle response
|
|
248
258
|
}
|
|
249
|
-
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
run();
|
|
250
262
|
```
|
|
251
263
|
|
|
252
264
|
### Parameters
|
|
@@ -17,9 +17,9 @@ This endpoint deletes an init image
|
|
|
17
17
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
18
18
|
import { DeleteInitImageByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
async function run() {
|
|
21
21
|
const sdk = new Leonardo({
|
|
22
|
-
bearerAuth: "",
|
|
22
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
23
23
|
});
|
|
24
24
|
const id: string = "string";
|
|
25
25
|
|
|
@@ -28,7 +28,9 @@ const id: string = "string";
|
|
|
28
28
|
if (res.statusCode == 200) {
|
|
29
29
|
// handle response
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
run();
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
### Parameters
|
|
@@ -58,9 +60,9 @@ This endpoint will return a single init image
|
|
|
58
60
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
59
61
|
import { GetInitImageByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
async function run() {
|
|
62
64
|
const sdk = new Leonardo({
|
|
63
|
-
bearerAuth: "",
|
|
65
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
64
66
|
});
|
|
65
67
|
const id: string = "string";
|
|
66
68
|
|
|
@@ -69,7 +71,9 @@ const id: string = "string";
|
|
|
69
71
|
if (res.statusCode == 200) {
|
|
70
72
|
// handle response
|
|
71
73
|
}
|
|
72
|
-
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
run();
|
|
73
77
|
```
|
|
74
78
|
|
|
75
79
|
### Parameters
|
|
@@ -98,9 +102,9 @@ This endpoint returns presigned details to upload an init image to S3
|
|
|
98
102
|
```typescript
|
|
99
103
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
async function run() {
|
|
102
106
|
const sdk = new Leonardo({
|
|
103
|
-
bearerAuth: "",
|
|
107
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
104
108
|
});
|
|
105
109
|
|
|
106
110
|
const res = await sdk.initImage.uploadInitImage({
|
|
@@ -110,7 +114,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
110
114
|
if (res.statusCode == 200) {
|
|
111
115
|
// handle response
|
|
112
116
|
}
|
|
113
|
-
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
run();
|
|
114
120
|
```
|
|
115
121
|
|
|
116
122
|
### Parameters
|
|
@@ -20,9 +20,9 @@ This endpoint will train a new custom model
|
|
|
20
20
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
21
21
|
import { CustomModelType, SdVersions, Strength } from "@leonardo-ai/sdk/dist/sdk/models/shared";
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
async function run() {
|
|
24
24
|
const sdk = new Leonardo({
|
|
25
|
-
bearerAuth: "",
|
|
25
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const res = await sdk.model.createModel({
|
|
@@ -34,7 +34,9 @@ import { CustomModelType, SdVersions, Strength } from "@leonardo-ai/sdk/dist/sdk
|
|
|
34
34
|
if (res.statusCode == 200) {
|
|
35
35
|
// handle response
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
run();
|
|
38
40
|
```
|
|
39
41
|
|
|
40
42
|
### Parameters
|
|
@@ -64,9 +66,9 @@ This endpoint will delete a specific custom model
|
|
|
64
66
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
65
67
|
import { DeleteModelByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
async function run() {
|
|
68
70
|
const sdk = new Leonardo({
|
|
69
|
-
bearerAuth: "",
|
|
71
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
70
72
|
});
|
|
71
73
|
const id: string = "string";
|
|
72
74
|
|
|
@@ -75,7 +77,9 @@ const id: string = "string";
|
|
|
75
77
|
if (res.statusCode == 200) {
|
|
76
78
|
// handle response
|
|
77
79
|
}
|
|
78
|
-
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
run();
|
|
79
83
|
```
|
|
80
84
|
|
|
81
85
|
### Parameters
|
|
@@ -105,9 +109,9 @@ This endpoint deletes the specific 3D Model
|
|
|
105
109
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
106
110
|
import { DeleteModels3dIdRequest, DeleteModels3dIdRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
107
111
|
|
|
108
|
-
|
|
112
|
+
async function run() {
|
|
109
113
|
const sdk = new Leonardo({
|
|
110
|
-
bearerAuth: "",
|
|
114
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
111
115
|
});
|
|
112
116
|
const id: string = "string";
|
|
113
117
|
const requestBody: DeleteModels3dIdRequestBody = {};
|
|
@@ -117,16 +121,18 @@ const requestBody: DeleteModels3dIdRequestBody = {};
|
|
|
117
121
|
if (res.statusCode == 200) {
|
|
118
122
|
// handle response
|
|
119
123
|
}
|
|
120
|
-
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
run();
|
|
121
127
|
```
|
|
122
128
|
|
|
123
129
|
### Parameters
|
|
124
130
|
|
|
125
|
-
| Parameter
|
|
126
|
-
|
|
|
127
|
-
| `id`
|
|
128
|
-
| `requestBody`
|
|
129
|
-
| `config`
|
|
131
|
+
| Parameter | Type | Required | Description |
|
|
132
|
+
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| `id` | *string* | :heavy_check_mark: | _"id" is required (enter it either in parameters or request body)_ |
|
|
134
|
+
| `requestBody` | [operations.DeleteModels3dIdRequestBody](../../sdk/models/operations/deletemodels3didrequestbody.md) | :heavy_minus_sign: | Query parameters can also be provided in the request body as a JSON object |
|
|
135
|
+
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |
|
|
130
136
|
|
|
131
137
|
|
|
132
138
|
### Response
|
|
@@ -148,9 +154,9 @@ This endpoint gets the specific custom model
|
|
|
148
154
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
149
155
|
import { GetModelByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
150
156
|
|
|
151
|
-
|
|
157
|
+
async function run() {
|
|
152
158
|
const sdk = new Leonardo({
|
|
153
|
-
bearerAuth: "",
|
|
159
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
154
160
|
});
|
|
155
161
|
const id: string = "string";
|
|
156
162
|
|
|
@@ -159,7 +165,9 @@ const id: string = "string";
|
|
|
159
165
|
if (res.statusCode == 200) {
|
|
160
166
|
// handle response
|
|
161
167
|
}
|
|
162
|
-
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
run();
|
|
163
171
|
```
|
|
164
172
|
|
|
165
173
|
### Parameters
|
|
@@ -189,9 +197,9 @@ Get a list of public Platform Models available for use with generations.
|
|
|
189
197
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
190
198
|
import { GetPlatformModelsRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
191
199
|
|
|
192
|
-
|
|
200
|
+
async function run() {
|
|
193
201
|
const sdk = new Leonardo({
|
|
194
|
-
bearerAuth: "",
|
|
202
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
195
203
|
});
|
|
196
204
|
const limit: number = 419487;
|
|
197
205
|
const offset: number = 472174;
|
|
@@ -201,7 +209,9 @@ const offset: number = 472174;
|
|
|
201
209
|
if (res.statusCode == 200) {
|
|
202
210
|
// handle response
|
|
203
211
|
}
|
|
204
|
-
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
run();
|
|
205
215
|
```
|
|
206
216
|
|
|
207
217
|
### Parameters
|
|
@@ -231,9 +241,9 @@ This endpoint returns presigned details to upload a 3D model to S3
|
|
|
231
241
|
```typescript
|
|
232
242
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
233
243
|
|
|
234
|
-
|
|
244
|
+
async function run() {
|
|
235
245
|
const sdk = new Leonardo({
|
|
236
|
-
bearerAuth: "",
|
|
246
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
237
247
|
});
|
|
238
248
|
|
|
239
249
|
const res = await sdk.model.postModels3dUpload({});
|
|
@@ -241,7 +251,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
241
251
|
if (res.statusCode == 200) {
|
|
242
252
|
// handle response
|
|
243
253
|
}
|
|
244
|
-
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
run();
|
|
245
257
|
```
|
|
246
258
|
|
|
247
259
|
### Parameters
|
package/docs/sdks/user/README.md
CHANGED
|
@@ -14,9 +14,9 @@ This endpoint will return your user information such as your user id, username,
|
|
|
14
14
|
```typescript
|
|
15
15
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
async function run() {
|
|
18
18
|
const sdk = new Leonardo({
|
|
19
|
-
bearerAuth: "",
|
|
19
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const res = await sdk.user.getUserSelf();
|
|
@@ -24,7 +24,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
24
24
|
if (res.statusCode == 200) {
|
|
25
25
|
// handle response
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
run();
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
### Parameters
|
|
@@ -17,9 +17,9 @@ This endpoint will create a no background variation of the provided image ID
|
|
|
17
17
|
```typescript
|
|
18
18
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
async function run() {
|
|
21
21
|
const sdk = new Leonardo({
|
|
22
|
-
bearerAuth: "",
|
|
22
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const res = await sdk.variation.createVariationNoBG({
|
|
@@ -29,7 +29,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
29
29
|
if (res.statusCode == 200) {
|
|
30
30
|
// handle response
|
|
31
31
|
}
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
run();
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
### Parameters
|
|
@@ -58,9 +60,9 @@ This endpoint will create an upscale for the provided image ID
|
|
|
58
60
|
```typescript
|
|
59
61
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
async function run() {
|
|
62
64
|
const sdk = new Leonardo({
|
|
63
|
-
bearerAuth: "",
|
|
65
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
64
66
|
});
|
|
65
67
|
|
|
66
68
|
const res = await sdk.variation.createVariationUpscale({
|
|
@@ -70,7 +72,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
70
72
|
if (res.statusCode == 200) {
|
|
71
73
|
// handle response
|
|
72
74
|
}
|
|
73
|
-
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
run();
|
|
74
78
|
```
|
|
75
79
|
|
|
76
80
|
### Parameters
|
|
@@ -100,9 +104,9 @@ This endpoint will get the variation by ID
|
|
|
100
104
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
101
105
|
import { GetVariationByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
async function run() {
|
|
104
108
|
const sdk = new Leonardo({
|
|
105
|
-
bearerAuth: "",
|
|
109
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
106
110
|
});
|
|
107
111
|
const id: string = "string";
|
|
108
112
|
|
|
@@ -111,7 +115,9 @@ const id: string = "string";
|
|
|
111
115
|
if (res.statusCode == 200) {
|
|
112
116
|
// handle response
|
|
113
117
|
}
|
|
114
|
-
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
run();
|
|
115
121
|
```
|
|
116
122
|
|
|
117
123
|
### Parameters
|
|
@@ -140,9 +146,9 @@ This endpoint will create an unzoom variation for the provided image ID
|
|
|
140
146
|
```typescript
|
|
141
147
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
142
148
|
|
|
143
|
-
|
|
149
|
+
async function run() {
|
|
144
150
|
const sdk = new Leonardo({
|
|
145
|
-
bearerAuth: "",
|
|
151
|
+
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
146
152
|
});
|
|
147
153
|
|
|
148
154
|
const res = await sdk.variation.postVariationsUnzoom({});
|
|
@@ -150,7 +156,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
|
|
|
150
156
|
if (res.statusCode == 200) {
|
|
151
157
|
// handle response
|
|
152
158
|
}
|
|
153
|
-
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
run();
|
|
154
162
|
```
|
|
155
163
|
|
|
156
164
|
### Parameters
|