@leonardo-ai/sdk 1.28.1 → 1.36.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 (56) hide show
  1. package/README.md +1 -1
  2. package/dist/internal/utils/queryparams.js +5 -5
  3. package/dist/internal/utils/security.js +1 -1
  4. package/dist/internal/utils/utils.d.ts +1 -0
  5. package/dist/internal/utils/utils.js +6 -2
  6. package/dist/sdk/dataset.d.ts +8 -12
  7. package/dist/sdk/dataset.js +49 -41
  8. package/dist/sdk/generation.d.ts +7 -11
  9. package/dist/sdk/generation.js +43 -37
  10. package/dist/sdk/initimage.d.ts +6 -10
  11. package/dist/sdk/initimage.js +28 -25
  12. package/dist/sdk/model.d.ts +6 -10
  13. package/dist/sdk/model.js +28 -25
  14. package/dist/sdk/models/operations/creategeneration.d.ts +4 -4
  15. package/dist/sdk/models/operations/createmodel.d.ts +3 -3
  16. package/dist/sdk/models/operations/getdatasetbyid.js +1 -3
  17. package/dist/sdk/models/operations/getgenerationbyid.d.ts +6 -6
  18. package/dist/sdk/models/operations/getgenerationbyid.js +1 -3
  19. package/dist/sdk/models/operations/getgenerationsbyuserid.d.ts +7 -7
  20. package/dist/sdk/models/operations/getgenerationsbyuserid.js +6 -12
  21. package/dist/sdk/models/operations/getmodelbyid.d.ts +3 -3
  22. package/dist/sdk/models/operations/getvariationbyid.d.ts +2 -2
  23. package/dist/sdk/models/operations/uploaddatasetimage.js +1 -3
  24. package/dist/sdk/models/operations/uploaddatasetimagefromgen.js +1 -3
  25. package/dist/sdk/models/shared/{controlnettypeenum.d.ts → controlnettype.d.ts} +1 -1
  26. package/dist/sdk/models/shared/controlnettype.js +15 -0
  27. package/dist/sdk/models/shared/{custommodeltypeenum.d.ts → custommodeltype.d.ts} +1 -1
  28. package/dist/sdk/models/shared/custommodeltype.js +26 -0
  29. package/dist/sdk/models/shared/index.d.ts +8 -8
  30. package/dist/sdk/models/shared/index.js +8 -8
  31. package/dist/sdk/models/shared/{jobstatusenum.d.ts → jobstatus.d.ts} +1 -1
  32. package/dist/sdk/models/shared/jobstatus.js +15 -0
  33. package/dist/sdk/models/shared/{sdgenerationschedulersenum.d.ts → sdgenerationschedulers.d.ts} +1 -1
  34. package/dist/sdk/models/shared/sdgenerationschedulers.js +18 -0
  35. package/dist/sdk/models/shared/{sdgenerationstyleenum.d.ts → sdgenerationstyle.d.ts} +1 -1
  36. package/dist/sdk/models/shared/sdgenerationstyle.js +14 -0
  37. package/dist/sdk/models/shared/{sdversionsenum.d.ts → sdversions.d.ts} +1 -1
  38. package/dist/sdk/models/shared/{sdversionsenum.js → sdversions.js} +6 -6
  39. package/dist/sdk/models/shared/{strengthenum.d.ts → strength.d.ts} +1 -1
  40. package/dist/sdk/models/shared/strength.js +16 -0
  41. package/dist/sdk/models/shared/{variationtypeenum.d.ts → variationtype.d.ts} +1 -1
  42. package/dist/sdk/models/shared/variationtype.js +17 -0
  43. package/dist/sdk/sdk.d.ts +15 -7
  44. package/dist/sdk/sdk.js +32 -18
  45. package/dist/sdk/user.d.ts +5 -9
  46. package/dist/sdk/user.js +10 -12
  47. package/dist/sdk/variation.d.ts +5 -9
  48. package/dist/sdk/variation.js +18 -19
  49. package/package.json +3 -1
  50. package/dist/sdk/models/shared/controlnettypeenum.js +0 -15
  51. package/dist/sdk/models/shared/custommodeltypeenum.js +0 -26
  52. package/dist/sdk/models/shared/jobstatusenum.js +0 -15
  53. package/dist/sdk/models/shared/sdgenerationschedulersenum.js +0 -18
  54. package/dist/sdk/models/shared/sdgenerationstyleenum.js +0 -14
  55. package/dist/sdk/models/shared/strengthenum.js +0 -16
  56. package/dist/sdk/models/shared/variationtypeenum.js +0 -17
package/README.md CHANGED
@@ -35,7 +35,7 @@ import { CreateDatasetResponse } from "@leonardo-ai/sdk/dist/sdk/models/operatio
35
35
 
36
36
  const sdk = new Leonardo({
37
37
  security: {
38
- bearerAuth: "Bearer YOUR_BEARER_TOKEN_HERE",
38
+ bearerAuth: "YOUR_BEARER_TOKEN_HERE",
39
39
  },
40
40
  });
41
41
 
@@ -72,7 +72,7 @@ function noExplodeSerializer(params, delimiter) {
72
72
  var query = [];
73
73
  Object.entries(Object.assign({}, params)).forEach(function (_a) {
74
74
  var key = _a[0], value = _a[1];
75
- if (!value)
75
+ if (!(0, utils_1.shouldQueryParamSerialize)(value))
76
76
  return;
77
77
  if (value !== Object(value))
78
78
  query.push("".concat(key, "=").concat(encodeURIComponent((0, utils_1.valToString)(value))));
@@ -87,9 +87,9 @@ function noExplodeSerializer(params, delimiter) {
87
87
  var qpDecorator = (0, utils_1.parseParamDecorator)(qpAnn, paramKey, "form", true);
88
88
  if (qpDecorator == null)
89
89
  return;
90
- return "".concat(paramKey, ",").concat((0, utils_1.valToString)(value[paramKey]));
90
+ return "".concat(paramKey).concat(delimiter).concat((0, utils_1.valToString)(value[paramKey]));
91
91
  })
92
- .join(",");
92
+ .join(delimiter);
93
93
  query.push("".concat(key, "=").concat(encodeURIComponent(values)));
94
94
  }
95
95
  });
@@ -100,7 +100,7 @@ function formSerializerExplode(params) {
100
100
  var query = [];
101
101
  Object.entries(Object.assign({}, params)).forEach(function (_a) {
102
102
  var key = _a[0], value = _a[1];
103
- if (!value)
103
+ if (!(0, utils_1.shouldQueryParamSerialize)(value))
104
104
  return;
105
105
  if (value !== Object(value))
106
106
  query.push("".concat(key, "=").concat(encodeURIComponent(value)));
@@ -127,7 +127,7 @@ function deepObjectSerializer(params) {
127
127
  var query = [];
128
128
  Object.entries(Object.assign({}, params)).forEach(function (_a) {
129
129
  var key = _a[0], value = _a[1];
130
- if (!value)
130
+ if (!(0, utils_1.shouldQueryParamSerialize)(value))
131
131
  return;
132
132
  if (value !== Object(value))
133
133
  query.push("".concat(key, "=").concat(encodeURIComponent(value)));
@@ -127,7 +127,7 @@ function parseSecuritySchemeValue(client, schemeDecorator, securityDecorator, va
127
127
  case "basic":
128
128
  break;
129
129
  case "bearer":
130
- client.defaults.headers.common[securityDecorator.Name] = value;
130
+ client.defaults.headers.common[securityDecorator.Name] = value.toLowerCase().startsWith("bearer ") ? value : "Bearer ".concat(value);
131
131
  break;
132
132
  default:
133
133
  throw new Error("not supported");
@@ -34,3 +34,4 @@ export declare function objectToClass<T>(value: T, klass?: any, elemDepth?: numb
34
34
  export declare function getResFieldDepth(res: any): number;
35
35
  export declare function populateFromGlobals(value: any, fieldName: string, paramType: string, globals: any): any;
36
36
  export declare function valToString(value: any): string;
37
+ export declare function shouldQueryParamSerialize(value: any): boolean;
@@ -3,7 +3,7 @@
3
3
  * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.valToString = exports.populateFromGlobals = exports.getResFieldDepth = exports.objectToClass = exports.isEmpty = exports.isBooleanRecord = exports.isNumberRecord = exports.isStringRecord = exports.parseParamDecorator = exports.generateURL = exports.templateUrl = exports.SpeakeasyMetadata = exports.ParamDecorator = exports.SpeakeasyBase = exports.SerializationMethodToContentType = void 0;
6
+ exports.shouldQueryParamSerialize = exports.valToString = exports.populateFromGlobals = exports.getResFieldDepth = exports.objectToClass = exports.isEmpty = exports.isBooleanRecord = exports.isNumberRecord = exports.isStringRecord = exports.parseParamDecorator = exports.generateURL = exports.templateUrl = exports.SpeakeasyMetadata = exports.ParamDecorator = exports.SpeakeasyBase = exports.SerializationMethodToContentType = void 0;
7
7
  require("reflect-metadata");
8
8
  var pathparams_1 = require("./pathparams");
9
9
  var class_transformer_1 = require("class-transformer");
@@ -18,7 +18,7 @@ exports.SerializationMethodToContentType = {
18
18
  };
19
19
  function isSpeakeasyBase(type) {
20
20
  var _a;
21
- return type && ((_a = Object.getPrototypeOf(type)) === null || _a === void 0 ? void 0 : _a.name) == "SpeakeasyBase";
21
+ return type && ((_a = Object.getPrototypeOf(type)) === null || _a === void 0 ? void 0 : _a.name) == SpeakeasyBase.name;
22
22
  }
23
23
  function handleArray(value, elemType, elemDepth) {
24
24
  if (!Array.isArray(value)) {
@@ -315,3 +315,7 @@ function valToString(value) {
315
315
  return value.toString();
316
316
  }
317
317
  exports.valToString = valToString;
318
+ function shouldQueryParamSerialize(value) {
319
+ return !(value === undefined || value === null || value === "");
320
+ }
321
+ exports.shouldQueryParamSerialize = shouldQueryParamSerialize;
@@ -1,13 +1,9 @@
1
1
  import * as operations from "./models/operations";
2
- import { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ import { SDKConfiguration } from "./sdk";
3
+ import { AxiosRequestConfig } from "axios";
3
4
  export declare class Dataset {
4
- _defaultClient: AxiosInstance;
5
- _securityClient: AxiosInstance;
6
- _serverURL: string;
7
- _language: string;
8
- _sdkVersion: string;
9
- _genVersion: string;
10
- constructor(defaultClient: AxiosInstance, securityClient: AxiosInstance, serverURL: string, language: string, sdkVersion: string, genVersion: string);
5
+ private sdkConfiguration;
6
+ constructor(sdkConfig: SDKConfiguration);
11
7
  /**
12
8
  * Create a Dataset
13
9
  *
@@ -21,26 +17,26 @@ export declare class Dataset {
21
17
  * @remarks
22
18
  * This endpoint deletes the specific dataset
23
19
  */
24
- deleteDatasetById(req: operations.DeleteDatasetByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteDatasetByIdResponse>;
20
+ deleteDatasetById(id: string, config?: AxiosRequestConfig): Promise<operations.DeleteDatasetByIdResponse>;
25
21
  /**
26
22
  * Get a Single Dataset by ID
27
23
  *
28
24
  * @remarks
29
25
  * This endpoint gets the specific dataset
30
26
  */
31
- getDatasetById(req: operations.GetDatasetByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetDatasetByIdResponse>;
27
+ getDatasetById(id: string, config?: AxiosRequestConfig): Promise<operations.GetDatasetByIdResponse>;
32
28
  /**
33
29
  * Upload dataset image
34
30
  *
35
31
  * @remarks
36
32
  * This endpoint returns presigned details to upload a dataset image to S3
37
33
  */
38
- uploadDatasetImage(req: operations.UploadDatasetImageRequest, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageResponse>;
34
+ uploadDatasetImage(requestBody: operations.UploadDatasetImageRequestBody, datasetId: string, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageResponse>;
39
35
  /**
40
36
  * Upload a Single Generated Image to a Dataset
41
37
  *
42
38
  * @remarks
43
39
  * This endpoint will upload a previously generated image to the dataset
44
40
  */
45
- uploadDatasetImageFromGen(req: operations.UploadDatasetImageFromGenRequest, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageFromGenResponse>;
41
+ uploadDatasetImageFromGen(requestBody: operations.UploadDatasetImageFromGenRequestBody, datasetId: string, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageFromGenResponse>;
46
42
  }
@@ -77,13 +77,8 @@ exports.Dataset = void 0;
77
77
  var utils = __importStar(require("../internal/utils"));
78
78
  var operations = __importStar(require("./models/operations"));
79
79
  var Dataset = /** @class */ (function () {
80
- function Dataset(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
81
- this._defaultClient = defaultClient;
82
- this._securityClient = securityClient;
83
- this._serverURL = serverURL;
84
- this._language = language;
85
- this._sdkVersion = sdkVersion;
86
- this._genVersion = genVersion;
80
+ function Dataset(sdkConfig) {
81
+ this.sdkConfiguration = sdkConfig;
87
82
  }
88
83
  /**
89
84
  * Create a Dataset
@@ -102,7 +97,7 @@ var Dataset = /** @class */ (function () {
102
97
  if (!(req instanceof utils.SpeakeasyBase)) {
103
98
  req = new operations.CreateDatasetRequestBody(req);
104
99
  }
105
- baseURL = this._serverURL;
100
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
106
101
  url = baseURL.replace(/\/$/, "") + "/datasets";
107
102
  _c = [{}, {}], reqBodyHeaders = _c[0], reqBody = _c[1];
108
103
  try {
@@ -113,10 +108,12 @@ var Dataset = /** @class */ (function () {
113
108
  throw new Error("Error serializing request body, cause: ".concat(e.message));
114
109
  }
115
110
  }
116
- client = this._securityClient || this._defaultClient;
111
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
117
112
  headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
118
113
  if (reqBody == null || Object.keys(reqBody).length === 0)
119
114
  throw new Error("request body is required");
115
+ headers["Accept"] = "application/json";
116
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
120
117
  return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, data: reqBody }, config))];
121
118
  case 1:
122
119
  httpRes = _e.sent();
@@ -147,20 +144,23 @@ var Dataset = /** @class */ (function () {
147
144
  * @remarks
148
145
  * This endpoint deletes the specific dataset
149
146
  */
150
- Dataset.prototype.deleteDatasetById = function (req, config) {
147
+ Dataset.prototype.deleteDatasetById = function (id, config) {
151
148
  var _a, _b;
152
149
  return __awaiter(this, void 0, void 0, function () {
153
- var baseURL, url, client, httpRes, contentType, res;
150
+ var req, baseURL, url, client, headers, httpRes, contentType, res;
154
151
  return __generator(this, function (_c) {
155
152
  switch (_c.label) {
156
153
  case 0:
157
- if (!(req instanceof utils.SpeakeasyBase)) {
158
- req = new operations.DeleteDatasetByIdRequest(req);
159
- }
160
- baseURL = this._serverURL;
154
+ req = new operations.DeleteDatasetByIdRequest({
155
+ id: id,
156
+ });
157
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
161
158
  url = utils.generateURL(baseURL, "/datasets/{id}", req);
162
- client = this._securityClient || this._defaultClient;
163
- return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "delete" }, config))];
159
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
160
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
161
+ headers["Accept"] = "application/json";
162
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
163
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "delete", headers: headers }, config))];
164
164
  case 1:
165
165
  httpRes = _c.sent();
166
166
  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 : "";
@@ -190,20 +190,23 @@ var Dataset = /** @class */ (function () {
190
190
  * @remarks
191
191
  * This endpoint gets the specific dataset
192
192
  */
193
- Dataset.prototype.getDatasetById = function (req, config) {
193
+ Dataset.prototype.getDatasetById = function (id, config) {
194
194
  var _a, _b;
195
195
  return __awaiter(this, void 0, void 0, function () {
196
- var baseURL, url, client, httpRes, contentType, res;
196
+ var req, baseURL, url, client, headers, httpRes, contentType, res;
197
197
  return __generator(this, function (_c) {
198
198
  switch (_c.label) {
199
199
  case 0:
200
- if (!(req instanceof utils.SpeakeasyBase)) {
201
- req = new operations.GetDatasetByIdRequest(req);
202
- }
203
- baseURL = this._serverURL;
200
+ req = new operations.GetDatasetByIdRequest({
201
+ id: id,
202
+ });
203
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
204
204
  url = utils.generateURL(baseURL, "/datasets/{id}", req);
205
- client = this._securityClient || this._defaultClient;
206
- return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get" }, config))];
205
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
206
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
207
+ headers["Accept"] = "application/json";
208
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
209
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers }, config))];
207
210
  case 1:
208
211
  httpRes = _c.sent();
209
212
  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 : "";
@@ -233,18 +236,19 @@ var Dataset = /** @class */ (function () {
233
236
  * @remarks
234
237
  * This endpoint returns presigned details to upload a dataset image to S3
235
238
  */
236
- Dataset.prototype.uploadDatasetImage = function (req, config) {
239
+ Dataset.prototype.uploadDatasetImage = function (requestBody, datasetId, config) {
237
240
  var _a, _b;
238
241
  return __awaiter(this, void 0, void 0, function () {
239
- var baseURL, url, _c, reqBodyHeaders, reqBody, client, headers, httpRes, contentType, res;
242
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, headers, httpRes, contentType, res;
240
243
  var _d;
241
244
  return __generator(this, function (_e) {
242
245
  switch (_e.label) {
243
246
  case 0:
244
- if (!(req instanceof utils.SpeakeasyBase)) {
245
- req = new operations.UploadDatasetImageRequest(req);
246
- }
247
- baseURL = this._serverURL;
247
+ req = new operations.UploadDatasetImageRequest({
248
+ requestBody: requestBody,
249
+ datasetId: datasetId,
250
+ });
251
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
248
252
  url = utils.generateURL(baseURL, "/datasets/{datasetId}/upload", req);
249
253
  _c = [{}, {}], reqBodyHeaders = _c[0], reqBody = _c[1];
250
254
  try {
@@ -255,10 +259,12 @@ var Dataset = /** @class */ (function () {
255
259
  throw new Error("Error serializing request body, cause: ".concat(e.message));
256
260
  }
257
261
  }
258
- client = this._securityClient || this._defaultClient;
262
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
259
263
  headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
260
264
  if (reqBody == null || Object.keys(reqBody).length === 0)
261
265
  throw new Error("request body is required");
266
+ headers["Accept"] = "application/json";
267
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
262
268
  return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, data: reqBody }, config))];
263
269
  case 1:
264
270
  httpRes = _e.sent();
@@ -289,18 +295,19 @@ var Dataset = /** @class */ (function () {
289
295
  * @remarks
290
296
  * This endpoint will upload a previously generated image to the dataset
291
297
  */
292
- Dataset.prototype.uploadDatasetImageFromGen = function (req, config) {
298
+ Dataset.prototype.uploadDatasetImageFromGen = function (requestBody, datasetId, config) {
293
299
  var _a, _b;
294
300
  return __awaiter(this, void 0, void 0, function () {
295
- var baseURL, url, _c, reqBodyHeaders, reqBody, client, headers, httpRes, contentType, res;
301
+ var req, baseURL, url, _c, reqBodyHeaders, reqBody, client, headers, httpRes, contentType, res;
296
302
  var _d;
297
303
  return __generator(this, function (_e) {
298
304
  switch (_e.label) {
299
305
  case 0:
300
- if (!(req instanceof utils.SpeakeasyBase)) {
301
- req = new operations.UploadDatasetImageFromGenRequest(req);
302
- }
303
- baseURL = this._serverURL;
306
+ req = new operations.UploadDatasetImageFromGenRequest({
307
+ requestBody: requestBody,
308
+ datasetId: datasetId,
309
+ });
310
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
304
311
  url = utils.generateURL(baseURL, "/datasets/{datasetId}/upload/gen", req);
305
312
  _c = [{}, {}], reqBodyHeaders = _c[0], reqBody = _c[1];
306
313
  try {
@@ -311,10 +318,12 @@ var Dataset = /** @class */ (function () {
311
318
  throw new Error("Error serializing request body, cause: ".concat(e.message));
312
319
  }
313
320
  }
314
- client = this._securityClient || this._defaultClient;
321
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
315
322
  headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
316
323
  if (reqBody == null || Object.keys(reqBody).length === 0)
317
324
  throw new Error("request body is required");
325
+ headers["Accept"] = "application/json";
326
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
318
327
  return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, data: reqBody }, config))];
319
328
  case 1:
320
329
  httpRes = _e.sent();
@@ -330,8 +339,7 @@ var Dataset = /** @class */ (function () {
330
339
  switch (true) {
331
340
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
332
341
  if (utils.matchContentType(contentType, "application/json")) {
333
- res.uploadDatasetImageFromGen200ApplicationJSONObject =
334
- utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImageFromGen200ApplicationJSON);
342
+ res.uploadDatasetImageFromGen200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImageFromGen200ApplicationJSON);
335
343
  }
336
344
  break;
337
345
  }
@@ -1,13 +1,9 @@
1
1
  import * as operations from "./models/operations";
2
- import { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ import { SDKConfiguration } from "./sdk";
3
+ import { AxiosRequestConfig } from "axios";
3
4
  export declare class Generation {
4
- _defaultClient: AxiosInstance;
5
- _securityClient: AxiosInstance;
6
- _serverURL: string;
7
- _language: string;
8
- _sdkVersion: string;
9
- _genVersion: string;
10
- constructor(defaultClient: AxiosInstance, securityClient: AxiosInstance, serverURL: string, language: string, sdkVersion: string, genVersion: string);
5
+ private sdkConfiguration;
6
+ constructor(sdkConfig: SDKConfiguration);
11
7
  /**
12
8
  * Create a Generation of Images
13
9
  *
@@ -21,19 +17,19 @@ export declare class Generation {
21
17
  * @remarks
22
18
  * This endpoint deletes a specific generation
23
19
  */
24
- deleteGenerationById(req: operations.DeleteGenerationByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteGenerationByIdResponse>;
20
+ deleteGenerationById(id: string, config?: AxiosRequestConfig): Promise<operations.DeleteGenerationByIdResponse>;
25
21
  /**
26
22
  * Get a Single Generation
27
23
  *
28
24
  * @remarks
29
25
  * This endpoint will provide information about a specific generation
30
26
  */
31
- getGenerationById(req: operations.GetGenerationByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetGenerationByIdResponse>;
27
+ getGenerationById(id: string, config?: AxiosRequestConfig): Promise<operations.GetGenerationByIdResponse>;
32
28
  /**
33
29
  * Get generations by user ID
34
30
  *
35
31
  * @remarks
36
32
  * This endpoint returns all generations by a specific user
37
33
  */
38
- getGenerationsByUserId(req: operations.GetGenerationsByUserIdRequest, config?: AxiosRequestConfig): Promise<operations.GetGenerationsByUserIdResponse>;
34
+ getGenerationsByUserId(userId: string, limit?: number, offset?: number, config?: AxiosRequestConfig): Promise<operations.GetGenerationsByUserIdResponse>;
39
35
  }
@@ -77,13 +77,8 @@ exports.Generation = void 0;
77
77
  var utils = __importStar(require("../internal/utils"));
78
78
  var operations = __importStar(require("./models/operations"));
79
79
  var Generation = /** @class */ (function () {
80
- function Generation(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
81
- this._defaultClient = defaultClient;
82
- this._securityClient = securityClient;
83
- this._serverURL = serverURL;
84
- this._language = language;
85
- this._sdkVersion = sdkVersion;
86
- this._genVersion = genVersion;
80
+ function Generation(sdkConfig) {
81
+ this.sdkConfiguration = sdkConfig;
87
82
  }
88
83
  /**
89
84
  * Create a Generation of Images
@@ -102,7 +97,7 @@ var Generation = /** @class */ (function () {
102
97
  if (!(req instanceof utils.SpeakeasyBase)) {
103
98
  req = new operations.CreateGenerationRequestBody(req);
104
99
  }
105
- baseURL = this._serverURL;
100
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
106
101
  url = baseURL.replace(/\/$/, "") + "/generations";
107
102
  _c = [{}, {}], reqBodyHeaders = _c[0], reqBody = _c[1];
108
103
  try {
@@ -113,10 +108,12 @@ var Generation = /** @class */ (function () {
113
108
  throw new Error("Error serializing request body, cause: ".concat(e.message));
114
109
  }
115
110
  }
116
- client = this._securityClient || this._defaultClient;
111
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
117
112
  headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
118
113
  if (reqBody == null || Object.keys(reqBody).length === 0)
119
114
  throw new Error("request body is required");
115
+ headers["Accept"] = "application/json";
116
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
120
117
  return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, data: reqBody }, config))];
121
118
  case 1:
122
119
  httpRes = _e.sent();
@@ -147,20 +144,23 @@ var Generation = /** @class */ (function () {
147
144
  * @remarks
148
145
  * This endpoint deletes a specific generation
149
146
  */
150
- Generation.prototype.deleteGenerationById = function (req, config) {
147
+ Generation.prototype.deleteGenerationById = function (id, config) {
151
148
  var _a, _b;
152
149
  return __awaiter(this, void 0, void 0, function () {
153
- var baseURL, url, client, httpRes, contentType, res;
150
+ var req, baseURL, url, client, headers, httpRes, contentType, res;
154
151
  return __generator(this, function (_c) {
155
152
  switch (_c.label) {
156
153
  case 0:
157
- if (!(req instanceof utils.SpeakeasyBase)) {
158
- req = new operations.DeleteGenerationByIdRequest(req);
159
- }
160
- baseURL = this._serverURL;
154
+ req = new operations.DeleteGenerationByIdRequest({
155
+ id: id,
156
+ });
157
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
161
158
  url = utils.generateURL(baseURL, "/generations/{id}", req);
162
- client = this._securityClient || this._defaultClient;
163
- return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "delete" }, config))];
159
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
160
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
161
+ headers["Accept"] = "application/json";
162
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
163
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "delete", headers: headers }, config))];
164
164
  case 1:
165
165
  httpRes = _c.sent();
166
166
  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 : "";
@@ -175,8 +175,7 @@ var Generation = /** @class */ (function () {
175
175
  switch (true) {
176
176
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
177
177
  if (utils.matchContentType(contentType, "application/json")) {
178
- res.deleteGenerationById200ApplicationJSONObject =
179
- utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteGenerationById200ApplicationJSON);
178
+ res.deleteGenerationById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteGenerationById200ApplicationJSON);
180
179
  }
181
180
  break;
182
181
  }
@@ -191,20 +190,23 @@ var Generation = /** @class */ (function () {
191
190
  * @remarks
192
191
  * This endpoint will provide information about a specific generation
193
192
  */
194
- Generation.prototype.getGenerationById = function (req, config) {
193
+ Generation.prototype.getGenerationById = function (id, config) {
195
194
  var _a, _b;
196
195
  return __awaiter(this, void 0, void 0, function () {
197
- var baseURL, url, client, httpRes, contentType, res;
196
+ var req, baseURL, url, client, headers, httpRes, contentType, res;
198
197
  return __generator(this, function (_c) {
199
198
  switch (_c.label) {
200
199
  case 0:
201
- if (!(req instanceof utils.SpeakeasyBase)) {
202
- req = new operations.GetGenerationByIdRequest(req);
203
- }
204
- baseURL = this._serverURL;
200
+ req = new operations.GetGenerationByIdRequest({
201
+ id: id,
202
+ });
203
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
205
204
  url = utils.generateURL(baseURL, "/generations/{id}", req);
206
- client = this._securityClient || this._defaultClient;
207
- return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get" }, config))];
205
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
206
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
207
+ headers["Accept"] = "application/json";
208
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
209
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers }, config))];
208
210
  case 1:
209
211
  httpRes = _c.sent();
210
212
  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 : "";
@@ -234,21 +236,26 @@ var Generation = /** @class */ (function () {
234
236
  * @remarks
235
237
  * This endpoint returns all generations by a specific user
236
238
  */
237
- Generation.prototype.getGenerationsByUserId = function (req, config) {
239
+ Generation.prototype.getGenerationsByUserId = function (userId, limit, offset, config) {
238
240
  var _a, _b;
239
241
  return __awaiter(this, void 0, void 0, function () {
240
- var baseURL, url, client, queryParams, httpRes, contentType, res;
242
+ var req, baseURL, url, client, headers, queryParams, httpRes, contentType, res;
241
243
  return __generator(this, function (_c) {
242
244
  switch (_c.label) {
243
245
  case 0:
244
- if (!(req instanceof utils.SpeakeasyBase)) {
245
- req = new operations.GetGenerationsByUserIdRequest(req);
246
- }
247
- baseURL = this._serverURL;
246
+ req = new operations.GetGenerationsByUserIdRequest({
247
+ userId: userId,
248
+ limit: limit,
249
+ offset: offset,
250
+ });
251
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
248
252
  url = utils.generateURL(baseURL, "/generations/user/{userId}", req);
249
- client = this._securityClient || this._defaultClient;
253
+ client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
254
+ headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
250
255
  queryParams = utils.serializeQueryParams(req);
251
- return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get" }, config))];
256
+ headers["Accept"] = "application/json";
257
+ headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion);
258
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers }, config))];
252
259
  case 1:
253
260
  httpRes = _c.sent();
254
261
  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 : "";
@@ -263,8 +270,7 @@ var Generation = /** @class */ (function () {
263
270
  switch (true) {
264
271
  case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
265
272
  if (utils.matchContentType(contentType, "application/json")) {
266
- res.getGenerationsByUserId200ApplicationJSONObject =
267
- utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationsByUserId200ApplicationJSON);
273
+ res.getGenerationsByUserId200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationsByUserId200ApplicationJSON);
268
274
  }
269
275
  break;
270
276
  }
@@ -1,27 +1,23 @@
1
1
  import * as operations from "./models/operations";
2
- import { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ import { SDKConfiguration } from "./sdk";
3
+ import { AxiosRequestConfig } from "axios";
3
4
  export declare class InitImage {
4
- _defaultClient: AxiosInstance;
5
- _securityClient: AxiosInstance;
6
- _serverURL: string;
7
- _language: string;
8
- _sdkVersion: string;
9
- _genVersion: string;
10
- constructor(defaultClient: AxiosInstance, securityClient: AxiosInstance, serverURL: string, language: string, sdkVersion: string, genVersion: string);
5
+ private sdkConfiguration;
6
+ constructor(sdkConfig: SDKConfiguration);
11
7
  /**
12
8
  * Delete init image
13
9
  *
14
10
  * @remarks
15
11
  * This endpoint deletes an init image
16
12
  */
17
- deleteInitImageById(req: operations.DeleteInitImageByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteInitImageByIdResponse>;
13
+ deleteInitImageById(id: string, config?: AxiosRequestConfig): Promise<operations.DeleteInitImageByIdResponse>;
18
14
  /**
19
15
  * Get single init image
20
16
  *
21
17
  * @remarks
22
18
  * This endpoint will return a single init image
23
19
  */
24
- getInitImageById(req: operations.GetInitImageByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetInitImageByIdResponse>;
20
+ getInitImageById(id: string, config?: AxiosRequestConfig): Promise<operations.GetInitImageByIdResponse>;
25
21
  /**
26
22
  * Upload init image
27
23
  *