@leonardo-ai/sdk 1.7.4 → 1.10.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.
Files changed (48) hide show
  1. package/README.md +3 -6
  2. package/dist/internal/utils/queryparams.d.ts +1 -1
  3. package/dist/internal/utils/queryparams.js +11 -7
  4. package/dist/internal/utils/utils.d.ts +10 -1
  5. package/dist/internal/utils/utils.js +66 -4
  6. package/dist/sdk/dataset.d.ts +5 -5
  7. package/dist/sdk/dataset.js +40 -16
  8. package/dist/sdk/generation.d.ts +4 -4
  9. package/dist/sdk/generation.js +32 -13
  10. package/dist/sdk/initimage.d.ts +3 -3
  11. package/dist/sdk/initimage.js +24 -10
  12. package/dist/sdk/model.d.ts +3 -3
  13. package/dist/sdk/model.js +24 -10
  14. package/dist/sdk/models/operations/createdataset.d.ts +1 -1
  15. package/dist/sdk/models/operations/createdataset.js +1 -1
  16. package/dist/sdk/models/operations/deletedatasetbyid.d.ts +1 -1
  17. package/dist/sdk/models/operations/deletedatasetbyid.js +1 -1
  18. package/dist/sdk/models/operations/deletegenerationbyid.d.ts +1 -1
  19. package/dist/sdk/models/operations/deletegenerationbyid.js +1 -1
  20. package/dist/sdk/models/operations/deleteinitimagebyid.d.ts +1 -1
  21. package/dist/sdk/models/operations/deleteinitimagebyid.js +1 -1
  22. package/dist/sdk/models/operations/deletemodelbyid.d.ts +1 -1
  23. package/dist/sdk/models/operations/deletemodelbyid.js +1 -1
  24. package/dist/sdk/models/operations/getdatasetbyid.d.ts +2 -2
  25. package/dist/sdk/models/operations/getdatasetbyid.js +5 -3
  26. package/dist/sdk/models/operations/getgenerationbyid.d.ts +3 -3
  27. package/dist/sdk/models/operations/getgenerationbyid.js +12 -6
  28. package/dist/sdk/models/operations/getgenerationsbyuserid.d.ts +3 -3
  29. package/dist/sdk/models/operations/getgenerationsbyuserid.js +21 -9
  30. package/dist/sdk/models/operations/getinitimagebyid.d.ts +1 -1
  31. package/dist/sdk/models/operations/getinitimagebyid.js +1 -1
  32. package/dist/sdk/models/operations/getmodelbyid.d.ts +1 -1
  33. package/dist/sdk/models/operations/getmodelbyid.js +1 -1
  34. package/dist/sdk/models/operations/getuserself.d.ts +2 -2
  35. package/dist/sdk/models/operations/getuserself.js +2 -2
  36. package/dist/sdk/models/operations/getvariationbyid.d.ts +1 -1
  37. package/dist/sdk/models/operations/getvariationbyid.js +4 -2
  38. package/dist/sdk/models/operations/uploaddatasetimage.js +3 -1
  39. package/dist/sdk/models/operations/uploaddatasetimagefromgen.js +3 -1
  40. package/dist/sdk/models/shared/security.d.ts +1 -4
  41. package/dist/sdk/models/shared/security.js +5 -15
  42. package/dist/sdk/sdk.d.ts +3 -2
  43. package/dist/sdk/sdk.js +9 -9
  44. package/dist/sdk/user.d.ts +1 -1
  45. package/dist/sdk/user.js +8 -4
  46. package/dist/sdk/variation.d.ts +2 -2
  47. package/dist/sdk/variation.js +16 -7
  48. package/package.json +1 -1
package/dist/sdk/sdk.d.ts CHANGED
@@ -8,8 +8,8 @@ import { Variation } from "./variation";
8
8
  import { AxiosInstance } from "axios";
9
9
  export declare const ServerList: readonly ["https://cloud.leonardo.ai/api/rest/v1"];
10
10
  export type SDKProps = {
11
- defaultClient?: AxiosInstance;
12
11
  security?: shared.Security;
12
+ defaultClient?: AxiosInstance;
13
13
  serverUrl?: string;
14
14
  };
15
15
  export declare class Leonardo {
@@ -25,5 +25,6 @@ export declare class Leonardo {
25
25
  private _language;
26
26
  private _sdkVersion;
27
27
  private _genVersion;
28
- constructor(props: SDKProps);
28
+ private _globals;
29
+ constructor(props?: SDKProps);
29
30
  }
package/dist/sdk/sdk.js CHANGED
@@ -36,19 +36,19 @@ var shared = __importStar(require("./models/shared"));
36
36
  var user_1 = require("./user");
37
37
  var variation_1 = require("./variation");
38
38
  var axios_1 = __importDefault(require("axios"));
39
- exports.ServerList = [
40
- "https://cloud.leonardo.ai/api/rest/v1",
41
- ];
42
- /* SDK Documentation: Leonardo.Ai API OpenAPI specification.*/
39
+ exports.ServerList = ["https://cloud.leonardo.ai/api/rest/v1"];
40
+ /* SDK Documentation: Leonardo.Ai API OpenAPI specification.
41
+ */
43
42
  var Leonardo = /** @class */ (function () {
44
43
  function Leonardo(props) {
45
44
  var _a, _b;
46
45
  this._language = "typescript";
47
- this._sdkVersion = "1.7.4";
48
- this._genVersion = "1.8.5";
49
- this._serverURL = (_a = props.serverUrl) !== null && _a !== void 0 ? _a : exports.ServerList[0];
50
- this._defaultClient = (_b = props.defaultClient) !== null && _b !== void 0 ? _b : axios_1.default.create({ baseURL: this._serverURL });
51
- if (props.security) {
46
+ this._sdkVersion = "1.10.0";
47
+ this._genVersion = "1.11.0";
48
+ this._serverURL = (_a = props === null || props === void 0 ? void 0 : props.serverUrl) !== null && _a !== void 0 ? _a : exports.ServerList[0];
49
+ this._defaultClient =
50
+ (_b = props === null || props === void 0 ? void 0 : props.defaultClient) !== null && _b !== void 0 ? _b : axios_1.default.create({ baseURL: this._serverURL });
51
+ if (props === null || props === void 0 ? void 0 : props.security) {
52
52
  var security = props.security;
53
53
  if (!(props.security instanceof utils.SpeakeasyBase))
54
54
  security = new shared.Security(props.security);
@@ -12,6 +12,6 @@ export declare class User {
12
12
  * getUserSelf - Get user information
13
13
  *
14
14
  * This endpoint will return your user information, including your user ID.
15
- **/
15
+ **/
16
16
  getUserSelf(config?: AxiosRequestConfig): Promise<operations.GetUserSelfResponse>;
17
17
  }
package/dist/sdk/user.js CHANGED
@@ -37,7 +37,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.User = void 0;
38
38
  var utils = __importStar(require("../internal/utils"));
39
39
  var operations = __importStar(require("./models/operations"));
40
- var class_transformer_1 = require("class-transformer");
41
40
  var User = /** @class */ (function () {
42
41
  function User(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
43
42
  this._defaultClient = defaultClient;
@@ -51,7 +50,7 @@ var User = /** @class */ (function () {
51
50
  * getUserSelf - Get user information
52
51
  *
53
52
  * This endpoint will return your user information, including your user ID.
54
- **/
53
+ **/
55
54
  User.prototype.getUserSelf = function (config) {
56
55
  var baseURL = this._serverURL;
57
56
  var url = baseURL.replace(/\/$/, "") + "/me";
@@ -62,11 +61,16 @@ var User = /** @class */ (function () {
62
61
  var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
63
62
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
64
63
  throw new Error("status code not found in response: ".concat(httpRes));
65
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
64
+ var res = new operations.GetUserSelfResponse({
65
+ statusCode: httpRes.status,
66
+ contentType: contentType,
67
+ rawResponse: httpRes,
68
+ });
66
69
  switch (true) {
67
70
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
68
71
  if (utils.matchContentType(contentType, "application/json")) {
69
- res.getUserSelf200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.GetUserSelf200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
72
+ res.getUserSelf200ApplicationJSONObject =
73
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetUserSelf200ApplicationJSON);
70
74
  }
71
75
  break;
72
76
  }
@@ -12,12 +12,12 @@ export declare class Variation {
12
12
  * createVariationUpscale - Create upscale
13
13
  *
14
14
  * This endpoint will create an upscale for the provided image ID
15
- **/
15
+ **/
16
16
  createVariationUpscale(req: operations.CreateVariationUpscaleRequest, config?: AxiosRequestConfig): Promise<operations.CreateVariationUpscaleResponse>;
17
17
  /**
18
18
  * getVariationById - Get variation by ID
19
19
  *
20
20
  * This endpoint will get the variation by ID
21
- **/
21
+ **/
22
22
  getVariationById(req: operations.GetVariationByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetVariationByIdResponse>;
23
23
  }
@@ -37,7 +37,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.Variation = void 0;
38
38
  var utils = __importStar(require("../internal/utils"));
39
39
  var operations = __importStar(require("./models/operations"));
40
- var class_transformer_1 = require("class-transformer");
41
40
  var Variation = /** @class */ (function () {
42
41
  function Variation(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
43
42
  this._defaultClient = defaultClient;
@@ -51,7 +50,7 @@ var Variation = /** @class */ (function () {
51
50
  * createVariationUpscale - Create upscale
52
51
  *
53
52
  * This endpoint will create an upscale for the provided image ID
54
- **/
53
+ **/
55
54
  Variation.prototype.createVariationUpscale = function (req, config) {
56
55
  var _a;
57
56
  if (!(req instanceof utils.SpeakeasyBase)) {
@@ -76,11 +75,16 @@ var Variation = /** @class */ (function () {
76
75
  var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
77
76
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
78
77
  throw new Error("status code not found in response: ".concat(httpRes));
79
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
78
+ var res = new operations.CreateVariationUpscaleResponse({
79
+ statusCode: httpRes.status,
80
+ contentType: contentType,
81
+ rawResponse: httpRes,
82
+ });
80
83
  switch (true) {
81
84
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
82
85
  if (utils.matchContentType(contentType, "application/json")) {
83
- res.createVariationUpscale200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.CreateVariationUpscale200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
86
+ res.createVariationUpscale200ApplicationJSONObject =
87
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateVariationUpscale200ApplicationJSON);
84
88
  }
85
89
  break;
86
90
  }
@@ -91,7 +95,7 @@ var Variation = /** @class */ (function () {
91
95
  * getVariationById - Get variation by ID
92
96
  *
93
97
  * This endpoint will get the variation by ID
94
- **/
98
+ **/
95
99
  Variation.prototype.getVariationById = function (req, config) {
96
100
  if (!(req instanceof utils.SpeakeasyBase)) {
97
101
  req = new operations.GetVariationByIdRequest(req);
@@ -105,11 +109,16 @@ var Variation = /** @class */ (function () {
105
109
  var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
106
110
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
107
111
  throw new Error("status code not found in response: ".concat(httpRes));
108
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
112
+ var res = new operations.GetVariationByIdResponse({
113
+ statusCode: httpRes.status,
114
+ contentType: contentType,
115
+ rawResponse: httpRes,
116
+ });
109
117
  switch (true) {
110
118
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
111
119
  if (utils.matchContentType(contentType, "application/json")) {
112
- res.getVariationById200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.GetVariationById200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
120
+ res.getVariationById200ApplicationJSONObject =
121
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetVariationById200ApplicationJSON);
113
122
  }
114
123
  break;
115
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leonardo-ai/sdk",
3
- "version": "1.7.4",
3
+ "version": "1.10.0",
4
4
  "author": "leonardoai",
5
5
  "scripts": {
6
6
  "prepare": "tsc --build"