@leonardo-ai/sdk 1.18.2 → 1.20.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 +5 -5
- package/dist/internal/utils/headers.js +6 -6
- package/dist/internal/utils/pathparams.d.ts +1 -1
- package/dist/internal/utils/pathparams.js +9 -10
- package/dist/internal/utils/queryparams.js +18 -31
- package/dist/internal/utils/requestbody.js +32 -39
- package/dist/internal/utils/utils.d.ts +3 -5
- package/dist/internal/utils/utils.js +39 -39
- package/dist/sdk/dataset.js +5 -8
- package/dist/sdk/generation.js +4 -6
- package/dist/sdk/initimage.js +3 -5
- package/dist/sdk/model.js +3 -6
- package/dist/sdk/models/operations/creategeneration.d.ts +4 -0
- package/dist/sdk/models/operations/creategeneration.js +5 -0
- package/dist/sdk/sdk.js +2 -2
- package/dist/sdk/types/index.d.ts +1 -0
- package/dist/sdk/types/index.js +20 -0
- package/dist/sdk/types/rfcdate.d.ts +7 -0
- package/dist/sdk/types/rfcdate.js +33 -0
- package/dist/sdk/user.js +1 -2
- package/dist/sdk/variation.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Leonardo TypeScript SDK
|
|
2
|
-
|
|
3
1
|
<div align="center">
|
|
2
|
+
<img src="https://user-images.githubusercontent.com/6267663/230025738-42a4980e-a5ea-4d00-a591-65e8de14de85.png" width="200">
|
|
3
|
+
<h1>Leonardo Typescript SDK</h1>
|
|
4
4
|
<p>The API for creating stunning game assets with AI.</p>
|
|
5
5
|
<a href="https://github.com/Leonardo-Interactive/leonardo-ts-sdk/actions"><img src="https://img.shields.io/github/actions/workflow/status/Leonardo-Interactive/leonardo-ts-sdk/speakeasy_sdk_generate.yml?style=for-the-badge" /></a>
|
|
6
6
|
<a href="https://docs.leonardo.ai/"><img src="https://img.shields.io/static/v1?label=Docs&message=API Ref&color=000&style=for-the-badge" /></a>
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
### NPM
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm add
|
|
16
|
+
npm add @leonardo-ai/sdk
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
### Yarn
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
yarn add
|
|
22
|
+
yarn add @leonardo-ai/sdk
|
|
23
23
|
```
|
|
24
24
|
<!-- End SDK Installation -->
|
|
25
25
|
|
|
@@ -45,7 +45,7 @@ const sdk = new Leonardo({
|
|
|
45
45
|
|
|
46
46
|
const req: CreateDatasetRequestBody = {
|
|
47
47
|
description: "corrupti",
|
|
48
|
-
name: "
|
|
48
|
+
name: "Kelvin Sporer",
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
sdk.dataset.createDataset(req).then((res: CreateDatasetResponse | AxiosError) => {
|
|
@@ -22,7 +22,7 @@ function getHeadersFromRequest(headerParams) {
|
|
|
22
22
|
var headerDecorator = (0, utils_1.parseParamDecorator)(headerAnn, fname, "simple", false);
|
|
23
23
|
if (headerDecorator == null)
|
|
24
24
|
return;
|
|
25
|
-
var value = serializeHeader(headerParams[fname], headerDecorator.Explode
|
|
25
|
+
var value = serializeHeader(headerParams[fname], headerDecorator.Explode);
|
|
26
26
|
if (value != "")
|
|
27
27
|
headers[headerDecorator.ParamName] = value;
|
|
28
28
|
});
|
|
@@ -51,11 +51,11 @@ function getHeadersFromResponse(headers) {
|
|
|
51
51
|
return reponseHeaders;
|
|
52
52
|
}
|
|
53
53
|
exports.getHeadersFromResponse = getHeadersFromResponse;
|
|
54
|
-
function serializeHeader(header, explode
|
|
54
|
+
function serializeHeader(header, explode) {
|
|
55
55
|
var headerVals = [];
|
|
56
56
|
if (Array.isArray(header)) {
|
|
57
57
|
header.forEach(function (val) {
|
|
58
|
-
headerVals.push((0, utils_1.
|
|
58
|
+
headerVals.push((0, utils_1.valToString)(val));
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
else if ((0, utils_1.isStringRecord)(header) ||
|
|
@@ -63,9 +63,9 @@ function serializeHeader(header, explode, dateTimeFormat) {
|
|
|
63
63
|
(0, utils_1.isBooleanRecord)(header)) {
|
|
64
64
|
Object.getOwnPropertyNames(header).forEach(function (headerKey) {
|
|
65
65
|
if (explode)
|
|
66
|
-
headerVals.push("".concat(headerKey, "=").concat(header[headerKey]));
|
|
66
|
+
headerVals.push("".concat(headerKey, "=").concat((0, utils_1.valToString)(header[headerKey])));
|
|
67
67
|
else
|
|
68
|
-
headerVals.push("".concat(headerKey, ",").concat(header[headerKey]));
|
|
68
|
+
headerVals.push("".concat(headerKey, ",").concat((0, utils_1.valToString)(header[headerKey])));
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
else if (header instanceof Object) {
|
|
@@ -76,7 +76,7 @@ function serializeHeader(header, explode, dateTimeFormat) {
|
|
|
76
76
|
var headerDecorator = (0, utils_1.parseParamDecorator)(headerAnn, headerKey, "simple", explode);
|
|
77
77
|
if (headerDecorator == null)
|
|
78
78
|
return;
|
|
79
|
-
var headerFieldValue = (0, utils_1.
|
|
79
|
+
var headerFieldValue = (0, utils_1.valToString)(header[headerKey]);
|
|
80
80
|
if ((0, utils_1.isEmpty)(headerFieldValue))
|
|
81
81
|
return;
|
|
82
82
|
else if (explode)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const ppMetadataKey = "pathParam";
|
|
2
|
-
export declare function getSimplePathParams(paramName: string, paramValue: any, explode: boolean
|
|
2
|
+
export declare function getSimplePathParams(paramName: string, paramValue: any, explode: boolean): Map<string, string>;
|
|
@@ -5,22 +5,21 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getSimplePathParams = exports.ppMetadataKey = void 0;
|
|
7
7
|
var utils_1 = require("./utils");
|
|
8
|
-
var utils_2 = require("./utils");
|
|
9
8
|
exports.ppMetadataKey = "pathParam";
|
|
10
|
-
function getSimplePathParams(paramName, paramValue, explode
|
|
9
|
+
function getSimplePathParams(paramName, paramValue, explode) {
|
|
11
10
|
var pathParams = new Map();
|
|
12
11
|
var ppVals = [];
|
|
13
12
|
if (Array.isArray(paramValue)) {
|
|
14
13
|
paramValue.forEach(function (param) {
|
|
15
|
-
ppVals.push((0, utils_1.
|
|
14
|
+
ppVals.push(encodeURIComponent((0, utils_1.valToString)(param)));
|
|
16
15
|
});
|
|
17
16
|
pathParams.set(paramName, ppVals.join(","));
|
|
18
17
|
}
|
|
19
|
-
else if ((0,
|
|
20
|
-
(0,
|
|
21
|
-
(0,
|
|
18
|
+
else if ((0, utils_1.isStringRecord)(paramValue) ||
|
|
19
|
+
(0, utils_1.isNumberRecord)(paramValue) ||
|
|
20
|
+
(0, utils_1.isBooleanRecord)(paramValue)) {
|
|
22
21
|
Object.getOwnPropertyNames(paramValue).forEach(function (paramKey) {
|
|
23
|
-
var paramFieldValue = (0, utils_1.
|
|
22
|
+
var paramFieldValue = encodeURIComponent((0, utils_1.valToString)(paramValue[paramKey]));
|
|
24
23
|
if (explode)
|
|
25
24
|
ppVals.push("".concat(paramKey, "=").concat(paramFieldValue));
|
|
26
25
|
else
|
|
@@ -36,8 +35,8 @@ function getSimplePathParams(paramName, paramValue, explode, dateTimeFormat) {
|
|
|
36
35
|
var ppDecorator = (0, utils_1.parseParamDecorator)(ppAnn, paramKey, "simple", explode);
|
|
37
36
|
if (ppDecorator == null)
|
|
38
37
|
return;
|
|
39
|
-
var paramFieldValue = (0, utils_1.
|
|
40
|
-
if ((0,
|
|
38
|
+
var paramFieldValue = encodeURIComponent((0, utils_1.valToString)(paramValue[paramKey]));
|
|
39
|
+
if ((0, utils_1.isEmpty)(paramFieldValue))
|
|
41
40
|
return;
|
|
42
41
|
else if (explode)
|
|
43
42
|
ppVals.push("".concat(ppDecorator.ParamName, "=").concat(paramFieldValue));
|
|
@@ -47,7 +46,7 @@ function getSimplePathParams(paramName, paramValue, explode, dateTimeFormat) {
|
|
|
47
46
|
pathParams.set(paramName, ppVals.join(","));
|
|
48
47
|
}
|
|
49
48
|
else {
|
|
50
|
-
pathParams.set(paramName, (0, utils_1.
|
|
49
|
+
pathParams.set(paramName, encodeURIComponent((0, utils_1.valToString)(paramValue)));
|
|
51
50
|
}
|
|
52
51
|
return pathParams;
|
|
53
52
|
}
|
|
@@ -33,16 +33,16 @@ function serializeQueryParams(queryParams, globals) {
|
|
|
33
33
|
else {
|
|
34
34
|
switch (qpDecorator.Style) {
|
|
35
35
|
case "deepObject":
|
|
36
|
-
queryStringParts.push(deepObjectSerializer((_b = {}, _b[qpDecorator.ParamName] = value, _b)
|
|
36
|
+
queryStringParts.push(deepObjectSerializer((_b = {}, _b[qpDecorator.ParamName] = value, _b)));
|
|
37
37
|
return;
|
|
38
38
|
case "form":
|
|
39
39
|
if (!qpDecorator.Explode)
|
|
40
|
-
queryStringParts.push(formSerializer((_c = {}, _c[qpDecorator.ParamName] = value, _c)
|
|
40
|
+
queryStringParts.push(formSerializer((_c = {}, _c[qpDecorator.ParamName] = value, _c)));
|
|
41
41
|
else
|
|
42
|
-
queryStringParts.push(formSerializerExplode((_d = {}, _d[qpDecorator.ParamName] = value, _d)
|
|
42
|
+
queryStringParts.push(formSerializerExplode((_d = {}, _d[qpDecorator.ParamName] = value, _d)));
|
|
43
43
|
return;
|
|
44
44
|
default:
|
|
45
|
-
queryStringParts.push(formSerializerExplode((_e = {}, _e[qpDecorator.ParamName] = value, _e)
|
|
45
|
+
queryStringParts.push(formSerializerExplode((_e = {}, _e[qpDecorator.ParamName] = value, _e)));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -54,32 +54,21 @@ function jsonSerializer(params) {
|
|
|
54
54
|
var query = [];
|
|
55
55
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
56
56
|
var key = _a[0], value = _a[1];
|
|
57
|
-
|
|
58
|
-
.map(function (paramKey) {
|
|
59
|
-
var qpAnn = Reflect.getMetadata(exports.qpMetadataKey, value, paramKey);
|
|
60
|
-
var qpDecorator = (0, utils_1.parseParamDecorator)(qpAnn, paramKey, "form", true);
|
|
61
|
-
if (qpDecorator == null)
|
|
62
|
-
return;
|
|
63
|
-
return "\"".concat(paramKey, "\":").concat(JSON.stringify((0, utils_1.convertIfDateObjectToISOString)(value[paramKey], qpDecorator.DateTimeFormat)));
|
|
64
|
-
})
|
|
65
|
-
.join(",");
|
|
66
|
-
query.push("".concat(key, "={").concat(encodeURIComponent(values), "}"));
|
|
57
|
+
query.push("".concat(key, "=").concat(encodeURIComponent(JSON.stringify(value))));
|
|
67
58
|
});
|
|
68
59
|
return query.join("&");
|
|
69
60
|
}
|
|
70
61
|
// TODO: Add support for disabling percent encoding for reserved characters
|
|
71
|
-
function formSerializer(params
|
|
62
|
+
function formSerializer(params) {
|
|
72
63
|
var query = [];
|
|
73
64
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
74
65
|
var key = _a[0], value = _a[1];
|
|
75
66
|
if (!value)
|
|
76
67
|
return;
|
|
77
68
|
if (value !== Object(value))
|
|
78
|
-
query.push("".concat(key, "=").concat((0, utils_1.
|
|
69
|
+
query.push("".concat(key, "=").concat(encodeURIComponent((0, utils_1.valToString)(value))));
|
|
79
70
|
else if (Array.isArray(value)) {
|
|
80
|
-
var values = value
|
|
81
|
-
.map(function (aValue) { return (0, utils_1.convertIfDateObjectToISOString)(aValue, dateTimeFormat); })
|
|
82
|
-
.join(",");
|
|
71
|
+
var values = value.map(function (aValue) { return aValue; }).join(",");
|
|
83
72
|
query.push("".concat(key, "=").concat(encodeURIComponent(values)));
|
|
84
73
|
}
|
|
85
74
|
else {
|
|
@@ -89,7 +78,7 @@ function formSerializer(params, dateTimeFormat) {
|
|
|
89
78
|
var qpDecorator = (0, utils_1.parseParamDecorator)(qpAnn, paramKey, "form", true);
|
|
90
79
|
if (qpDecorator == null)
|
|
91
80
|
return;
|
|
92
|
-
return "".concat(paramKey, ",").concat((0, utils_1.
|
|
81
|
+
return "".concat(paramKey, ",").concat((0, utils_1.valToString)(value[paramKey]));
|
|
93
82
|
})
|
|
94
83
|
.join(",");
|
|
95
84
|
query.push("".concat(key, "=").concat(encodeURIComponent(values)));
|
|
@@ -98,19 +87,17 @@ function formSerializer(params, dateTimeFormat) {
|
|
|
98
87
|
return query.join("&");
|
|
99
88
|
}
|
|
100
89
|
// TODO: Add support for disabling percent encoding for reserved characters
|
|
101
|
-
function formSerializerExplode(params
|
|
90
|
+
function formSerializerExplode(params) {
|
|
102
91
|
var query = [];
|
|
103
92
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
104
93
|
var key = _a[0], value = _a[1];
|
|
105
94
|
if (!value)
|
|
106
95
|
return;
|
|
107
96
|
if (value !== Object(value))
|
|
108
|
-
query.push("".concat(key, "=").concat((
|
|
97
|
+
query.push("".concat(key, "=").concat(encodeURIComponent(value)));
|
|
109
98
|
else if (Array.isArray(value)) {
|
|
110
99
|
query.push(value
|
|
111
|
-
.map(function (aValue) {
|
|
112
|
-
return "".concat(key, "=").concat((0, utils_1.encodeAndConvertPrimitiveVal)(aValue, dateTimeFormat));
|
|
113
|
-
})
|
|
100
|
+
.map(function (aValue) { return "".concat(key, "=").concat(encodeURIComponent((0, utils_1.valToString)(aValue))); })
|
|
114
101
|
.join("&"));
|
|
115
102
|
}
|
|
116
103
|
else
|
|
@@ -120,26 +107,26 @@ function formSerializerExplode(params, dateTimeFormat) {
|
|
|
120
107
|
var qpDecorator = (0, utils_1.parseParamDecorator)(qpAnn, paramKey, "form", true);
|
|
121
108
|
if (qpDecorator == null)
|
|
122
109
|
return;
|
|
123
|
-
return "".concat(paramKey, "=").concat((0, utils_1.
|
|
110
|
+
return "".concat(paramKey, "=").concat(encodeURIComponent((0, utils_1.valToString)(value[paramKey])));
|
|
124
111
|
})
|
|
125
112
|
.join("&"));
|
|
126
113
|
});
|
|
127
114
|
return query.join("&");
|
|
128
115
|
}
|
|
129
116
|
// TODO: Add support for disabling percent encoding for reserved characters
|
|
130
|
-
function deepObjectSerializer(params
|
|
117
|
+
function deepObjectSerializer(params) {
|
|
131
118
|
var query = [];
|
|
132
119
|
Object.entries(Object.assign({}, params)).forEach(function (_a) {
|
|
133
120
|
var key = _a[0], value = _a[1];
|
|
134
121
|
if (!value)
|
|
135
122
|
return;
|
|
136
123
|
if (value !== Object(value))
|
|
137
|
-
query.push("".concat(key, "=").concat((
|
|
124
|
+
query.push("".concat(key, "=").concat(encodeURIComponent(value)));
|
|
138
125
|
else if (Array.isArray(value)) {
|
|
139
126
|
query.push(value
|
|
140
127
|
.map(function (_a) {
|
|
141
128
|
var objKey = _a[0], objValue = _a[1];
|
|
142
|
-
return "".concat(key, "[").concat(objKey, "]=").concat((0, utils_1.
|
|
129
|
+
return "".concat(key, "[").concat(objKey, "]=").concat(encodeURIComponent((0, utils_1.valToString)(objValue)));
|
|
143
130
|
})
|
|
144
131
|
.join("&"));
|
|
145
132
|
}
|
|
@@ -154,10 +141,10 @@ function deepObjectSerializer(params, dateTimeFormat) {
|
|
|
154
141
|
if (Array.isArray(value[paramKey]))
|
|
155
142
|
return value[paramKey]
|
|
156
143
|
.map(function (arrValue) {
|
|
157
|
-
return "".concat(key, "[").concat(paramKey, "]=").concat((0, utils_1.
|
|
144
|
+
return "".concat(key, "[").concat(paramKey, "]=").concat(encodeURIComponent((0, utils_1.valToString)(arrValue)));
|
|
158
145
|
})
|
|
159
146
|
.join("&");
|
|
160
|
-
return "".concat(key, "[").concat(paramKey, "]=").concat((0, utils_1.
|
|
147
|
+
return "".concat(key, "[").concat(paramKey, "]=").concat(encodeURIComponent((0, utils_1.valToString)(value[paramKey])));
|
|
161
148
|
})
|
|
162
149
|
.join("&"));
|
|
163
150
|
});
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.serializeRequestBody = exports.requestMetadataKey = void 0;
|
|
10
10
|
var utils_1 = require("./utils");
|
|
11
11
|
var form_data_1 = __importDefault(require("form-data"));
|
|
12
|
+
var types_1 = require("../../sdk/types");
|
|
12
13
|
exports.requestMetadataKey = "request";
|
|
13
14
|
var mpFormMetadataKey = "multipart_form";
|
|
14
15
|
function serializeRequestBody(request, requestFieldName, serializationMethod) {
|
|
@@ -82,10 +83,10 @@ var encodeFormUrlEncodeData = function (data) {
|
|
|
82
83
|
if (formDecorator.Style === "form") {
|
|
83
84
|
var parsed_1;
|
|
84
85
|
if (formDecorator.Explode === true) {
|
|
85
|
-
parsed_1 = formExplode(fname, data[fname]
|
|
86
|
+
parsed_1 = formExplode(fname, data[fname]);
|
|
86
87
|
}
|
|
87
88
|
else {
|
|
88
|
-
parsed_1 = formNotExplode(fname, data[fname]
|
|
89
|
+
parsed_1 = formNotExplode(fname, data[fname]);
|
|
89
90
|
}
|
|
90
91
|
Object.keys(parsed_1).forEach(function (key) {
|
|
91
92
|
parsed_1[key].forEach(function (v) { return formData.append(key, v); });
|
|
@@ -96,7 +97,7 @@ var encodeFormUrlEncodeData = function (data) {
|
|
|
96
97
|
}
|
|
97
98
|
return formData;
|
|
98
99
|
};
|
|
99
|
-
var formExplode = function (fname, data
|
|
100
|
+
var formExplode = function (fname, data) {
|
|
100
101
|
var exploded = {};
|
|
101
102
|
if (Array.isArray(data)) {
|
|
102
103
|
data.forEach(function (value) {
|
|
@@ -106,15 +107,14 @@ var formExplode = function (fname, data, dateTimeFormat) {
|
|
|
106
107
|
exploded[fname].push(value);
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
|
-
else {
|
|
110
|
-
if (
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
exploded[fname] = [];
|
|
114
|
-
}
|
|
115
|
-
exploded[fname].push((0, utils_1.convertIfDateObjectToISOString)(data, dateTimeFormat));
|
|
116
|
-
return exploded;
|
|
110
|
+
else if (typeof data === "object") {
|
|
111
|
+
if (data instanceof Date || data instanceof types_1.RFCDate) {
|
|
112
|
+
if (!exploded[fname]) {
|
|
113
|
+
exploded[fname] = [];
|
|
117
114
|
}
|
|
115
|
+
exploded[fname].push((0, utils_1.valToString)(data));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
118
|
Object.keys(data).forEach(function (key) {
|
|
119
119
|
if (!exploded[key]) {
|
|
120
120
|
exploded[key] = [];
|
|
@@ -122,16 +122,16 @@ var formExplode = function (fname, data, dateTimeFormat) {
|
|
|
122
122
|
exploded[key].push(data[key]);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
exploded[fname].push(data.toString());
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
if (!exploded[fname]) {
|
|
128
|
+
exploded[fname] = [];
|
|
130
129
|
}
|
|
130
|
+
exploded[fname].push((0, utils_1.valToString)(data));
|
|
131
131
|
}
|
|
132
132
|
return exploded;
|
|
133
133
|
};
|
|
134
|
-
var formNotExplode = function (fname, data
|
|
134
|
+
var formNotExplode = function (fname, data) {
|
|
135
135
|
var notExploded = {};
|
|
136
136
|
if (Array.isArray(data)) {
|
|
137
137
|
if (!notExploded[fname]) {
|
|
@@ -139,15 +139,14 @@ var formNotExplode = function (fname, data, dateTimeFormat) {
|
|
|
139
139
|
}
|
|
140
140
|
notExploded[fname].push(data.map(function (item) { return item.toString(); }).join(","));
|
|
141
141
|
}
|
|
142
|
-
else {
|
|
143
|
-
if (
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
notExploded[fname] = [];
|
|
147
|
-
}
|
|
148
|
-
notExploded[fname].push((0, utils_1.convertIfDateObjectToISOString)(data, dateTimeFormat));
|
|
149
|
-
return notExploded;
|
|
142
|
+
else if (typeof data === "object") {
|
|
143
|
+
if (data instanceof Date || data instanceof types_1.RFCDate) {
|
|
144
|
+
if (!notExploded[fname]) {
|
|
145
|
+
notExploded[fname] = [];
|
|
150
146
|
}
|
|
147
|
+
notExploded[fname].push((0, utils_1.valToString)(data));
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
151
150
|
Object.keys(data).forEach(function (key) {
|
|
152
151
|
if (!notExploded[key]) {
|
|
153
152
|
notExploded[key] = [];
|
|
@@ -155,12 +154,12 @@ var formNotExplode = function (fname, data, dateTimeFormat) {
|
|
|
155
154
|
notExploded[fname].push("".concat(key, "=").concat(data[key]));
|
|
156
155
|
});
|
|
157
156
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
notExploded[fname].push(data.toString());
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
if (!notExploded[fname]) {
|
|
160
|
+
notExploded[fname] = [];
|
|
163
161
|
}
|
|
162
|
+
notExploded[fname].push((0, utils_1.valToString)(data));
|
|
164
163
|
}
|
|
165
164
|
return notExploded;
|
|
166
165
|
};
|
|
@@ -181,8 +180,6 @@ function parseFormDecorator(formAnn) {
|
|
|
181
180
|
case "json":
|
|
182
181
|
formDecorator.JSON = formVal === "true";
|
|
183
182
|
break;
|
|
184
|
-
case "dateTimeFormat":
|
|
185
|
-
formDecorator.DateTimeFormat = formVal;
|
|
186
183
|
}
|
|
187
184
|
});
|
|
188
185
|
return formDecorator;
|
|
@@ -207,18 +204,16 @@ function encodeMultipartFormData(form) {
|
|
|
207
204
|
if (mpFormDecorator.File)
|
|
208
205
|
return encodeMultipartFormDataFile(formData, form[fname]);
|
|
209
206
|
else if (mpFormDecorator.JSON) {
|
|
210
|
-
formData.append(mpFormDecorator.Name, JSON.stringify(form[fname]
|
|
211
|
-
return (0, utils_1.convertIfDateObjectToISOString)(value, mpFormDecorator.DateTimeFormat);
|
|
212
|
-
}));
|
|
207
|
+
formData.append(mpFormDecorator.Name, JSON.stringify(form[fname]));
|
|
213
208
|
}
|
|
214
209
|
else {
|
|
215
210
|
if (Array.isArray(form[fname])) {
|
|
216
211
|
form[fname].forEach(function (val) {
|
|
217
|
-
formData.append(mpFormDecorator.Name + "[]",
|
|
212
|
+
formData.append(mpFormDecorator.Name + "[]", (0, utils_1.valToString)(val));
|
|
218
213
|
});
|
|
219
214
|
}
|
|
220
215
|
else {
|
|
221
|
-
formData.append(mpFormDecorator.Name,
|
|
216
|
+
formData.append(mpFormDecorator.Name, (0, utils_1.valToString)(form[fname]));
|
|
222
217
|
}
|
|
223
218
|
}
|
|
224
219
|
});
|
|
@@ -270,8 +265,6 @@ function parseMultipartFormDecorator(mpFormAnn) {
|
|
|
270
265
|
case "json":
|
|
271
266
|
mpFormDecorator.JSON = mpFormVal == "true";
|
|
272
267
|
break;
|
|
273
|
-
case "dateTimeFormat":
|
|
274
|
-
mpFormDecorator.DateTimeFormat = mpFormVal;
|
|
275
268
|
}
|
|
276
269
|
});
|
|
277
270
|
return mpFormDecorator;
|
|
@@ -14,8 +14,7 @@ export declare class ParamDecorator {
|
|
|
14
14
|
Explode: boolean;
|
|
15
15
|
ParamName: string;
|
|
16
16
|
Serialization?: string;
|
|
17
|
-
|
|
18
|
-
constructor(Style: string, Explode: boolean, ParamName: string, Serialization?: string, DateTimeFormat?: string);
|
|
17
|
+
constructor(Style: string, Explode: boolean, ParamName: string, Serialization?: string);
|
|
19
18
|
}
|
|
20
19
|
export declare function SpeakeasyMetadata<T extends SpeakeasyBase = Record<string | symbol, unknown>>(params?: {
|
|
21
20
|
data?: string;
|
|
@@ -31,8 +30,7 @@ export declare function isStringRecord(obj: any): obj is Record<string, string>;
|
|
|
31
30
|
export declare function isNumberRecord(obj: any): obj is Record<string, number>;
|
|
32
31
|
export declare function isBooleanRecord(obj: any): obj is Record<string, boolean>;
|
|
33
32
|
export declare function isEmpty(value: any): boolean;
|
|
34
|
-
export declare function
|
|
35
|
-
export declare function encodeAndConvertPrimitiveVal(value: any, dateTimeFormat?: string): any;
|
|
36
|
-
export declare function deserializeJSONResponse<T>(value: T, klass?: any, elemDepth?: number): any;
|
|
33
|
+
export declare function objectToClass<T>(value: T, klass?: any, elemDepth?: number): any;
|
|
37
34
|
export declare function getResFieldDepth(res: any): number;
|
|
38
35
|
export declare function populateFromGlobals(value: any, fieldName: string, paramType: string, globals: any): any;
|
|
36
|
+
export declare function valToString(value: any): string;
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
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;
|
|
7
7
|
require("reflect-metadata");
|
|
8
8
|
var pathparams_1 = require("./pathparams");
|
|
9
9
|
var class_transformer_1 = require("class-transformer");
|
|
10
|
+
var types_1 = require("../../sdk/types");
|
|
10
11
|
var requestbody_1 = require("./requestbody");
|
|
11
12
|
exports.SerializationMethodToContentType = {
|
|
12
13
|
json: "application/json",
|
|
@@ -85,6 +86,14 @@ var SpeakeasyBase = /** @class */ (function () {
|
|
|
85
86
|
isSpeakeasyBase(prop.elemType)) {
|
|
86
87
|
this[prop.key] = handleObject(value, prop.elemType, prop.elemDepth);
|
|
87
88
|
}
|
|
89
|
+
else if (prop.type.name == "RFCDate") {
|
|
90
|
+
if (value instanceof Date) {
|
|
91
|
+
this[prop.key] = new types_1.RFCDate(value);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this[prop.key] = value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
88
97
|
else {
|
|
89
98
|
this[prop.key] = value;
|
|
90
99
|
}
|
|
@@ -96,12 +105,11 @@ var SpeakeasyBase = /** @class */ (function () {
|
|
|
96
105
|
}());
|
|
97
106
|
exports.SpeakeasyBase = SpeakeasyBase;
|
|
98
107
|
var ParamDecorator = /** @class */ (function () {
|
|
99
|
-
function ParamDecorator(Style, Explode, ParamName, Serialization
|
|
108
|
+
function ParamDecorator(Style, Explode, ParamName, Serialization) {
|
|
100
109
|
this.Style = Style;
|
|
101
110
|
this.Explode = Explode;
|
|
102
111
|
this.ParamName = ParamName;
|
|
103
112
|
this.Serialization = Serialization;
|
|
104
|
-
this.DateTimeFormat = DateTimeFormat;
|
|
105
113
|
}
|
|
106
114
|
return ParamDecorator;
|
|
107
115
|
}());
|
|
@@ -161,12 +169,21 @@ function generateURL(serverURL, path, pathParams, globals) {
|
|
|
161
169
|
return;
|
|
162
170
|
var value = pathParams[fname];
|
|
163
171
|
value = populateFromGlobals(value, fname, "pathParam", globals);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
if (ppDecorator.Serialization) {
|
|
173
|
+
switch (ppDecorator.Serialization) {
|
|
174
|
+
case "json":
|
|
175
|
+
parsedParameters[ppDecorator.ParamName] = encodeURIComponent(JSON.stringify(value));
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
switch (ppDecorator.Style) {
|
|
181
|
+
case "simple": {
|
|
182
|
+
var simpleParams = (0, pathparams_1.getSimplePathParams)(ppDecorator.ParamName, value, ppDecorator.Explode);
|
|
183
|
+
simpleParams.forEach(function (value, key) {
|
|
184
|
+
parsedParameters[key] = value;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
170
187
|
}
|
|
171
188
|
}
|
|
172
189
|
});
|
|
@@ -193,8 +210,6 @@ function parseParamDecorator(ann, fName, defaultStyle, defaultExplode) {
|
|
|
193
210
|
case "serialization":
|
|
194
211
|
decorator.Serialization = paramVal;
|
|
195
212
|
break;
|
|
196
|
-
case "dateTimeFormat":
|
|
197
|
-
decorator.DateTimeFormat = paramVal;
|
|
198
213
|
}
|
|
199
214
|
});
|
|
200
215
|
return decorator;
|
|
@@ -234,31 +249,7 @@ function isEmpty(value) {
|
|
|
234
249
|
return res || value == null;
|
|
235
250
|
}
|
|
236
251
|
exports.isEmpty = isEmpty;
|
|
237
|
-
|
|
238
|
-
function convertIfDateObjectToISOString(value, dateTimeFormat) {
|
|
239
|
-
var dtFormat = dateTimeFormat !== null && dateTimeFormat !== void 0 ? dateTimeFormat : "YYYY-MM-DDThh:mm:ss.sssZ";
|
|
240
|
-
if (value instanceof Date) {
|
|
241
|
-
if (dtFormat === "YYYY-MM-DD") {
|
|
242
|
-
var dateRegex = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
243
|
-
var matches = value.toISOString().match(dateRegex);
|
|
244
|
-
if (matches == null) {
|
|
245
|
-
throw new Error("Date format is not valid");
|
|
246
|
-
}
|
|
247
|
-
var year = matches[1], month = matches[2], day = matches[3];
|
|
248
|
-
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
249
|
-
}
|
|
250
|
-
if (dtFormat === "YYYY-MM-DDThh:mm:ss.sssZ") {
|
|
251
|
-
return value.toISOString();
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return value;
|
|
255
|
-
}
|
|
256
|
-
exports.convertIfDateObjectToISOString = convertIfDateObjectToISOString;
|
|
257
|
-
function encodeAndConvertPrimitiveVal(value, dateTimeFormat) {
|
|
258
|
-
return encodeURIComponent(convertIfDateObjectToISOString(value, dateTimeFormat));
|
|
259
|
-
}
|
|
260
|
-
exports.encodeAndConvertPrimitiveVal = encodeAndConvertPrimitiveVal;
|
|
261
|
-
function deserializeJSONResponse(value, klass, elemDepth) {
|
|
252
|
+
function objectToClass(value, klass, elemDepth) {
|
|
262
253
|
if (elemDepth === void 0) { elemDepth = 0; }
|
|
263
254
|
if (value !== Object(value)) {
|
|
264
255
|
return value;
|
|
@@ -266,23 +257,25 @@ function deserializeJSONResponse(value, klass, elemDepth) {
|
|
|
266
257
|
if (elemDepth === 0 && klass != null) {
|
|
267
258
|
return (0, class_transformer_1.plainToInstance)(klass, value, {
|
|
268
259
|
excludeExtraneousValues: true,
|
|
260
|
+
exposeUnsetFields: false,
|
|
269
261
|
});
|
|
270
262
|
}
|
|
271
263
|
if (Array.isArray(value)) {
|
|
272
|
-
return value.map(function (v) { return
|
|
264
|
+
return value.map(function (v) { return objectToClass(v, klass, elemDepth - 1); });
|
|
273
265
|
}
|
|
274
266
|
if (typeof value === "object" && value != null) {
|
|
275
267
|
var copiedRecord = {};
|
|
276
268
|
for (var key in value) {
|
|
277
|
-
copiedRecord[key] =
|
|
269
|
+
copiedRecord[key] = objectToClass(value[key], klass, elemDepth - 1);
|
|
278
270
|
}
|
|
279
271
|
return copiedRecord;
|
|
280
272
|
}
|
|
281
273
|
return (0, class_transformer_1.plainToInstance)(klass, value, {
|
|
282
274
|
excludeExtraneousValues: true,
|
|
275
|
+
exposeUnsetFields: false,
|
|
283
276
|
});
|
|
284
277
|
}
|
|
285
|
-
exports.
|
|
278
|
+
exports.objectToClass = objectToClass;
|
|
286
279
|
function getResFieldDepth(res) {
|
|
287
280
|
var props = res["__props__"];
|
|
288
281
|
var resFieldDepth = 1;
|
|
@@ -315,3 +308,10 @@ function populateFromGlobals(value, fieldName, paramType, globals) {
|
|
|
315
308
|
return value;
|
|
316
309
|
}
|
|
317
310
|
exports.populateFromGlobals = populateFromGlobals;
|
|
311
|
+
function valToString(value) {
|
|
312
|
+
if (value instanceof Date) {
|
|
313
|
+
return value.toISOString();
|
|
314
|
+
}
|
|
315
|
+
return value.toString();
|
|
316
|
+
}
|
|
317
|
+
exports.valToString = valToString;
|
package/dist/sdk/dataset.js
CHANGED
|
@@ -89,8 +89,7 @@ var Dataset = /** @class */ (function () {
|
|
|
89
89
|
switch (true) {
|
|
90
90
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
91
91
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
92
|
-
res.createDataset200ApplicationJSONObject =
|
|
93
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateDataset200ApplicationJSON);
|
|
92
|
+
res.createDataset200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateDataset200ApplicationJSON);
|
|
94
93
|
}
|
|
95
94
|
break;
|
|
96
95
|
}
|
|
@@ -124,8 +123,7 @@ var Dataset = /** @class */ (function () {
|
|
|
124
123
|
switch (true) {
|
|
125
124
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
126
125
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
127
|
-
res.deleteDatasetById200ApplicationJSONObject =
|
|
128
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteDatasetById200ApplicationJSON);
|
|
126
|
+
res.deleteDatasetById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteDatasetById200ApplicationJSON);
|
|
129
127
|
}
|
|
130
128
|
break;
|
|
131
129
|
}
|
|
@@ -159,8 +157,7 @@ var Dataset = /** @class */ (function () {
|
|
|
159
157
|
switch (true) {
|
|
160
158
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
161
159
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
162
|
-
res.getDatasetById200ApplicationJSONObject =
|
|
163
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetDatasetById200ApplicationJSON);
|
|
160
|
+
res.getDatasetById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetDatasetById200ApplicationJSON);
|
|
164
161
|
}
|
|
165
162
|
break;
|
|
166
163
|
}
|
|
@@ -208,7 +205,7 @@ var Dataset = /** @class */ (function () {
|
|
|
208
205
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
209
206
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
210
207
|
res.uploadDatasetImage200ApplicationJSONObject =
|
|
211
|
-
utils.
|
|
208
|
+
utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImage200ApplicationJSON);
|
|
212
209
|
}
|
|
213
210
|
break;
|
|
214
211
|
}
|
|
@@ -256,7 +253,7 @@ var Dataset = /** @class */ (function () {
|
|
|
256
253
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
257
254
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
258
255
|
res.uploadDatasetImageFromGen200ApplicationJSONObject =
|
|
259
|
-
utils.
|
|
256
|
+
utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImageFromGen200ApplicationJSON);
|
|
260
257
|
}
|
|
261
258
|
break;
|
|
262
259
|
}
|
package/dist/sdk/generation.js
CHANGED
|
@@ -89,8 +89,7 @@ var Generation = /** @class */ (function () {
|
|
|
89
89
|
switch (true) {
|
|
90
90
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
91
91
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
92
|
-
res.createGeneration200ApplicationJSONObject =
|
|
93
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateGeneration200ApplicationJSON);
|
|
92
|
+
res.createGeneration200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateGeneration200ApplicationJSON);
|
|
94
93
|
}
|
|
95
94
|
break;
|
|
96
95
|
}
|
|
@@ -125,7 +124,7 @@ var Generation = /** @class */ (function () {
|
|
|
125
124
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
126
125
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
127
126
|
res.deleteGenerationById200ApplicationJSONObject =
|
|
128
|
-
utils.
|
|
127
|
+
utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteGenerationById200ApplicationJSON);
|
|
129
128
|
}
|
|
130
129
|
break;
|
|
131
130
|
}
|
|
@@ -159,8 +158,7 @@ var Generation = /** @class */ (function () {
|
|
|
159
158
|
switch (true) {
|
|
160
159
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
161
160
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
162
|
-
res.getGenerationById200ApplicationJSONObject =
|
|
163
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationById200ApplicationJSON);
|
|
161
|
+
res.getGenerationById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationById200ApplicationJSON);
|
|
164
162
|
}
|
|
165
163
|
break;
|
|
166
164
|
}
|
|
@@ -196,7 +194,7 @@ var Generation = /** @class */ (function () {
|
|
|
196
194
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
197
195
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
198
196
|
res.getGenerationsByUserId200ApplicationJSONObject =
|
|
199
|
-
utils.
|
|
197
|
+
utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetGenerationsByUserId200ApplicationJSON);
|
|
200
198
|
}
|
|
201
199
|
break;
|
|
202
200
|
}
|
package/dist/sdk/initimage.js
CHANGED
|
@@ -77,7 +77,7 @@ var InitImage = /** @class */ (function () {
|
|
|
77
77
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
78
78
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
79
79
|
res.deleteInitImageById200ApplicationJSONObject =
|
|
80
|
-
utils.
|
|
80
|
+
utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteInitImageById200ApplicationJSON);
|
|
81
81
|
}
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
@@ -111,8 +111,7 @@ var InitImage = /** @class */ (function () {
|
|
|
111
111
|
switch (true) {
|
|
112
112
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
113
113
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
114
|
-
res.getInitImageById200ApplicationJSONObject =
|
|
115
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetInitImageById200ApplicationJSON);
|
|
114
|
+
res.getInitImageById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetInitImageById200ApplicationJSON);
|
|
116
115
|
}
|
|
117
116
|
break;
|
|
118
117
|
}
|
|
@@ -159,8 +158,7 @@ var InitImage = /** @class */ (function () {
|
|
|
159
158
|
switch (true) {
|
|
160
159
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
161
160
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
162
|
-
res.uploadInitImage200ApplicationJSONObject =
|
|
163
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadInitImage200ApplicationJSON);
|
|
161
|
+
res.uploadInitImage200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadInitImage200ApplicationJSON);
|
|
164
162
|
}
|
|
165
163
|
break;
|
|
166
164
|
}
|
package/dist/sdk/model.js
CHANGED
|
@@ -89,8 +89,7 @@ var Model = /** @class */ (function () {
|
|
|
89
89
|
switch (true) {
|
|
90
90
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
91
91
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
92
|
-
res.createModel200ApplicationJSONObject =
|
|
93
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateModel200ApplicationJSON);
|
|
92
|
+
res.createModel200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateModel200ApplicationJSON);
|
|
94
93
|
}
|
|
95
94
|
break;
|
|
96
95
|
}
|
|
@@ -124,8 +123,7 @@ var Model = /** @class */ (function () {
|
|
|
124
123
|
switch (true) {
|
|
125
124
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
126
125
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
127
|
-
res.deleteModelById200ApplicationJSONObject =
|
|
128
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteModelById200ApplicationJSON);
|
|
126
|
+
res.deleteModelById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteModelById200ApplicationJSON);
|
|
129
127
|
}
|
|
130
128
|
break;
|
|
131
129
|
}
|
|
@@ -159,8 +157,7 @@ var Model = /** @class */ (function () {
|
|
|
159
157
|
switch (true) {
|
|
160
158
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
161
159
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
162
|
-
res.getModelById200ApplicationJSONObject =
|
|
163
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetModelById200ApplicationJSON);
|
|
160
|
+
res.getModelById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetModelById200ApplicationJSON);
|
|
164
161
|
}
|
|
165
162
|
break;
|
|
166
163
|
}
|
|
@@ -55,6 +55,10 @@ export declare class CreateGenerationRequestBody extends SpeakeasyBase {
|
|
|
55
55
|
* The prompt used to generate images
|
|
56
56
|
*/
|
|
57
57
|
prompt: string;
|
|
58
|
+
/**
|
|
59
|
+
* Enable to use Prompt Magic.
|
|
60
|
+
*/
|
|
61
|
+
promptMagic?: boolean;
|
|
58
62
|
/**
|
|
59
63
|
* Whether the generated images should show in the community feed.
|
|
60
64
|
*/
|
|
@@ -117,6 +117,11 @@ var CreateGenerationRequestBody = /** @class */ (function (_super) {
|
|
|
117
117
|
(0, class_transformer_1.Expose)({ name: "prompt" }),
|
|
118
118
|
__metadata("design:type", String)
|
|
119
119
|
], CreateGenerationRequestBody.prototype, "prompt", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, utils_1.SpeakeasyMetadata)(),
|
|
122
|
+
(0, class_transformer_1.Expose)({ name: "promptMagic" }),
|
|
123
|
+
__metadata("design:type", Boolean)
|
|
124
|
+
], CreateGenerationRequestBody.prototype, "promptMagic", void 0);
|
|
120
125
|
__decorate([
|
|
121
126
|
(0, utils_1.SpeakeasyMetadata)(),
|
|
122
127
|
(0, class_transformer_1.Expose)({ name: "public" }),
|
package/dist/sdk/sdk.js
CHANGED
|
@@ -55,8 +55,8 @@ var Leonardo = /** @class */ (function () {
|
|
|
55
55
|
function Leonardo(props) {
|
|
56
56
|
var _a, _b;
|
|
57
57
|
this._language = "typescript";
|
|
58
|
-
this._sdkVersion = "1.
|
|
59
|
-
this._genVersion = "2.
|
|
58
|
+
this._sdkVersion = "1.20.0";
|
|
59
|
+
this._genVersion = "2.18.0";
|
|
60
60
|
this._serverURL = (_a = props === null || props === void 0 ? void 0 : props.serverURL) !== null && _a !== void 0 ? _a : exports.ServerList[0];
|
|
61
61
|
this._defaultClient =
|
|
62
62
|
(_b = props === null || props === void 0 ? void 0 : props.defaultClient) !== null && _b !== void 0 ? _b : axios_1.default.create({ baseURL: this._serverURL });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./rfcdate";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./rfcdate"), exports);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RFCDate = void 0;
|
|
7
|
+
var RFCDate = /** @class */ (function () {
|
|
8
|
+
function RFCDate(date) {
|
|
9
|
+
if (typeof date === "string") {
|
|
10
|
+
this.date = new Date(date);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this.date = date !== null && date !== void 0 ? date : new Date();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
RFCDate.prototype.getDate = function () {
|
|
17
|
+
return this.date;
|
|
18
|
+
};
|
|
19
|
+
RFCDate.prototype.toJSON = function () {
|
|
20
|
+
return this.toString();
|
|
21
|
+
};
|
|
22
|
+
RFCDate.prototype.toString = function () {
|
|
23
|
+
var dateRegex = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
24
|
+
var matches = this.date.toISOString().match(dateRegex);
|
|
25
|
+
if (matches == null) {
|
|
26
|
+
throw new Error("Date format is not valid");
|
|
27
|
+
}
|
|
28
|
+
var year = matches[1], month = matches[2], day = matches[3];
|
|
29
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
30
|
+
};
|
|
31
|
+
return RFCDate;
|
|
32
|
+
}());
|
|
33
|
+
exports.RFCDate = RFCDate;
|
package/dist/sdk/user.js
CHANGED
|
@@ -73,8 +73,7 @@ var User = /** @class */ (function () {
|
|
|
73
73
|
switch (true) {
|
|
74
74
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
75
75
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
76
|
-
res.getUserSelf200ApplicationJSONObject =
|
|
77
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetUserSelf200ApplicationJSON);
|
|
76
|
+
res.getUserSelf200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetUserSelf200ApplicationJSON);
|
|
78
77
|
}
|
|
79
78
|
break;
|
|
80
79
|
}
|
package/dist/sdk/variation.js
CHANGED
|
@@ -88,7 +88,7 @@ var Variation = /** @class */ (function () {
|
|
|
88
88
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
89
89
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
90
90
|
res.createVariationUpscale200ApplicationJSONObject =
|
|
91
|
-
utils.
|
|
91
|
+
utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateVariationUpscale200ApplicationJSON);
|
|
92
92
|
}
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
@@ -122,8 +122,7 @@ var Variation = /** @class */ (function () {
|
|
|
122
122
|
switch (true) {
|
|
123
123
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
124
124
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
125
|
-
res.getVariationById200ApplicationJSONObject =
|
|
126
|
-
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetVariationById200ApplicationJSON);
|
|
125
|
+
res.getVariationById200ApplicationJSONObject = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetVariationById200ApplicationJSON);
|
|
127
126
|
}
|
|
128
127
|
break;
|
|
129
128
|
}
|