@leonardo-ai/sdk 1.8.3 → 1.11.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.
- package/README.md +7 -12
- package/dist/internal/utils/headers.js +4 -0
- package/dist/internal/utils/queryparams.d.ts +1 -1
- package/dist/internal/utils/queryparams.js +15 -7
- package/dist/internal/utils/requestbody.d.ts +2 -1
- package/dist/internal/utils/requestbody.js +45 -48
- package/dist/internal/utils/utils.d.ts +9 -1
- package/dist/internal/utils/utils.js +38 -7
- package/dist/sdk/dataset.d.ts +6 -6
- package/dist/sdk/dataset.js +28 -23
- package/dist/sdk/generation.d.ts +5 -5
- package/dist/sdk/generation.js +22 -18
- package/dist/sdk/initimage.d.ts +4 -4
- package/dist/sdk/initimage.js +16 -13
- package/dist/sdk/model.d.ts +4 -4
- package/dist/sdk/model.js +16 -13
- package/dist/sdk/models/operations/createdataset.d.ts +1 -4
- package/dist/sdk/models/operations/createdataset.js +2 -14
- package/dist/sdk/models/operations/creategeneration.d.ts +0 -3
- package/dist/sdk/models/operations/creategeneration.js +1 -13
- package/dist/sdk/models/operations/createmodel.d.ts +0 -3
- package/dist/sdk/models/operations/createmodel.js +1 -13
- package/dist/sdk/models/operations/createvariationupscale.d.ts +0 -3
- package/dist/sdk/models/operations/createvariationupscale.js +1 -13
- package/dist/sdk/models/operations/deletedatasetbyid.d.ts +2 -5
- package/dist/sdk/models/operations/deletedatasetbyid.js +5 -17
- package/dist/sdk/models/operations/deletegenerationbyid.d.ts +2 -5
- package/dist/sdk/models/operations/deletegenerationbyid.js +5 -17
- package/dist/sdk/models/operations/deleteinitimagebyid.d.ts +2 -5
- package/dist/sdk/models/operations/deleteinitimagebyid.js +5 -17
- package/dist/sdk/models/operations/deletemodelbyid.d.ts +2 -5
- package/dist/sdk/models/operations/deletemodelbyid.js +5 -17
- package/dist/sdk/models/operations/getdatasetbyid.d.ts +3 -6
- package/dist/sdk/models/operations/getdatasetbyid.js +9 -19
- package/dist/sdk/models/operations/getgenerationbyid.d.ts +4 -7
- package/dist/sdk/models/operations/getgenerationbyid.js +16 -22
- package/dist/sdk/models/operations/getgenerationsbyuserid.d.ts +5 -11
- package/dist/sdk/models/operations/getgenerationsbyuserid.js +29 -41
- package/dist/sdk/models/operations/getinitimagebyid.d.ts +2 -5
- package/dist/sdk/models/operations/getinitimagebyid.js +5 -17
- package/dist/sdk/models/operations/getmodelbyid.d.ts +2 -5
- package/dist/sdk/models/operations/getmodelbyid.js +5 -17
- package/dist/sdk/models/operations/getuserself.d.ts +2 -2
- package/dist/sdk/models/operations/getuserself.js +2 -2
- package/dist/sdk/models/operations/getvariationbyid.d.ts +2 -5
- package/dist/sdk/models/operations/getvariationbyid.js +8 -18
- package/dist/sdk/models/operations/uploaddatasetimage.d.ts +2 -5
- package/dist/sdk/models/operations/uploaddatasetimage.js +8 -18
- package/dist/sdk/models/operations/uploaddatasetimagefromgen.d.ts +2 -5
- package/dist/sdk/models/operations/uploaddatasetimagefromgen.js +8 -18
- package/dist/sdk/models/operations/uploadinitimage.d.ts +0 -3
- package/dist/sdk/models/operations/uploadinitimage.js +1 -13
- package/dist/sdk/models/shared/security.d.ts +1 -4
- package/dist/sdk/models/shared/security.js +5 -15
- package/dist/sdk/sdk.d.ts +2 -1
- package/dist/sdk/sdk.js +7 -7
- package/dist/sdk/user.d.ts +1 -1
- package/dist/sdk/user.js +4 -3
- package/dist/sdk/variation.d.ts +3 -3
- package/dist/sdk/variation.js +11 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,26 +31,21 @@ To get access to the API and fetch an API key, please sign up for [access](https
|
|
|
31
31
|
<!-- Start SDK Example Usage -->
|
|
32
32
|
```typescript
|
|
33
33
|
import {
|
|
34
|
-
|
|
34
|
+
CreateDatasetRequestBody,
|
|
35
35
|
CreateDatasetResponse
|
|
36
36
|
} from "@leonardo-ai/sdk/dist/sdk/models/operations";
|
|
37
37
|
|
|
38
38
|
import { AxiosError } from "axios";
|
|
39
39
|
import { Leonardo } from "@leonardo-ai/sdk";
|
|
40
|
-
|
|
41
40
|
const sdk = new Leonardo({
|
|
42
41
|
security: {
|
|
43
|
-
bearerAuth:
|
|
44
|
-
authorization: "Bearer YOUR_BEARER_TOKEN_HERE",
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const req: CreateDatasetRequest = {
|
|
50
|
-
request: {
|
|
51
|
-
description: "unde",
|
|
52
|
-
name: "deserunt",
|
|
42
|
+
bearerAuth: "Bearer YOUR_BEARER_TOKEN_HERE",
|
|
53
43
|
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const req: CreateDatasetRequestBody = {
|
|
47
|
+
description: "unde",
|
|
48
|
+
name: "deserunt",
|
|
54
49
|
};
|
|
55
50
|
|
|
56
51
|
sdk.dataset.createDataset(req).then((res: CreateDatasetResponse | AxiosError) => {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getHeadersFromResponse = exports.getHeadersFromRequest = exports.headerMetadataKey = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
|
+
var requestbody_1 = require("./requestbody");
|
|
5
6
|
exports.headerMetadataKey = "header";
|
|
6
7
|
function getHeadersFromRequest(headerParams) {
|
|
7
8
|
if (headerParams == null)
|
|
@@ -9,6 +10,9 @@ function getHeadersFromRequest(headerParams) {
|
|
|
9
10
|
var headers = {};
|
|
10
11
|
var fieldNames = Object.getOwnPropertyNames(headerParams);
|
|
11
12
|
fieldNames.forEach(function (fname) {
|
|
13
|
+
var requestBodyAnn = Reflect.getMetadata(requestbody_1.requestMetadataKey, headerParams, fname);
|
|
14
|
+
if (requestBodyAnn)
|
|
15
|
+
return;
|
|
12
16
|
var headerAnn = Reflect.getMetadata(exports.headerMetadataKey, headerParams, fname);
|
|
13
17
|
if (headerAnn == null)
|
|
14
18
|
return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const qpMetadataKey = "queryParam";
|
|
2
|
-
export declare function serializeQueryParams(queryParams: any): string;
|
|
2
|
+
export declare function serializeQueryParams(queryParams: any, globals?: any): string;
|
|
@@ -2,36 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serializeQueryParams = exports.qpMetadataKey = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
|
+
var requestbody_1 = require("./requestbody");
|
|
5
6
|
exports.qpMetadataKey = "queryParam";
|
|
6
7
|
var queryStringPrefix = "?";
|
|
7
|
-
function serializeQueryParams(queryParams) {
|
|
8
|
+
function serializeQueryParams(queryParams, globals) {
|
|
8
9
|
var queryStringParts = [];
|
|
9
10
|
if (!queryParams)
|
|
10
11
|
return queryStringParts.join("&");
|
|
11
|
-
var fieldNames =
|
|
12
|
+
var fieldNames = "__props__" in queryParams
|
|
13
|
+
? queryParams["__props__"].map(function (prop) { return prop.key; })
|
|
14
|
+
: Object.getOwnPropertyNames(queryParams);
|
|
12
15
|
fieldNames.forEach(function (fname) {
|
|
13
16
|
var _a, _b, _c, _d, _e;
|
|
17
|
+
var requestBodyAnn = Reflect.getMetadata(requestbody_1.requestMetadataKey, queryParams, fname);
|
|
18
|
+
if (requestBodyAnn)
|
|
19
|
+
return;
|
|
14
20
|
var qpAnn = Reflect.getMetadata(exports.qpMetadataKey, queryParams, fname);
|
|
15
21
|
if (!qpAnn)
|
|
16
22
|
return { serialize: function (params) { return ""; } };
|
|
17
23
|
var qpDecorator = (0, utils_1.parseParamDecorator)(qpAnn, fname, "form", true);
|
|
18
24
|
if (!qpDecorator)
|
|
19
25
|
return;
|
|
26
|
+
var value = queryParams[fname];
|
|
27
|
+
value = (0, utils_1.populateFromGlobals)(value, fname, "queryParam", globals);
|
|
20
28
|
if (qpDecorator.Serialization === "json")
|
|
21
|
-
queryStringParts.push(jsonSerializer((_a = {}, _a[
|
|
29
|
+
queryStringParts.push(jsonSerializer((_a = {}, _a[qpDecorator.ParamName] = value, _a)));
|
|
22
30
|
else {
|
|
23
31
|
switch (qpDecorator.Style) {
|
|
24
32
|
case "deepObject":
|
|
25
|
-
queryStringParts.push(deepObjectSerializer((_b = {}, _b[
|
|
33
|
+
queryStringParts.push(deepObjectSerializer((_b = {}, _b[qpDecorator.ParamName] = value, _b), qpDecorator.DateTimeFormat));
|
|
26
34
|
return;
|
|
27
35
|
case "form":
|
|
28
36
|
if (!qpDecorator.Explode)
|
|
29
|
-
queryStringParts.push(formSerializer((_c = {}, _c[
|
|
37
|
+
queryStringParts.push(formSerializer((_c = {}, _c[qpDecorator.ParamName] = value, _c), qpDecorator.DateTimeFormat));
|
|
30
38
|
else
|
|
31
|
-
queryStringParts.push(formSerializerExplode((_d = {}, _d[
|
|
39
|
+
queryStringParts.push(formSerializerExplode((_d = {}, _d[qpDecorator.ParamName] = value, _d), qpDecorator.DateTimeFormat));
|
|
32
40
|
return;
|
|
33
41
|
default:
|
|
34
|
-
queryStringParts.push(formSerializerExplode((_e = {}, _e[
|
|
42
|
+
queryStringParts.push(formSerializerExplode((_e = {}, _e[qpDecorator.ParamName] = value, _e), qpDecorator.DateTimeFormat));
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const requestMetadataKey = "request";
|
|
2
|
+
export declare function serializeRequestBody(request: any, requestFieldName: string, serializationMethod: string): [object, any];
|
|
@@ -3,60 +3,57 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.serializeRequestBody = void 0;
|
|
6
|
+
exports.serializeRequestBody = exports.requestMetadataKey = void 0;
|
|
7
7
|
var form_data_1 = __importDefault(require("form-data"));
|
|
8
8
|
var utils_1 = require("./utils");
|
|
9
|
-
|
|
9
|
+
exports.requestMetadataKey = "request";
|
|
10
10
|
var mpFormMetadataKey = "multipart_form";
|
|
11
|
-
function serializeRequestBody(request) {
|
|
12
|
-
if (!request.hasOwnProperty(
|
|
13
|
-
|
|
11
|
+
function serializeRequestBody(request, requestFieldName, serializationMethod) {
|
|
12
|
+
if (request !== Object(request) || !request.hasOwnProperty(requestFieldName)) {
|
|
13
|
+
return serializeContentType(utils_1.SerializationMethodToContentType[serializationMethod], request);
|
|
14
14
|
}
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
fieldNames.forEach(function (fname) {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
var requestAnn = Reflect.getMetadata(requestMetadataKey, requestBodyObj, fname);
|
|
24
|
-
if (requestAnn == null)
|
|
25
|
-
return;
|
|
26
|
-
var requestDecorator = parseRequestDecorator(requestAnn);
|
|
27
|
-
switch (requestDecorator.MediaType) {
|
|
28
|
-
case "multipart/form-data":
|
|
29
|
-
case "multipart/mixed":
|
|
30
|
-
requestBody = encodeMultipartFormData(requestBodyObj[fname]);
|
|
31
|
-
requestHeaders = requestBody.getHeaders();
|
|
32
|
-
break;
|
|
33
|
-
case "application/x-www-form-urlencoded":
|
|
34
|
-
_a = [
|
|
35
|
-
{ "Content-Type": "".concat(requestDecorator.MediaType) },
|
|
36
|
-
encodeFormUrlEncodeData(requestBodyObj[fname]),
|
|
37
|
-
], requestHeaders = _a[0], requestBody = _a[1];
|
|
38
|
-
break;
|
|
39
|
-
case "application/json":
|
|
40
|
-
case "text/json":
|
|
41
|
-
_b = [
|
|
42
|
-
{ "Content-Type": "".concat(requestDecorator.MediaType) },
|
|
43
|
-
requestBodyObj[fname],
|
|
44
|
-
], requestHeaders = _b[0], requestBody = _b[1];
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
requestBody = requestBodyObj[fname];
|
|
48
|
-
var requestBodyType = typeof requestBody;
|
|
49
|
-
if (requestBodyType === "string" ||
|
|
50
|
-
requestBody instanceof String ||
|
|
51
|
-
requestBody instanceof Uint8Array)
|
|
52
|
-
requestHeaders = { "Content-Type": "".concat(requestDecorator.MediaType) };
|
|
53
|
-
else
|
|
54
|
-
throw new Error("invalid request body type ".concat(requestBodyType, " for mediaType ").concat(requestDecorator.MediaType));
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return [requestHeaders, requestBody];
|
|
15
|
+
var requestBodyAnn = Reflect.getMetadata(exports.requestMetadataKey, request, requestFieldName);
|
|
16
|
+
if (!requestBodyAnn) {
|
|
17
|
+
throw new Error("invalid request type");
|
|
18
|
+
}
|
|
19
|
+
var requestDecorator = parseRequestDecorator(requestBodyAnn);
|
|
20
|
+
return serializeContentType(requestDecorator.MediaType, request[requestFieldName]);
|
|
58
21
|
}
|
|
59
22
|
exports.serializeRequestBody = serializeRequestBody;
|
|
23
|
+
var serializeContentType = function (contentType, reqBody) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
var _c = [{}, {}], requestHeaders = _c[0], requestBody = _c[1];
|
|
26
|
+
switch (contentType) {
|
|
27
|
+
case "multipart/form-data":
|
|
28
|
+
case "multipart/mixed":
|
|
29
|
+
requestBody = encodeMultipartFormData(reqBody);
|
|
30
|
+
requestHeaders = requestBody.getHeaders();
|
|
31
|
+
break;
|
|
32
|
+
case "application/x-www-form-urlencoded":
|
|
33
|
+
_a = [
|
|
34
|
+
{ "Content-Type": "".concat(contentType) },
|
|
35
|
+
encodeFormUrlEncodeData(reqBody),
|
|
36
|
+
], requestHeaders = _a[0], requestBody = _a[1];
|
|
37
|
+
break;
|
|
38
|
+
case "application/json":
|
|
39
|
+
case "text/json":
|
|
40
|
+
_b = [
|
|
41
|
+
{ "Content-Type": "".concat(contentType) },
|
|
42
|
+
reqBody,
|
|
43
|
+
], requestHeaders = _b[0], requestBody = _b[1];
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
requestBody = reqBody;
|
|
47
|
+
var requestBodyType = typeof requestBody;
|
|
48
|
+
if (requestBodyType === "string" ||
|
|
49
|
+
requestBody instanceof String ||
|
|
50
|
+
requestBody instanceof Uint8Array)
|
|
51
|
+
requestHeaders = { "Content-Type": "".concat(contentType) };
|
|
52
|
+
else
|
|
53
|
+
throw new Error("invalid request body type ".concat(requestBodyType, " for mediaType ").concat(contentType));
|
|
54
|
+
}
|
|
55
|
+
return [requestHeaders, requestBody];
|
|
56
|
+
};
|
|
60
57
|
var encodeFormUrlEncodeData = function (data) {
|
|
61
58
|
var formData = new form_data_1.default();
|
|
62
59
|
var fieldNames = Object.getOwnPropertyNames(data);
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
+
export declare const SerializationMethodToContentType: Record<string, string>;
|
|
3
|
+
export interface PropInfo {
|
|
4
|
+
key: string | symbol;
|
|
5
|
+
type: any;
|
|
6
|
+
elemType: any;
|
|
7
|
+
elemDepth: number;
|
|
8
|
+
}
|
|
2
9
|
export declare class SpeakeasyBase {
|
|
3
10
|
constructor(payload?: Record<string | symbol, unknown>);
|
|
4
11
|
}
|
|
@@ -18,7 +25,7 @@ export declare function SpeakeasyMetadata<T extends SpeakeasyBase = Record<strin
|
|
|
18
25
|
elemDepth?: number;
|
|
19
26
|
}): PropertyDecorator;
|
|
20
27
|
export declare function templateUrl(stringWithParams: string, params: Record<string, string>): string;
|
|
21
|
-
export declare function generateURL(serverURL: string, path: string, pathParams: any): string;
|
|
28
|
+
export declare function generateURL(serverURL: string, path: string, pathParams: any, globals?: any): string;
|
|
22
29
|
export declare function parseParamDecorator(ann: string, fName: string, defaultStyle: string, defaultExplode: boolean): ParamDecorator;
|
|
23
30
|
export declare function isStringRecord(obj: any): obj is Record<string, string>;
|
|
24
31
|
export declare function isNumberRecord(obj: any): obj is Record<string, number>;
|
|
@@ -28,3 +35,4 @@ export declare function convertIfDateObjectToISOString(value: any, dateTimeForma
|
|
|
28
35
|
export declare function encodeAndConvertPrimitiveVal(value: any, dateTimeFormat?: string): any;
|
|
29
36
|
export declare function deserializeJSONResponse<T>(value: T, klass?: any, elemDepth?: number): any;
|
|
30
37
|
export declare function getResFieldDepth(res: any): number;
|
|
38
|
+
export declare function populateFromGlobals(value: any, fieldName: string, paramType: string, globals: any): any;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getResFieldDepth = exports.deserializeJSONResponse = exports.encodeAndConvertPrimitiveVal = exports.convertIfDateObjectToISOString = exports.isEmpty = exports.isBooleanRecord = exports.isNumberRecord = exports.isStringRecord = exports.parseParamDecorator = exports.generateURL = exports.templateUrl = exports.SpeakeasyMetadata = exports.ParamDecorator = exports.SpeakeasyBase = void 0;
|
|
3
|
+
exports.populateFromGlobals = exports.getResFieldDepth = exports.deserializeJSONResponse = exports.encodeAndConvertPrimitiveVal = exports.convertIfDateObjectToISOString = exports.isEmpty = exports.isBooleanRecord = exports.isNumberRecord = exports.isStringRecord = exports.parseParamDecorator = exports.generateURL = exports.templateUrl = exports.SpeakeasyMetadata = exports.ParamDecorator = exports.SpeakeasyBase = exports.SerializationMethodToContentType = void 0;
|
|
4
4
|
require("reflect-metadata");
|
|
5
5
|
var pathparams_1 = require("./pathparams");
|
|
6
6
|
var class_transformer_1 = require("class-transformer");
|
|
7
|
+
var requestbody_1 = require("./requestbody");
|
|
8
|
+
exports.SerializationMethodToContentType = {
|
|
9
|
+
"json": "application/json",
|
|
10
|
+
"form": "application/x-www-form-urlencoded",
|
|
11
|
+
"multipart": "multipart/form-data",
|
|
12
|
+
"raw": "application/octet-stream",
|
|
13
|
+
"string": "text/plain",
|
|
14
|
+
};
|
|
7
15
|
function isSpeakeasyBase(type) {
|
|
8
16
|
var _a;
|
|
9
17
|
return type && ((_a = Object.getPrototypeOf(type)) === null || _a === void 0 ? void 0 : _a.name) == "SpeakeasyBase";
|
|
@@ -132,20 +140,27 @@ function templateUrl(stringWithParams, params) {
|
|
|
132
140
|
return res;
|
|
133
141
|
}
|
|
134
142
|
exports.templateUrl = templateUrl;
|
|
135
|
-
function generateURL(serverURL, path, pathParams) {
|
|
143
|
+
function generateURL(serverURL, path, pathParams, globals) {
|
|
136
144
|
var url = serverURL.replace(/\/$/, "") + path;
|
|
137
145
|
var parsedParameters = {};
|
|
138
|
-
var fieldNames =
|
|
146
|
+
var fieldNames = "__props__" in pathParams
|
|
147
|
+
? pathParams["__props__"].map(function (prop) { return prop.key; })
|
|
148
|
+
: Object.getOwnPropertyNames(pathParams);
|
|
139
149
|
fieldNames.forEach(function (fname) {
|
|
150
|
+
var requestBodyAnn = Reflect.getMetadata(requestbody_1.requestMetadataKey, pathParams, fname);
|
|
151
|
+
if (requestBodyAnn)
|
|
152
|
+
return;
|
|
140
153
|
var ppAnn = Reflect.getMetadata(pathparams_1.ppMetadataKey, pathParams, fname);
|
|
141
154
|
if (ppAnn == null)
|
|
142
155
|
return;
|
|
143
156
|
var ppDecorator = parseParamDecorator(ppAnn, fname, "simple", false);
|
|
144
157
|
if (ppDecorator == null)
|
|
145
158
|
return;
|
|
159
|
+
var value = pathParams[fname];
|
|
160
|
+
value = populateFromGlobals(value, fname, "pathParam", globals);
|
|
146
161
|
switch (ppDecorator.Style) {
|
|
147
162
|
case "simple":
|
|
148
|
-
var simpleParams = (0, pathparams_1.getSimplePathParams)(ppDecorator.ParamName,
|
|
163
|
+
var simpleParams = (0, pathparams_1.getSimplePathParams)(ppDecorator.ParamName, value, ppDecorator.Explode, ppDecorator.DateTimeFormat);
|
|
149
164
|
simpleParams.forEach(function (value, key) {
|
|
150
165
|
parsedParameters[key] = value;
|
|
151
166
|
});
|
|
@@ -243,19 +258,23 @@ function deserializeJSONResponse(value, klass, elemDepth) {
|
|
|
243
258
|
return value;
|
|
244
259
|
}
|
|
245
260
|
if (elemDepth === 0 && klass != null) {
|
|
246
|
-
return (0, class_transformer_1.plainToInstance)(klass, value, {
|
|
261
|
+
return (0, class_transformer_1.plainToInstance)(klass, value, {
|
|
262
|
+
excludeExtraneousValues: true,
|
|
263
|
+
});
|
|
247
264
|
}
|
|
248
265
|
if (Array.isArray(value)) {
|
|
249
266
|
return value.map(function (v) { return deserializeJSONResponse(v, klass, elemDepth - 1); });
|
|
250
267
|
}
|
|
251
|
-
if (typeof value ===
|
|
268
|
+
if (typeof value === "object" && value != null) {
|
|
252
269
|
var copiedRecord = {};
|
|
253
270
|
for (var key in value) {
|
|
254
271
|
copiedRecord[key] = deserializeJSONResponse(value[key], klass, elemDepth - 1);
|
|
255
272
|
}
|
|
256
273
|
return copiedRecord;
|
|
257
274
|
}
|
|
258
|
-
return (0, class_transformer_1.plainToInstance)(klass, value, {
|
|
275
|
+
return (0, class_transformer_1.plainToInstance)(klass, value, {
|
|
276
|
+
excludeExtraneousValues: true,
|
|
277
|
+
});
|
|
259
278
|
}
|
|
260
279
|
exports.deserializeJSONResponse = deserializeJSONResponse;
|
|
261
280
|
function getResFieldDepth(res) {
|
|
@@ -278,3 +297,15 @@ function getResFieldDepth(res) {
|
|
|
278
297
|
return resFieldDepth;
|
|
279
298
|
}
|
|
280
299
|
exports.getResFieldDepth = getResFieldDepth;
|
|
300
|
+
function populateFromGlobals(value, fieldName, paramType, globals) {
|
|
301
|
+
if (globals && value === undefined) {
|
|
302
|
+
if ("parameters" in globals && paramType in globals.parameters) {
|
|
303
|
+
var globalValue = globals.parameters[paramType][fieldName];
|
|
304
|
+
if (globalValue !== undefined) {
|
|
305
|
+
value = globalValue;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return value;
|
|
310
|
+
}
|
|
311
|
+
exports.populateFromGlobals = populateFromGlobals;
|
package/dist/sdk/dataset.d.ts
CHANGED
|
@@ -12,30 +12,30 @@ export declare class Dataset {
|
|
|
12
12
|
* createDataset - Create a Dataset
|
|
13
13
|
*
|
|
14
14
|
* This endpoint creates a new dataset
|
|
15
|
-
|
|
16
|
-
createDataset(req: operations.
|
|
15
|
+
**/
|
|
16
|
+
createDataset(req: operations.CreateDatasetRequestBody, config?: AxiosRequestConfig): Promise<operations.CreateDatasetResponse>;
|
|
17
17
|
/**
|
|
18
18
|
* deleteDatasetById - Delete a Single Dataset by ID
|
|
19
19
|
*
|
|
20
20
|
* This endpoint deletes the specific dataset
|
|
21
|
-
|
|
21
|
+
**/
|
|
22
22
|
deleteDatasetById(req: operations.DeleteDatasetByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteDatasetByIdResponse>;
|
|
23
23
|
/**
|
|
24
24
|
* getDatasetById - Get a Single Dataset by ID
|
|
25
25
|
*
|
|
26
26
|
* This endpoint gets the specific dataset
|
|
27
|
-
|
|
27
|
+
**/
|
|
28
28
|
getDatasetById(req: operations.GetDatasetByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetDatasetByIdResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* uploadDatasetImage - Upload dataset image
|
|
31
31
|
*
|
|
32
32
|
* This endpoint returns presigned details to upload a dataset image to S3
|
|
33
|
-
|
|
33
|
+
**/
|
|
34
34
|
uploadDatasetImage(req: operations.UploadDatasetImageRequest, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageResponse>;
|
|
35
35
|
/**
|
|
36
36
|
* uploadDatasetImageFromGen - Upload a Single Generated Image to a Dataset
|
|
37
37
|
*
|
|
38
38
|
* This endpoint will upload a previously generated image to the dataset
|
|
39
|
-
|
|
39
|
+
**/
|
|
40
40
|
uploadDatasetImageFromGen(req: operations.UploadDatasetImageFromGenRequest, config?: AxiosRequestConfig): Promise<operations.UploadDatasetImageFromGenResponse>;
|
|
41
41
|
}
|
package/dist/sdk/dataset.js
CHANGED
|
@@ -50,17 +50,17 @@ var Dataset = /** @class */ (function () {
|
|
|
50
50
|
* createDataset - Create a Dataset
|
|
51
51
|
*
|
|
52
52
|
* This endpoint creates a new dataset
|
|
53
|
-
|
|
53
|
+
**/
|
|
54
54
|
Dataset.prototype.createDataset = function (req, config) {
|
|
55
55
|
var _a;
|
|
56
56
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
57
|
-
req = new operations.
|
|
57
|
+
req = new operations.CreateDatasetRequestBody(req);
|
|
58
58
|
}
|
|
59
59
|
var baseURL = this._serverURL;
|
|
60
60
|
var url = baseURL.replace(/\/$/, "") + "/datasets";
|
|
61
61
|
var _b = [{}, {}], reqBodyHeaders = _b[0], reqBody = _b[1];
|
|
62
62
|
try {
|
|
63
|
-
_a = utils.serializeRequestBody(req), reqBodyHeaders = _a[0], reqBody = _a[1];
|
|
63
|
+
_a = utils.serializeRequestBody(req, "request", "json"), reqBodyHeaders = _a[0], reqBody = _a[1];
|
|
64
64
|
}
|
|
65
65
|
catch (e) {
|
|
66
66
|
if (e instanceof Error) {
|
|
@@ -80,12 +80,13 @@ var Dataset = /** @class */ (function () {
|
|
|
80
80
|
var res = new operations.CreateDatasetResponse({
|
|
81
81
|
statusCode: httpRes.status,
|
|
82
82
|
contentType: contentType,
|
|
83
|
-
rawResponse: httpRes
|
|
83
|
+
rawResponse: httpRes,
|
|
84
84
|
});
|
|
85
85
|
switch (true) {
|
|
86
86
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
87
87
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
88
|
-
res.createDataset200ApplicationJSONObject =
|
|
88
|
+
res.createDataset200ApplicationJSONObject =
|
|
89
|
+
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.CreateDataset200ApplicationJSON);
|
|
89
90
|
}
|
|
90
91
|
break;
|
|
91
92
|
}
|
|
@@ -96,13 +97,13 @@ var Dataset = /** @class */ (function () {
|
|
|
96
97
|
* deleteDatasetById - Delete a Single Dataset by ID
|
|
97
98
|
*
|
|
98
99
|
* This endpoint deletes the specific dataset
|
|
99
|
-
|
|
100
|
+
**/
|
|
100
101
|
Dataset.prototype.deleteDatasetById = function (req, config) {
|
|
101
102
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
102
103
|
req = new operations.DeleteDatasetByIdRequest(req);
|
|
103
104
|
}
|
|
104
105
|
var baseURL = this._serverURL;
|
|
105
|
-
var url = utils.generateURL(baseURL, "/datasets/{id}", req
|
|
106
|
+
var url = utils.generateURL(baseURL, "/datasets/{id}", req);
|
|
106
107
|
var client = this._securityClient;
|
|
107
108
|
var r = client.request(__assign({ url: url, method: "delete" }, config));
|
|
108
109
|
return r.then(function (httpRes) {
|
|
@@ -113,12 +114,13 @@ var Dataset = /** @class */ (function () {
|
|
|
113
114
|
var res = new operations.DeleteDatasetByIdResponse({
|
|
114
115
|
statusCode: httpRes.status,
|
|
115
116
|
contentType: contentType,
|
|
116
|
-
rawResponse: httpRes
|
|
117
|
+
rawResponse: httpRes,
|
|
117
118
|
});
|
|
118
119
|
switch (true) {
|
|
119
120
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
120
121
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
121
|
-
res.deleteDatasetById200ApplicationJSONObject =
|
|
122
|
+
res.deleteDatasetById200ApplicationJSONObject =
|
|
123
|
+
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.DeleteDatasetById200ApplicationJSON);
|
|
122
124
|
}
|
|
123
125
|
break;
|
|
124
126
|
}
|
|
@@ -129,13 +131,13 @@ var Dataset = /** @class */ (function () {
|
|
|
129
131
|
* getDatasetById - Get a Single Dataset by ID
|
|
130
132
|
*
|
|
131
133
|
* This endpoint gets the specific dataset
|
|
132
|
-
|
|
134
|
+
**/
|
|
133
135
|
Dataset.prototype.getDatasetById = function (req, config) {
|
|
134
136
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
135
137
|
req = new operations.GetDatasetByIdRequest(req);
|
|
136
138
|
}
|
|
137
139
|
var baseURL = this._serverURL;
|
|
138
|
-
var url = utils.generateURL(baseURL, "/datasets/{id}", req
|
|
140
|
+
var url = utils.generateURL(baseURL, "/datasets/{id}", req);
|
|
139
141
|
var client = this._securityClient;
|
|
140
142
|
var r = client.request(__assign({ url: url, method: "get" }, config));
|
|
141
143
|
return r.then(function (httpRes) {
|
|
@@ -146,12 +148,13 @@ var Dataset = /** @class */ (function () {
|
|
|
146
148
|
var res = new operations.GetDatasetByIdResponse({
|
|
147
149
|
statusCode: httpRes.status,
|
|
148
150
|
contentType: contentType,
|
|
149
|
-
rawResponse: httpRes
|
|
151
|
+
rawResponse: httpRes,
|
|
150
152
|
});
|
|
151
153
|
switch (true) {
|
|
152
154
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
153
155
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
154
|
-
res.getDatasetById200ApplicationJSONObject =
|
|
156
|
+
res.getDatasetById200ApplicationJSONObject =
|
|
157
|
+
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.GetDatasetById200ApplicationJSON);
|
|
155
158
|
}
|
|
156
159
|
break;
|
|
157
160
|
}
|
|
@@ -162,17 +165,17 @@ var Dataset = /** @class */ (function () {
|
|
|
162
165
|
* uploadDatasetImage - Upload dataset image
|
|
163
166
|
*
|
|
164
167
|
* This endpoint returns presigned details to upload a dataset image to S3
|
|
165
|
-
|
|
168
|
+
**/
|
|
166
169
|
Dataset.prototype.uploadDatasetImage = function (req, config) {
|
|
167
170
|
var _a;
|
|
168
171
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
169
172
|
req = new operations.UploadDatasetImageRequest(req);
|
|
170
173
|
}
|
|
171
174
|
var baseURL = this._serverURL;
|
|
172
|
-
var url = utils.generateURL(baseURL, "/datasets/{datasetId}/upload", req
|
|
175
|
+
var url = utils.generateURL(baseURL, "/datasets/{datasetId}/upload", req);
|
|
173
176
|
var _b = [{}, {}], reqBodyHeaders = _b[0], reqBody = _b[1];
|
|
174
177
|
try {
|
|
175
|
-
_a = utils.serializeRequestBody(req), reqBodyHeaders = _a[0], reqBody = _a[1];
|
|
178
|
+
_a = utils.serializeRequestBody(req, "requestBody", "json"), reqBodyHeaders = _a[0], reqBody = _a[1];
|
|
176
179
|
}
|
|
177
180
|
catch (e) {
|
|
178
181
|
if (e instanceof Error) {
|
|
@@ -192,12 +195,13 @@ var Dataset = /** @class */ (function () {
|
|
|
192
195
|
var res = new operations.UploadDatasetImageResponse({
|
|
193
196
|
statusCode: httpRes.status,
|
|
194
197
|
contentType: contentType,
|
|
195
|
-
rawResponse: httpRes
|
|
198
|
+
rawResponse: httpRes,
|
|
196
199
|
});
|
|
197
200
|
switch (true) {
|
|
198
201
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
199
202
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
200
|
-
res.uploadDatasetImage200ApplicationJSONObject =
|
|
203
|
+
res.uploadDatasetImage200ApplicationJSONObject =
|
|
204
|
+
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImage200ApplicationJSON);
|
|
201
205
|
}
|
|
202
206
|
break;
|
|
203
207
|
}
|
|
@@ -208,17 +212,17 @@ var Dataset = /** @class */ (function () {
|
|
|
208
212
|
* uploadDatasetImageFromGen - Upload a Single Generated Image to a Dataset
|
|
209
213
|
*
|
|
210
214
|
* This endpoint will upload a previously generated image to the dataset
|
|
211
|
-
|
|
215
|
+
**/
|
|
212
216
|
Dataset.prototype.uploadDatasetImageFromGen = function (req, config) {
|
|
213
217
|
var _a;
|
|
214
218
|
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
215
219
|
req = new operations.UploadDatasetImageFromGenRequest(req);
|
|
216
220
|
}
|
|
217
221
|
var baseURL = this._serverURL;
|
|
218
|
-
var url = utils.generateURL(baseURL, "/datasets/{datasetId}/upload/gen", req
|
|
222
|
+
var url = utils.generateURL(baseURL, "/datasets/{datasetId}/upload/gen", req);
|
|
219
223
|
var _b = [{}, {}], reqBodyHeaders = _b[0], reqBody = _b[1];
|
|
220
224
|
try {
|
|
221
|
-
_a = utils.serializeRequestBody(req), reqBodyHeaders = _a[0], reqBody = _a[1];
|
|
225
|
+
_a = utils.serializeRequestBody(req, "requestBody", "json"), reqBodyHeaders = _a[0], reqBody = _a[1];
|
|
222
226
|
}
|
|
223
227
|
catch (e) {
|
|
224
228
|
if (e instanceof Error) {
|
|
@@ -238,12 +242,13 @@ var Dataset = /** @class */ (function () {
|
|
|
238
242
|
var res = new operations.UploadDatasetImageFromGenResponse({
|
|
239
243
|
statusCode: httpRes.status,
|
|
240
244
|
contentType: contentType,
|
|
241
|
-
rawResponse: httpRes
|
|
245
|
+
rawResponse: httpRes,
|
|
242
246
|
});
|
|
243
247
|
switch (true) {
|
|
244
248
|
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
245
249
|
if (utils.matchContentType(contentType, "application/json")) {
|
|
246
|
-
res.uploadDatasetImageFromGen200ApplicationJSONObject =
|
|
250
|
+
res.uploadDatasetImageFromGen200ApplicationJSONObject =
|
|
251
|
+
utils.deserializeJSONResponse(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, operations.UploadDatasetImageFromGen200ApplicationJSON);
|
|
247
252
|
}
|
|
248
253
|
break;
|
|
249
254
|
}
|
package/dist/sdk/generation.d.ts
CHANGED
|
@@ -12,24 +12,24 @@ export declare class Generation {
|
|
|
12
12
|
* createGeneration - Create a Generation of Images
|
|
13
13
|
*
|
|
14
14
|
* This endpoint will generate images
|
|
15
|
-
|
|
16
|
-
createGeneration(req: operations.
|
|
15
|
+
**/
|
|
16
|
+
createGeneration(req: operations.CreateGenerationRequestBody, config?: AxiosRequestConfig): Promise<operations.CreateGenerationResponse>;
|
|
17
17
|
/**
|
|
18
18
|
* deleteGenerationById - Delete a Single Generation
|
|
19
19
|
*
|
|
20
20
|
* This endpoint deletes a specific generation
|
|
21
|
-
|
|
21
|
+
**/
|
|
22
22
|
deleteGenerationById(req: operations.DeleteGenerationByIdRequest, config?: AxiosRequestConfig): Promise<operations.DeleteGenerationByIdResponse>;
|
|
23
23
|
/**
|
|
24
24
|
* getGenerationById - Get a Single Generation
|
|
25
25
|
*
|
|
26
26
|
* This endpoint will provide information about a specific generation
|
|
27
|
-
|
|
27
|
+
**/
|
|
28
28
|
getGenerationById(req: operations.GetGenerationByIdRequest, config?: AxiosRequestConfig): Promise<operations.GetGenerationByIdResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* getGenerationsByUserId - Get generations by user ID
|
|
31
31
|
*
|
|
32
32
|
* This endpoint returns all generations by a specific user
|
|
33
|
-
|
|
33
|
+
**/
|
|
34
34
|
getGenerationsByUserId(req: operations.GetGenerationsByUserIdRequest, config?: AxiosRequestConfig): Promise<operations.GetGenerationsByUserIdResponse>;
|
|
35
35
|
}
|