@leonardo-ai/sdk 1.50.0 → 1.51.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.
@@ -91,6 +91,7 @@ var __read = (this && this.__read) || function (o, n) {
91
91
  Object.defineProperty(exports, "__esModule", { value: true });
92
92
  exports.Dataset = void 0;
93
93
  var utils = __importStar(require("../internal/utils"));
94
+ var errors = __importStar(require("./models/errors"));
94
95
  var operations = __importStar(require("./models/operations"));
95
96
  var Dataset = /** @class */ (function () {
96
97
  function Dataset(sdkConfig) {
@@ -148,6 +149,9 @@ var Dataset = /** @class */ (function () {
148
149
  if (utils.matchContentType(contentType, "application/json")) {
149
150
  res.createDataset200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.CreateDataset200ApplicationJSON);
150
151
  }
152
+ else {
153
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
154
+ }
151
155
  break;
152
156
  }
153
157
  return [2 /*return*/, res];
@@ -195,6 +199,9 @@ var Dataset = /** @class */ (function () {
195
199
  if (utils.matchContentType(contentType, "application/json")) {
196
200
  res.deleteDatasetById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.DeleteDatasetById200ApplicationJSON);
197
201
  }
202
+ else {
203
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
204
+ }
198
205
  break;
199
206
  }
200
207
  return [2 /*return*/, res];
@@ -242,6 +249,9 @@ var Dataset = /** @class */ (function () {
242
249
  if (utils.matchContentType(contentType, "application/json")) {
243
250
  res.getDatasetById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.GetDatasetById200ApplicationJSON);
244
251
  }
252
+ else {
253
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
254
+ }
245
255
  break;
246
256
  }
247
257
  return [2 /*return*/, res];
@@ -302,6 +312,9 @@ var Dataset = /** @class */ (function () {
302
312
  if (utils.matchContentType(contentType, "application/json")) {
303
313
  res.uploadDatasetImage200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.UploadDatasetImage200ApplicationJSON);
304
314
  }
315
+ else {
316
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
317
+ }
305
318
  break;
306
319
  }
307
320
  return [2 /*return*/, res];
@@ -362,6 +375,9 @@ var Dataset = /** @class */ (function () {
362
375
  if (utils.matchContentType(contentType, "application/json")) {
363
376
  res.uploadDatasetImageFromGen200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.UploadDatasetImageFromGen200ApplicationJSON);
364
377
  }
378
+ else {
379
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
380
+ }
365
381
  break;
366
382
  }
367
383
  return [2 /*return*/, res];
@@ -91,6 +91,7 @@ var __read = (this && this.__read) || function (o, n) {
91
91
  Object.defineProperty(exports, "__esModule", { value: true });
92
92
  exports.Generation = void 0;
93
93
  var utils = __importStar(require("../internal/utils"));
94
+ var errors = __importStar(require("./models/errors"));
94
95
  var operations = __importStar(require("./models/operations"));
95
96
  var Generation = /** @class */ (function () {
96
97
  function Generation(sdkConfig) {
@@ -148,6 +149,9 @@ var Generation = /** @class */ (function () {
148
149
  if (utils.matchContentType(contentType, "application/json")) {
149
150
  res.createGeneration200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.CreateGeneration200ApplicationJSON);
150
151
  }
152
+ else {
153
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
154
+ }
151
155
  break;
152
156
  }
153
157
  return [2 /*return*/, res];
@@ -195,6 +199,9 @@ var Generation = /** @class */ (function () {
195
199
  if (utils.matchContentType(contentType, "application/json")) {
196
200
  res.deleteGenerationById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.DeleteGenerationById200ApplicationJSON);
197
201
  }
202
+ else {
203
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
204
+ }
198
205
  break;
199
206
  }
200
207
  return [2 /*return*/, res];
@@ -242,6 +249,9 @@ var Generation = /** @class */ (function () {
242
249
  if (utils.matchContentType(contentType, "application/json")) {
243
250
  res.getGenerationById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.GetGenerationById200ApplicationJSON);
244
251
  }
252
+ else {
253
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
254
+ }
245
255
  break;
246
256
  }
247
257
  return [2 /*return*/, res];
@@ -292,6 +302,9 @@ var Generation = /** @class */ (function () {
292
302
  if (utils.matchContentType(contentType, "application/json")) {
293
303
  res.getGenerationsByUserId200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.GetGenerationsByUserId200ApplicationJSON);
294
304
  }
305
+ else {
306
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
307
+ }
295
308
  break;
296
309
  }
297
310
  return [2 /*return*/, res];
@@ -91,6 +91,7 @@ var __read = (this && this.__read) || function (o, n) {
91
91
  Object.defineProperty(exports, "__esModule", { value: true });
92
92
  exports.InitImage = void 0;
93
93
  var utils = __importStar(require("../internal/utils"));
94
+ var errors = __importStar(require("./models/errors"));
94
95
  var operations = __importStar(require("./models/operations"));
95
96
  var InitImage = /** @class */ (function () {
96
97
  function InitImage(sdkConfig) {
@@ -136,6 +137,9 @@ var InitImage = /** @class */ (function () {
136
137
  if (utils.matchContentType(contentType, "application/json")) {
137
138
  res.deleteInitImageById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.DeleteInitImageById200ApplicationJSON);
138
139
  }
140
+ else {
141
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
142
+ }
139
143
  break;
140
144
  }
141
145
  return [2 /*return*/, res];
@@ -183,6 +187,9 @@ var InitImage = /** @class */ (function () {
183
187
  if (utils.matchContentType(contentType, "application/json")) {
184
188
  res.getInitImageById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.GetInitImageById200ApplicationJSON);
185
189
  }
190
+ else {
191
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
192
+ }
186
193
  break;
187
194
  }
188
195
  return [2 /*return*/, res];
@@ -242,6 +249,9 @@ var InitImage = /** @class */ (function () {
242
249
  if (utils.matchContentType(contentType, "application/json")) {
243
250
  res.uploadInitImage200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.UploadInitImage200ApplicationJSON);
244
251
  }
252
+ else {
253
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
254
+ }
245
255
  break;
246
256
  }
247
257
  return [2 /*return*/, res];
package/dist/sdk/model.js CHANGED
@@ -91,6 +91,7 @@ var __read = (this && this.__read) || function (o, n) {
91
91
  Object.defineProperty(exports, "__esModule", { value: true });
92
92
  exports.Model = void 0;
93
93
  var utils = __importStar(require("../internal/utils"));
94
+ var errors = __importStar(require("./models/errors"));
94
95
  var operations = __importStar(require("./models/operations"));
95
96
  var Model = /** @class */ (function () {
96
97
  function Model(sdkConfig) {
@@ -148,6 +149,9 @@ var Model = /** @class */ (function () {
148
149
  if (utils.matchContentType(contentType, "application/json")) {
149
150
  res.createModel200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.CreateModel200ApplicationJSON);
150
151
  }
152
+ else {
153
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
154
+ }
151
155
  break;
152
156
  }
153
157
  return [2 /*return*/, res];
@@ -195,6 +199,9 @@ var Model = /** @class */ (function () {
195
199
  if (utils.matchContentType(contentType, "application/json")) {
196
200
  res.deleteModelById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.DeleteModelById200ApplicationJSON);
197
201
  }
202
+ else {
203
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
204
+ }
198
205
  break;
199
206
  }
200
207
  return [2 /*return*/, res];
@@ -242,6 +249,9 @@ var Model = /** @class */ (function () {
242
249
  if (utils.matchContentType(contentType, "application/json")) {
243
250
  res.getModelById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.GetModelById200ApplicationJSON);
244
251
  }
252
+ else {
253
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
254
+ }
245
255
  break;
246
256
  }
247
257
  return [2 /*return*/, res];
@@ -0,0 +1 @@
1
+ export * from "./sdkerror";
@@ -0,0 +1,20 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./sdkerror"), exports);
@@ -0,0 +1,7 @@
1
+ import { AxiosResponse } from "axios";
2
+ export declare class SDKError extends Error {
3
+ statusCode: number;
4
+ body: string;
5
+ rawResponse: AxiosResponse;
6
+ constructor(message: string, statusCode: number, body: string, rawResponse: AxiosResponse);
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __extends = (this && this.__extends) || (function () {
6
+ var extendStatics = function (d, b) {
7
+ extendStatics = Object.setPrototypeOf ||
8
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
9
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
10
+ return extendStatics(d, b);
11
+ };
12
+ return function (d, b) {
13
+ if (typeof b !== "function" && b !== null)
14
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
15
+ extendStatics(d, b);
16
+ function __() { this.constructor = d; }
17
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18
+ };
19
+ })();
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.SDKError = void 0;
22
+ var SDKError = /** @class */ (function (_super) {
23
+ __extends(SDKError, _super);
24
+ function SDKError(message, statusCode, body, rawResponse) {
25
+ var _this = this;
26
+ var bodyString = "";
27
+ if ((body === null || body === void 0 ? void 0 : body.length) > 0) {
28
+ bodyString = "\n".concat(body);
29
+ }
30
+ _this = _super.call(this, "".concat(message, ": Status ").concat(statusCode).concat(bodyString)) || this;
31
+ _this.statusCode = statusCode;
32
+ _this.body = body;
33
+ _this.rawResponse = rawResponse;
34
+ _this.name = "SDKError";
35
+ Object.setPrototypeOf(_this, SDKError.prototype);
36
+ return _this;
37
+ }
38
+ return SDKError;
39
+ }(Error));
40
+ exports.SDKError = SDKError;
package/dist/sdk/sdk.js CHANGED
@@ -52,8 +52,8 @@ var SDKConfiguration = /** @class */ (function () {
52
52
  function SDKConfiguration(init) {
53
53
  this.language = "typescript";
54
54
  this.openapiDocVersion = "v1.0.0";
55
- this.sdkVersion = "1.50.0";
56
- this.genVersion = "2.65.0";
55
+ this.sdkVersion = "1.51.0";
56
+ this.genVersion = "2.82.0";
57
57
  Object.assign(this, init);
58
58
  }
59
59
  return SDKConfiguration;
package/dist/sdk/user.js CHANGED
@@ -75,6 +75,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
75
75
  Object.defineProperty(exports, "__esModule", { value: true });
76
76
  exports.User = void 0;
77
77
  var utils = __importStar(require("../internal/utils"));
78
+ var errors = __importStar(require("./models/errors"));
78
79
  var operations = __importStar(require("./models/operations"));
79
80
  var User = /** @class */ (function () {
80
81
  function User(sdkConfig) {
@@ -117,6 +118,9 @@ var User = /** @class */ (function () {
117
118
  if (utils.matchContentType(contentType, "application/json")) {
118
119
  res.getUserSelf200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.GetUserSelf200ApplicationJSON);
119
120
  }
121
+ else {
122
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
123
+ }
120
124
  break;
121
125
  }
122
126
  return [2 /*return*/, res];
@@ -91,6 +91,7 @@ var __read = (this && this.__read) || function (o, n) {
91
91
  Object.defineProperty(exports, "__esModule", { value: true });
92
92
  exports.Variation = void 0;
93
93
  var utils = __importStar(require("../internal/utils"));
94
+ var errors = __importStar(require("./models/errors"));
94
95
  var operations = __importStar(require("./models/operations"));
95
96
  var Variation = /** @class */ (function () {
96
97
  function Variation(sdkConfig) {
@@ -146,6 +147,9 @@ var Variation = /** @class */ (function () {
146
147
  if (utils.matchContentType(contentType, "application/json")) {
147
148
  res.createVariationUpscale200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.CreateVariationUpscale200ApplicationJSON);
148
149
  }
150
+ else {
151
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
152
+ }
149
153
  break;
150
154
  }
151
155
  return [2 /*return*/, res];
@@ -193,6 +197,9 @@ var Variation = /** @class */ (function () {
193
197
  if (utils.matchContentType(contentType, "application/json")) {
194
198
  res.getVariationById200ApplicationJSONObject = utils.objectToClass(JSON.parse(decodedRes), operations.GetVariationById200ApplicationJSON);
195
199
  }
200
+ else {
201
+ throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
202
+ }
196
203
  break;
197
204
  }
198
205
  return [2 /*return*/, res];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leonardo-ai/sdk",
3
- "version": "1.50.0",
3
+ "version": "1.51.0",
4
4
  "author": "leonardoai",
5
5
  "scripts": {
6
6
  "prepare": "tsc --build"