@usecortex_ai/node 0.2.1 → 0.3.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/dist/Client.d.ts +14 -5
- package/dist/Client.js +68 -12
- package/dist/api/resources/document/client/Client.d.ts +5 -5
- package/dist/api/resources/document/client/Client.js +8 -4
- package/dist/api/resources/embeddings/client/Client.d.ts +9 -9
- package/dist/api/resources/embeddings/client/Client.js +16 -12
- package/dist/api/resources/embeddings/client/requests/EmbeddingsCreateCollectionRequest.d.ts +1 -1
- package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.d.ts +3 -3
- package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRequest.d.ts +2 -2
- package/dist/api/resources/embeddings/client/requests/GetEmbeddingsBasedOnChunkIdsRequest.d.ts +3 -3
- package/dist/api/resources/fetch/client/Client.d.ts +6 -6
- package/dist/api/resources/fetch/client/Client.js +9 -5
- package/dist/api/resources/fetch/client/requests/FetchContentRequest.d.ts +3 -8
- package/dist/api/resources/index.d.ts +1 -1
- package/dist/api/resources/index.js +2 -2
- package/dist/api/resources/search/client/Client.d.ts +11 -11
- package/dist/api/resources/search/client/Client.js +14 -10
- package/dist/api/resources/search/client/requests/FullTextSearchRequest.d.ts +3 -3
- package/dist/api/resources/search/client/requests/QnARequest.d.ts +3 -3
- package/dist/api/resources/search/client/requests/SearchRequest.d.ts +5 -3
- package/dist/api/resources/sources/client/Client.d.ts +8 -33
- package/dist/api/resources/sources/client/Client.js +12 -95
- package/dist/api/resources/sources/client/requests/SourceBodyParams.d.ts +6 -2
- package/dist/api/resources/sources/client/requests/index.d.ts +0 -1
- package/dist/api/resources/tenant/client/Client.d.ts +8 -7
- package/dist/api/resources/tenant/client/Client.js +11 -6
- package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.d.ts +2 -2
- package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.d.ts +1 -1
- package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +3 -2
- package/dist/api/resources/upload/client/Client.d.ts +47 -32
- package/dist/api/resources/upload/client/Client.js +56 -31
- package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts +3 -2
- package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.d.ts +5 -2
- package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts +5 -2
- package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.d.ts +3 -2
- package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.d.ts +5 -3
- package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.d.ts +5 -4
- package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.d.ts +5 -4
- package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.d.ts +5 -4
- package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.d.ts +3 -2
- package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.d.ts +4 -3
- package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +2 -1
- package/dist/api/resources/user/client/Client.d.ts +6 -4
- package/dist/api/resources/user/client/Client.js +13 -4
- package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.d.ts +4 -1
- package/dist/api/resources/userMemory/client/Client.d.ts +19 -13
- package/dist/api/resources/userMemory/client/Client.js +22 -12
- package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.d.ts +4 -3
- package/dist/api/resources/userMemory/client/requests/GenerateUserMemoryRequest.d.ts +6 -5
- package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.d.ts +7 -3
- package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.d.ts +4 -3
- package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.d.ts +3 -2
- package/dist/api/types/DeleteMemoryRequest.d.ts +1 -1
- package/dist/api/types/MarkdownUploadRequest.d.ts +2 -0
- package/dist/api/types/SubTenantIdsData.d.ts +2 -0
- package/dist/api/types/TenantStats.d.ts +2 -2
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ const CortexAI = __importStar(require("../../../index.js"));
|
|
|
33
33
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
34
34
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
35
35
|
class Search {
|
|
36
|
-
constructor(_options) {
|
|
36
|
+
constructor(_options = {}) {
|
|
37
37
|
this._options = _options;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -52,9 +52,9 @@ class Search {
|
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* await client.search.qna({
|
|
55
|
-
* question: "
|
|
56
|
-
* session_id: "
|
|
57
|
-
* tenant_id: "
|
|
55
|
+
* question: "What is Cortex AI",
|
|
56
|
+
* session_id: "chat_session_1234",
|
|
57
|
+
* tenant_id: "tenant_1234"
|
|
58
58
|
* })
|
|
59
59
|
*/
|
|
60
60
|
qna(request, requestOptions) {
|
|
@@ -137,8 +137,8 @@ class Search {
|
|
|
137
137
|
*
|
|
138
138
|
* @example
|
|
139
139
|
* await client.search.retrieve({
|
|
140
|
-
* query: "
|
|
141
|
-
* tenant_id: "
|
|
140
|
+
* query: "Which mode does user prefer",
|
|
141
|
+
* tenant_id: "tenant_1234"
|
|
142
142
|
* })
|
|
143
143
|
*/
|
|
144
144
|
retrieve(request, requestOptions) {
|
|
@@ -206,7 +206,7 @@ class Search {
|
|
|
206
206
|
* Perform full text search for exact matches within your indexed sources.
|
|
207
207
|
*
|
|
208
208
|
* Use this endpoint to find content chunks using BM25-based text matching with configurable operators.
|
|
209
|
-
* Choose between OR and AND operators to control how search terms are combined for precise text matching.
|
|
209
|
+
* Choose between 'OR' and 'AND' operators to control how search terms are combined for precise text matching.
|
|
210
210
|
*
|
|
211
211
|
* @param {CortexAI.FullTextSearchRequest} request
|
|
212
212
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -221,8 +221,8 @@ class Search {
|
|
|
221
221
|
*
|
|
222
222
|
* @example
|
|
223
223
|
* await client.search.fullTextSearch({
|
|
224
|
-
* query: "
|
|
225
|
-
* tenant_id: "
|
|
224
|
+
* query: "John Smith Jake",
|
|
225
|
+
* tenant_id: "tenant_1234"
|
|
226
226
|
* })
|
|
227
227
|
*/
|
|
228
228
|
fullTextSearch(request, requestOptions) {
|
|
@@ -287,7 +287,11 @@ class Search {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
async _getAuthorizationHeader() {
|
|
290
|
-
|
|
290
|
+
const bearer = await core.Supplier.get(this._options.token);
|
|
291
|
+
if (bearer != null) {
|
|
292
|
+
return `Bearer ${bearer}`;
|
|
293
|
+
}
|
|
294
|
+
return undefined;
|
|
291
295
|
}
|
|
292
296
|
}
|
|
293
297
|
exports.Search = Search;
|
|
@@ -5,8 +5,8 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* query: "
|
|
9
|
-
* tenant_id: "
|
|
8
|
+
* query: "John Smith Jake",
|
|
9
|
+
* tenant_id: "tenant_1234"
|
|
10
10
|
* }
|
|
11
11
|
*/
|
|
12
12
|
export interface FullTextSearchRequest {
|
|
@@ -14,7 +14,7 @@ export interface FullTextSearchRequest {
|
|
|
14
14
|
query: string;
|
|
15
15
|
/** Unique identifier for the tenant/organization */
|
|
16
16
|
tenant_id: string;
|
|
17
|
-
/** Optional sub-tenant identifier
|
|
17
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
18
18
|
sub_tenant_id?: string;
|
|
19
19
|
/** How to combine search terms (OR or AND) */
|
|
20
20
|
operator?: CortexAI.Bm25OperatorType;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* query: "
|
|
8
|
-
* tenant_id: "
|
|
7
|
+
* query: "Which mode does user prefer",
|
|
8
|
+
* tenant_id: "tenant_1234"
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
11
|
export interface SearchRequest {
|
|
@@ -13,7 +13,7 @@ export interface SearchRequest {
|
|
|
13
13
|
query: string;
|
|
14
14
|
/** Unique identifier for the tenant/organization */
|
|
15
15
|
tenant_id: string;
|
|
16
|
-
/** Optional sub-tenant identifier
|
|
16
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
17
17
|
sub_tenant_id?: string;
|
|
18
18
|
/** Maximum number of results to return */
|
|
19
19
|
max_chunks?: number;
|
|
@@ -21,6 +21,8 @@ export interface SearchRequest {
|
|
|
21
21
|
alpha?: SearchRequest.Alpha;
|
|
22
22
|
/** Preference for newer content (0.0 = no bias, 1.0 = strong recency preference) */
|
|
23
23
|
recency_bias?: number;
|
|
24
|
+
/** Enable personalized search results based on user preferences */
|
|
25
|
+
personalise_search?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export declare namespace SearchRequest {
|
|
26
28
|
/**
|
|
@@ -9,7 +9,7 @@ export declare namespace Sources {
|
|
|
9
9
|
environment?: core.Supplier<environments.CortexAIEnvironment | string>;
|
|
10
10
|
/** Specify a custom URL to connect the client to. */
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -28,32 +28,7 @@ export declare namespace Sources {
|
|
|
28
28
|
}
|
|
29
29
|
export declare class Sources {
|
|
30
30
|
protected readonly _options: Sources.Options;
|
|
31
|
-
constructor(_options
|
|
32
|
-
/**
|
|
33
|
-
* Retrieve all sources for a specific tenant.
|
|
34
|
-
*
|
|
35
|
-
* Use this endpoint to fetch a complete list of all sources associated with your tenant. This includes documents, files, and other content you've uploaded for processing.
|
|
36
|
-
*
|
|
37
|
-
* You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
38
|
-
*
|
|
39
|
-
* @param {CortexAI.SourcesGetAllRequest} request
|
|
40
|
-
* @param {Sources.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
|
-
*
|
|
42
|
-
* @throws {@link CortexAI.BadRequestError}
|
|
43
|
-
* @throws {@link CortexAI.UnauthorizedError}
|
|
44
|
-
* @throws {@link CortexAI.ForbiddenError}
|
|
45
|
-
* @throws {@link CortexAI.NotFoundError}
|
|
46
|
-
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
47
|
-
* @throws {@link CortexAI.InternalServerError}
|
|
48
|
-
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* await client.sources.getAll({
|
|
52
|
-
* tenant_id: "tenant_id"
|
|
53
|
-
* })
|
|
54
|
-
*/
|
|
55
|
-
getAll(request: CortexAI.SourcesGetAllRequest, requestOptions?: Sources.RequestOptions): core.HttpResponsePromise<CortexAI.ListSourcesResponse>;
|
|
56
|
-
private __getAll;
|
|
31
|
+
constructor(_options?: Sources.Options);
|
|
57
32
|
/**
|
|
58
33
|
* Retrieve specific sources by their IDs.
|
|
59
34
|
*
|
|
@@ -73,12 +48,12 @@ export declare class Sources {
|
|
|
73
48
|
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
74
49
|
*
|
|
75
50
|
* @example
|
|
76
|
-
* await client.sources.
|
|
77
|
-
* tenant_id: "
|
|
78
|
-
* source_ids: ["
|
|
51
|
+
* await client.sources.getAll({
|
|
52
|
+
* tenant_id: "tenant_1234",
|
|
53
|
+
* source_ids: ["CortexDoc1234", "CortexDoc4567"]
|
|
79
54
|
* })
|
|
80
55
|
*/
|
|
81
|
-
|
|
82
|
-
private
|
|
83
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
56
|
+
getAll(request: CortexAI.SourceBodyParams, requestOptions?: Sources.RequestOptions): core.HttpResponsePromise<CortexAI.ListSourcesResponse>;
|
|
57
|
+
private __getAll;
|
|
58
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
84
59
|
}
|
|
@@ -33,96 +33,9 @@ const CortexAI = __importStar(require("../../../index.js"));
|
|
|
33
33
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
34
34
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
35
35
|
class Sources {
|
|
36
|
-
constructor(_options) {
|
|
36
|
+
constructor(_options = {}) {
|
|
37
37
|
this._options = _options;
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Retrieve all sources for a specific tenant.
|
|
41
|
-
*
|
|
42
|
-
* Use this endpoint to fetch a complete list of all sources associated with your tenant. This includes documents, files, and other content you've uploaded for processing.
|
|
43
|
-
*
|
|
44
|
-
* You can optionally specify a sub-tenant to narrow down the results to sources within that specific sub-tenant scope.
|
|
45
|
-
*
|
|
46
|
-
* @param {CortexAI.SourcesGetAllRequest} request
|
|
47
|
-
* @param {Sources.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
|
-
*
|
|
49
|
-
* @throws {@link CortexAI.BadRequestError}
|
|
50
|
-
* @throws {@link CortexAI.UnauthorizedError}
|
|
51
|
-
* @throws {@link CortexAI.ForbiddenError}
|
|
52
|
-
* @throws {@link CortexAI.NotFoundError}
|
|
53
|
-
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
54
|
-
* @throws {@link CortexAI.InternalServerError}
|
|
55
|
-
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* await client.sources.getAll({
|
|
59
|
-
* tenant_id: "tenant_id"
|
|
60
|
-
* })
|
|
61
|
-
*/
|
|
62
|
-
getAll(request, requestOptions) {
|
|
63
|
-
return core.HttpResponsePromise.fromPromise(this.__getAll(request, requestOptions));
|
|
64
|
-
}
|
|
65
|
-
async __getAll(request, requestOptions) {
|
|
66
|
-
var _a, _b, _c;
|
|
67
|
-
const { tenant_id: tenantId, sub_tenant_id: subTenantId } = request;
|
|
68
|
-
const _queryParams = {};
|
|
69
|
-
_queryParams["tenant_id"] = tenantId;
|
|
70
|
-
if (subTenantId != null) {
|
|
71
|
-
_queryParams["sub_tenant_id"] = subTenantId;
|
|
72
|
-
}
|
|
73
|
-
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
74
|
-
const _response = await core.fetcher({
|
|
75
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "list/sources"),
|
|
76
|
-
method: "GET",
|
|
77
|
-
headers: _headers,
|
|
78
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
79
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
80
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
81
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
82
|
-
});
|
|
83
|
-
if (_response.ok) {
|
|
84
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
85
|
-
}
|
|
86
|
-
if (_response.error.reason === "status-code") {
|
|
87
|
-
switch (_response.error.statusCode) {
|
|
88
|
-
case 400:
|
|
89
|
-
throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
90
|
-
case 401:
|
|
91
|
-
throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
92
|
-
case 403:
|
|
93
|
-
throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
94
|
-
case 404:
|
|
95
|
-
throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
|
|
96
|
-
case 422:
|
|
97
|
-
throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
98
|
-
case 500:
|
|
99
|
-
throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
100
|
-
case 503:
|
|
101
|
-
throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
102
|
-
default:
|
|
103
|
-
throw new errors.CortexAIError({
|
|
104
|
-
statusCode: _response.error.statusCode,
|
|
105
|
-
body: _response.error.body,
|
|
106
|
-
rawResponse: _response.rawResponse,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
switch (_response.error.reason) {
|
|
111
|
-
case "non-json":
|
|
112
|
-
throw new errors.CortexAIError({
|
|
113
|
-
statusCode: _response.error.statusCode,
|
|
114
|
-
body: _response.error.rawBody,
|
|
115
|
-
rawResponse: _response.rawResponse,
|
|
116
|
-
});
|
|
117
|
-
case "timeout":
|
|
118
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /list/sources.");
|
|
119
|
-
case "unknown":
|
|
120
|
-
throw new errors.CortexAIError({
|
|
121
|
-
message: _response.error.errorMessage,
|
|
122
|
-
rawResponse: _response.rawResponse,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
39
|
/**
|
|
127
40
|
* Retrieve specific sources by their IDs.
|
|
128
41
|
*
|
|
@@ -142,15 +55,15 @@ class Sources {
|
|
|
142
55
|
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
143
56
|
*
|
|
144
57
|
* @example
|
|
145
|
-
* await client.sources.
|
|
146
|
-
* tenant_id: "
|
|
147
|
-
* source_ids: ["
|
|
58
|
+
* await client.sources.getAll({
|
|
59
|
+
* tenant_id: "tenant_1234",
|
|
60
|
+
* source_ids: ["CortexDoc1234", "CortexDoc4567"]
|
|
148
61
|
* })
|
|
149
62
|
*/
|
|
150
|
-
|
|
151
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
63
|
+
getAll(request, requestOptions) {
|
|
64
|
+
return core.HttpResponsePromise.fromPromise(this.__getAll(request, requestOptions));
|
|
152
65
|
}
|
|
153
|
-
async
|
|
66
|
+
async __getAll(request, requestOptions) {
|
|
154
67
|
var _a, _b, _c;
|
|
155
68
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
156
69
|
const _response = await core.fetcher({
|
|
@@ -209,7 +122,11 @@ class Sources {
|
|
|
209
122
|
}
|
|
210
123
|
}
|
|
211
124
|
async _getAuthorizationHeader() {
|
|
212
|
-
|
|
125
|
+
const bearer = await core.Supplier.get(this._options.token);
|
|
126
|
+
if (bearer != null) {
|
|
127
|
+
return `Bearer ${bearer}`;
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
213
130
|
}
|
|
214
131
|
}
|
|
215
132
|
exports.Sources = Sources;
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* tenant_id: "
|
|
8
|
-
* source_ids: ["
|
|
7
|
+
* tenant_id: "tenant_1234",
|
|
8
|
+
* source_ids: ["CortexDoc1234", "CortexDoc4567"]
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
11
|
export interface SourceBodyParams {
|
|
12
|
+
/** Unique identifier for the tenant/organization */
|
|
12
13
|
tenant_id: string;
|
|
14
|
+
/** List of source IDs to fetch */
|
|
13
15
|
source_ids: string[];
|
|
16
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
17
|
+
sub_tenant_id?: string;
|
|
14
18
|
}
|
|
@@ -9,7 +9,7 @@ export declare namespace Tenant {
|
|
|
9
9
|
environment?: core.Supplier<environments.CortexAIEnvironment | string>;
|
|
10
10
|
/** Specify a custom URL to connect the client to. */
|
|
11
11
|
baseUrl?: core.Supplier<string>;
|
|
12
|
-
token
|
|
12
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ export declare namespace Tenant {
|
|
|
28
28
|
}
|
|
29
29
|
export declare class Tenant {
|
|
30
30
|
protected readonly _options: Tenant.Options;
|
|
31
|
-
constructor(_options
|
|
31
|
+
constructor(_options?: Tenant.Options);
|
|
32
32
|
/**
|
|
33
33
|
* Retrieve usage stats for your tenant.
|
|
34
34
|
*
|
|
@@ -51,7 +51,8 @@ export declare class Tenant {
|
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* await client.tenant.stats({
|
|
54
|
-
* tenant_id: "
|
|
54
|
+
* tenant_id: "tenant_1234",
|
|
55
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
55
56
|
* })
|
|
56
57
|
*/
|
|
57
58
|
stats(request: CortexAI.TenantStatsRequest, requestOptions?: Tenant.RequestOptions): core.HttpResponsePromise<CortexAI.TenantStats>;
|
|
@@ -72,7 +73,7 @@ export declare class Tenant {
|
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
74
75
|
* await client.tenant.getSubTenantIds({
|
|
75
|
-
* tenant_id: "
|
|
76
|
+
* tenant_id: "tenant_1234"
|
|
76
77
|
* })
|
|
77
78
|
*/
|
|
78
79
|
getSubTenantIds(request: CortexAI.TenantGetSubTenantIdsRequest, requestOptions?: Tenant.RequestOptions): core.HttpResponsePromise<CortexAI.SubTenantIdsData>;
|
|
@@ -96,11 +97,11 @@ export declare class Tenant {
|
|
|
96
97
|
*
|
|
97
98
|
* @example
|
|
98
99
|
* await client.tenant.deleteSubTenant({
|
|
99
|
-
* tenant_id: "
|
|
100
|
-
* sub_tenant_id: "
|
|
100
|
+
* tenant_id: "tenant_1234",
|
|
101
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
101
102
|
* })
|
|
102
103
|
*/
|
|
103
104
|
deleteSubTenant(request: CortexAI.TenantDeleteSubTenantRequest, requestOptions?: Tenant.RequestOptions): core.HttpResponsePromise<CortexAI.DeleteSubTenantData>;
|
|
104
105
|
private __deleteSubTenant;
|
|
105
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
106
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
106
107
|
}
|
|
@@ -33,7 +33,7 @@ const CortexAI = __importStar(require("../../../index.js"));
|
|
|
33
33
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
34
34
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
35
35
|
class Tenant {
|
|
36
|
-
constructor(_options) {
|
|
36
|
+
constructor(_options = {}) {
|
|
37
37
|
this._options = _options;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -58,7 +58,8 @@ class Tenant {
|
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* await client.tenant.stats({
|
|
61
|
-
* tenant_id: "
|
|
61
|
+
* tenant_id: "tenant_1234",
|
|
62
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
62
63
|
* })
|
|
63
64
|
*/
|
|
64
65
|
stats(request, requestOptions) {
|
|
@@ -141,7 +142,7 @@ class Tenant {
|
|
|
141
142
|
*
|
|
142
143
|
* @example
|
|
143
144
|
* await client.tenant.getSubTenantIds({
|
|
144
|
-
* tenant_id: "
|
|
145
|
+
* tenant_id: "tenant_1234"
|
|
145
146
|
* })
|
|
146
147
|
*/
|
|
147
148
|
getSubTenantIds(request, requestOptions) {
|
|
@@ -224,8 +225,8 @@ class Tenant {
|
|
|
224
225
|
*
|
|
225
226
|
* @example
|
|
226
227
|
* await client.tenant.deleteSubTenant({
|
|
227
|
-
* tenant_id: "
|
|
228
|
-
* sub_tenant_id: "
|
|
228
|
+
* tenant_id: "tenant_1234",
|
|
229
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
229
230
|
* })
|
|
230
231
|
*/
|
|
231
232
|
deleteSubTenant(request, requestOptions) {
|
|
@@ -291,7 +292,11 @@ class Tenant {
|
|
|
291
292
|
}
|
|
292
293
|
}
|
|
293
294
|
async _getAuthorizationHeader() {
|
|
294
|
-
|
|
295
|
+
const bearer = await core.Supplier.get(this._options.token);
|
|
296
|
+
if (bearer != null) {
|
|
297
|
+
return `Bearer ${bearer}`;
|
|
298
|
+
}
|
|
299
|
+
return undefined;
|
|
295
300
|
}
|
|
296
301
|
}
|
|
297
302
|
exports.Tenant = Tenant;
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* tenant_id: "
|
|
7
|
+
* tenant_id: "tenant_1234",
|
|
8
|
+
* sub_tenant_id: "sub_tenant_4567"
|
|
8
9
|
* }
|
|
9
10
|
*/
|
|
10
11
|
export interface TenantStatsRequest {
|
|
11
12
|
/** Unique identifier for the tenant/organization */
|
|
12
13
|
tenant_id: string;
|
|
13
|
-
/** Optional sub-tenant identifier
|
|
14
|
+
/** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
|
|
14
15
|
sub_tenant_id?: string;
|
|
15
16
|
}
|