@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/README.md CHANGED
@@ -32,18 +32,15 @@ To get access to the API and fetch an API key, please sign up for [access](https
32
32
  ```typescript
33
33
  import {
34
34
  CreateDatasetRequest,
35
- CreateDatasetResponse
35
+ CreateDatasetResponse
36
36
  } from "@leonardo-ai/sdk/dist/sdk/models/operations";
37
37
 
38
38
  import { AxiosError } from "axios";
39
39
  import { Leonardo } from "@leonardo-ai/sdk";
40
-
41
40
  const sdk = new Leonardo({
42
41
  security: {
43
- bearerAuth: {
44
- authorization: "Bearer YOUR_BEARER_TOKEN_HERE",
45
- },
46
- }
42
+ bearerAuth: "Bearer YOUR_BEARER_TOKEN_HERE",
43
+ },
47
44
  });
48
45
 
49
46
  const req: CreateDatasetRequest = {
@@ -1,2 +1,2 @@
1
1
  export declare const qpMetadataKey = "queryParam";
2
- export declare function serializeQueryParams(queryParams: any): string;
2
+ export declare function serializeQueryParams(queryParams: any, globals?: any): string;
@@ -4,11 +4,13 @@ exports.serializeQueryParams = exports.qpMetadataKey = void 0;
4
4
  var utils_1 = require("./utils");
5
5
  exports.qpMetadataKey = "queryParam";
6
6
  var queryStringPrefix = "?";
7
- function serializeQueryParams(queryParams) {
7
+ function serializeQueryParams(queryParams, globals) {
8
8
  var queryStringParts = [];
9
9
  if (!queryParams)
10
10
  return queryStringParts.join("&");
11
- var fieldNames = Object.getOwnPropertyNames(queryParams);
11
+ var fieldNames = "__props__" in queryParams
12
+ ? queryParams["__props__"].map(function (prop) { return prop.key; })
13
+ : Object.getOwnPropertyNames(queryParams);
12
14
  fieldNames.forEach(function (fname) {
13
15
  var _a, _b, _c, _d, _e;
14
16
  var qpAnn = Reflect.getMetadata(exports.qpMetadataKey, queryParams, fname);
@@ -17,21 +19,23 @@ function serializeQueryParams(queryParams) {
17
19
  var qpDecorator = (0, utils_1.parseParamDecorator)(qpAnn, fname, "form", true);
18
20
  if (!qpDecorator)
19
21
  return;
22
+ var value = queryParams[fname];
23
+ value = (0, utils_1.populateFromGlobals)(value, fname, "queryParam", globals);
20
24
  if (qpDecorator.Serialization === "json")
21
- queryStringParts.push(jsonSerializer((_a = {}, _a[fname] = queryParams[fname], _a)));
25
+ queryStringParts.push(jsonSerializer((_a = {}, _a[fname] = value, _a)));
22
26
  else {
23
27
  switch (qpDecorator.Style) {
24
28
  case "deepObject":
25
- queryStringParts.push(deepObjectSerializer((_b = {}, _b[fname] = queryParams[fname], _b), qpDecorator.DateTimeFormat));
29
+ queryStringParts.push(deepObjectSerializer((_b = {}, _b[fname] = value, _b), qpDecorator.DateTimeFormat));
26
30
  return;
27
31
  case "form":
28
32
  if (!qpDecorator.Explode)
29
- queryStringParts.push(formSerializer((_c = {}, _c[fname] = queryParams[fname], _c), qpDecorator.DateTimeFormat));
33
+ queryStringParts.push(formSerializer((_c = {}, _c[fname] = value, _c), qpDecorator.DateTimeFormat));
30
34
  else
31
- queryStringParts.push(formSerializerExplode((_d = {}, _d[fname] = queryParams[fname], _d), qpDecorator.DateTimeFormat));
35
+ queryStringParts.push(formSerializerExplode((_d = {}, _d[fname] = value, _d), qpDecorator.DateTimeFormat));
32
36
  return;
33
37
  default:
34
- queryStringParts.push(formSerializerExplode((_e = {}, _e[fname] = queryParams[fname], _e), qpDecorator.DateTimeFormat));
38
+ queryStringParts.push(formSerializerExplode((_e = {}, _e[fname] = value, _e), qpDecorator.DateTimeFormat));
35
39
  }
36
40
  }
37
41
  });
@@ -1,4 +1,10 @@
1
1
  import "reflect-metadata";
2
+ export interface PropInfo {
3
+ key: string | symbol;
4
+ type: any;
5
+ elemType: any;
6
+ elemDepth: number;
7
+ }
2
8
  export declare class SpeakeasyBase {
3
9
  constructor(payload?: Record<string | symbol, unknown>);
4
10
  }
@@ -18,7 +24,7 @@ export declare function SpeakeasyMetadata<T extends SpeakeasyBase = Record<strin
18
24
  elemDepth?: number;
19
25
  }): PropertyDecorator;
20
26
  export declare function templateUrl(stringWithParams: string, params: Record<string, string>): string;
21
- export declare function generateURL(serverURL: string, path: string, pathParams: any): string;
27
+ export declare function generateURL(serverURL: string, path: string, pathParams: any, globals?: any): string;
22
28
  export declare function parseParamDecorator(ann: string, fName: string, defaultStyle: string, defaultExplode: boolean): ParamDecorator;
23
29
  export declare function isStringRecord(obj: any): obj is Record<string, string>;
24
30
  export declare function isNumberRecord(obj: any): obj is Record<string, number>;
@@ -26,3 +32,6 @@ export declare function isBooleanRecord(obj: any): obj is Record<string, boolean
26
32
  export declare function isEmpty(value: any): boolean;
27
33
  export declare function convertIfDateObjectToISOString(value: any, dateTimeFormat?: string): any;
28
34
  export declare function encodeAndConvertPrimitiveVal(value: any, dateTimeFormat?: string): any;
35
+ export declare function deserializeJSONResponse<T>(value: T, klass?: any, elemDepth?: number): any;
36
+ export declare function getResFieldDepth(res: any): number;
37
+ export declare function populateFromGlobals(value: any, fieldName: string, paramType: string, globals: any): any;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encodeAndConvertPrimitiveVal = exports.convertIfDateObjectToISOString = exports.isEmpty = exports.isBooleanRecord = exports.isNumberRecord = exports.isStringRecord = exports.parseParamDecorator = exports.generateURL = exports.templateUrl = exports.SpeakeasyMetadata = exports.ParamDecorator = exports.SpeakeasyBase = void 0;
3
+ exports.populateFromGlobals = exports.getResFieldDepth = exports.deserializeJSONResponse = exports.encodeAndConvertPrimitiveVal = exports.convertIfDateObjectToISOString = exports.isEmpty = exports.isBooleanRecord = exports.isNumberRecord = exports.isStringRecord = exports.parseParamDecorator = exports.generateURL = exports.templateUrl = exports.SpeakeasyMetadata = exports.ParamDecorator = exports.SpeakeasyBase = void 0;
4
4
  require("reflect-metadata");
5
5
  var pathparams_1 = require("./pathparams");
6
+ var class_transformer_1 = require("class-transformer");
6
7
  function isSpeakeasyBase(type) {
7
8
  var _a;
8
9
  return type && ((_a = Object.getPrototypeOf(type)) === null || _a === void 0 ? void 0 : _a.name) == "SpeakeasyBase";
@@ -131,10 +132,12 @@ function templateUrl(stringWithParams, params) {
131
132
  return res;
132
133
  }
133
134
  exports.templateUrl = templateUrl;
134
- function generateURL(serverURL, path, pathParams) {
135
+ function generateURL(serverURL, path, pathParams, globals) {
135
136
  var url = serverURL.replace(/\/$/, "") + path;
136
137
  var parsedParameters = {};
137
- var fieldNames = Object.getOwnPropertyNames(pathParams);
138
+ var fieldNames = "__props__" in pathParams
139
+ ? pathParams["__props__"].map(function (prop) { return prop.key; })
140
+ : Object.getOwnPropertyNames(pathParams);
138
141
  fieldNames.forEach(function (fname) {
139
142
  var ppAnn = Reflect.getMetadata(pathparams_1.ppMetadataKey, pathParams, fname);
140
143
  if (ppAnn == null)
@@ -142,9 +145,11 @@ function generateURL(serverURL, path, pathParams) {
142
145
  var ppDecorator = parseParamDecorator(ppAnn, fname, "simple", false);
143
146
  if (ppDecorator == null)
144
147
  return;
148
+ var value = pathParams[fname];
149
+ value = populateFromGlobals(value, fname, "pathParam", globals);
145
150
  switch (ppDecorator.Style) {
146
151
  case "simple":
147
- var simpleParams = (0, pathparams_1.getSimplePathParams)(ppDecorator.ParamName, pathParams[fname], ppDecorator.Explode, ppDecorator.DateTimeFormat);
152
+ var simpleParams = (0, pathparams_1.getSimplePathParams)(ppDecorator.ParamName, value, ppDecorator.Explode, ppDecorator.DateTimeFormat);
148
153
  simpleParams.forEach(function (value, key) {
149
154
  parsedParameters[key] = value;
150
155
  });
@@ -236,3 +241,60 @@ function encodeAndConvertPrimitiveVal(value, dateTimeFormat) {
236
241
  return encodeURIComponent(convertIfDateObjectToISOString(value, dateTimeFormat));
237
242
  }
238
243
  exports.encodeAndConvertPrimitiveVal = encodeAndConvertPrimitiveVal;
244
+ function deserializeJSONResponse(value, klass, elemDepth) {
245
+ if (elemDepth === void 0) { elemDepth = 0; }
246
+ if (value !== Object(value)) {
247
+ return value;
248
+ }
249
+ if (elemDepth === 0 && klass != null) {
250
+ return (0, class_transformer_1.plainToInstance)(klass, value, {
251
+ excludeExtraneousValues: true,
252
+ });
253
+ }
254
+ if (Array.isArray(value)) {
255
+ return value.map(function (v) { return deserializeJSONResponse(v, klass, elemDepth - 1); });
256
+ }
257
+ if (typeof value === "object" && value != null) {
258
+ var copiedRecord = {};
259
+ for (var key in value) {
260
+ copiedRecord[key] = deserializeJSONResponse(value[key], klass, elemDepth - 1);
261
+ }
262
+ return copiedRecord;
263
+ }
264
+ return (0, class_transformer_1.plainToInstance)(klass, value, {
265
+ excludeExtraneousValues: true,
266
+ });
267
+ }
268
+ exports.deserializeJSONResponse = deserializeJSONResponse;
269
+ function getResFieldDepth(res) {
270
+ var props = res["__props__"];
271
+ var resFieldDepth = 1;
272
+ if (props) {
273
+ for (var _i = 0, props_2 = props; _i < props_2.length; _i++) {
274
+ var prop = props_2[_i];
275
+ if (res && res.hasOwnProperty(prop.key)) {
276
+ if ((prop.type.name == "Array" || prop.type.name == "Object") &&
277
+ isSpeakeasyBase(prop.elemType)) {
278
+ if (prop.elemDepth > resFieldDepth) {
279
+ resFieldDepth = prop.elemDepth;
280
+ break;
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+ return resFieldDepth;
287
+ }
288
+ exports.getResFieldDepth = getResFieldDepth;
289
+ function populateFromGlobals(value, fieldName, paramType, globals) {
290
+ if (globals && value === undefined) {
291
+ if ("parameters" in globals && paramType in globals.parameters) {
292
+ var globalValue = globals.parameters[paramType][fieldName];
293
+ if (globalValue !== undefined) {
294
+ value = globalValue;
295
+ }
296
+ }
297
+ }
298
+ return value;
299
+ }
300
+ exports.populateFromGlobals = populateFromGlobals;
@@ -12,30 +12,30 @@ export declare class Dataset {
12
12
  * createDataset - Create a Dataset
13
13
  *
14
14
  * This endpoint creates a new dataset
15
- **/
15
+ **/
16
16
  createDataset(req: operations.CreateDatasetRequest, config?: AxiosRequestConfig): Promise<operations.CreateDatasetResponse>;
17
17
  /**
18
18
  * deleteDatasetById - Delete a Single Dataset by ID
19
19
  *
20
20
  * This endpoint deletes the specific dataset
21
- **/
21
+ **/
22
22
  deleteDatasetById(req: operations.DeleteDatasetByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteDatasetByIdResponse>;
23
23
  /**
24
24
  * getDatasetById - Get a Single Dataset by ID
25
25
  *
26
26
  * This endpoint gets the specific dataset
27
- **/
27
+ **/
28
28
  getDatasetById(req: operations.GetDatasetByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetDatasetByIdResponse>;
29
29
  /**
30
30
  * uploadDatasetImage - Upload dataset image
31
31
  *
32
32
  * This endpoint returns presigned details to upload a dataset image to S3
33
- **/
33
+ **/
34
34
  uploadDatasetImage(req: operations.UploadDatasetImageRequest, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageResponse>;
35
35
  /**
36
36
  * uploadDatasetImageFromGen - Upload a Single Generated Image to a Dataset
37
37
  *
38
38
  * This endpoint will upload a previously generated image to the dataset
39
- **/
39
+ **/
40
40
  uploadDatasetImageFromGen(req: operations.UploadDatasetImageFromGenRequest, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageFromGenResponse>;
41
41
  }
@@ -37,7 +37,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.Dataset = 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 Dataset = /** @class */ (function () {
42
41
  function Dataset(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
43
42
  this._defaultClient = defaultClient;
@@ -51,7 +50,7 @@ var Dataset = /** @class */ (function () {
51
50
  * createDataset - Create a Dataset
52
51
  *
53
52
  * This endpoint creates a new dataset
54
- **/
53
+ **/
55
54
  Dataset.prototype.createDataset = function (req, config) {
56
55
  var _a;
57
56
  if (!(req instanceof utils.SpeakeasyBase)) {
@@ -78,11 +77,16 @@ var Dataset = /** @class */ (function () {
78
77
  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 : "";
79
78
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
80
79
  throw new Error("status code not found in response: ".concat(httpRes));
81
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
80
+ var res = new operations.CreateDatasetResponse({
81
+ statusCode: httpRes.status,
82
+ contentType: contentType,
83
+ rawResponse: httpRes,
84
+ });
82
85
  switch (true) {
83
86
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
84
87
  if (utils.matchContentType(contentType, "application/json")) {
85
- res.createDataset200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.CreateDataset200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
88
+ res.createDataset200ApplicationJSONObject =
89
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateDataset200ApplicationJSON);
86
90
  }
87
91
  break;
88
92
  }
@@ -93,7 +97,7 @@ var Dataset = /** @class */ (function () {
93
97
  * deleteDatasetById - Delete a Single Dataset by ID
94
98
  *
95
99
  * This endpoint deletes the specific dataset
96
- **/
100
+ **/
97
101
  Dataset.prototype.deleteDatasetById = function (req, config) {
98
102
  if (!(req instanceof utils.SpeakeasyBase)) {
99
103
  req = new operations.DeleteDatasetByIdRequest(req);
@@ -107,11 +111,16 @@ var Dataset = /** @class */ (function () {
107
111
  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 : "";
108
112
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
109
113
  throw new Error("status code not found in response: ".concat(httpRes));
110
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
114
+ var res = new operations.DeleteDatasetByIdResponse({
115
+ statusCode: httpRes.status,
116
+ contentType: contentType,
117
+ rawResponse: httpRes,
118
+ });
111
119
  switch (true) {
112
120
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
113
121
  if (utils.matchContentType(contentType, "application/json")) {
114
- res.deleteDatasetById200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.DeleteDatasetById200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
122
+ res.deleteDatasetById200ApplicationJSONObject =
123
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteDatasetById200ApplicationJSON);
115
124
  }
116
125
  break;
117
126
  }
@@ -122,7 +131,7 @@ var Dataset = /** @class */ (function () {
122
131
  * getDatasetById - Get a Single Dataset by ID
123
132
  *
124
133
  * This endpoint gets the specific dataset
125
- **/
134
+ **/
126
135
  Dataset.prototype.getDatasetById = function (req, config) {
127
136
  if (!(req instanceof utils.SpeakeasyBase)) {
128
137
  req = new operations.GetDatasetByIdRequest(req);
@@ -136,11 +145,16 @@ var Dataset = /** @class */ (function () {
136
145
  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 : "";
137
146
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
138
147
  throw new Error("status code not found in response: ".concat(httpRes));
139
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
148
+ var res = new operations.GetDatasetByIdResponse({
149
+ statusCode: httpRes.status,
150
+ contentType: contentType,
151
+ rawResponse: httpRes,
152
+ });
140
153
  switch (true) {
141
154
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
142
155
  if (utils.matchContentType(contentType, "application/json")) {
143
- res.getDatasetById200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.GetDatasetById200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
156
+ res.getDatasetById200ApplicationJSONObject =
157
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetDatasetById200ApplicationJSON);
144
158
  }
145
159
  break;
146
160
  }
@@ -151,7 +165,7 @@ var Dataset = /** @class */ (function () {
151
165
  * uploadDatasetImage - Upload dataset image
152
166
  *
153
167
  * This endpoint returns presigned details to upload a dataset image to S3
154
- **/
168
+ **/
155
169
  Dataset.prototype.uploadDatasetImage = function (req, config) {
156
170
  var _a;
157
171
  if (!(req instanceof utils.SpeakeasyBase)) {
@@ -178,11 +192,16 @@ var Dataset = /** @class */ (function () {
178
192
  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 : "";
179
193
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
180
194
  throw new Error("status code not found in response: ".concat(httpRes));
181
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
195
+ var res = new operations.UploadDatasetImageResponse({
196
+ statusCode: httpRes.status,
197
+ contentType: contentType,
198
+ rawResponse: httpRes,
199
+ });
182
200
  switch (true) {
183
201
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
184
202
  if (utils.matchContentType(contentType, "application/json")) {
185
- res.uploadDatasetImage200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.UploadDatasetImage200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
203
+ res.uploadDatasetImage200ApplicationJSONObject =
204
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImage200ApplicationJSON);
186
205
  }
187
206
  break;
188
207
  }
@@ -193,7 +212,7 @@ var Dataset = /** @class */ (function () {
193
212
  * uploadDatasetImageFromGen - Upload a Single Generated Image to a Dataset
194
213
  *
195
214
  * This endpoint will upload a previously generated image to the dataset
196
- **/
215
+ **/
197
216
  Dataset.prototype.uploadDatasetImageFromGen = function (req, config) {
198
217
  var _a;
199
218
  if (!(req instanceof utils.SpeakeasyBase)) {
@@ -220,11 +239,16 @@ var Dataset = /** @class */ (function () {
220
239
  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 : "";
221
240
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
222
241
  throw new Error("status code not found in response: ".concat(httpRes));
223
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
242
+ var res = new operations.UploadDatasetImageFromGenResponse({
243
+ statusCode: httpRes.status,
244
+ contentType: contentType,
245
+ rawResponse: httpRes,
246
+ });
224
247
  switch (true) {
225
248
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
226
249
  if (utils.matchContentType(contentType, "application/json")) {
227
- res.uploadDatasetImageFromGen200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.UploadDatasetImageFromGen200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
250
+ res.uploadDatasetImageFromGen200ApplicationJSONObject =
251
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImageFromGen200ApplicationJSON);
228
252
  }
229
253
  break;
230
254
  }
@@ -12,24 +12,24 @@ export declare class Generation {
12
12
  * createGeneration - Create a Generation of Images
13
13
  *
14
14
  * This endpoint will generate images
15
- **/
15
+ **/
16
16
  createGeneration(req: operations.CreateGenerationRequest, config?: AxiosRequestConfig): Promise<operations.CreateGenerationResponse>;
17
17
  /**
18
18
  * deleteGenerationById - Delete a Single Generation
19
19
  *
20
20
  * This endpoint deletes a specific generation
21
- **/
21
+ **/
22
22
  deleteGenerationById(req: operations.DeleteGenerationByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteGenerationByIdResponse>;
23
23
  /**
24
24
  * getGenerationById - Get a Single Generation
25
25
  *
26
26
  * This endpoint will provide information about a specific generation
27
- **/
27
+ **/
28
28
  getGenerationById(req: operations.GetGenerationByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetGenerationByIdResponse>;
29
29
  /**
30
30
  * getGenerationsByUserId - Get generations by user ID
31
31
  *
32
32
  * This endpoint returns all generations by a specific user
33
- **/
33
+ **/
34
34
  getGenerationsByUserId(req: operations.GetGenerationsByUserIdRequest, config?: AxiosRequestConfig): Promise<operations.GetGenerationsByUserIdResponse>;
35
35
  }
@@ -37,7 +37,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.Generation = 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 Generation = /** @class */ (function () {
42
41
  function Generation(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
43
42
  this._defaultClient = defaultClient;
@@ -51,7 +50,7 @@ var Generation = /** @class */ (function () {
51
50
  * createGeneration - Create a Generation of Images
52
51
  *
53
52
  * This endpoint will generate images
54
- **/
53
+ **/
55
54
  Generation.prototype.createGeneration = function (req, config) {
56
55
  var _a;
57
56
  if (!(req instanceof utils.SpeakeasyBase)) {
@@ -78,11 +77,16 @@ var Generation = /** @class */ (function () {
78
77
  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 : "";
79
78
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
80
79
  throw new Error("status code not found in response: ".concat(httpRes));
81
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
80
+ var res = new operations.CreateGenerationResponse({
81
+ statusCode: httpRes.status,
82
+ contentType: contentType,
83
+ rawResponse: httpRes,
84
+ });
82
85
  switch (true) {
83
86
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
84
87
  if (utils.matchContentType(contentType, "application/json")) {
85
- res.createGeneration200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.CreateGeneration200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
88
+ res.createGeneration200ApplicationJSONObject =
89
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateGeneration200ApplicationJSON);
86
90
  }
87
91
  break;
88
92
  }
@@ -93,7 +97,7 @@ var Generation = /** @class */ (function () {
93
97
  * deleteGenerationById - Delete a Single Generation
94
98
  *
95
99
  * This endpoint deletes a specific generation
96
- **/
100
+ **/
97
101
  Generation.prototype.deleteGenerationById = function (req, config) {
98
102
  if (!(req instanceof utils.SpeakeasyBase)) {
99
103
  req = new operations.DeleteGenerationByIdRequest(req);
@@ -107,11 +111,16 @@ var Generation = /** @class */ (function () {
107
111
  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 : "";
108
112
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
109
113
  throw new Error("status code not found in response: ".concat(httpRes));
110
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
114
+ var res = new operations.DeleteGenerationByIdResponse({
115
+ statusCode: httpRes.status,
116
+ contentType: contentType,
117
+ rawResponse: httpRes,
118
+ });
111
119
  switch (true) {
112
120
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
113
121
  if (utils.matchContentType(contentType, "application/json")) {
114
- res.deleteGenerationById200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.DeleteGenerationById200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
122
+ res.deleteGenerationById200ApplicationJSONObject =
123
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteGenerationById200ApplicationJSON);
115
124
  }
116
125
  break;
117
126
  }
@@ -122,7 +131,7 @@ var Generation = /** @class */ (function () {
122
131
  * getGenerationById - Get a Single Generation
123
132
  *
124
133
  * This endpoint will provide information about a specific generation
125
- **/
134
+ **/
126
135
  Generation.prototype.getGenerationById = function (req, config) {
127
136
  if (!(req instanceof utils.SpeakeasyBase)) {
128
137
  req = new operations.GetGenerationByIdRequest(req);
@@ -136,11 +145,16 @@ var Generation = /** @class */ (function () {
136
145
  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 : "";
137
146
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
138
147
  throw new Error("status code not found in response: ".concat(httpRes));
139
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
148
+ var res = new operations.GetGenerationByIdResponse({
149
+ statusCode: httpRes.status,
150
+ contentType: contentType,
151
+ rawResponse: httpRes,
152
+ });
140
153
  switch (true) {
141
154
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
142
155
  if (utils.matchContentType(contentType, "application/json")) {
143
- res.getGenerationById200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.GetGenerationById200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
156
+ res.getGenerationById200ApplicationJSONObject =
157
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationById200ApplicationJSON);
144
158
  }
145
159
  break;
146
160
  }
@@ -151,7 +165,7 @@ var Generation = /** @class */ (function () {
151
165
  * getGenerationsByUserId - Get generations by user ID
152
166
  *
153
167
  * This endpoint returns all generations by a specific user
154
- **/
168
+ **/
155
169
  Generation.prototype.getGenerationsByUserId = function (req, config) {
156
170
  if (!(req instanceof utils.SpeakeasyBase)) {
157
171
  req = new operations.GetGenerationsByUserIdRequest(req);
@@ -166,11 +180,16 @@ var Generation = /** @class */ (function () {
166
180
  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 : "";
167
181
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
168
182
  throw new Error("status code not found in response: ".concat(httpRes));
169
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
183
+ var res = new operations.GetGenerationsByUserIdResponse({
184
+ statusCode: httpRes.status,
185
+ contentType: contentType,
186
+ rawResponse: httpRes,
187
+ });
170
188
  switch (true) {
171
189
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
172
190
  if (utils.matchContentType(contentType, "application/json")) {
173
- res.getGenerationsByUserId200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.GetGenerationsByUserId200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
191
+ res.getGenerationsByUserId200ApplicationJSONObject =
192
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationsByUserId200ApplicationJSON);
174
193
  }
175
194
  break;
176
195
  }
@@ -12,18 +12,18 @@ export declare class InitImage {
12
12
  * deleteInitImageById - Delete init image
13
13
  *
14
14
  * This endpoint deletes an init image
15
- **/
15
+ **/
16
16
  deleteInitImageById(req: operations.DeleteInitImageByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteInitImageByIdResponse>;
17
17
  /**
18
18
  * getInitImageById - Get single init image
19
19
  *
20
20
  * This endpoint will return a single init image
21
- **/
21
+ **/
22
22
  getInitImageById(req: operations.GetInitImageByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetInitImageByIdResponse>;
23
23
  /**
24
24
  * uploadInitImage - Upload init image
25
25
  *
26
26
  * This endpoint returns presigned details to upload an init image to S3
27
- **/
27
+ **/
28
28
  uploadInitImage(req: operations.UploadInitImageRequest, config?: AxiosRequestConfig): Promise<operations.UploadInitImageResponse>;
29
29
  }
@@ -37,7 +37,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.InitImage = 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 InitImage = /** @class */ (function () {
42
41
  function InitImage(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
43
42
  this._defaultClient = defaultClient;
@@ -51,7 +50,7 @@ var InitImage = /** @class */ (function () {
51
50
  * deleteInitImageById - Delete init image
52
51
  *
53
52
  * This endpoint deletes an init image
54
- **/
53
+ **/
55
54
  InitImage.prototype.deleteInitImageById = function (req, config) {
56
55
  if (!(req instanceof utils.SpeakeasyBase)) {
57
56
  req = new operations.DeleteInitImageByIdRequest(req);
@@ -65,11 +64,16 @@ var InitImage = /** @class */ (function () {
65
64
  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 : "";
66
65
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
67
66
  throw new Error("status code not found in response: ".concat(httpRes));
68
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
67
+ var res = new operations.DeleteInitImageByIdResponse({
68
+ statusCode: httpRes.status,
69
+ contentType: contentType,
70
+ rawResponse: httpRes,
71
+ });
69
72
  switch (true) {
70
73
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
71
74
  if (utils.matchContentType(contentType, "application/json")) {
72
- res.deleteInitImageById200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.DeleteInitImageById200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
75
+ res.deleteInitImageById200ApplicationJSONObject =
76
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteInitImageById200ApplicationJSON);
73
77
  }
74
78
  break;
75
79
  }
@@ -80,7 +84,7 @@ var InitImage = /** @class */ (function () {
80
84
  * getInitImageById - Get single init image
81
85
  *
82
86
  * This endpoint will return a single init image
83
- **/
87
+ **/
84
88
  InitImage.prototype.getInitImageById = function (req, config) {
85
89
  if (!(req instanceof utils.SpeakeasyBase)) {
86
90
  req = new operations.GetInitImageByIdRequest(req);
@@ -94,11 +98,16 @@ var InitImage = /** @class */ (function () {
94
98
  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 : "";
95
99
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
96
100
  throw new Error("status code not found in response: ".concat(httpRes));
97
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
101
+ var res = new operations.GetInitImageByIdResponse({
102
+ statusCode: httpRes.status,
103
+ contentType: contentType,
104
+ rawResponse: httpRes,
105
+ });
98
106
  switch (true) {
99
107
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
100
108
  if (utils.matchContentType(contentType, "application/json")) {
101
- res.getInitImageById200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.GetInitImageById200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
109
+ res.getInitImageById200ApplicationJSONObject =
110
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetInitImageById200ApplicationJSON);
102
111
  }
103
112
  break;
104
113
  }
@@ -109,7 +118,7 @@ var InitImage = /** @class */ (function () {
109
118
  * uploadInitImage - Upload init image
110
119
  *
111
120
  * This endpoint returns presigned details to upload an init image to S3
112
- **/
121
+ **/
113
122
  InitImage.prototype.uploadInitImage = function (req, config) {
114
123
  var _a;
115
124
  if (!(req instanceof utils.SpeakeasyBase)) {
@@ -136,11 +145,16 @@ var InitImage = /** @class */ (function () {
136
145
  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 : "";
137
146
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
138
147
  throw new Error("status code not found in response: ".concat(httpRes));
139
- var res = { statusCode: httpRes.status, contentType: contentType, rawResponse: httpRes };
148
+ var res = new operations.UploadInitImageResponse({
149
+ statusCode: httpRes.status,
150
+ contentType: contentType,
151
+ rawResponse: httpRes,
152
+ });
140
153
  switch (true) {
141
154
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
142
155
  if (utils.matchContentType(contentType, "application/json")) {
143
- res.uploadInitImage200ApplicationJSONObject = (0, class_transformer_1.plainToInstance)(operations.UploadInitImage200ApplicationJSON, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, { excludeExtraneousValues: true });
156
+ res.uploadInitImage200ApplicationJSONObject =
157
+ utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadInitImage200ApplicationJSON);
144
158
  }
145
159
  break;
146
160
  }