@leonardo-ai/sdk 1.3.5 → 1.8.3

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 (55) hide show
  1. package/README.md +8 -4
  2. package/dist/internal/utils/headers.js +4 -4
  3. package/dist/internal/utils/pathparams.d.ts +1 -8
  4. package/dist/internal/utils/pathparams.js +11 -18
  5. package/dist/internal/utils/queryparams.d.ts +1 -2
  6. package/dist/internal/utils/queryparams.js +100 -50
  7. package/dist/internal/utils/requestbody.js +90 -57
  8. package/dist/internal/utils/security.js +69 -57
  9. package/dist/internal/utils/utils.d.ts +13 -2
  10. package/dist/internal/utils/utils.js +93 -15
  11. package/dist/sdk/dataset.js +30 -10
  12. package/dist/sdk/generation.js +26 -11
  13. package/dist/sdk/initimage.js +18 -6
  14. package/dist/sdk/model.js +18 -6
  15. package/dist/sdk/models/operations/createdataset.d.ts +2 -0
  16. package/dist/sdk/models/operations/createdataset.js +14 -4
  17. package/dist/sdk/models/operations/creategeneration.d.ts +2 -0
  18. package/dist/sdk/models/operations/creategeneration.js +42 -18
  19. package/dist/sdk/models/operations/createmodel.d.ts +2 -0
  20. package/dist/sdk/models/operations/createmodel.js +28 -11
  21. package/dist/sdk/models/operations/createvariationupscale.d.ts +2 -0
  22. package/dist/sdk/models/operations/createvariationupscale.js +12 -3
  23. package/dist/sdk/models/operations/deletedatasetbyid.d.ts +2 -0
  24. package/dist/sdk/models/operations/deletedatasetbyid.js +10 -2
  25. package/dist/sdk/models/operations/deletegenerationbyid.d.ts +2 -0
  26. package/dist/sdk/models/operations/deletegenerationbyid.js +10 -2
  27. package/dist/sdk/models/operations/deleteinitimagebyid.d.ts +2 -0
  28. package/dist/sdk/models/operations/deleteinitimagebyid.js +10 -2
  29. package/dist/sdk/models/operations/deletemodelbyid.d.ts +2 -0
  30. package/dist/sdk/models/operations/deletemodelbyid.js +10 -2
  31. package/dist/sdk/models/operations/getdatasetbyid.d.ts +2 -0
  32. package/dist/sdk/models/operations/getdatasetbyid.js +27 -10
  33. package/dist/sdk/models/operations/getgenerationbyid.d.ts +2 -0
  34. package/dist/sdk/models/operations/getgenerationbyid.js +60 -26
  35. package/dist/sdk/models/operations/getgenerationsbyuserid.d.ts +2 -0
  36. package/dist/sdk/models/operations/getgenerationsbyuserid.js +60 -26
  37. package/dist/sdk/models/operations/getinitimagebyid.d.ts +2 -0
  38. package/dist/sdk/models/operations/getinitimagebyid.js +14 -4
  39. package/dist/sdk/models/operations/getmodelbyid.d.ts +2 -0
  40. package/dist/sdk/models/operations/getmodelbyid.js +32 -13
  41. package/dist/sdk/models/operations/getuserself.d.ts +2 -0
  42. package/dist/sdk/models/operations/getuserself.js +17 -5
  43. package/dist/sdk/models/operations/getvariationbyid.d.ts +2 -0
  44. package/dist/sdk/models/operations/getvariationbyid.js +18 -6
  45. package/dist/sdk/models/operations/uploaddatasetimage.d.ts +2 -0
  46. package/dist/sdk/models/operations/uploaddatasetimage.js +18 -6
  47. package/dist/sdk/models/operations/uploaddatasetimagefromgen.d.ts +2 -0
  48. package/dist/sdk/models/operations/uploaddatasetimagefromgen.js +12 -3
  49. package/dist/sdk/models/operations/uploadinitimage.d.ts +2 -0
  50. package/dist/sdk/models/operations/uploadinitimage.js +20 -7
  51. package/dist/sdk/sdk.d.ts +3 -3
  52. package/dist/sdk/sdk.js +8 -7
  53. package/dist/sdk/user.js +7 -2
  54. package/dist/sdk/variation.js +12 -4
  55. package/package.json +2 -3
@@ -43,11 +43,17 @@ function parseSecurityClass(client, security) {
43
43
  var securityDecorator = parseSecurityDecorator(securityAnn);
44
44
  if (securityDecorator == null)
45
45
  return;
46
+ var value = security[fname];
46
47
  if (securityDecorator.Option) {
47
- return parseSecurityOption(client, security[fname]);
48
+ return parseSecurityOption(client, value);
48
49
  }
49
50
  else if (securityDecorator.Scheme) {
50
- return parseSecurityScheme(client, securityDecorator, security[fname]);
51
+ if (securityDecorator.SubType === "basic" && value !== Object(value)) {
52
+ return parseSecurityScheme(client, securityDecorator, security);
53
+ }
54
+ else {
55
+ client = parseSecurityScheme(client, securityDecorator, value);
56
+ }
51
57
  }
52
58
  });
53
59
  return client;
@@ -59,67 +65,73 @@ function parseSecurityOption(client, optionType) {
59
65
  if (securityAnn == null)
60
66
  return;
61
67
  var securityDecorator = parseSecurityDecorator(securityAnn);
62
- if (securityDecorator != null && securityDecorator.Scheme)
68
+ if (securityDecorator == null || !securityDecorator.Scheme)
63
69
  return;
64
- if (securityDecorator.Scheme) {
65
- return parseSecurityScheme(client, securityDecorator, optionType[fname]);
66
- }
70
+ return parseSecurityScheme(client, securityDecorator, optionType[fname]);
67
71
  });
68
72
  return client;
69
73
  }
70
74
  function parseSecurityScheme(client, schemeDecorator, scheme) {
71
- if (schemeDecorator.Type === "http" && schemeDecorator.SubType === "basic") {
72
- return parseBasicAuthScheme(client, scheme);
73
- }
74
- var fieldNames = Object.getOwnPropertyNames(scheme);
75
- fieldNames.forEach(function (fname) {
76
- var securityAnn = Reflect.getMetadata(securityMetadataKey, scheme, fname);
77
- if (securityAnn == null)
78
- return;
79
- var securityDecorator = parseSecurityDecorator(securityAnn);
80
- if (securityDecorator == null || securityDecorator.Name === "")
81
- return;
82
- switch (schemeDecorator.Type) {
83
- case "apiKey":
84
- switch (schemeDecorator.SubType) {
85
- case "header":
86
- client.defaults.headers.common[securityDecorator.Name] =
87
- scheme[fname];
88
- break;
89
- case "query":
90
- client.defaults.params[securityDecorator.Name] = scheme[fname];
91
- break;
92
- case "cookie":
93
- var securityDecoratorName = securityDecorator.Name;
94
- var val = scheme[fname];
95
- client.defaults.headers.common["Cookie"] = "".concat(securityDecoratorName, "=").concat(val);
96
- break;
97
- default:
98
- throw new Error("not supported");
99
- }
100
- break;
101
- case "openIdConnect":
102
- client.defaults.headers.common[securityDecorator.Name] = scheme[fname];
103
- break;
104
- case "oauth2":
105
- client.defaults.headers.common[securityDecorator.Name] = scheme[fname];
106
- break;
107
- case "http":
108
- switch (schemeDecorator.SubType) {
109
- case "basic":
110
- break;
111
- case "bearer":
112
- client.defaults.headers.common[securityDecorator.Name] =
113
- scheme[fname];
114
- break;
115
- default:
116
- throw new Error("not supported");
117
- }
118
- break;
119
- default:
120
- throw new Error("not supported");
75
+ if (scheme === Object(scheme)) {
76
+ if (schemeDecorator.Type === "http" &&
77
+ schemeDecorator.SubType === "basic") {
78
+ return parseBasicAuthScheme(client, scheme);
121
79
  }
122
- });
80
+ var fieldNames = Object.getOwnPropertyNames(scheme);
81
+ fieldNames.forEach(function (fname) {
82
+ var securityAnn = Reflect.getMetadata(securityMetadataKey, scheme, fname);
83
+ if (securityAnn == null)
84
+ return;
85
+ var securityDecorator = parseSecurityDecorator(securityAnn);
86
+ if (securityDecorator == null || securityDecorator.Name === "")
87
+ return;
88
+ client = parseSecuritySchemeValue(client, schemeDecorator, securityDecorator, scheme[fname]);
89
+ });
90
+ }
91
+ else {
92
+ client = parseSecuritySchemeValue(client, schemeDecorator, schemeDecorator, scheme);
93
+ }
94
+ return client;
95
+ }
96
+ function parseSecuritySchemeValue(client, schemeDecorator, securityDecorator, value) {
97
+ switch (schemeDecorator.Type) {
98
+ case "apiKey":
99
+ switch (schemeDecorator.SubType) {
100
+ case "header":
101
+ client.defaults.headers.common[securityDecorator.Name] = value;
102
+ break;
103
+ case "query":
104
+ client.defaults.params[securityDecorator.Name] = value;
105
+ break;
106
+ case "cookie":
107
+ var securityDecoratorName = securityDecorator.Name;
108
+ var val = value;
109
+ client.defaults.headers.common["Cookie"] = "".concat(securityDecoratorName, "=").concat(val);
110
+ break;
111
+ default:
112
+ throw new Error("not supported");
113
+ }
114
+ break;
115
+ case "openIdConnect":
116
+ client.defaults.headers.common[securityDecorator.Name] = value;
117
+ break;
118
+ case "oauth2":
119
+ client.defaults.headers.common[securityDecorator.Name] = value;
120
+ break;
121
+ case "http":
122
+ switch (schemeDecorator.SubType) {
123
+ case "basic":
124
+ break;
125
+ case "bearer":
126
+ client.defaults.headers.common[securityDecorator.Name] = value;
127
+ break;
128
+ default:
129
+ throw new Error("not supported");
130
+ }
131
+ break;
132
+ default:
133
+ throw new Error("not supported");
134
+ }
123
135
  return client;
124
136
  }
125
137
  function parseBasicAuthScheme(client, scheme) {
@@ -1,8 +1,15 @@
1
1
  import "reflect-metadata";
2
- import { ParamDecorator } from "./pathparams";
3
2
  export declare class SpeakeasyBase {
4
3
  constructor(payload?: Record<string | symbol, unknown>);
5
4
  }
5
+ export declare class ParamDecorator {
6
+ Style: string;
7
+ Explode: boolean;
8
+ ParamName: string;
9
+ Serialization?: string;
10
+ DateTimeFormat?: string;
11
+ constructor(Style: string, Explode: boolean, ParamName: string, Serialization?: string, DateTimeFormat?: string);
12
+ }
6
13
  export declare function SpeakeasyMetadata<T extends SpeakeasyBase = Record<string | symbol, unknown>>(params?: {
7
14
  data?: string;
8
15
  elemType?: {
@@ -10,10 +17,14 @@ export declare function SpeakeasyMetadata<T extends SpeakeasyBase = Record<strin
10
17
  };
11
18
  elemDepth?: number;
12
19
  }): PropertyDecorator;
13
- export declare function replaceParameters(stringWithParams: string, params: Map<string, string>): string;
20
+ export declare function templateUrl(stringWithParams: string, params: Record<string, string>): string;
14
21
  export declare function generateURL(serverURL: string, path: string, pathParams: any): string;
15
22
  export declare function parseParamDecorator(ann: string, fName: string, defaultStyle: string, defaultExplode: boolean): ParamDecorator;
16
23
  export declare function isStringRecord(obj: any): obj is Record<string, string>;
17
24
  export declare function isNumberRecord(obj: any): obj is Record<string, number>;
18
25
  export declare function isBooleanRecord(obj: any): obj is Record<string, boolean>;
19
26
  export declare function isEmpty(value: any): boolean;
27
+ export declare function convertIfDateObjectToISOString(value: any, dateTimeFormat?: string): any;
28
+ export declare function encodeAndConvertPrimitiveVal(value: any, dateTimeFormat?: string): any;
29
+ export declare function deserializeJSONResponse<T>(value: T, klass?: any, elemDepth?: number): any;
30
+ export declare function getResFieldDepth(res: any): number;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEmpty = exports.isBooleanRecord = exports.isNumberRecord = exports.isStringRecord = exports.parseParamDecorator = exports.generateURL = exports.replaceParameters = exports.SpeakeasyMetadata = exports.SpeakeasyBase = void 0;
3
+ 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";
@@ -83,6 +84,17 @@ var SpeakeasyBase = /** @class */ (function () {
83
84
  return SpeakeasyBase;
84
85
  }());
85
86
  exports.SpeakeasyBase = SpeakeasyBase;
87
+ var ParamDecorator = /** @class */ (function () {
88
+ function ParamDecorator(Style, Explode, ParamName, Serialization, DateTimeFormat) {
89
+ this.Style = Style;
90
+ this.Explode = Explode;
91
+ this.ParamName = ParamName;
92
+ this.Serialization = Serialization;
93
+ this.DateTimeFormat = DateTimeFormat;
94
+ }
95
+ return ParamDecorator;
96
+ }());
97
+ exports.ParamDecorator = ParamDecorator;
86
98
  function SpeakeasyMetadata(params) {
87
99
  return function (target, propertyKey) {
88
100
  if (params === null || params === void 0 ? void 0 : params.data) {
@@ -110,18 +122,19 @@ function SpeakeasyMetadata(params) {
110
122
  };
111
123
  }
112
124
  exports.SpeakeasyMetadata = SpeakeasyMetadata;
113
- function replaceParameters(stringWithParams, params) {
125
+ function templateUrl(stringWithParams, params) {
114
126
  var res = stringWithParams;
115
- params.forEach(function (value, key) {
127
+ Object.entries(params).forEach(function (_a) {
128
+ var key = _a[0], value = _a[1];
116
129
  var match = "{" + key + "}";
117
130
  res = res.replaceAll(match, value);
118
131
  });
119
132
  return res;
120
133
  }
121
- exports.replaceParameters = replaceParameters;
134
+ exports.templateUrl = templateUrl;
122
135
  function generateURL(serverURL, path, pathParams) {
123
136
  var url = serverURL.replace(/\/$/, "") + path;
124
- var parsedParameters = new Map();
137
+ var parsedParameters = {};
125
138
  var fieldNames = Object.getOwnPropertyNames(pathParams);
126
139
  fieldNames.forEach(function (fname) {
127
140
  var ppAnn = Reflect.getMetadata(pathparams_1.ppMetadataKey, pathParams, fname);
@@ -132,18 +145,20 @@ function generateURL(serverURL, path, pathParams) {
132
145
  return;
133
146
  switch (ppDecorator.Style) {
134
147
  case "simple":
135
- var simpleParams = (0, pathparams_1.getSimplePathParams)(ppDecorator.ParamName, pathParams[fname], ppDecorator.Explode);
148
+ var simpleParams = (0, pathparams_1.getSimplePathParams)(ppDecorator.ParamName, pathParams[fname], ppDecorator.Explode, ppDecorator.DateTimeFormat);
136
149
  simpleParams.forEach(function (value, key) {
137
- parsedParameters.set(key, value);
150
+ parsedParameters[key] = value;
138
151
  });
139
152
  }
140
153
  });
141
- return replaceParameters(url, parsedParameters);
154
+ return templateUrl(url, parsedParameters);
142
155
  }
143
156
  exports.generateURL = generateURL;
144
157
  function parseParamDecorator(ann, fName, defaultStyle, defaultExplode) {
145
158
  // style=simple;explode=false;name=apiID
146
- var decorator = new pathparams_1.ParamDecorator(defaultStyle, defaultExplode, fName.toLowerCase());
159
+ var decorator = new ParamDecorator(defaultStyle, defaultExplode, fName.toLowerCase());
160
+ if (ann == null)
161
+ return decorator;
147
162
  ann.split(";").forEach(function (annPart) {
148
163
  var _a = annPart.split("="), paramKey = _a[0], paramVal = _a[1];
149
164
  switch (paramKey) {
@@ -158,6 +173,9 @@ function parseParamDecorator(ann, fName, defaultStyle, defaultExplode) {
158
173
  break;
159
174
  case "serialization":
160
175
  decorator.Serialization = paramVal;
176
+ break;
177
+ case "dateTimeFormat":
178
+ decorator.DateTimeFormat = paramVal;
161
179
  }
162
180
  });
163
181
  return decorator;
@@ -168,8 +186,7 @@ function isStringRecord(obj) {
168
186
  return false;
169
187
  if (Object.getOwnPropertySymbols(obj).length > 0)
170
188
  return false;
171
- return Object.getOwnPropertyNames(obj)
172
- .every(function (prop) { return typeof obj[prop] === "string"; });
189
+ return Object.getOwnPropertyNames(obj).every(function (prop) { return typeof obj[prop] === "string"; });
173
190
  }
174
191
  exports.isStringRecord = isStringRecord;
175
192
  function isNumberRecord(obj) {
@@ -177,8 +194,7 @@ function isNumberRecord(obj) {
177
194
  return false;
178
195
  if (Object.getOwnPropertySymbols(obj).length > 0)
179
196
  return false;
180
- return Object.getOwnPropertyNames(obj)
181
- .every(function (prop) { return typeof obj[prop] === "number"; });
197
+ return Object.getOwnPropertyNames(obj).every(function (prop) { return typeof obj[prop] === "number"; });
182
198
  }
183
199
  exports.isNumberRecord = isNumberRecord;
184
200
  function isBooleanRecord(obj) {
@@ -186,8 +202,7 @@ function isBooleanRecord(obj) {
186
202
  return false;
187
203
  if (Object.getOwnPropertySymbols(obj).length > 0)
188
204
  return false;
189
- return Object.getOwnPropertyNames(obj)
190
- .every(function (prop) { return typeof obj[prop] === "boolean"; });
205
+ return Object.getOwnPropertyNames(obj).every(function (prop) { return typeof obj[prop] === "boolean"; });
191
206
  }
192
207
  exports.isBooleanRecord = isBooleanRecord;
193
208
  function isEmpty(value) {
@@ -200,3 +215,66 @@ function isEmpty(value) {
200
215
  return res || value == null;
201
216
  }
202
217
  exports.isEmpty = isEmpty;
218
+ // If value is Date type, serialize as ISO string since Date constructor creates from system clock
219
+ function convertIfDateObjectToISOString(value, dateTimeFormat) {
220
+ var dtFormat = dateTimeFormat !== null && dateTimeFormat !== void 0 ? dateTimeFormat : "YYYY-MM-DDThh:mm:ss.sssZ";
221
+ if (value instanceof Date) {
222
+ if (dtFormat === "YYYY-MM-DD") {
223
+ var dateRegex = /^(\d{4})-(\d{2})-(\d{2})/;
224
+ var _a = value
225
+ .toISOString()
226
+ .match(dateRegex), _ = _a[0], year = _a[1], month = _a[2], day = _a[3];
227
+ return "".concat(year, "-").concat(month, "-").concat(day);
228
+ }
229
+ if (dtFormat === "YYYY-MM-DDThh:mm:ss.sssZ") {
230
+ return value.toISOString();
231
+ }
232
+ }
233
+ return value;
234
+ }
235
+ exports.convertIfDateObjectToISOString = convertIfDateObjectToISOString;
236
+ function encodeAndConvertPrimitiveVal(value, dateTimeFormat) {
237
+ return encodeURIComponent(convertIfDateObjectToISOString(value, dateTimeFormat));
238
+ }
239
+ exports.encodeAndConvertPrimitiveVal = encodeAndConvertPrimitiveVal;
240
+ function deserializeJSONResponse(value, klass, elemDepth) {
241
+ if (elemDepth === void 0) { elemDepth = 0; }
242
+ if (value !== Object(value)) {
243
+ return value;
244
+ }
245
+ if (elemDepth === 0 && klass != null) {
246
+ return (0, class_transformer_1.plainToInstance)(klass, value, { excludeExtraneousValues: true });
247
+ }
248
+ if (Array.isArray(value)) {
249
+ return value.map(function (v) { return deserializeJSONResponse(v, klass, elemDepth - 1); });
250
+ }
251
+ if (typeof value === 'object' && value != null) {
252
+ var copiedRecord = {};
253
+ for (var key in value) {
254
+ copiedRecord[key] = deserializeJSONResponse(value[key], klass, elemDepth - 1);
255
+ }
256
+ return copiedRecord;
257
+ }
258
+ return (0, class_transformer_1.plainToInstance)(klass, value, { excludeExtraneousValues: true });
259
+ }
260
+ exports.deserializeJSONResponse = deserializeJSONResponse;
261
+ function getResFieldDepth(res) {
262
+ var props = res["__props__"];
263
+ var resFieldDepth = 1;
264
+ if (props) {
265
+ for (var _i = 0, props_2 = props; _i < props_2.length; _i++) {
266
+ var prop = props_2[_i];
267
+ if (res && res.hasOwnProperty(prop.key)) {
268
+ if ((prop.type.name == "Array" || prop.type.name == "Object") &&
269
+ isSpeakeasyBase(prop.elemType)) {
270
+ if (prop.elemDepth > resFieldDepth) {
271
+ resFieldDepth = prop.elemDepth;
272
+ break;
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ return resFieldDepth;
279
+ }
280
+ exports.getResFieldDepth = getResFieldDepth;
@@ -77,11 +77,15 @@ var Dataset = /** @class */ (function () {
77
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 : "";
78
78
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
79
79
  throw new Error("status code not found in response: ".concat(httpRes));
80
- var res = { statusCode: httpRes.status, contentType: contentType };
80
+ var res = new operations.CreateDatasetResponse({
81
+ statusCode: httpRes.status,
82
+ contentType: contentType,
83
+ rawResponse: httpRes
84
+ });
81
85
  switch (true) {
82
86
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
83
87
  if (utils.matchContentType(contentType, "application/json")) {
84
- res.createDataset200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
88
+ res.createDataset200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateDataset200ApplicationJSON);
85
89
  }
86
90
  break;
87
91
  }
@@ -106,11 +110,15 @@ var Dataset = /** @class */ (function () {
106
110
  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 : "";
107
111
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
108
112
  throw new Error("status code not found in response: ".concat(httpRes));
109
- var res = { statusCode: httpRes.status, contentType: contentType };
113
+ var res = new operations.DeleteDatasetByIdResponse({
114
+ statusCode: httpRes.status,
115
+ contentType: contentType,
116
+ rawResponse: httpRes
117
+ });
110
118
  switch (true) {
111
119
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
112
120
  if (utils.matchContentType(contentType, "application/json")) {
113
- res.deleteDatasetById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
121
+ res.deleteDatasetById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteDatasetById200ApplicationJSON);
114
122
  }
115
123
  break;
116
124
  }
@@ -135,11 +143,15 @@ var Dataset = /** @class */ (function () {
135
143
  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 : "";
136
144
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
137
145
  throw new Error("status code not found in response: ".concat(httpRes));
138
- var res = { statusCode: httpRes.status, contentType: contentType };
146
+ var res = new operations.GetDatasetByIdResponse({
147
+ statusCode: httpRes.status,
148
+ contentType: contentType,
149
+ rawResponse: httpRes
150
+ });
139
151
  switch (true) {
140
152
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
141
153
  if (utils.matchContentType(contentType, "application/json")) {
142
- res.getDatasetById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
154
+ res.getDatasetById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetDatasetById200ApplicationJSON);
143
155
  }
144
156
  break;
145
157
  }
@@ -177,11 +189,15 @@ var Dataset = /** @class */ (function () {
177
189
  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 : "";
178
190
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
179
191
  throw new Error("status code not found in response: ".concat(httpRes));
180
- var res = { statusCode: httpRes.status, contentType: contentType };
192
+ var res = new operations.UploadDatasetImageResponse({
193
+ statusCode: httpRes.status,
194
+ contentType: contentType,
195
+ rawResponse: httpRes
196
+ });
181
197
  switch (true) {
182
198
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
183
199
  if (utils.matchContentType(contentType, "application/json")) {
184
- res.uploadDatasetImage200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
200
+ res.uploadDatasetImage200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImage200ApplicationJSON);
185
201
  }
186
202
  break;
187
203
  }
@@ -219,11 +235,15 @@ var Dataset = /** @class */ (function () {
219
235
  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 : "";
220
236
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
221
237
  throw new Error("status code not found in response: ".concat(httpRes));
222
- var res = { statusCode: httpRes.status, contentType: contentType };
238
+ var res = new operations.UploadDatasetImageFromGenResponse({
239
+ statusCode: httpRes.status,
240
+ contentType: contentType,
241
+ rawResponse: httpRes
242
+ });
223
243
  switch (true) {
224
244
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
225
245
  if (utils.matchContentType(contentType, "application/json")) {
226
- res.uploadDatasetImageFromGen200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
246
+ res.uploadDatasetImageFromGen200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImageFromGen200ApplicationJSON);
227
247
  }
228
248
  break;
229
249
  }
@@ -77,11 +77,15 @@ var Generation = /** @class */ (function () {
77
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 : "";
78
78
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
79
79
  throw new Error("status code not found in response: ".concat(httpRes));
80
- var res = { statusCode: httpRes.status, contentType: contentType };
80
+ var res = new operations.CreateGenerationResponse({
81
+ statusCode: httpRes.status,
82
+ contentType: contentType,
83
+ rawResponse: httpRes
84
+ });
81
85
  switch (true) {
82
86
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
83
87
  if (utils.matchContentType(contentType, "application/json")) {
84
- res.createGeneration200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
88
+ res.createGeneration200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateGeneration200ApplicationJSON);
85
89
  }
86
90
  break;
87
91
  }
@@ -106,11 +110,15 @@ var Generation = /** @class */ (function () {
106
110
  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 : "";
107
111
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
108
112
  throw new Error("status code not found in response: ".concat(httpRes));
109
- var res = { statusCode: httpRes.status, contentType: contentType };
113
+ var res = new operations.DeleteGenerationByIdResponse({
114
+ statusCode: httpRes.status,
115
+ contentType: contentType,
116
+ rawResponse: httpRes
117
+ });
110
118
  switch (true) {
111
119
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
112
120
  if (utils.matchContentType(contentType, "application/json")) {
113
- res.deleteGenerationById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
121
+ res.deleteGenerationById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteGenerationById200ApplicationJSON);
114
122
  }
115
123
  break;
116
124
  }
@@ -135,11 +143,15 @@ var Generation = /** @class */ (function () {
135
143
  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 : "";
136
144
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
137
145
  throw new Error("status code not found in response: ".concat(httpRes));
138
- var res = { statusCode: httpRes.status, contentType: contentType };
146
+ var res = new operations.GetGenerationByIdResponse({
147
+ statusCode: httpRes.status,
148
+ contentType: contentType,
149
+ rawResponse: httpRes
150
+ });
139
151
  switch (true) {
140
152
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
141
153
  if (utils.matchContentType(contentType, "application/json")) {
142
- res.getGenerationById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
154
+ res.getGenerationById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationById200ApplicationJSON);
143
155
  }
144
156
  break;
145
157
  }
@@ -158,19 +170,22 @@ var Generation = /** @class */ (function () {
158
170
  var baseURL = this._serverURL;
159
171
  var url = utils.generateURL(baseURL, "/generations/user/{userId}", req.pathParams);
160
172
  var client = this._securityClient;
161
- var qpSerializer = utils.getQueryParamSerializer(req.queryParams);
162
- var requestConfig = __assign(__assign({}, config), { params: req.queryParams, paramsSerializer: qpSerializer });
163
- var r = client.request(__assign({ url: url, method: "get" }, requestConfig));
173
+ var queryParams = utils.serializeQueryParams(req.queryParams);
174
+ var r = client.request(__assign({ url: url + queryParams, method: "get" }, config));
164
175
  return r.then(function (httpRes) {
165
176
  var _a, _b;
166
177
  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
178
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
168
179
  throw new Error("status code not found in response: ".concat(httpRes));
169
- var res = { statusCode: httpRes.status, contentType: contentType };
180
+ var res = new operations.GetGenerationsByUserIdResponse({
181
+ statusCode: httpRes.status,
182
+ contentType: contentType,
183
+ rawResponse: httpRes
184
+ });
170
185
  switch (true) {
171
186
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
172
187
  if (utils.matchContentType(contentType, "application/json")) {
173
- res.getGenerationsByUserId200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
188
+ res.getGenerationsByUserId200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationsByUserId200ApplicationJSON);
174
189
  }
175
190
  break;
176
191
  }
@@ -64,11 +64,15 @@ var InitImage = /** @class */ (function () {
64
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 : "";
65
65
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
66
66
  throw new Error("status code not found in response: ".concat(httpRes));
67
- var res = { statusCode: httpRes.status, contentType: contentType };
67
+ var res = new operations.DeleteInitImageByIdResponse({
68
+ statusCode: httpRes.status,
69
+ contentType: contentType,
70
+ rawResponse: httpRes
71
+ });
68
72
  switch (true) {
69
73
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
70
74
  if (utils.matchContentType(contentType, "application/json")) {
71
- res.deleteInitImageById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
75
+ res.deleteInitImageById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteInitImageById200ApplicationJSON);
72
76
  }
73
77
  break;
74
78
  }
@@ -93,11 +97,15 @@ var InitImage = /** @class */ (function () {
93
97
  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 : "";
94
98
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
95
99
  throw new Error("status code not found in response: ".concat(httpRes));
96
- var res = { statusCode: httpRes.status, contentType: contentType };
100
+ var res = new operations.GetInitImageByIdResponse({
101
+ statusCode: httpRes.status,
102
+ contentType: contentType,
103
+ rawResponse: httpRes
104
+ });
97
105
  switch (true) {
98
106
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
99
107
  if (utils.matchContentType(contentType, "application/json")) {
100
- res.getInitImageById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
108
+ res.getInitImageById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetInitImageById200ApplicationJSON);
101
109
  }
102
110
  break;
103
111
  }
@@ -135,11 +143,15 @@ var InitImage = /** @class */ (function () {
135
143
  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 : "";
136
144
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
137
145
  throw new Error("status code not found in response: ".concat(httpRes));
138
- var res = { statusCode: httpRes.status, contentType: contentType };
146
+ var res = new operations.UploadInitImageResponse({
147
+ statusCode: httpRes.status,
148
+ contentType: contentType,
149
+ rawResponse: httpRes
150
+ });
139
151
  switch (true) {
140
152
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
141
153
  if (utils.matchContentType(contentType, "application/json")) {
142
- res.uploadInitImage200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
154
+ res.uploadInitImage200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadInitImage200ApplicationJSON);
143
155
  }
144
156
  break;
145
157
  }
package/dist/sdk/model.js CHANGED
@@ -77,11 +77,15 @@ var Model = /** @class */ (function () {
77
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 : "";
78
78
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
79
79
  throw new Error("status code not found in response: ".concat(httpRes));
80
- var res = { statusCode: httpRes.status, contentType: contentType };
80
+ var res = new operations.CreateModelResponse({
81
+ statusCode: httpRes.status,
82
+ contentType: contentType,
83
+ rawResponse: httpRes
84
+ });
81
85
  switch (true) {
82
86
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
83
87
  if (utils.matchContentType(contentType, "application/json")) {
84
- res.createModel200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
88
+ res.createModel200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateModel200ApplicationJSON);
85
89
  }
86
90
  break;
87
91
  }
@@ -106,11 +110,15 @@ var Model = /** @class */ (function () {
106
110
  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 : "";
107
111
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
108
112
  throw new Error("status code not found in response: ".concat(httpRes));
109
- var res = { statusCode: httpRes.status, contentType: contentType };
113
+ var res = new operations.DeleteModelByIdResponse({
114
+ statusCode: httpRes.status,
115
+ contentType: contentType,
116
+ rawResponse: httpRes
117
+ });
110
118
  switch (true) {
111
119
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
112
120
  if (utils.matchContentType(contentType, "application/json")) {
113
- res.deleteModelById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
121
+ res.deleteModelById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteModelById200ApplicationJSON);
114
122
  }
115
123
  break;
116
124
  }
@@ -135,11 +143,15 @@ var Model = /** @class */ (function () {
135
143
  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 : "";
136
144
  if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
137
145
  throw new Error("status code not found in response: ".concat(httpRes));
138
- var res = { statusCode: httpRes.status, contentType: contentType };
146
+ var res = new operations.GetModelByIdResponse({
147
+ statusCode: httpRes.status,
148
+ contentType: contentType,
149
+ rawResponse: httpRes
150
+ });
139
151
  switch (true) {
140
152
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
141
153
  if (utils.matchContentType(contentType, "application/json")) {
142
- res.getModelById200ApplicationJSONObject = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
154
+ res.getModelById200ApplicationJSONObject = utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetModelById200ApplicationJSON);
143
155
  }
144
156
  break;
145
157
  }