@leonardo-ai/sdk 1.58.3 → 1.61.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 CHANGED
@@ -5,6 +5,7 @@
5
5
  <a href="https://github.com/Leonardo-Interactive/leonardo-ts-sdk/actions"><img src="https://img.shields.io/github/actions/workflow/status/Leonardo-Interactive/leonardo-ts-sdk/speakeasy_sdk_generate.yml?style=for-the-badge" /></a>
6
6
  <a href="https://docs.leonardo.ai/"><img src="https://img.shields.io/static/v1?label=Docs&message=API Ref&color=000&style=for-the-badge" /></a>
7
7
  <a href="https://discord.gg/leonardo-ai"><img src="https://img.shields.io/static/v1?label=Discord&message=Join&color=7289da&style=for-the-badge" /></a>
8
+ <a href="https://codespaces.new/Leonardo-Interactive/leonardo-ts-sdk.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
8
9
  </div>
9
10
 
10
11
  <!-- Start SDK Installation -->
@@ -31,22 +32,20 @@ To get access to the API and fetch an API key, please sign up for [access](https
31
32
  <!-- Start SDK Example Usage -->
32
33
  ```typescript
33
34
  import { Leonardo } from "@leonardo-ai/sdk";
34
- import { CreateDatasetResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
35
35
 
36
- const sdk = new Leonardo({
37
- security: {
36
+ (async() => {
37
+ const sdk = new Leonardo({
38
38
  bearerAuth: "",
39
- },
40
- });
39
+ });
40
+
41
+ const res = await sdk.dataset.createDataset({
42
+ name: "Forward South uselessly",
43
+ });
41
44
 
42
- sdk.dataset.createDataset({
43
- description: "Synchronised multi-tasking projection",
44
- name: "Quetzal South",
45
- }).then((res: CreateDatasetResponse) => {
46
45
  if (res.statusCode == 200) {
47
46
  // handle response
48
47
  }
49
- });
48
+ })();
50
49
  ```
51
50
  <!-- End SDK Example Usage -->
52
51
 
@@ -100,7 +99,15 @@ sdk.dataset.createDataset({
100
99
 
101
100
 
102
101
  <!-- Start Dev Containers -->
102
+ # Dev Containers
103
+ <div align="left">
104
+ <a href="https://codespaces.new/Leonardo-Interactive/leonardo-ts-sdk.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
105
+
106
+ </div>
107
+
108
+ Experience our SDK in an enhanced sandbox environment. Try it now in **GitHub Codespaces**!
103
109
 
110
+ * [Explore Dev Containers](.devcontainer/README.md)
104
111
  <!-- End Dev Containers -->
105
112
 
106
113
 
package/dist/sdk/sdk.d.ts CHANGED
@@ -15,10 +15,7 @@ export declare const ServerList: readonly ["https://cloud.leonardo.ai/api/rest/v
15
15
  * The available configuration options for the SDK
16
16
  */
17
17
  export type SDKProps = {
18
- /**
19
- * The security details required to authenticate the SDK
20
- */
21
- security?: shared.Security | (() => Promise<shared.Security>);
18
+ bearerAuth?: string;
22
19
  /**
23
20
  * Allows overriding the default axios client used by the SDK
24
21
  */
package/dist/sdk/sdk.js CHANGED
@@ -2,6 +2,29 @@
2
2
  /*
3
3
  * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
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
+ };
5
28
  var __importDefault = (this && this.__importDefault) || function (mod) {
6
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
7
30
  };
@@ -11,6 +34,7 @@ var dataset_1 = require("./dataset");
11
34
  var generation_1 = require("./generation");
12
35
  var initimage_1 = require("./initimage");
13
36
  var model_1 = require("./model");
37
+ var shared = __importStar(require("./models/shared"));
14
38
  var user_1 = require("./user");
15
39
  var variation_1 = require("./variation");
16
40
  var axios_1 = __importDefault(require("axios"));
@@ -27,9 +51,9 @@ var SDKConfiguration = /** @class */ (function () {
27
51
  function SDKConfiguration(init) {
28
52
  this.language = "typescript";
29
53
  this.openapiDocVersion = "v1.0.0";
30
- this.sdkVersion = "1.58.3";
31
- this.genVersion = "2.146.3";
32
- this.userAgent = "speakeasy-sdk/typescript 1.58.3 2.146.3 v1.0.0 @leonardo-ai/sdk";
54
+ this.sdkVersion = "1.61.0";
55
+ this.genVersion = "2.150.1";
56
+ this.userAgent = "speakeasy-sdk/typescript 1.61.0 2.150.1 v1.0.0 @leonardo-ai/sdk";
33
57
  Object.assign(this, init);
34
58
  }
35
59
  return SDKConfiguration;
@@ -49,7 +73,7 @@ var Leonardo = /** @class */ (function () {
49
73
  var defaultClient = (_b = props === null || props === void 0 ? void 0 : props.defaultClient) !== null && _b !== void 0 ? _b : axios_1.default.create({ baseURL: serverURL });
50
74
  this.sdkConfiguration = new SDKConfiguration({
51
75
  defaultClient: defaultClient,
52
- security: props === null || props === void 0 ? void 0 : props.security,
76
+ security: new shared.Security({ bearerAuth: props === null || props === void 0 ? void 0 : props.bearerAuth }),
53
77
  serverURL: serverURL,
54
78
  retryConfig: props === null || props === void 0 ? void 0 : props.retryConfig,
55
79
  });
@@ -17,22 +17,22 @@ This endpoint creates a new dataset
17
17
 
18
18
  ```typescript
19
19
  import { Leonardo } from "@leonardo-ai/sdk";
20
- import { CreateDatasetResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
21
-
22
- const sdk = new Leonardo({
23
- security: {
24
- bearerAuth: "",
25
- },
26
- });
27
-
28
- sdk.dataset.createDataset({
29
- description: "Synchronised multi-tasking projection",
30
- name: "Quetzal South",
31
- }).then((res: CreateDatasetResponse) => {
20
+
21
+ (async() => {
22
+ const sdk = new Leonardo({
23
+ security: {
24
+ bearerAuth: "",
25
+ },
26
+ });
27
+
28
+ const res = await sdk.dataset.createDataset({
29
+ name: "Forward South uselessly",
30
+ });
31
+
32
32
  if (res.statusCode == 200) {
33
33
  // handle response
34
34
  }
35
- });
35
+ })();
36
36
  ```
37
37
 
38
38
  ### Parameters
@@ -56,20 +56,22 @@ This endpoint deletes the specific dataset
56
56
 
57
57
  ```typescript
58
58
  import { Leonardo } from "@leonardo-ai/sdk";
59
- import { DeleteDatasetByIdRequest, DeleteDatasetByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
60
-
61
- const sdk = new Leonardo({
62
- security: {
63
- bearerAuth: "",
64
- },
65
- });
59
+ import { DeleteDatasetByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
60
+
61
+ (async() => {
62
+ const sdk = new Leonardo({
63
+ security: {
64
+ bearerAuth: "",
65
+ },
66
+ });
66
67
  const id: string = "Lucia";
67
68
 
68
- sdk.dataset.deleteDatasetById(id).then((res: DeleteDatasetByIdResponse) => {
69
+ const res = await sdk.dataset.deleteDatasetById(id);
70
+
69
71
  if (res.statusCode == 200) {
70
72
  // handle response
71
73
  }
72
- });
74
+ })();
73
75
  ```
74
76
 
75
77
  ### Parameters
@@ -93,20 +95,22 @@ This endpoint gets the specific dataset
93
95
 
94
96
  ```typescript
95
97
  import { Leonardo } from "@leonardo-ai/sdk";
96
- import { GetDatasetByIdRequest, GetDatasetByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
97
-
98
- const sdk = new Leonardo({
99
- security: {
100
- bearerAuth: "",
101
- },
102
- });
98
+ import { GetDatasetByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
99
+
100
+ (async() => {
101
+ const sdk = new Leonardo({
102
+ security: {
103
+ bearerAuth: "",
104
+ },
105
+ });
103
106
  const id: string = "red";
104
107
 
105
- sdk.dataset.getDatasetById(id).then((res: GetDatasetByIdResponse) => {
108
+ const res = await sdk.dataset.getDatasetById(id);
109
+
106
110
  if (res.statusCode == 200) {
107
111
  // handle response
108
112
  }
109
- });
113
+ })();
110
114
  ```
111
115
 
112
116
  ### Parameters
@@ -130,27 +134,25 @@ This endpoint returns presigned details to upload a dataset image to S3
130
134
 
131
135
  ```typescript
132
136
  import { Leonardo } from "@leonardo-ai/sdk";
133
- import {
134
- UploadDatasetImageRequest,
135
- UploadDatasetImageRequestBody,
136
- UploadDatasetImageResponse,
137
- } from "@leonardo-ai/sdk/dist/sdk/models/operations";
138
-
139
- const sdk = new Leonardo({
140
- security: {
141
- bearerAuth: "",
142
- },
143
- });
137
+ import { UploadDatasetImageRequest, UploadDatasetImageRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
138
+
139
+ (async() => {
140
+ const sdk = new Leonardo({
141
+ security: {
142
+ bearerAuth: "",
143
+ },
144
+ });
144
145
  const requestBody: UploadDatasetImageRequestBody = {
145
146
  extension: "mpg4",
146
147
  };
147
148
  const datasetId: string = "deposit";
148
149
 
149
- sdk.dataset.uploadDatasetImage(requestBody, datasetId).then((res: UploadDatasetImageResponse) => {
150
+ const res = await sdk.dataset.uploadDatasetImage(requestBody, datasetId);
151
+
150
152
  if (res.statusCode == 200) {
151
153
  // handle response
152
154
  }
153
- });
155
+ })();
154
156
  ```
155
157
 
156
158
  ### Parameters
@@ -175,27 +177,25 @@ This endpoint will upload a previously generated image to the dataset
175
177
 
176
178
  ```typescript
177
179
  import { Leonardo } from "@leonardo-ai/sdk";
178
- import {
179
- UploadDatasetImageFromGenRequest,
180
- UploadDatasetImageFromGenRequestBody,
181
- UploadDatasetImageFromGenResponse,
182
- } from "@leonardo-ai/sdk/dist/sdk/models/operations";
183
-
184
- const sdk = new Leonardo({
185
- security: {
186
- bearerAuth: "",
187
- },
188
- });
180
+ import { UploadDatasetImageFromGenRequest, UploadDatasetImageFromGenRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
181
+
182
+ (async() => {
183
+ const sdk = new Leonardo({
184
+ security: {
185
+ bearerAuth: "",
186
+ },
187
+ });
189
188
  const requestBody: UploadDatasetImageFromGenRequestBody = {
190
189
  generatedImageId: "navigate programming evolve",
191
190
  };
192
191
  const datasetId: string = "finally";
193
192
 
194
- sdk.dataset.uploadDatasetImageFromGen(requestBody, datasetId).then((res: UploadDatasetImageFromGenResponse) => {
193
+ const res = await sdk.dataset.uploadDatasetImageFromGen(requestBody, datasetId);
194
+
195
195
  if (res.statusCode == 200) {
196
196
  // handle response
197
197
  }
198
- });
198
+ })();
199
199
  ```
200
200
 
201
201
  ### Parameters
@@ -18,57 +18,25 @@ This endpoint will generate images
18
18
 
19
19
  ```typescript
20
20
  import { Leonardo } from "@leonardo-ai/sdk";
21
- import { CreateGenerationResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
22
21
  import { ControlnetType, SdGenerationSchedulers, SdGenerationStyle, SdVersions } from "@leonardo-ai/sdk/dist/sdk/models/shared";
23
22
 
24
- const sdk = new Leonardo({
25
- security: {
26
- bearerAuth: "",
27
- },
28
- });
29
-
30
- sdk.generation.createGeneration({
31
- alchemy: false,
32
- contrastRatio: 4444.14,
33
- controlNet: false,
34
- controlNetType: ControlnetType.Canny,
35
- expandedDomain: false,
36
- guidanceScale: 784343,
37
- height: 244808,
38
- highContrast: false,
39
- highResolution: false,
40
- imagePromptWeight: 2793,
41
- imagePrompts: [
42
- "Product",
43
- ],
44
- initGenerationImageId: "actuating DNS",
45
- initImageId: "salmon wireless rarely",
46
- initStrength: 1502.38,
47
- modelId: "emulation Country",
48
- negativePrompt: "Kentucky MTF",
49
- nsfw: false,
50
- numImages: 649224,
51
- numInferenceSteps: 895539,
52
- photoReal: false,
53
- presetStyle: SdGenerationStyle.Leonardo,
54
- prompt: "aggregate",
55
- promptMagic: false,
56
- promptMagicVersion: "visionary which",
57
- public: false,
58
- scheduler: SdGenerationSchedulers.Ddim,
59
- sdVersion: SdVersions.V2,
60
- seed: 262328,
61
- tiling: false,
62
- unzoom: false,
63
- unzoomAmount: 371.25,
64
- upscaleRatio: 485.82,
65
- weighting: 9968.92,
66
- width: 152007,
67
- }).then((res: CreateGenerationResponse) => {
23
+ (async() => {
24
+ const sdk = new Leonardo({
25
+ security: {
26
+ bearerAuth: "",
27
+ },
28
+ });
29
+
30
+ const res = await sdk.generation.createGeneration({
31
+ imagePrompts: [
32
+ "payment",
33
+ ],
34
+ });
35
+
68
36
  if (res.statusCode == 200) {
69
37
  // handle response
70
38
  }
71
- });
39
+ })();
72
40
  ```
73
41
 
74
42
  ### Parameters
@@ -92,20 +60,22 @@ This endpoint deletes a specific generation
92
60
 
93
61
  ```typescript
94
62
  import { Leonardo } from "@leonardo-ai/sdk";
95
- import { DeleteGenerationByIdRequest, DeleteGenerationByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
96
-
97
- const sdk = new Leonardo({
98
- security: {
99
- bearerAuth: "",
100
- },
101
- });
63
+ import { DeleteGenerationByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
64
+
65
+ (async() => {
66
+ const sdk = new Leonardo({
67
+ security: {
68
+ bearerAuth: "",
69
+ },
70
+ });
102
71
  const id: string = "Sports";
103
72
 
104
- sdk.generation.deleteGenerationById(id).then((res: DeleteGenerationByIdResponse) => {
73
+ const res = await sdk.generation.deleteGenerationById(id);
74
+
105
75
  if (res.statusCode == 200) {
106
76
  // handle response
107
77
  }
108
- });
78
+ })();
109
79
  ```
110
80
 
111
81
  ### Parameters
@@ -129,27 +99,23 @@ This endpoint deletes the specific texture generation.
129
99
 
130
100
  ```typescript
131
101
  import { Leonardo } from "@leonardo-ai/sdk";
132
- import {
133
- DeleteGenerationsTextureIdRequest,
134
- DeleteGenerationsTextureIdRequestBody,
135
- DeleteGenerationsTextureIdResponse,
136
- } from "@leonardo-ai/sdk/dist/sdk/models/operations";
137
-
138
- const sdk = new Leonardo({
139
- security: {
140
- bearerAuth: "",
141
- },
142
- });
102
+ import { DeleteGenerationsTextureIdRequest, DeleteGenerationsTextureIdRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
103
+
104
+ (async() => {
105
+ const sdk = new Leonardo({
106
+ security: {
107
+ bearerAuth: "",
108
+ },
109
+ });
143
110
  const id: string = "Lodge";
144
- const requestBody: DeleteGenerationsTextureIdRequestBody = {
145
- id: "<ID>",
146
- };
111
+ const requestBody: DeleteGenerationsTextureIdRequestBody = {};
112
+
113
+ const res = await sdk.generation.deleteGenerationsTextureId(id, requestBody);
147
114
 
148
- sdk.generation.deleteGenerationsTextureId(id, requestBody).then((res: DeleteGenerationsTextureIdResponse) => {
149
115
  if (res.statusCode == 200) {
150
116
  // handle response
151
117
  }
152
- });
118
+ })();
153
119
  ```
154
120
 
155
121
  ### Parameters
@@ -174,20 +140,22 @@ This endpoint will provide information about a specific generation
174
140
 
175
141
  ```typescript
176
142
  import { Leonardo } from "@leonardo-ai/sdk";
177
- import { GetGenerationByIdRequest, GetGenerationByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
178
-
179
- const sdk = new Leonardo({
180
- security: {
181
- bearerAuth: "",
182
- },
183
- });
143
+ import { GetGenerationByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
144
+
145
+ (async() => {
146
+ const sdk = new Leonardo({
147
+ security: {
148
+ bearerAuth: "",
149
+ },
150
+ });
184
151
  const id: string = "male";
185
152
 
186
- sdk.generation.getGenerationById(id).then((res: GetGenerationByIdResponse) => {
153
+ const res = await sdk.generation.getGenerationById(id);
154
+
187
155
  if (res.statusCode == 200) {
188
156
  // handle response
189
157
  }
190
- });
158
+ })();
191
159
  ```
192
160
 
193
161
  ### Parameters
@@ -211,22 +179,24 @@ This endpoint returns all generations by a specific user
211
179
 
212
180
  ```typescript
213
181
  import { Leonardo } from "@leonardo-ai/sdk";
214
- import { GetGenerationsByUserIdRequest, GetGenerationsByUserIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
215
-
216
- const sdk = new Leonardo({
217
- security: {
218
- bearerAuth: "",
219
- },
220
- });
182
+ import { GetGenerationsByUserIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
183
+
184
+ (async() => {
185
+ const sdk = new Leonardo({
186
+ security: {
187
+ bearerAuth: "",
188
+ },
189
+ });
221
190
  const userId: string = "Oriental";
222
191
  const limit: number = 135536;
223
192
  const offset: number = 934375;
224
193
 
225
- sdk.generation.getGenerationsByUserId(userId, limit, offset).then((res: GetGenerationsByUserIdResponse) => {
194
+ const res = await sdk.generation.getGenerationsByUserId(userId, limit, offset);
195
+
226
196
  if (res.statusCode == 200) {
227
197
  // handle response
228
198
  }
229
- });
199
+ })();
230
200
  ```
231
201
 
232
202
  ### Parameters
@@ -252,28 +222,20 @@ This endpoint will generate a texture generation.
252
222
 
253
223
  ```typescript
254
224
  import { Leonardo } from "@leonardo-ai/sdk";
255
- import { PostGenerationsTextureResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
256
-
257
- const sdk = new Leonardo({
258
- security: {
259
- bearerAuth: "",
260
- },
261
- });
262
-
263
- sdk.generation.postGenerationsTexture({
264
- frontRotationOffset: 854632,
265
- modelAssetId: "West",
266
- negativePrompt: "quantifying pink ah",
267
- preview: false,
268
- previewDirection: "Auto",
269
- prompt: "Coupe North Steel",
270
- sdVersion: "Market parsing inasmuch",
271
- seed: 895868,
272
- }).then((res: PostGenerationsTextureResponse) => {
225
+
226
+ (async() => {
227
+ const sdk = new Leonardo({
228
+ security: {
229
+ bearerAuth: "",
230
+ },
231
+ });
232
+
233
+ const res = await sdk.generation.postGenerationsTexture({});
234
+
273
235
  if (res.statusCode == 200) {
274
236
  // handle response
275
237
  }
276
- });
238
+ })();
277
239
  ```
278
240
 
279
241
  ### Parameters
@@ -15,20 +15,22 @@ This endpoint deletes an init image
15
15
 
16
16
  ```typescript
17
17
  import { Leonardo } from "@leonardo-ai/sdk";
18
- import { DeleteInitImageByIdRequest, DeleteInitImageByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
19
-
20
- const sdk = new Leonardo({
21
- security: {
22
- bearerAuth: "",
23
- },
24
- });
18
+ import { DeleteInitImageByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
19
+
20
+ (async() => {
21
+ const sdk = new Leonardo({
22
+ security: {
23
+ bearerAuth: "",
24
+ },
25
+ });
25
26
  const id: string = "Woman";
26
27
 
27
- sdk.initImage.deleteInitImageById(id).then((res: DeleteInitImageByIdResponse) => {
28
+ const res = await sdk.initImage.deleteInitImageById(id);
29
+
28
30
  if (res.statusCode == 200) {
29
31
  // handle response
30
32
  }
31
- });
33
+ })();
32
34
  ```
33
35
 
34
36
  ### Parameters
@@ -52,20 +54,22 @@ This endpoint will return a single init image
52
54
 
53
55
  ```typescript
54
56
  import { Leonardo } from "@leonardo-ai/sdk";
55
- import { GetInitImageByIdRequest, GetInitImageByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
56
-
57
- const sdk = new Leonardo({
58
- security: {
59
- bearerAuth: "",
60
- },
61
- });
57
+ import { GetInitImageByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
58
+
59
+ (async() => {
60
+ const sdk = new Leonardo({
61
+ security: {
62
+ bearerAuth: "",
63
+ },
64
+ });
62
65
  const id: string = "Namibia";
63
66
 
64
- sdk.initImage.getInitImageById(id).then((res: GetInitImageByIdResponse) => {
67
+ const res = await sdk.initImage.getInitImageById(id);
68
+
65
69
  if (res.statusCode == 200) {
66
70
  // handle response
67
71
  }
68
- });
72
+ })();
69
73
  ```
70
74
 
71
75
  ### Parameters
@@ -89,21 +93,22 @@ This endpoint returns presigned details to upload an init image to S3
89
93
 
90
94
  ```typescript
91
95
  import { Leonardo } from "@leonardo-ai/sdk";
92
- import { UploadInitImageResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
93
96
 
94
- const sdk = new Leonardo({
95
- security: {
96
- bearerAuth: "",
97
- },
98
- });
97
+ (async() => {
98
+ const sdk = new Leonardo({
99
+ security: {
100
+ bearerAuth: "",
101
+ },
102
+ });
103
+
104
+ const res = await sdk.initImage.uploadInitImage({
105
+ extension: "png",
106
+ });
99
107
 
100
- sdk.initImage.uploadInitImage({
101
- extension: "png",
102
- }).then((res: UploadInitImageResponse) => {
103
108
  if (res.statusCode == 200) {
104
109
  // handle response
105
110
  }
106
- });
111
+ })();
107
112
  ```
108
113
 
109
114
  ### Parameters
@@ -18,30 +18,25 @@ This endpoint will train a new custom model
18
18
 
19
19
  ```typescript
20
20
  import { Leonardo } from "@leonardo-ai/sdk";
21
- import { CreateModelResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
22
21
  import { CustomModelType, SdVersions, Strength } from "@leonardo-ai/sdk/dist/sdk/models/shared";
23
22
 
24
- const sdk = new Leonardo({
25
- security: {
26
- bearerAuth: "",
27
- },
28
- });
29
-
30
- sdk.model.createModel({
31
- datasetId: "24/7",
32
- description: "Proactive transitional function",
33
- instancePrompt: "Des",
34
- modelType: CustomModelType.PixelArt,
35
- name: "Officer female",
36
- nsfw: false,
37
- resolution: 451662,
38
- sdVersion: SdVersions.V2,
39
- strength: Strength.High,
40
- }).then((res: CreateModelResponse) => {
23
+ (async() => {
24
+ const sdk = new Leonardo({
25
+ security: {
26
+ bearerAuth: "",
27
+ },
28
+ });
29
+
30
+ const res = await sdk.model.createModel({
31
+ datasetId: "24/7",
32
+ instancePrompt: "instead Anchorage",
33
+ name: "Ohio",
34
+ });
35
+
41
36
  if (res.statusCode == 200) {
42
37
  // handle response
43
38
  }
44
- });
39
+ })();
45
40
  ```
46
41
 
47
42
  ### Parameters
@@ -65,20 +60,22 @@ This endpoint will delete a specific custom model
65
60
 
66
61
  ```typescript
67
62
  import { Leonardo } from "@leonardo-ai/sdk";
68
- import { DeleteModelByIdRequest, DeleteModelByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
69
-
70
- const sdk = new Leonardo({
71
- security: {
72
- bearerAuth: "",
73
- },
74
- });
63
+ import { DeleteModelByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
64
+
65
+ (async() => {
66
+ const sdk = new Leonardo({
67
+ security: {
68
+ bearerAuth: "",
69
+ },
70
+ });
75
71
  const id: string = "Mills";
76
72
 
77
- sdk.model.deleteModelById(id).then((res: DeleteModelByIdResponse) => {
73
+ const res = await sdk.model.deleteModelById(id);
74
+
78
75
  if (res.statusCode == 200) {
79
76
  // handle response
80
77
  }
81
- });
78
+ })();
82
79
  ```
83
80
 
84
81
  ### Parameters
@@ -102,23 +99,23 @@ This endpoint deletes the specific 3D Model
102
99
 
103
100
  ```typescript
104
101
  import { Leonardo } from "@leonardo-ai/sdk";
105
- import { DeleteModels3dIdRequest, DeleteModels3dIdRequestBody, DeleteModels3dIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
106
-
107
- const sdk = new Leonardo({
108
- security: {
109
- bearerAuth: "",
110
- },
111
- });
102
+ import { DeleteModels3dIdRequest, DeleteModels3dIdRequestBody } from "@leonardo-ai/sdk/dist/sdk/models/operations";
103
+
104
+ (async() => {
105
+ const sdk = new Leonardo({
106
+ security: {
107
+ bearerAuth: "",
108
+ },
109
+ });
112
110
  const id: string = "Electronics";
113
- const requestBody: DeleteModels3dIdRequestBody = {
114
- id: "<ID>",
115
- };
111
+ const requestBody: DeleteModels3dIdRequestBody = {};
112
+
113
+ const res = await sdk.model.deleteModels3dId(id, requestBody);
116
114
 
117
- sdk.model.deleteModels3dId(id, requestBody).then((res: DeleteModels3dIdResponse) => {
118
115
  if (res.statusCode == 200) {
119
116
  // handle response
120
117
  }
121
- });
118
+ })();
122
119
  ```
123
120
 
124
121
  ### Parameters
@@ -143,20 +140,22 @@ This endpoint gets the specific custom model
143
140
 
144
141
  ```typescript
145
142
  import { Leonardo } from "@leonardo-ai/sdk";
146
- import { GetModelByIdRequest, GetModelByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
147
-
148
- const sdk = new Leonardo({
149
- security: {
150
- bearerAuth: "",
151
- },
152
- });
143
+ import { GetModelByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
144
+
145
+ (async() => {
146
+ const sdk = new Leonardo({
147
+ security: {
148
+ bearerAuth: "",
149
+ },
150
+ });
153
151
  const id: string = "protocol";
154
152
 
155
- sdk.model.getModelById(id).then((res: GetModelByIdResponse) => {
153
+ const res = await sdk.model.getModelById(id);
154
+
156
155
  if (res.statusCode == 200) {
157
156
  // handle response
158
157
  }
159
- });
158
+ })();
160
159
  ```
161
160
 
162
161
  ### Parameters
@@ -180,21 +179,23 @@ Get a list of public Platform Models available for use with generations.
180
179
 
181
180
  ```typescript
182
181
  import { Leonardo } from "@leonardo-ai/sdk";
183
- import { GetPlatformModelsRequest, GetPlatformModelsResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
184
-
185
- const sdk = new Leonardo({
186
- security: {
187
- bearerAuth: "",
188
- },
189
- });
182
+ import { GetPlatformModelsRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
183
+
184
+ (async() => {
185
+ const sdk = new Leonardo({
186
+ security: {
187
+ bearerAuth: "",
188
+ },
189
+ });
190
190
  const limit: number = 419487;
191
191
  const offset: number = 472174;
192
192
 
193
- sdk.model.getPlatformModels(limit, offset).then((res: GetPlatformModelsResponse) => {
193
+ const res = await sdk.model.getPlatformModels(limit, offset);
194
+
194
195
  if (res.statusCode == 200) {
195
196
  // handle response
196
197
  }
197
- });
198
+ })();
198
199
  ```
199
200
 
200
201
  ### Parameters
@@ -219,22 +220,20 @@ This endpoint returns presigned details to upload a 3D model to S3
219
220
 
220
221
  ```typescript
221
222
  import { Leonardo } from "@leonardo-ai/sdk";
222
- import { PostModels3dUploadResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
223
-
224
- const sdk = new Leonardo({
225
- security: {
226
- bearerAuth: "",
227
- },
228
- });
229
-
230
- sdk.model.postModels3dUpload({
231
- modelExtension: "Bromine",
232
- name: "Electric Berkshire",
233
- }).then((res: PostModels3dUploadResponse) => {
223
+
224
+ (async() => {
225
+ const sdk = new Leonardo({
226
+ security: {
227
+ bearerAuth: "",
228
+ },
229
+ });
230
+
231
+ const res = await sdk.model.postModels3dUpload({});
232
+
234
233
  if (res.statusCode == 200) {
235
234
  // handle response
236
235
  }
237
- });
236
+ })();
238
237
  ```
239
238
 
240
239
  ### Parameters
@@ -13,19 +13,20 @@ This endpoint will return your user such as your user id, username, token renewa
13
13
 
14
14
  ```typescript
15
15
  import { Leonardo } from "@leonardo-ai/sdk";
16
- import { GetUserSelfResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
17
16
 
18
- const sdk = new Leonardo({
19
- security: {
20
- bearerAuth: "",
21
- },
22
- });
17
+ (async() => {
18
+ const sdk = new Leonardo({
19
+ security: {
20
+ bearerAuth: "",
21
+ },
22
+ });
23
+
24
+ const res = await sdk.user.getUserSelf();
23
25
 
24
- sdk.user.getUserSelf().then((res: GetUserSelfResponse) => {
25
26
  if (res.statusCode == 200) {
26
27
  // handle response
27
28
  }
28
- });
29
+ })();
29
30
  ```
30
31
 
31
32
  ### Parameters
@@ -15,21 +15,22 @@ This endpoint will create an upscale for the provided image ID
15
15
 
16
16
  ```typescript
17
17
  import { Leonardo } from "@leonardo-ai/sdk";
18
- import { CreateVariationUpscaleResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
19
18
 
20
- const sdk = new Leonardo({
21
- security: {
22
- bearerAuth: "",
23
- },
24
- });
19
+ (async() => {
20
+ const sdk = new Leonardo({
21
+ security: {
22
+ bearerAuth: "",
23
+ },
24
+ });
25
+
26
+ const res = await sdk.variation.createVariationUpscale({
27
+ id: "<ID>",
28
+ });
25
29
 
26
- sdk.variation.createVariationUpscale({
27
- id: "<ID>",
28
- }).then((res: CreateVariationUpscaleResponse) => {
29
30
  if (res.statusCode == 200) {
30
31
  // handle response
31
32
  }
32
- });
33
+ })();
33
34
  ```
34
35
 
35
36
  ### Parameters
@@ -53,20 +54,22 @@ This endpoint will get the variation by ID
53
54
 
54
55
  ```typescript
55
56
  import { Leonardo } from "@leonardo-ai/sdk";
56
- import { GetVariationByIdRequest, GetVariationByIdResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
57
-
58
- const sdk = new Leonardo({
59
- security: {
60
- bearerAuth: "",
61
- },
62
- });
57
+ import { GetVariationByIdRequest } from "@leonardo-ai/sdk/dist/sdk/models/operations";
58
+
59
+ (async() => {
60
+ const sdk = new Leonardo({
61
+ security: {
62
+ bearerAuth: "",
63
+ },
64
+ });
63
65
  const id: string = "walker";
64
66
 
65
- sdk.variation.getVariationById(id).then((res: GetVariationByIdResponse) => {
67
+ const res = await sdk.variation.getVariationById(id);
68
+
66
69
  if (res.statusCode == 200) {
67
70
  // handle response
68
71
  }
69
- });
72
+ })();
70
73
  ```
71
74
 
72
75
  ### Parameters
@@ -90,22 +93,20 @@ This endpoint will create an unzoom variation for the provided image ID
90
93
 
91
94
  ```typescript
92
95
  import { Leonardo } from "@leonardo-ai/sdk";
93
- import { PostVariationsUnzoomResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
94
-
95
- const sdk = new Leonardo({
96
- security: {
97
- bearerAuth: "",
98
- },
99
- });
100
-
101
- sdk.variation.postVariationsUnzoom({
102
- id: "<ID>",
103
- isVariation: false,
104
- }).then((res: PostVariationsUnzoomResponse) => {
96
+
97
+ (async() => {
98
+ const sdk = new Leonardo({
99
+ security: {
100
+ bearerAuth: "",
101
+ },
102
+ });
103
+
104
+ const res = await sdk.variation.postVariationsUnzoom({});
105
+
105
106
  if (res.statusCode == 200) {
106
107
  // handle response
107
108
  }
108
- });
109
+ })();
109
110
  ```
110
111
 
111
112
  ### Parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leonardo-ai/sdk",
3
- "version": "1.58.3",
3
+ "version": "1.61.0",
4
4
  "author": "leonardoai",
5
5
  "scripts": {
6
6
  "prepare": "tsc --build"