@leonardo-ai/sdk 1.36.3 → 1.39.2
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 +25 -25
- package/dist/internal/utils/queryparams.js +21 -5
- package/dist/internal/utils/requestbody.js +24 -8
- package/dist/internal/utils/retries.d.ts +1 -1
- package/dist/internal/utils/retries.js +35 -11
- package/dist/internal/utils/security.js +17 -1
- package/dist/internal/utils/utils.js +84 -35
- package/dist/sdk/dataset.js +47 -26
- package/dist/sdk/generation.js +38 -18
- package/dist/sdk/initimage.js +33 -14
- package/dist/sdk/model.js +33 -14
- package/dist/sdk/sdk.d.ts +2 -1
- package/dist/sdk/sdk.js +4 -3
- package/dist/sdk/types/rfcdate.js +17 -1
- package/dist/sdk/user.js +5 -4
- package/dist/sdk/variation.js +28 -10
- package/package.json +1 -1
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: "
|
|
38
|
+
bearerAuth: "",
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -54,41 +54,41 @@ sdk.dataset.createDataset({
|
|
|
54
54
|
## Available Resources and Operations
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
### [dataset](docs/dataset/README.md)
|
|
57
|
+
### [dataset](docs/sdks/dataset/README.md)
|
|
58
58
|
|
|
59
|
-
* [createDataset](docs/dataset/README.md#createdataset) - Create a Dataset
|
|
60
|
-
* [deleteDatasetById](docs/dataset/README.md#deletedatasetbyid) - Delete a Single Dataset by ID
|
|
61
|
-
* [getDatasetById](docs/dataset/README.md#getdatasetbyid) - Get a Single Dataset by ID
|
|
62
|
-
* [uploadDatasetImage](docs/dataset/README.md#uploaddatasetimage) - Upload dataset image
|
|
63
|
-
* [uploadDatasetImageFromGen](docs/dataset/README.md#uploaddatasetimagefromgen) - Upload a Single Generated Image to a Dataset
|
|
59
|
+
* [createDataset](docs/sdks/dataset/README.md#createdataset) - Create a Dataset
|
|
60
|
+
* [deleteDatasetById](docs/sdks/dataset/README.md#deletedatasetbyid) - Delete a Single Dataset by ID
|
|
61
|
+
* [getDatasetById](docs/sdks/dataset/README.md#getdatasetbyid) - Get a Single Dataset by ID
|
|
62
|
+
* [uploadDatasetImage](docs/sdks/dataset/README.md#uploaddatasetimage) - Upload dataset image
|
|
63
|
+
* [uploadDatasetImageFromGen](docs/sdks/dataset/README.md#uploaddatasetimagefromgen) - Upload a Single Generated Image to a Dataset
|
|
64
64
|
|
|
65
|
-
### [generation](docs/generation/README.md)
|
|
65
|
+
### [generation](docs/sdks/generation/README.md)
|
|
66
66
|
|
|
67
|
-
* [createGeneration](docs/generation/README.md#creategeneration) - Create a Generation of Images
|
|
68
|
-
* [deleteGenerationById](docs/generation/README.md#deletegenerationbyid) - Delete a Single Generation
|
|
69
|
-
* [getGenerationById](docs/generation/README.md#getgenerationbyid) - Get a Single Generation
|
|
70
|
-
* [getGenerationsByUserId](docs/generation/README.md#getgenerationsbyuserid) - Get generations by user ID
|
|
67
|
+
* [createGeneration](docs/sdks/generation/README.md#creategeneration) - Create a Generation of Images
|
|
68
|
+
* [deleteGenerationById](docs/sdks/generation/README.md#deletegenerationbyid) - Delete a Single Generation
|
|
69
|
+
* [getGenerationById](docs/sdks/generation/README.md#getgenerationbyid) - Get a Single Generation
|
|
70
|
+
* [getGenerationsByUserId](docs/sdks/generation/README.md#getgenerationsbyuserid) - Get generations by user ID
|
|
71
71
|
|
|
72
|
-
### [initImage](docs/initimage/README.md)
|
|
72
|
+
### [initImage](docs/sdks/initimage/README.md)
|
|
73
73
|
|
|
74
|
-
* [deleteInitImageById](docs/initimage/README.md#deleteinitimagebyid) - Delete init image
|
|
75
|
-
* [getInitImageById](docs/initimage/README.md#getinitimagebyid) - Get single init image
|
|
76
|
-
* [uploadInitImage](docs/initimage/README.md#uploadinitimage) - Upload init image
|
|
74
|
+
* [deleteInitImageById](docs/sdks/initimage/README.md#deleteinitimagebyid) - Delete init image
|
|
75
|
+
* [getInitImageById](docs/sdks/initimage/README.md#getinitimagebyid) - Get single init image
|
|
76
|
+
* [uploadInitImage](docs/sdks/initimage/README.md#uploadinitimage) - Upload init image
|
|
77
77
|
|
|
78
|
-
### [model](docs/model/README.md)
|
|
78
|
+
### [model](docs/sdks/model/README.md)
|
|
79
79
|
|
|
80
|
-
* [createModel](docs/model/README.md#createmodel) - Train a Custom Model
|
|
81
|
-
* [deleteModelById](docs/model/README.md#deletemodelbyid) - Delete a Single Custom Model by ID
|
|
82
|
-
* [getModelById](docs/model/README.md#getmodelbyid) - Get a Single Custom Model by ID
|
|
80
|
+
* [createModel](docs/sdks/model/README.md#createmodel) - Train a Custom Model
|
|
81
|
+
* [deleteModelById](docs/sdks/model/README.md#deletemodelbyid) - Delete a Single Custom Model by ID
|
|
82
|
+
* [getModelById](docs/sdks/model/README.md#getmodelbyid) - Get a Single Custom Model by ID
|
|
83
83
|
|
|
84
|
-
### [user](docs/user/README.md)
|
|
84
|
+
### [user](docs/sdks/user/README.md)
|
|
85
85
|
|
|
86
|
-
* [getUserSelf](docs/user/README.md#getuserself) - Get user information
|
|
86
|
+
* [getUserSelf](docs/sdks/user/README.md#getuserself) - Get user information
|
|
87
87
|
|
|
88
|
-
### [variation](docs/variation/README.md)
|
|
88
|
+
### [variation](docs/sdks/variation/README.md)
|
|
89
89
|
|
|
90
|
-
* [createVariationUpscale](docs/variation/README.md#createvariationupscale) - Create upscale
|
|
91
|
-
* [getVariationById](docs/variation/README.md#getvariationbyid) - Get variation by ID
|
|
90
|
+
* [createVariationUpscale](docs/sdks/variation/README.md#createvariationupscale) - Create upscale
|
|
91
|
+
* [getVariationById](docs/sdks/variation/README.md#getvariationbyid) - Get variation by ID
|
|
92
92
|
<!-- End SDK Available Operations -->
|
|
93
93
|
|
|
94
94
|
### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
|
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
4
|
*/
|
|
5
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
6
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7
|
+
if (!m) return o;
|
|
8
|
+
var i = m.call(o), r, ar = [], e;
|
|
9
|
+
try {
|
|
10
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
11
|
+
}
|
|
12
|
+
catch (error) { e = { error: error }; }
|
|
13
|
+
finally {
|
|
14
|
+
try {
|
|
15
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
16
|
+
}
|
|
17
|
+
finally { if (e) throw e.error; }
|
|
18
|
+
}
|
|
19
|
+
return ar;
|
|
20
|
+
};
|
|
5
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
22
|
exports.serializeQueryParams = exports.qpMetadataKey = void 0;
|
|
7
23
|
var utils_1 = require("./utils");
|
|
@@ -61,7 +77,7 @@ exports.serializeQueryParams = serializeQueryParams;
|
|
|
61
77
|
function jsonSerializer(params) {
|
|
62
78
|
var query = [];
|
|
63
79
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
64
|
-
var key =
|
|
80
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
65
81
|
query.push("".concat(key, "=").concat(encodeURIComponent(JSON.stringify(value))));
|
|
66
82
|
});
|
|
67
83
|
return query.join("&");
|
|
@@ -71,7 +87,7 @@ function noExplodeSerializer(params, delimiter) {
|
|
|
71
87
|
if (delimiter === void 0) { delimiter = ","; }
|
|
72
88
|
var query = [];
|
|
73
89
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
74
|
-
var key =
|
|
90
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
75
91
|
if (!(0, utils_1.shouldQueryParamSerialize)(value))
|
|
76
92
|
return;
|
|
77
93
|
if (value !== Object(value))
|
|
@@ -99,7 +115,7 @@ function noExplodeSerializer(params, delimiter) {
|
|
|
99
115
|
function formSerializerExplode(params) {
|
|
100
116
|
var query = [];
|
|
101
117
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
102
|
-
var key =
|
|
118
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
103
119
|
if (!(0, utils_1.shouldQueryParamSerialize)(value))
|
|
104
120
|
return;
|
|
105
121
|
if (value !== Object(value))
|
|
@@ -126,7 +142,7 @@ function formSerializerExplode(params) {
|
|
|
126
142
|
function deepObjectSerializer(params) {
|
|
127
143
|
var query = [];
|
|
128
144
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
129
|
-
var key =
|
|
145
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
130
146
|
if (!(0, utils_1.shouldQueryParamSerialize)(value))
|
|
131
147
|
return;
|
|
132
148
|
if (value !== Object(value))
|
|
@@ -134,7 +150,7 @@ function deepObjectSerializer(params) {
|
|
|
134
150
|
else if (Array.isArray(value)) {
|
|
135
151
|
query.push(value
|
|
136
152
|
.map(function (_a) {
|
|
137
|
-
var objKey =
|
|
153
|
+
var _b = __read(_a, 2), objKey = _b[0], objValue = _b[1];
|
|
138
154
|
return "".concat(key, "[").concat(objKey, "]=").concat(encodeURIComponent((0, utils_1.valToString)(objValue)));
|
|
139
155
|
})
|
|
140
156
|
.join("&"));
|
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
4
|
*/
|
|
5
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
6
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7
|
+
if (!m) return o;
|
|
8
|
+
var i = m.call(o), r, ar = [], e;
|
|
9
|
+
try {
|
|
10
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
11
|
+
}
|
|
12
|
+
catch (error) { e = { error: error }; }
|
|
13
|
+
finally {
|
|
14
|
+
try {
|
|
15
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
16
|
+
}
|
|
17
|
+
finally { if (e) throw e.error; }
|
|
18
|
+
}
|
|
19
|
+
return ar;
|
|
20
|
+
};
|
|
5
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
23
|
};
|
|
@@ -27,7 +43,7 @@ function serializeRequestBody(request, requestFieldName, serializationMethod) {
|
|
|
27
43
|
exports.serializeRequestBody = serializeRequestBody;
|
|
28
44
|
var serializeContentType = function (contentType, reqBody) {
|
|
29
45
|
var _a, _b;
|
|
30
|
-
var _c = [{}, {}], requestHeaders = _c[0], requestBody = _c[1];
|
|
46
|
+
var _c = __read([{}, {}], 2), requestHeaders = _c[0], requestBody = _c[1];
|
|
31
47
|
switch (contentType) {
|
|
32
48
|
case "multipart/form-data":
|
|
33
49
|
requestBody = encodeMultipartFormData(reqBody);
|
|
@@ -37,17 +53,17 @@ var serializeContentType = function (contentType, reqBody) {
|
|
|
37
53
|
requestHeaders = requestBody.getHeaders();
|
|
38
54
|
break;
|
|
39
55
|
case "application/x-www-form-urlencoded":
|
|
40
|
-
_a = [
|
|
56
|
+
_a = __read([
|
|
41
57
|
{ "Content-Type": "".concat(contentType) },
|
|
42
58
|
encodeFormUrlEncodeData(reqBody),
|
|
43
|
-
], requestHeaders = _a[0], requestBody = _a[1];
|
|
59
|
+
], 2), requestHeaders = _a[0], requestBody = _a[1];
|
|
44
60
|
break;
|
|
45
61
|
case "application/json":
|
|
46
62
|
case "text/json":
|
|
47
|
-
_b = [
|
|
63
|
+
_b = __read([
|
|
48
64
|
{ "Content-Type": "".concat(contentType) },
|
|
49
65
|
reqBody,
|
|
50
|
-
], requestHeaders = _b[0], requestBody = _b[1];
|
|
66
|
+
], 2), requestHeaders = _b[0], requestBody = _b[1];
|
|
51
67
|
break;
|
|
52
68
|
default: {
|
|
53
69
|
requestBody = reqBody;
|
|
@@ -168,7 +184,7 @@ var formNotExplode = function (fname, data) {
|
|
|
168
184
|
function parseFormDecorator(formAnn) {
|
|
169
185
|
var formDecorator = new FormDecorator("", "form", false, false);
|
|
170
186
|
formAnn.split(";").forEach(function (formAnnPart) {
|
|
171
|
-
var _a = formAnnPart.split("="), formKey = _a[0], formVal = _a[1];
|
|
187
|
+
var _a = __read(formAnnPart.split("="), 2), formKey = _a[0], formVal = _a[1];
|
|
172
188
|
switch (formKey) {
|
|
173
189
|
case "name":
|
|
174
190
|
formDecorator.Name = formVal;
|
|
@@ -253,7 +269,7 @@ function parseMultipartFormDecorator(mpFormAnn) {
|
|
|
253
269
|
// example "name=file"
|
|
254
270
|
var mpFormDecorator = new MultipartFormDecorator(false, false, false, "");
|
|
255
271
|
mpFormAnn.split(";").forEach(function (mpFormAnnPart) {
|
|
256
|
-
var _a = mpFormAnnPart.split("="), mpFormKey = _a[0], mpFormVal = _a[1];
|
|
272
|
+
var _a = __read(mpFormAnnPart.split("="), 2), mpFormKey = _a[0], mpFormVal = _a[1];
|
|
257
273
|
switch (mpFormKey) {
|
|
258
274
|
case "file":
|
|
259
275
|
mpFormDecorator.File = mpFormVal == "true";
|
|
@@ -283,7 +299,7 @@ var MultipartFormDecorator = /** @class */ (function () {
|
|
|
283
299
|
function parseRequestDecorator(requestAnn) {
|
|
284
300
|
// example "media_type=multipart/form-data"
|
|
285
301
|
var requestDecorator = new RequestDecorator("application/octet-stream");
|
|
286
|
-
var _a = requestAnn.split("="), mediaTypeKey = _a[0], mediaTypeVal = _a[1];
|
|
302
|
+
var _a = __read(requestAnn.split("="), 2), mediaTypeKey = _a[0], mediaTypeVal = _a[1];
|
|
287
303
|
if (mediaTypeKey === "media_type")
|
|
288
304
|
requestDecorator.MediaType = mediaTypeVal;
|
|
289
305
|
return requestDecorator;
|
|
@@ -10,7 +10,7 @@ export declare class RetryConfig {
|
|
|
10
10
|
strategy: string;
|
|
11
11
|
backoff?: BackoffStrategy;
|
|
12
12
|
retryConnectionErrors: boolean;
|
|
13
|
-
constructor(strategy: string, retryConnectionErrors?: boolean);
|
|
13
|
+
constructor(strategy: string, backoff?: BackoffStrategy, retryConnectionErrors?: boolean);
|
|
14
14
|
}
|
|
15
15
|
export declare class Retries {
|
|
16
16
|
config: RetryConfig;
|
|
@@ -53,6 +53,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
53
53
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
+
var __values = (this && this.__values) || function(o) {
|
|
57
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
58
|
+
if (m) return m.call(o);
|
|
59
|
+
if (o && typeof o.length === "number") return {
|
|
60
|
+
next: function () {
|
|
61
|
+
if (o && i >= o.length) o = void 0;
|
|
62
|
+
return { value: o && o[i++], done: !o };
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
66
|
+
};
|
|
56
67
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
68
|
exports.Retry = exports.Retries = exports.RetryConfig = exports.BackoffStrategy = void 0;
|
|
58
69
|
var axios_1 = require("axios");
|
|
@@ -67,9 +78,10 @@ var BackoffStrategy = /** @class */ (function () {
|
|
|
67
78
|
}());
|
|
68
79
|
exports.BackoffStrategy = BackoffStrategy;
|
|
69
80
|
var RetryConfig = /** @class */ (function () {
|
|
70
|
-
function RetryConfig(strategy, retryConnectionErrors) {
|
|
81
|
+
function RetryConfig(strategy, backoff, retryConnectionErrors) {
|
|
71
82
|
if (retryConnectionErrors === void 0) { retryConnectionErrors = true; }
|
|
72
83
|
this.strategy = strategy;
|
|
84
|
+
this.backoff = backoff;
|
|
73
85
|
this.retryConnectionErrors = retryConnectionErrors;
|
|
74
86
|
}
|
|
75
87
|
return RetryConfig;
|
|
@@ -88,6 +100,7 @@ var PermanentError = /** @class */ (function (_super) {
|
|
|
88
100
|
function PermanentError(inner) {
|
|
89
101
|
var _this = _super.call(this, "Permanent error") || this;
|
|
90
102
|
_this.inner = inner;
|
|
103
|
+
Object.setPrototypeOf(_this, PermanentError.prototype);
|
|
91
104
|
return _this;
|
|
92
105
|
}
|
|
93
106
|
return PermanentError;
|
|
@@ -97,6 +110,7 @@ var TemporaryError = /** @class */ (function (_super) {
|
|
|
97
110
|
function TemporaryError(res) {
|
|
98
111
|
var _this = _super.call(this, "Temporary error") || this;
|
|
99
112
|
_this.res = res;
|
|
113
|
+
Object.setPrototypeOf(_this, TemporaryError.prototype);
|
|
100
114
|
return _this;
|
|
101
115
|
}
|
|
102
116
|
return TemporaryError;
|
|
@@ -159,21 +173,31 @@ function Retry(fn, retries) {
|
|
|
159
173
|
}
|
|
160
174
|
exports.Retry = Retry;
|
|
161
175
|
function isRetryableResponse(res, statusCodes) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
var
|
|
166
|
-
if (
|
|
167
|
-
|
|
176
|
+
var e_1, _a;
|
|
177
|
+
try {
|
|
178
|
+
for (var statusCodes_1 = __values(statusCodes), statusCodes_1_1 = statusCodes_1.next(); !statusCodes_1_1.done; statusCodes_1_1 = statusCodes_1.next()) {
|
|
179
|
+
var code = statusCodes_1_1.value;
|
|
180
|
+
if (code.toUpperCase().includes("X")) {
|
|
181
|
+
var codeRange = parseInt(code[0]);
|
|
182
|
+
if (isNaN(codeRange)) {
|
|
183
|
+
throw new Error("Invalid status code range");
|
|
184
|
+
}
|
|
185
|
+
var s = res.status / 100;
|
|
186
|
+
if (s >= codeRange && s < codeRange + 1) {
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
168
189
|
}
|
|
169
|
-
|
|
170
|
-
if (s >= codeRange && s < codeRange + 1) {
|
|
190
|
+
else if (res.status == parseInt(code)) {
|
|
171
191
|
return true;
|
|
172
192
|
}
|
|
173
193
|
}
|
|
174
|
-
|
|
175
|
-
|
|
194
|
+
}
|
|
195
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
196
|
+
finally {
|
|
197
|
+
try {
|
|
198
|
+
if (statusCodes_1_1 && !statusCodes_1_1.done && (_a = statusCodes_1.return)) _a.call(statusCodes_1);
|
|
176
199
|
}
|
|
200
|
+
finally { if (e_1) throw e_1.error; }
|
|
177
201
|
}
|
|
178
202
|
return false;
|
|
179
203
|
}
|
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
4
|
*/
|
|
5
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
6
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7
|
+
if (!m) return o;
|
|
8
|
+
var i = m.call(o), r, ar = [], e;
|
|
9
|
+
try {
|
|
10
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
11
|
+
}
|
|
12
|
+
catch (error) { e = { error: error }; }
|
|
13
|
+
finally {
|
|
14
|
+
try {
|
|
15
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
16
|
+
}
|
|
17
|
+
finally { if (e) throw e.error; }
|
|
18
|
+
}
|
|
19
|
+
return ar;
|
|
20
|
+
};
|
|
5
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
22
|
exports.createSecurityClient = void 0;
|
|
7
23
|
var securityMetadataKey = "security";
|
|
@@ -17,7 +33,7 @@ function parseSecurityDecorator(securityAnn) {
|
|
|
17
33
|
var securityType = "";
|
|
18
34
|
var securitySubType = "";
|
|
19
35
|
securityAnn.split(";").forEach(function (securityAnnPart) {
|
|
20
|
-
var _a = securityAnnPart.split("="), sKey = _a[0], sVal = _a[1];
|
|
36
|
+
var _a = __read(securityAnnPart.split("="), 2), sKey = _a[0], sVal = _a[1];
|
|
21
37
|
switch (sKey) {
|
|
22
38
|
case "name":
|
|
23
39
|
name = sVal;
|
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
4
|
*/
|
|
5
|
+
var __values = (this && this.__values) || function(o) {
|
|
6
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
7
|
+
if (m) return m.call(o);
|
|
8
|
+
if (o && typeof o.length === "number") return {
|
|
9
|
+
next: function () {
|
|
10
|
+
if (o && i >= o.length) o = void 0;
|
|
11
|
+
return { value: o && o[i++], done: !o };
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
15
|
+
};
|
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
+
if (!m) return o;
|
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
+
}
|
|
23
|
+
catch (error) { e = { error: error }; }
|
|
24
|
+
finally {
|
|
25
|
+
try {
|
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
+
}
|
|
28
|
+
finally { if (e) throw e.error; }
|
|
29
|
+
}
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
5
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
33
|
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
34
|
require("reflect-metadata");
|
|
@@ -69,36 +96,46 @@ function handleObject(value, elemType, elemDepth) {
|
|
|
69
96
|
}
|
|
70
97
|
var SpeakeasyBase = /** @class */ (function () {
|
|
71
98
|
function SpeakeasyBase(payload) {
|
|
99
|
+
var e_1, _a;
|
|
72
100
|
var props = this["__props__"];
|
|
73
101
|
if (props) {
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
102
|
+
try {
|
|
103
|
+
for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
|
|
104
|
+
var prop = props_1_1.value;
|
|
105
|
+
if (payload && payload.hasOwnProperty(prop.key)) {
|
|
106
|
+
var value = payload[prop.key];
|
|
107
|
+
if (isSpeakeasyBase(prop.type)) {
|
|
108
|
+
this[prop.key] = new prop.type(value);
|
|
109
|
+
}
|
|
110
|
+
else if (prop.type.name == "Array" &&
|
|
111
|
+
isSpeakeasyBase(prop.elemType)) {
|
|
112
|
+
this[prop.key] = handleArray(value, prop.elemType, prop.elemDepth);
|
|
113
|
+
}
|
|
114
|
+
else if (prop.type.name == "Object" &&
|
|
115
|
+
isSpeakeasyBase(prop.elemType)) {
|
|
116
|
+
this[prop.key] = handleObject(value, prop.elemType, prop.elemDepth);
|
|
117
|
+
}
|
|
118
|
+
else if (prop.type.name == "RFCDate") {
|
|
119
|
+
if (value instanceof Date) {
|
|
120
|
+
this[prop.key] = new types_1.RFCDate(value);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this[prop.key] = value;
|
|
124
|
+
}
|
|
92
125
|
}
|
|
93
126
|
else {
|
|
94
127
|
this[prop.key] = value;
|
|
95
128
|
}
|
|
96
129
|
}
|
|
97
|
-
else {
|
|
98
|
-
this[prop.key] = value;
|
|
99
|
-
}
|
|
100
130
|
}
|
|
101
131
|
}
|
|
132
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
133
|
+
finally {
|
|
134
|
+
try {
|
|
135
|
+
if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
|
|
136
|
+
}
|
|
137
|
+
finally { if (e_1) throw e_1.error; }
|
|
138
|
+
}
|
|
102
139
|
}
|
|
103
140
|
}
|
|
104
141
|
return SpeakeasyBase;
|
|
@@ -143,11 +180,13 @@ function SpeakeasyMetadata(params) {
|
|
|
143
180
|
exports.SpeakeasyMetadata = SpeakeasyMetadata;
|
|
144
181
|
function templateUrl(stringWithParams, params) {
|
|
145
182
|
var res = stringWithParams;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
183
|
+
if (params) {
|
|
184
|
+
Object.entries(params).forEach(function (_a) {
|
|
185
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
186
|
+
var match = "{" + key + "}";
|
|
187
|
+
res = res.replaceAll(match, value);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
151
190
|
return res;
|
|
152
191
|
}
|
|
153
192
|
exports.templateUrl = templateUrl;
|
|
@@ -196,7 +235,7 @@ function parseParamDecorator(ann, fName, defaultStyle, defaultExplode) {
|
|
|
196
235
|
if (ann == null)
|
|
197
236
|
return decorator;
|
|
198
237
|
ann.split(";").forEach(function (annPart) {
|
|
199
|
-
var _a = annPart.split("="), paramKey = _a[0], paramVal = _a[1];
|
|
238
|
+
var _a = __read(annPart.split("="), 2), paramKey = _a[0], paramVal = _a[1];
|
|
200
239
|
switch (paramKey) {
|
|
201
240
|
case "style":
|
|
202
241
|
decorator.Style = paramVal;
|
|
@@ -277,21 +316,31 @@ function objectToClass(value, klass, elemDepth) {
|
|
|
277
316
|
}
|
|
278
317
|
exports.objectToClass = objectToClass;
|
|
279
318
|
function getResFieldDepth(res) {
|
|
319
|
+
var e_2, _a;
|
|
280
320
|
var props = res["__props__"];
|
|
281
321
|
var resFieldDepth = 1;
|
|
282
322
|
if (props) {
|
|
283
|
-
|
|
284
|
-
var
|
|
285
|
-
|
|
286
|
-
if (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
323
|
+
try {
|
|
324
|
+
for (var props_2 = __values(props), props_2_1 = props_2.next(); !props_2_1.done; props_2_1 = props_2.next()) {
|
|
325
|
+
var prop = props_2_1.value;
|
|
326
|
+
if (res && res.hasOwnProperty(prop.key)) {
|
|
327
|
+
if ((prop.type.name == "Array" || prop.type.name == "Object") &&
|
|
328
|
+
isSpeakeasyBase(prop.elemType)) {
|
|
329
|
+
if (prop.elemDepth > resFieldDepth) {
|
|
330
|
+
resFieldDepth = prop.elemDepth;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
291
333
|
}
|
|
292
334
|
}
|
|
293
335
|
}
|
|
294
336
|
}
|
|
337
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
338
|
+
finally {
|
|
339
|
+
try {
|
|
340
|
+
if (props_2_1 && !props_2_1.done && (_a = props_2.return)) _a.call(props_2);
|
|
341
|
+
}
|
|
342
|
+
finally { if (e_2) throw e_2.error; }
|
|
343
|
+
}
|
|
295
344
|
}
|
|
296
345
|
return resFieldDepth;
|
|
297
346
|
}
|