@leonardo-ai/sdk 1.1.1
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/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/internal/utils/contenttype.d.ts +1 -0
- package/dist/internal/utils/contenttype.js +30 -0
- package/dist/internal/utils/headers.d.ts +4 -0
- package/dist/internal/utils/headers.js +85 -0
- package/dist/internal/utils/index.d.ts +8 -0
- package/dist/internal/utils/index.js +24 -0
- package/dist/internal/utils/pathparams.d.ts +9 -0
- package/dist/internal/utils/pathparams.js +58 -0
- package/dist/internal/utils/queryparams.d.ts +3 -0
- package/dist/internal/utils/queryparams.js +104 -0
- package/dist/internal/utils/requestbody.d.ts +1 -0
- package/dist/internal/utils/requestbody.js +266 -0
- package/dist/internal/utils/retries.d.ts +20 -0
- package/dist/internal/utils/retries.js +223 -0
- package/dist/internal/utils/security.d.ts +2 -0
- package/dist/internal/utils/security.js +156 -0
- package/dist/internal/utils/utils.d.ts +19 -0
- package/dist/internal/utils/utils.js +202 -0
- package/dist/sdk/creatingdatasets.d.ts +41 -0
- package/dist/sdk/creatingdatasets.js +235 -0
- package/dist/sdk/generatingimages.d.ts +35 -0
- package/dist/sdk/generatingimages.js +182 -0
- package/dist/sdk/imagevariations.d.ts +23 -0
- package/dist/sdk/imagevariations.js +120 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +17 -0
- package/dist/sdk/initimages.d.ts +29 -0
- package/dist/sdk/initimages.js +151 -0
- package/dist/sdk/models/operations/deletedatasetsid.d.ts +12 -0
- package/dist/sdk/models/operations/deletedatasetsid.js +72 -0
- package/dist/sdk/models/operations/deletegenerationsid.d.ts +12 -0
- package/dist/sdk/models/operations/deletegenerationsid.js +72 -0
- package/dist/sdk/models/operations/deleteinitimageid.d.ts +12 -0
- package/dist/sdk/models/operations/deleteinitimageid.js +72 -0
- package/dist/sdk/models/operations/deletemodelsid.d.ts +12 -0
- package/dist/sdk/models/operations/deletemodelsid.js +72 -0
- package/dist/sdk/models/operations/getdatasetsid.d.ts +12 -0
- package/dist/sdk/models/operations/getdatasetsid.js +72 -0
- package/dist/sdk/models/operations/getgenerationsid.d.ts +12 -0
- package/dist/sdk/models/operations/getgenerationsid.js +72 -0
- package/dist/sdk/models/operations/getgenerationsuseruserid.d.ts +17 -0
- package/dist/sdk/models/operations/getgenerationsuseruserid.js +92 -0
- package/dist/sdk/models/operations/getinitimageid.d.ts +12 -0
- package/dist/sdk/models/operations/getinitimageid.js +72 -0
- package/dist/sdk/models/operations/getme.d.ts +6 -0
- package/dist/sdk/models/operations/getme.js +48 -0
- package/dist/sdk/models/operations/getmodelsid.d.ts +12 -0
- package/dist/sdk/models/operations/getmodelsid.js +72 -0
- package/dist/sdk/models/operations/getvariationsid.d.ts +12 -0
- package/dist/sdk/models/operations/getvariationsid.js +72 -0
- package/dist/sdk/models/operations/index.d.ts +18 -0
- package/dist/sdk/models/operations/index.js +34 -0
- package/dist/sdk/models/operations/postdatasets.d.ts +13 -0
- package/dist/sdk/models/operations/postdatasets.js +76 -0
- package/dist/sdk/models/operations/postdatasetsdatasetidupload.d.ts +16 -0
- package/dist/sdk/models/operations/postdatasetsdatasetidupload.js +88 -0
- package/dist/sdk/models/operations/postdatasetsdatasetiduploadgen.d.ts +16 -0
- package/dist/sdk/models/operations/postdatasetsdatasetiduploadgen.js +88 -0
- package/dist/sdk/models/operations/postgenerations.d.ts +27 -0
- package/dist/sdk/models/operations/postgenerations.js +132 -0
- package/dist/sdk/models/operations/postinitimage.d.ts +12 -0
- package/dist/sdk/models/operations/postinitimage.js +72 -0
- package/dist/sdk/models/operations/postmodels.d.ts +20 -0
- package/dist/sdk/models/operations/postmodels.js +104 -0
- package/dist/sdk/models/operations/postvariationsupscale.d.ts +12 -0
- package/dist/sdk/models/operations/postvariationsupscale.js +72 -0
- package/dist/sdk/models/shared/index.d.ts +1 -0
- package/dist/sdk/models/shared/index.js +17 -0
- package/dist/sdk/models/shared/security.d.ts +7 -0
- package/dist/sdk/models/shared/security.js +52 -0
- package/dist/sdk/sdk.d.ts +29 -0
- package/dist/sdk/sdk.js +68 -0
- package/dist/sdk/trainingmodels.d.ts +29 -0
- package/dist/sdk/trainingmodels.js +151 -0
- package/dist/sdk/userinformation.d.ts +17 -0
- package/dist/sdk/userinformation.js +76 -0
- package/package.json +41 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.TrainingModels = void 0;
|
|
38
|
+
var utils = __importStar(require("../internal/utils"));
|
|
39
|
+
var operations = __importStar(require("./models/operations"));
|
|
40
|
+
var TrainingModels = /** @class */ (function () {
|
|
41
|
+
function TrainingModels(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
|
|
42
|
+
this._defaultClient = defaultClient;
|
|
43
|
+
this._securityClient = securityClient;
|
|
44
|
+
this._serverURL = serverURL;
|
|
45
|
+
this._language = language;
|
|
46
|
+
this._sdkVersion = sdkVersion;
|
|
47
|
+
this._genVersion = genVersion;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* deleteModelsId - Delete a Single Custom Model by ID
|
|
51
|
+
*
|
|
52
|
+
* This endpoint will delete a specific custom model
|
|
53
|
+
**/
|
|
54
|
+
TrainingModels.prototype.deleteModelsId = function (req, config) {
|
|
55
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
56
|
+
req = new operations.DeleteModelsIdRequest(req);
|
|
57
|
+
}
|
|
58
|
+
var baseURL = this._serverURL;
|
|
59
|
+
var url = utils.generateURL(baseURL, "/models/{id}", req.pathParams);
|
|
60
|
+
var client = this._securityClient;
|
|
61
|
+
var r = client.request(__assign({ url: url, method: "delete" }, config));
|
|
62
|
+
return r.then(function (httpRes) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
65
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
|
|
66
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
67
|
+
var res = { statusCode: httpRes.status, contentType: contentType };
|
|
68
|
+
switch (true) {
|
|
69
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
70
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
71
|
+
res.deleteModelsId200ApplicationJSONAny = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
return res;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* getModelsId - Get a Single Custom Model by ID
|
|
80
|
+
*
|
|
81
|
+
* This endpoint gets the specific custom model
|
|
82
|
+
**/
|
|
83
|
+
TrainingModels.prototype.getModelsId = function (req, config) {
|
|
84
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
85
|
+
req = new operations.GetModelsIdRequest(req);
|
|
86
|
+
}
|
|
87
|
+
var baseURL = this._serverURL;
|
|
88
|
+
var url = utils.generateURL(baseURL, "/models/{id}", req.pathParams);
|
|
89
|
+
var client = this._securityClient;
|
|
90
|
+
var r = client.request(__assign({ url: url, method: "get" }, config));
|
|
91
|
+
return r.then(function (httpRes) {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
94
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
|
|
95
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
96
|
+
var res = { statusCode: httpRes.status, contentType: contentType };
|
|
97
|
+
switch (true) {
|
|
98
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
99
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
100
|
+
res.getModelsId200ApplicationJSONAny = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
return res;
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* postModels - Train a Custom Model
|
|
109
|
+
*
|
|
110
|
+
* This endpoint will train a new custom model
|
|
111
|
+
**/
|
|
112
|
+
TrainingModels.prototype.postModels = function (req, config) {
|
|
113
|
+
var _a;
|
|
114
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
115
|
+
req = new operations.PostModelsRequest(req);
|
|
116
|
+
}
|
|
117
|
+
var baseURL = this._serverURL;
|
|
118
|
+
var url = baseURL.replace(/\/$/, "") + "/models";
|
|
119
|
+
var _b = [{}, {}], reqBodyHeaders = _b[0], reqBody = _b[1];
|
|
120
|
+
try {
|
|
121
|
+
_a = utils.serializeRequestBody(req), reqBodyHeaders = _a[0], reqBody = _a[1];
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
if (e instanceof Error) {
|
|
125
|
+
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
var client = this._securityClient;
|
|
129
|
+
var headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
|
|
130
|
+
if (reqBody == null || Object.keys(reqBody).length === 0)
|
|
131
|
+
throw new Error("request body is required");
|
|
132
|
+
var r = client.request(__assign({ url: url, method: "post", headers: headers, data: reqBody }, config));
|
|
133
|
+
return r.then(function (httpRes) {
|
|
134
|
+
var _a, _b;
|
|
135
|
+
var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
136
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
|
|
137
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
138
|
+
var res = { statusCode: httpRes.status, contentType: contentType };
|
|
139
|
+
switch (true) {
|
|
140
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
141
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
142
|
+
res.postModels200ApplicationJSONAny = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
return res;
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
return TrainingModels;
|
|
150
|
+
}());
|
|
151
|
+
exports.TrainingModels = TrainingModels;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as operations from "./models/operations";
|
|
2
|
+
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
3
|
+
export declare class UserInformation {
|
|
4
|
+
_defaultClient: AxiosInstance;
|
|
5
|
+
_securityClient: AxiosInstance;
|
|
6
|
+
_serverURL: string;
|
|
7
|
+
_language: string;
|
|
8
|
+
_sdkVersion: string;
|
|
9
|
+
_genVersion: string;
|
|
10
|
+
constructor(defaultClient: AxiosInstance, securityClient: AxiosInstance, serverURL: string, language: string, sdkVersion: string, genVersion: string);
|
|
11
|
+
/**
|
|
12
|
+
* getMe - Get user information
|
|
13
|
+
*
|
|
14
|
+
* This endpoint will return your user information, including your user ID.
|
|
15
|
+
**/
|
|
16
|
+
getMe(config?: AxiosRequestConfig): Promise<operations.GetMeResponse>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.UserInformation = void 0;
|
|
38
|
+
var utils = __importStar(require("../internal/utils"));
|
|
39
|
+
var UserInformation = /** @class */ (function () {
|
|
40
|
+
function UserInformation(defaultClient, securityClient, serverURL, language, sdkVersion, genVersion) {
|
|
41
|
+
this._defaultClient = defaultClient;
|
|
42
|
+
this._securityClient = securityClient;
|
|
43
|
+
this._serverURL = serverURL;
|
|
44
|
+
this._language = language;
|
|
45
|
+
this._sdkVersion = sdkVersion;
|
|
46
|
+
this._genVersion = genVersion;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* getMe - Get user information
|
|
50
|
+
*
|
|
51
|
+
* This endpoint will return your user information, including your user ID.
|
|
52
|
+
**/
|
|
53
|
+
UserInformation.prototype.getMe = function (config) {
|
|
54
|
+
var baseURL = this._serverURL;
|
|
55
|
+
var url = baseURL.replace(/\/$/, "") + "/me";
|
|
56
|
+
var client = this._securityClient;
|
|
57
|
+
var r = client.request(__assign({ url: url, method: "get" }, config));
|
|
58
|
+
return r.then(function (httpRes) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
|
|
61
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
|
|
62
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
63
|
+
var res = { statusCode: httpRes.status, contentType: contentType };
|
|
64
|
+
switch (true) {
|
|
65
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
66
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
67
|
+
res.getMe200ApplicationJSONAny = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
return res;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
return UserInformation;
|
|
75
|
+
}());
|
|
76
|
+
exports.UserInformation = UserInformation;
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leonardo-ai/sdk",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"author": "leonardoai",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"prepare": "tsc --build"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"axios": "^1.1.3",
|
|
10
|
+
"form-data": "^4.0.0",
|
|
11
|
+
"qs": "^6.11.0",
|
|
12
|
+
"reflect-metadata": "^0.1.13"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/node": "^18.11.5",
|
|
16
|
+
"@types/qs": "^6.9.7",
|
|
17
|
+
"typescript": "^4.8.4"
|
|
18
|
+
},
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"description": "<div align=\"center\"> <p>The API for creating stunning game assets with AI.</p> <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> <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> <a href=\"https://discord.gg/leonardo-ai\"><img src=\"https://img.shields.io/static/v1?label=Discord&message=Join&color=7289da&style=for-the-badge\" /></a> </div>",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/Leonardo-Interactive/leonardo-ts-sdk.git"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"image-generation",
|
|
31
|
+
"ts",
|
|
32
|
+
"sdk",
|
|
33
|
+
"api"
|
|
34
|
+
],
|
|
35
|
+
"license": "ISC",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/Leonardo-Interactive/leonardo-ts-sdk/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/Leonardo-Interactive/leonardo-ts-sdk#readme",
|
|
40
|
+
"types": "./dist/index.d.ts"
|
|
41
|
+
}
|