@rightbrain/brain-api-client 0.0.1-dev.29.b1d5e4e
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/.openapi-generator-ignore +28 -0
- package/README.md +45 -0
- package/api.ts +27331 -0
- package/base.ts +86 -0
- package/common.ts +190 -0
- package/configuration.ts +110 -0
- package/dist/api.d.ts +17749 -0
- package/dist/api.js +22699 -0
- package/dist/base.d.ts +66 -0
- package/dist/base.js +86 -0
- package/dist/common.d.ts +65 -0
- package/dist/common.js +305 -0
- package/dist/configuration.d.ts +91 -0
- package/dist/configuration.js +45 -0
- package/dist/errors.d.ts +30 -0
- package/dist/errors.js +33 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -0
- package/errors.ts +46 -0
- package/index.ts +10 -0
- package/package.json +29 -0
- package/tsconfig.json +22 -0
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RightBrain API
|
|
3
|
+
* The RightBrain API provides programmatic access to AI-powered task execution.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: v1
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { Configuration } from './configuration';
|
|
13
|
+
import type { AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
14
|
+
export declare const BASE_PATH: string;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export declare const COLLECTION_FORMATS: {
|
|
20
|
+
csv: string;
|
|
21
|
+
ssv: string;
|
|
22
|
+
tsv: string;
|
|
23
|
+
pipes: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @interface RequestArgs
|
|
29
|
+
*/
|
|
30
|
+
export interface RequestArgs {
|
|
31
|
+
url: string;
|
|
32
|
+
options: RawAxiosRequestConfig;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
* @class BaseAPI
|
|
38
|
+
*/
|
|
39
|
+
export declare class BaseAPI {
|
|
40
|
+
protected basePath: string;
|
|
41
|
+
protected axios: AxiosInstance;
|
|
42
|
+
protected configuration: Configuration | undefined;
|
|
43
|
+
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @class RequiredError
|
|
49
|
+
* @extends {Error}
|
|
50
|
+
*/
|
|
51
|
+
export declare class RequiredError extends Error {
|
|
52
|
+
field: string;
|
|
53
|
+
constructor(field: string, msg?: string);
|
|
54
|
+
}
|
|
55
|
+
interface ServerMap {
|
|
56
|
+
[key: string]: {
|
|
57
|
+
url: string;
|
|
58
|
+
description: string;
|
|
59
|
+
}[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
*/
|
|
65
|
+
export declare const operationServerMap: ServerMap;
|
|
66
|
+
export {};
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* RightBrain API
|
|
6
|
+
* The RightBrain API provides programmatic access to AI-powered task execution.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: v1
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __extends = (this && this.__extends) || (function () {
|
|
16
|
+
var extendStatics = function (d, b) {
|
|
17
|
+
extendStatics = Object.setPrototypeOf ||
|
|
18
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
19
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
20
|
+
return extendStatics(d, b);
|
|
21
|
+
};
|
|
22
|
+
return function (d, b) {
|
|
23
|
+
if (typeof b !== "function" && b !== null)
|
|
24
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
25
|
+
extendStatics(d, b);
|
|
26
|
+
function __() { this.constructor = d; }
|
|
27
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
28
|
+
};
|
|
29
|
+
})();
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.operationServerMap = exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
|
32
|
+
var axios_1 = require("axios");
|
|
33
|
+
exports.BASE_PATH = "https://api.rightbrain.ai/api/v1".replace(/\/+$/, "");
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
*/
|
|
38
|
+
exports.COLLECTION_FORMATS = {
|
|
39
|
+
csv: ",",
|
|
40
|
+
ssv: " ",
|
|
41
|
+
tsv: "\t",
|
|
42
|
+
pipes: "|",
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @export
|
|
47
|
+
* @class BaseAPI
|
|
48
|
+
*/
|
|
49
|
+
var BaseAPI = /** @class */ (function () {
|
|
50
|
+
function BaseAPI(configuration, basePath, axios) {
|
|
51
|
+
if (basePath === void 0) { basePath = exports.BASE_PATH; }
|
|
52
|
+
if (axios === void 0) { axios = axios_1.default; }
|
|
53
|
+
var _a;
|
|
54
|
+
this.basePath = basePath;
|
|
55
|
+
this.axios = axios;
|
|
56
|
+
if (configuration) {
|
|
57
|
+
this.configuration = configuration;
|
|
58
|
+
this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return BaseAPI;
|
|
62
|
+
}());
|
|
63
|
+
exports.BaseAPI = BaseAPI;
|
|
64
|
+
;
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @export
|
|
68
|
+
* @class RequiredError
|
|
69
|
+
* @extends {Error}
|
|
70
|
+
*/
|
|
71
|
+
var RequiredError = /** @class */ (function (_super) {
|
|
72
|
+
__extends(RequiredError, _super);
|
|
73
|
+
function RequiredError(field, msg) {
|
|
74
|
+
var _this = _super.call(this, msg) || this;
|
|
75
|
+
_this.field = field;
|
|
76
|
+
_this.name = "RequiredError";
|
|
77
|
+
return _this;
|
|
78
|
+
}
|
|
79
|
+
return RequiredError;
|
|
80
|
+
}(Error));
|
|
81
|
+
exports.RequiredError = RequiredError;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @export
|
|
85
|
+
*/
|
|
86
|
+
exports.operationServerMap = {};
|
package/dist/common.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RightBrain API
|
|
3
|
+
* The RightBrain API provides programmatic access to AI-powered task execution.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: v1
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { Configuration } from "./configuration";
|
|
13
|
+
import type { RequestArgs } from "./base";
|
|
14
|
+
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export declare const DUMMY_BASE_URL = "https://example.com";
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @throws {RequiredError}
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
*/
|
|
30
|
+
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @export
|
|
34
|
+
*/
|
|
35
|
+
export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
*/
|
|
40
|
+
export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @export
|
|
44
|
+
*/
|
|
45
|
+
export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
*/
|
|
50
|
+
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @export
|
|
59
|
+
*/
|
|
60
|
+
export declare const toPathString: (url: URL) => string;
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
*/
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
package/dist/common.js
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* RightBrain API
|
|
6
|
+
* The RightBrain API provides programmatic access to AI-powered task execution.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: v1
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
+
function step(op) {
|
|
40
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
42
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
43
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
+
switch (op[0]) {
|
|
45
|
+
case 0: case 1: t = op; break;
|
|
46
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
+
default:
|
|
50
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
+
if (t[2]) _.ops.pop();
|
|
55
|
+
_.trys.pop(); continue;
|
|
56
|
+
}
|
|
57
|
+
op = body.call(thisArg, _);
|
|
58
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
63
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
64
|
+
if (ar || !(i in from)) {
|
|
65
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
66
|
+
ar[i] = from[i];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
70
|
+
};
|
|
71
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
|
+
exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
|
73
|
+
var base_1 = require("./base");
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @export
|
|
77
|
+
*/
|
|
78
|
+
exports.DUMMY_BASE_URL = 'https://example.com';
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @throws {RequiredError}
|
|
82
|
+
* @export
|
|
83
|
+
*/
|
|
84
|
+
var assertParamExists = function (functionName, paramName, paramValue) {
|
|
85
|
+
if (paramValue === null || paramValue === undefined) {
|
|
86
|
+
throw new base_1.RequiredError(paramName, "Required parameter ".concat(paramName, " was null or undefined when calling ").concat(functionName, "."));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.assertParamExists = assertParamExists;
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @export
|
|
93
|
+
*/
|
|
94
|
+
var setApiKeyToObject = function (object, keyParamName, configuration) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
var localVarApiKeyValue, _a;
|
|
97
|
+
return __generator(this, function (_b) {
|
|
98
|
+
switch (_b.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
|
|
101
|
+
if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
|
|
102
|
+
return [4 /*yield*/, configuration.apiKey(keyParamName)];
|
|
103
|
+
case 1:
|
|
104
|
+
_a = _b.sent();
|
|
105
|
+
return [3 /*break*/, 4];
|
|
106
|
+
case 2: return [4 /*yield*/, configuration.apiKey];
|
|
107
|
+
case 3:
|
|
108
|
+
_a = _b.sent();
|
|
109
|
+
_b.label = 4;
|
|
110
|
+
case 4:
|
|
111
|
+
localVarApiKeyValue = _a;
|
|
112
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
113
|
+
_b.label = 5;
|
|
114
|
+
case 5: return [2 /*return*/];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
exports.setApiKeyToObject = setApiKeyToObject;
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @export
|
|
123
|
+
*/
|
|
124
|
+
var setBasicAuthToObject = function (object, configuration) {
|
|
125
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
126
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
exports.setBasicAuthToObject = setBasicAuthToObject;
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* @export
|
|
133
|
+
*/
|
|
134
|
+
var setBearerAuthToObject = function (object, configuration) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
+
var accessToken, _a;
|
|
137
|
+
return __generator(this, function (_b) {
|
|
138
|
+
switch (_b.label) {
|
|
139
|
+
case 0:
|
|
140
|
+
if (!(configuration && configuration.accessToken)) return [3 /*break*/, 5];
|
|
141
|
+
if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 2];
|
|
142
|
+
return [4 /*yield*/, configuration.accessToken()];
|
|
143
|
+
case 1:
|
|
144
|
+
_a = _b.sent();
|
|
145
|
+
return [3 /*break*/, 4];
|
|
146
|
+
case 2: return [4 /*yield*/, configuration.accessToken];
|
|
147
|
+
case 3:
|
|
148
|
+
_a = _b.sent();
|
|
149
|
+
_b.label = 4;
|
|
150
|
+
case 4:
|
|
151
|
+
accessToken = _a;
|
|
152
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
153
|
+
_b.label = 5;
|
|
154
|
+
case 5: return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
exports.setBearerAuthToObject = setBearerAuthToObject;
|
|
160
|
+
/**
|
|
161
|
+
*
|
|
162
|
+
* @export
|
|
163
|
+
*/
|
|
164
|
+
var setOAuthToObject = function (object, name, scopes, configuration) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
166
|
+
var localVarAccessTokenValue, _a;
|
|
167
|
+
return __generator(this, function (_b) {
|
|
168
|
+
switch (_b.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
if (!(configuration && configuration.accessToken)) return [3 /*break*/, 5];
|
|
171
|
+
if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 2];
|
|
172
|
+
return [4 /*yield*/, configuration.accessToken(name, scopes)];
|
|
173
|
+
case 1:
|
|
174
|
+
_a = _b.sent();
|
|
175
|
+
return [3 /*break*/, 4];
|
|
176
|
+
case 2: return [4 /*yield*/, configuration.accessToken];
|
|
177
|
+
case 3:
|
|
178
|
+
_a = _b.sent();
|
|
179
|
+
_b.label = 4;
|
|
180
|
+
case 4:
|
|
181
|
+
localVarAccessTokenValue = _a;
|
|
182
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
183
|
+
_b.label = 5;
|
|
184
|
+
case 5: return [2 /*return*/];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
exports.setOAuthToObject = setOAuthToObject;
|
|
190
|
+
function setFlattenedQueryParams(urlSearchParams, parameter, key) {
|
|
191
|
+
if (key === void 0) { key = ""; }
|
|
192
|
+
if (parameter == null)
|
|
193
|
+
return;
|
|
194
|
+
if (typeof parameter === "object") {
|
|
195
|
+
if (Array.isArray(parameter)) {
|
|
196
|
+
parameter.forEach(function (item) { return setFlattenedQueryParams(urlSearchParams, item, key); });
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
Object.keys(parameter).forEach(function (currentKey) {
|
|
200
|
+
return setFlattenedQueryParams(urlSearchParams, parameter[currentKey], "".concat(key).concat(key !== '' ? '.' : '').concat(currentKey));
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
if (urlSearchParams.has(key)) {
|
|
206
|
+
urlSearchParams.append(key, parameter);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
urlSearchParams.set(key, parameter);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
*
|
|
215
|
+
* @export
|
|
216
|
+
*/
|
|
217
|
+
var setSearchParams = function (url) {
|
|
218
|
+
var objects = [];
|
|
219
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
220
|
+
objects[_i - 1] = arguments[_i];
|
|
221
|
+
}
|
|
222
|
+
var searchParams = new URLSearchParams(url.search);
|
|
223
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
224
|
+
url.search = searchParams.toString();
|
|
225
|
+
};
|
|
226
|
+
exports.setSearchParams = setSearchParams;
|
|
227
|
+
/**
|
|
228
|
+
*
|
|
229
|
+
* @export
|
|
230
|
+
*/
|
|
231
|
+
var serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
232
|
+
var nonString = typeof value !== 'string';
|
|
233
|
+
var needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
234
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
235
|
+
: nonString;
|
|
236
|
+
return needsSerialization
|
|
237
|
+
? JSON.stringify(value !== undefined ? convertMapsAndSetsToPlain(value) : {})
|
|
238
|
+
: (value || "");
|
|
239
|
+
};
|
|
240
|
+
exports.serializeDataIfNeeded = serializeDataIfNeeded;
|
|
241
|
+
function convertMapsAndSetsToPlain(value) {
|
|
242
|
+
if (typeof Set === "undefined")
|
|
243
|
+
return value;
|
|
244
|
+
if (typeof Map === "undefined")
|
|
245
|
+
return value;
|
|
246
|
+
if (typeof value !== "object" || !value) {
|
|
247
|
+
return value;
|
|
248
|
+
}
|
|
249
|
+
if (value instanceof Set) {
|
|
250
|
+
return Array.from(value).map(function (item) { return convertMapsAndSetsToPlain(item); });
|
|
251
|
+
}
|
|
252
|
+
if (value instanceof Map) {
|
|
253
|
+
var entries_1 = [];
|
|
254
|
+
value.forEach(function (value, key) {
|
|
255
|
+
entries_1.push([key, convertMapsAndSetsToPlain(value)]);
|
|
256
|
+
});
|
|
257
|
+
return objectFromEntries(entries_1);
|
|
258
|
+
}
|
|
259
|
+
if (Array.isArray(value)) {
|
|
260
|
+
return value.map(function (it) { return convertMapsAndSetsToPlain(it); });
|
|
261
|
+
}
|
|
262
|
+
return objectFromEntries(objectEntries(value)
|
|
263
|
+
.map(function (_a) {
|
|
264
|
+
var k = _a[0], v = _a[1];
|
|
265
|
+
return [k, convertMapsAndSetsToPlain(v)];
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Ponyfill for Object.entries
|
|
270
|
+
*/
|
|
271
|
+
function objectEntries(object) {
|
|
272
|
+
return Object.keys(object).map(function (key) { return [key, object[key]]; });
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Ponyfill for Object.fromEntries
|
|
276
|
+
*/
|
|
277
|
+
function objectFromEntries(entries) {
|
|
278
|
+
return __spreadArray([], entries, true).reduce(function (object, _a) {
|
|
279
|
+
var key = _a[0], val = _a[1];
|
|
280
|
+
object[key] = val;
|
|
281
|
+
return object;
|
|
282
|
+
}, {});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
*
|
|
286
|
+
* @export
|
|
287
|
+
*/
|
|
288
|
+
var toPathString = function (url) {
|
|
289
|
+
return url.pathname + url.search + url.hash;
|
|
290
|
+
};
|
|
291
|
+
exports.toPathString = toPathString;
|
|
292
|
+
/**
|
|
293
|
+
*
|
|
294
|
+
* @export
|
|
295
|
+
*/
|
|
296
|
+
var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
297
|
+
return function (axios, basePath) {
|
|
298
|
+
var _a;
|
|
299
|
+
if (axios === void 0) { axios = globalAxios; }
|
|
300
|
+
if (basePath === void 0) { basePath = BASE_PATH; }
|
|
301
|
+
var axiosRequestArgs = __assign(__assign({}, axiosArgs.options), { url: (axios.defaults.baseURL ? '' : (_a = configuration === null || configuration === void 0 ? void 0 : configuration.basePath) !== null && _a !== void 0 ? _a : basePath) + axiosArgs.url });
|
|
302
|
+
return axios.request(axiosRequestArgs);
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
exports.createRequestFunction = createRequestFunction;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RightBrain API
|
|
3
|
+
* The RightBrain API provides programmatic access to AI-powered task execution.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: v1
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export interface ConfigurationParameters {
|
|
13
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
14
|
+
username?: string;
|
|
15
|
+
password?: string;
|
|
16
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
17
|
+
basePath?: string;
|
|
18
|
+
serverIndex?: number;
|
|
19
|
+
baseOptions?: any;
|
|
20
|
+
formDataCtor?: new () => any;
|
|
21
|
+
}
|
|
22
|
+
export declare class Configuration {
|
|
23
|
+
/**
|
|
24
|
+
* parameter for apiKey security
|
|
25
|
+
* @param name security name
|
|
26
|
+
* @memberof Configuration
|
|
27
|
+
*/
|
|
28
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
29
|
+
/**
|
|
30
|
+
* parameter for basic security
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof Configuration
|
|
34
|
+
*/
|
|
35
|
+
username?: string;
|
|
36
|
+
/**
|
|
37
|
+
* parameter for basic security
|
|
38
|
+
*
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @memberof Configuration
|
|
41
|
+
*/
|
|
42
|
+
password?: string;
|
|
43
|
+
/**
|
|
44
|
+
* parameter for oauth2 security
|
|
45
|
+
* @param name security name
|
|
46
|
+
* @param scopes oauth2 scope
|
|
47
|
+
* @memberof Configuration
|
|
48
|
+
*/
|
|
49
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
50
|
+
/**
|
|
51
|
+
* override base path
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
* @memberof Configuration
|
|
55
|
+
*/
|
|
56
|
+
basePath?: string;
|
|
57
|
+
/**
|
|
58
|
+
* override server index
|
|
59
|
+
*
|
|
60
|
+
* @type {number}
|
|
61
|
+
* @memberof Configuration
|
|
62
|
+
*/
|
|
63
|
+
serverIndex?: number;
|
|
64
|
+
/**
|
|
65
|
+
* base options for axios calls
|
|
66
|
+
*
|
|
67
|
+
* @type {any}
|
|
68
|
+
* @memberof Configuration
|
|
69
|
+
*/
|
|
70
|
+
baseOptions?: any;
|
|
71
|
+
/**
|
|
72
|
+
* The FormData constructor that will be used to create multipart form data
|
|
73
|
+
* requests. You can inject this here so that execution environments that
|
|
74
|
+
* do not support the FormData class can still run the generated client.
|
|
75
|
+
*
|
|
76
|
+
* @type {new () => FormData}
|
|
77
|
+
*/
|
|
78
|
+
formDataCtor?: new () => any;
|
|
79
|
+
constructor(param?: ConfigurationParameters);
|
|
80
|
+
/**
|
|
81
|
+
* Check if the given MIME is a JSON MIME.
|
|
82
|
+
* JSON MIME examples:
|
|
83
|
+
* application/json
|
|
84
|
+
* application/json; charset=UTF8
|
|
85
|
+
* APPLICATION/JSON
|
|
86
|
+
* application/vnd.company+json
|
|
87
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
88
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
89
|
+
*/
|
|
90
|
+
isJsonMime(mime: string): boolean;
|
|
91
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* RightBrain API
|
|
6
|
+
* The RightBrain API provides programmatic access to AI-powered task execution.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: v1
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Configuration = void 0;
|
|
17
|
+
var Configuration = /** @class */ (function () {
|
|
18
|
+
function Configuration(param) {
|
|
19
|
+
if (param === void 0) { param = {}; }
|
|
20
|
+
this.apiKey = param.apiKey;
|
|
21
|
+
this.username = param.username;
|
|
22
|
+
this.password = param.password;
|
|
23
|
+
this.accessToken = param.accessToken;
|
|
24
|
+
this.basePath = param.basePath;
|
|
25
|
+
this.serverIndex = param.serverIndex;
|
|
26
|
+
this.baseOptions = param.baseOptions;
|
|
27
|
+
this.formDataCtor = param.formDataCtor;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if the given MIME is a JSON MIME.
|
|
31
|
+
* JSON MIME examples:
|
|
32
|
+
* application/json
|
|
33
|
+
* application/json; charset=UTF8
|
|
34
|
+
* APPLICATION/JSON
|
|
35
|
+
* application/vnd.company+json
|
|
36
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
37
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
38
|
+
*/
|
|
39
|
+
Configuration.prototype.isJsonMime = function (mime) {
|
|
40
|
+
var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
41
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
42
|
+
};
|
|
43
|
+
return Configuration;
|
|
44
|
+
}());
|
|
45
|
+
exports.Configuration = Configuration;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as api from "./api";
|
|
2
|
+
import { AxiosError } from "axios";
|
|
3
|
+
export type InternalServerError = {
|
|
4
|
+
"reason": "INTERNAL_ERROR";
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
export type BrainErrorResponse = InternalServerError | api.InvalidMemberErrorResponse | api.InvalidRoleErrorResponse | api.InvalidSubjectTypeErrorResponse | api.MalformedResourceIdentifierErrorResponse | api.MissingAuthenticationErrorResponse | api.PermissionCheckFailedErrorResponse;
|
|
8
|
+
/**
|
|
9
|
+
* Determines if an error is a Brain API error.
|
|
10
|
+
*
|
|
11
|
+
* Example usage:
|
|
12
|
+
* ```ts
|
|
13
|
+
* orgAPI.organizationIamListMembers("123").catch(
|
|
14
|
+
* (error: unknown) => {
|
|
15
|
+
* if (isBrainError(error)) {
|
|
16
|
+
* switch (error.response.data.reason) {
|
|
17
|
+
* case "INVALID_MEMBER":
|
|
18
|
+
* console.log(error.response.data.invalidMemberError)
|
|
19
|
+
* break
|
|
20
|
+
* case "...":
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* )
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param error An error caught by an Axios response.
|
|
28
|
+
* @returns bool
|
|
29
|
+
*/
|
|
30
|
+
export declare function isBrainError(error: unknown): error is AxiosError<BrainErrorResponse>;
|