@leonardo-ai/sdk 1.43.0 → 1.50.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.
package/README.md CHANGED
@@ -29,6 +29,8 @@ To get access to the API and fetch an API key, please sign up for [access](https
29
29
 
30
30
  ## SDK Example Usage
31
31
  <!-- Start SDK Example Usage -->
32
+
33
+
32
34
  ```typescript
33
35
  import { Leonardo } from "@leonardo-ai/sdk";
34
36
  import { CreateDatasetResponse } from "@leonardo-ai/sdk/dist/sdk/models/operations";
@@ -26,6 +26,7 @@ exports.serializeRequestBody = exports.requestMetadataKey = void 0;
26
26
  var utils_1 = require("./utils");
27
27
  var form_data_1 = __importDefault(require("form-data"));
28
28
  var types_1 = require("../../sdk/types");
29
+ var class_transformer_1 = require("class-transformer");
29
30
  exports.requestMetadataKey = "request";
30
31
  var mpFormMetadataKey = "multipart_form";
31
32
  function serializeRequestBody(request, requestFieldName, serializationMethod) {
@@ -42,8 +43,8 @@ function serializeRequestBody(request, requestFieldName, serializationMethod) {
42
43
  }
43
44
  exports.serializeRequestBody = serializeRequestBody;
44
45
  var serializeContentType = function (contentType, reqBody) {
45
- var _a, _b;
46
- var _c = __read([{}, {}], 2), requestHeaders = _c[0], requestBody = _c[1];
46
+ var _a, _b, _c;
47
+ var _d = __read([{}, {}], 2), requestHeaders = _d[0], requestBody = _d[1];
47
48
  switch (contentType) {
48
49
  case "multipart/form-data":
49
50
  requestBody = encodeMultipartFormData(reqBody);
@@ -59,12 +60,17 @@ var serializeContentType = function (contentType, reqBody) {
59
60
  ], 2), requestHeaders = _a[0], requestBody = _a[1];
60
61
  break;
61
62
  case "application/json":
62
- case "text/json":
63
63
  _b = __read([
64
64
  { "Content-Type": "".concat(contentType) },
65
- reqBody,
65
+ (0, class_transformer_1.classToPlain)(reqBody, { exposeUnsetFields: false }),
66
66
  ], 2), requestHeaders = _b[0], requestBody = _b[1];
67
67
  break;
68
+ case "text/json":
69
+ _c = __read([
70
+ { "Content-Type": "".concat(contentType) },
71
+ reqBody,
72
+ ], 2), requestHeaders = _c[0], requestBody = _c[1];
73
+ break;
68
74
  default: {
69
75
  requestBody = reqBody;
70
76
  var requestBodyType = typeof requestBody;
package/dist/sdk/sdk.js CHANGED
@@ -52,8 +52,8 @@ var SDKConfiguration = /** @class */ (function () {
52
52
  function SDKConfiguration(init) {
53
53
  this.language = "typescript";
54
54
  this.openapiDocVersion = "v1.0.0";
55
- this.sdkVersion = "1.43.0";
56
- this.genVersion = "2.55.0";
55
+ this.sdkVersion = "1.50.0";
56
+ this.genVersion = "2.65.0";
57
57
  Object.assign(this, init);
58
58
  }
59
59
  return SDKConfiguration;
@@ -1,6 +1,8 @@
1
1
  export declare class RFCDate {
2
2
  private date;
3
- constructor(date?: Date | string);
3
+ constructor(date: Date | {
4
+ date: string;
5
+ } | string | undefined);
4
6
  getDate(): Date;
5
7
  toJSON(): string;
6
8
  toString(): string;
@@ -22,11 +22,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.RFCDate = void 0;
23
23
  var RFCDate = /** @class */ (function () {
24
24
  function RFCDate(date) {
25
+ if (!date) {
26
+ this.date = new Date();
27
+ return;
28
+ }
25
29
  if (typeof date === "string") {
26
30
  this.date = new Date(date);
31
+ return;
32
+ }
33
+ if (date instanceof Date) {
34
+ this.date = date;
35
+ return;
27
36
  }
28
- else {
29
- this.date = date !== null && date !== void 0 ? date : new Date();
37
+ var anyDate = date;
38
+ if (date && !!anyDate.date) {
39
+ this.date = new Date(anyDate.date);
30
40
  }
31
41
  }
32
42
  RFCDate.prototype.getDate = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leonardo-ai/sdk",
3
- "version": "1.43.0",
3
+ "version": "1.50.0",
4
4
  "author": "leonardoai",
5
5
  "scripts": {
6
6
  "prepare": "tsc --build"