@credal/sdk 0.1.10 → 0.1.12
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/cjs/BaseClient.d.ts +6 -1
- package/dist/cjs/BaseClient.js +47 -0
- package/dist/cjs/Client.d.ts +16 -16
- package/dist/cjs/Client.js +8 -49
- package/dist/cjs/api/resources/copilots/client/Client.d.ts +21 -21
- package/dist/cjs/api/resources/copilots/client/Client.js +41 -22
- package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +12 -12
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +22 -13
- package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +18 -18
- package/dist/cjs/api/resources/documentCollections/client/Client.js +34 -19
- package/dist/cjs/api/resources/search/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/search/client/Client.js +10 -7
- package/dist/cjs/api/resources/users/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/users/client/Client.js +10 -7
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +1 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/cjs/core/fetcher/Fetcher.js +202 -9
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +0 -6
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +2 -1
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +6 -1
- package/dist/esm/BaseClient.mjs +13 -1
- package/dist/esm/Client.d.mts +16 -16
- package/dist/esm/Client.mjs +13 -21
- package/dist/esm/api/resources/copilots/client/Client.d.mts +21 -21
- package/dist/esm/api/resources/copilots/client/Client.mjs +39 -20
- package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +12 -12
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +20 -11
- package/dist/esm/api/resources/documentCollections/client/Client.d.mts +18 -18
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +32 -17
- package/dist/esm/api/resources/search/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/search/client/Client.mjs +8 -5
- package/dist/esm/api/resources/users/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/users/client/Client.mjs +8 -5
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +0 -6
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -2
- package/reference.md +21 -21
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import type * as Credal from "../../../index.js";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace DocumentCatalogClient {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
10
|
+
export declare class DocumentCatalogClient {
|
|
11
|
+
protected readonly _options: DocumentCatalogClient.Options;
|
|
12
|
+
constructor(options?: DocumentCatalogClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* @param {Credal.UploadDocumentContentsRequest} request
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* await client.documentCatalog.uploadDocumentContents({
|
|
@@ -23,21 +23,21 @@ export declare class DocumentCatalog {
|
|
|
23
23
|
* uploadAsUserEmail: "jack@credal.ai"
|
|
24
24
|
* })
|
|
25
25
|
*/
|
|
26
|
-
uploadDocumentContents(request: Credal.UploadDocumentContentsRequest, requestOptions?:
|
|
26
|
+
uploadDocumentContents(request: Credal.UploadDocumentContentsRequest, requestOptions?: DocumentCatalogClient.RequestOptions): core.HttpResponsePromise<Credal.UploadDocumentResponse>;
|
|
27
27
|
private __uploadDocumentContents;
|
|
28
28
|
/**
|
|
29
29
|
* Upload a file (PDF, Word, Excel, CSV, PowerPoint) to Credal. Unlike uploadDocumentContents which requires pre-parsed text, this endpoint accepts actual file uploads and automatically parses them using Credal's parsing service.
|
|
30
30
|
*
|
|
31
31
|
* @param {Credal.UploadFileRequest} request
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
33
33
|
*/
|
|
34
|
-
uploadFile(request: Credal.UploadFileRequest, requestOptions?:
|
|
34
|
+
uploadFile(request: Credal.UploadFileRequest, requestOptions?: DocumentCatalogClient.RequestOptions): core.HttpResponsePromise<Credal.UploadDocumentResponse>;
|
|
35
35
|
private __uploadFile;
|
|
36
36
|
/**
|
|
37
37
|
* Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
|
|
38
38
|
*
|
|
39
39
|
* @param {Credal.SyncSourceByUrlRequest} request
|
|
40
|
-
* @param {
|
|
40
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* await client.documentCatalog.syncSourceByUrl({
|
|
@@ -45,13 +45,13 @@ export declare class DocumentCatalog {
|
|
|
45
45
|
* uploadAsUserEmail: "ria@credal.ai"
|
|
46
46
|
* })
|
|
47
47
|
*/
|
|
48
|
-
syncSourceByUrl(request: Credal.SyncSourceByUrlRequest, requestOptions?:
|
|
48
|
+
syncSourceByUrl(request: Credal.SyncSourceByUrlRequest, requestOptions?: DocumentCatalogClient.RequestOptions): core.HttpResponsePromise<Credal.SyncSourceByUrlResponse>;
|
|
49
49
|
private __syncSourceByUrl;
|
|
50
50
|
/**
|
|
51
51
|
* Bulk patch metadata for documents, synced natively by Credal or manual API uploads
|
|
52
52
|
*
|
|
53
53
|
* @param {Credal.DocumentMetadataPatchRequest} request
|
|
54
|
-
* @param {
|
|
54
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* await client.documentCatalog.metadata({
|
|
@@ -79,7 +79,7 @@ export declare class DocumentCatalog {
|
|
|
79
79
|
* uploadAsUserEmail: "ben@credal.ai"
|
|
80
80
|
* })
|
|
81
81
|
*/
|
|
82
|
-
metadata(request: Credal.DocumentMetadataPatchRequest, requestOptions?:
|
|
82
|
+
metadata(request: Credal.DocumentMetadataPatchRequest, requestOptions?: DocumentCatalogClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
83
83
|
private __metadata;
|
|
84
84
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
85
85
|
}
|
|
@@ -43,18 +43,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.DocumentCatalogClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
51
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
|
-
class
|
|
52
|
-
constructor(
|
|
53
|
-
this._options =
|
|
52
|
+
class DocumentCatalogClient {
|
|
53
|
+
constructor(options = {}) {
|
|
54
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* @param {Credal.UploadDocumentContentsRequest} request
|
|
57
|
-
* @param {
|
|
58
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
58
59
|
*
|
|
59
60
|
* @example
|
|
60
61
|
* await client.documentCatalog.uploadDocumentContents({
|
|
@@ -70,7 +71,7 @@ class DocumentCatalog {
|
|
|
70
71
|
}
|
|
71
72
|
__uploadDocumentContents(request, requestOptions) {
|
|
72
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
74
75
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
75
76
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
76
77
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/catalog/uploadDocumentContents"),
|
|
@@ -83,6 +84,8 @@ class DocumentCatalog {
|
|
|
83
84
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
84
85
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
85
86
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
87
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
88
|
+
logging: this._options.logging,
|
|
86
89
|
});
|
|
87
90
|
if (_response.ok) {
|
|
88
91
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -115,14 +118,14 @@ class DocumentCatalog {
|
|
|
115
118
|
* Upload a file (PDF, Word, Excel, CSV, PowerPoint) to Credal. Unlike uploadDocumentContents which requires pre-parsed text, this endpoint accepts actual file uploads and automatically parses them using Credal's parsing service.
|
|
116
119
|
*
|
|
117
120
|
* @param {Credal.UploadFileRequest} request
|
|
118
|
-
* @param {
|
|
121
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
119
122
|
*/
|
|
120
123
|
uploadFile(request, requestOptions) {
|
|
121
124
|
return core.HttpResponsePromise.fromPromise(this.__uploadFile(request, requestOptions));
|
|
122
125
|
}
|
|
123
126
|
__uploadFile(request, requestOptions) {
|
|
124
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
126
129
|
const _request = yield core.newFormData();
|
|
127
130
|
yield _request.appendFile("file", request.file);
|
|
128
131
|
if (request.documentName != null) {
|
|
@@ -167,6 +170,8 @@ class DocumentCatalog {
|
|
|
167
170
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
168
171
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
169
172
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
173
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
174
|
+
logging: this._options.logging,
|
|
170
175
|
});
|
|
171
176
|
if (_response.ok) {
|
|
172
177
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -199,7 +204,7 @@ class DocumentCatalog {
|
|
|
199
204
|
* Sync a document from a source URL. Does not support recursive web search. Reach out to a Credal representative for access.
|
|
200
205
|
*
|
|
201
206
|
* @param {Credal.SyncSourceByUrlRequest} request
|
|
202
|
-
* @param {
|
|
207
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
203
208
|
*
|
|
204
209
|
* @example
|
|
205
210
|
* await client.documentCatalog.syncSourceByUrl({
|
|
@@ -212,7 +217,7 @@ class DocumentCatalog {
|
|
|
212
217
|
}
|
|
213
218
|
__syncSourceByUrl(request, requestOptions) {
|
|
214
219
|
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
220
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
216
221
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
217
222
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
218
223
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/catalog/syncSourceByUrl"),
|
|
@@ -225,6 +230,8 @@ class DocumentCatalog {
|
|
|
225
230
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
226
231
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
227
232
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
233
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
234
|
+
logging: this._options.logging,
|
|
228
235
|
});
|
|
229
236
|
if (_response.ok) {
|
|
230
237
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -257,7 +264,7 @@ class DocumentCatalog {
|
|
|
257
264
|
* Bulk patch metadata for documents, synced natively by Credal or manual API uploads
|
|
258
265
|
*
|
|
259
266
|
* @param {Credal.DocumentMetadataPatchRequest} request
|
|
260
|
-
* @param {
|
|
267
|
+
* @param {DocumentCatalogClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
261
268
|
*
|
|
262
269
|
* @example
|
|
263
270
|
* await client.documentCatalog.metadata({
|
|
@@ -290,7 +297,7 @@ class DocumentCatalog {
|
|
|
290
297
|
}
|
|
291
298
|
__metadata(request, requestOptions) {
|
|
292
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
300
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
294
301
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
295
302
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
296
303
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/catalog/metadata"),
|
|
@@ -303,6 +310,8 @@ class DocumentCatalog {
|
|
|
303
310
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
304
311
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
305
312
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
313
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
314
|
+
logging: this._options.logging,
|
|
306
315
|
});
|
|
307
316
|
if (_response.ok) {
|
|
308
317
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -344,4 +353,4 @@ class DocumentCatalog {
|
|
|
344
353
|
});
|
|
345
354
|
}
|
|
346
355
|
}
|
|
347
|
-
exports.
|
|
356
|
+
exports.DocumentCatalogClient = DocumentCatalogClient;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import type * as Credal from "../../../index.js";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace DocumentCollectionsClient {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
10
|
+
export declare class DocumentCollectionsClient {
|
|
11
|
+
protected readonly _options: DocumentCollectionsClient.Options;
|
|
12
|
+
constructor(options?: DocumentCollectionsClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* Add documents to a document collection. Note that the documents must already exist in the document catalog to use this endpoint. If you want to upload a new document to a collection, use the `uploadDocumentContents` endpoint.
|
|
15
15
|
*
|
|
16
16
|
* @param {Credal.AddDocumentsToCollectionRequest} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* await client.documentCollections.addDocumentsToCollection({
|
|
@@ -30,13 +30,13 @@ export declare class DocumentCollections {
|
|
|
30
30
|
* }]
|
|
31
31
|
* })
|
|
32
32
|
*/
|
|
33
|
-
addDocumentsToCollection(request: Credal.AddDocumentsToCollectionRequest, requestOptions?:
|
|
33
|
+
addDocumentsToCollection(request: Credal.AddDocumentsToCollectionRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
34
34
|
private __addDocumentsToCollection;
|
|
35
35
|
/**
|
|
36
36
|
* Remove documents from a collection
|
|
37
37
|
*
|
|
38
38
|
* @param {Credal.RemoveDocumentsFromCollectionRequest} request
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* await client.documentCollections.removeDocumentsFromCollection({
|
|
@@ -52,26 +52,26 @@ export declare class DocumentCollections {
|
|
|
52
52
|
* }]
|
|
53
53
|
* })
|
|
54
54
|
*/
|
|
55
|
-
removeDocumentsFromCollection(request: Credal.RemoveDocumentsFromCollectionRequest, requestOptions?:
|
|
55
|
+
removeDocumentsFromCollection(request: Credal.RemoveDocumentsFromCollectionRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
56
56
|
private __removeDocumentsFromCollection;
|
|
57
57
|
/**
|
|
58
58
|
* List documents in a collection
|
|
59
59
|
*
|
|
60
60
|
* @param {Credal.ListDocumentsInCollectionRequest} request
|
|
61
|
-
* @param {
|
|
61
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* await client.documentCollections.listDocumentsInCollection({
|
|
65
65
|
* collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
|
|
66
66
|
* })
|
|
67
67
|
*/
|
|
68
|
-
listDocumentsInCollection(request: Credal.ListDocumentsInCollectionRequest, requestOptions?:
|
|
68
|
+
listDocumentsInCollection(request: Credal.ListDocumentsInCollectionRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<Credal.ListDocumentsInCollectionResponse>;
|
|
69
69
|
private __listDocumentsInCollection;
|
|
70
70
|
/**
|
|
71
71
|
* Create a new collection. The API key used will be added to the collection for future Requests
|
|
72
72
|
*
|
|
73
73
|
* @param {Credal.CreateCollectionRequest} request
|
|
74
|
-
* @param {
|
|
74
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
77
|
* await client.documentCollections.createCollection({
|
|
@@ -83,26 +83,26 @@ export declare class DocumentCollections {
|
|
|
83
83
|
* }]
|
|
84
84
|
* })
|
|
85
85
|
*/
|
|
86
|
-
createCollection(request: Credal.CreateCollectionRequest, requestOptions?:
|
|
86
|
+
createCollection(request: Credal.CreateCollectionRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<Credal.CreateCollectionResponse>;
|
|
87
87
|
private __createCollection;
|
|
88
88
|
/**
|
|
89
89
|
* Delete the collection.
|
|
90
90
|
*
|
|
91
91
|
* @param {Credal.DeleteCollectionRequest} request
|
|
92
|
-
* @param {
|
|
92
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
93
93
|
*
|
|
94
94
|
* @example
|
|
95
95
|
* await client.documentCollections.deleteCollection({
|
|
96
96
|
* collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a"
|
|
97
97
|
* })
|
|
98
98
|
*/
|
|
99
|
-
deleteCollection(request: Credal.DeleteCollectionRequest, requestOptions?:
|
|
99
|
+
deleteCollection(request: Credal.DeleteCollectionRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<Credal.DeleteCollectionResponse>;
|
|
100
100
|
private __deleteCollection;
|
|
101
101
|
/**
|
|
102
102
|
* Credal lets you easily sync your MongoDB data for use in Collections and Agents. Create a new sync from a MongoDB collection to a Credal collection.
|
|
103
103
|
*
|
|
104
104
|
* @param {Credal.CreateMongoCollectionSyncRequest} request
|
|
105
|
-
* @param {
|
|
105
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
106
106
|
*
|
|
107
107
|
* @example
|
|
108
108
|
* await client.documentCollections.createMongoCollectionSync({
|
|
@@ -125,13 +125,13 @@ export declare class DocumentCollections {
|
|
|
125
125
|
* }
|
|
126
126
|
* })
|
|
127
127
|
*/
|
|
128
|
-
createMongoCollectionSync(request: Credal.CreateMongoCollectionSyncRequest, requestOptions?:
|
|
128
|
+
createMongoCollectionSync(request: Credal.CreateMongoCollectionSyncRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<Credal.MongoCollectionSyncResponse>;
|
|
129
129
|
private __createMongoCollectionSync;
|
|
130
130
|
/**
|
|
131
131
|
* Credal lets you easily sync your MongoDB data for use in Collections and Agents. Update an existing sync from a MongoDB collection to a Credal collection via the `mongoCredentialId`, to disambiguate between multiple potential syncs to a given collection.
|
|
132
132
|
*
|
|
133
133
|
* @param {Credal.UpdateMongoCollectionSyncRequest} request
|
|
134
|
-
* @param {
|
|
134
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
135
135
|
*
|
|
136
136
|
* @example
|
|
137
137
|
* await client.documentCollections.updateMongoCollectionSync({
|
|
@@ -154,7 +154,7 @@ export declare class DocumentCollections {
|
|
|
154
154
|
* }
|
|
155
155
|
* })
|
|
156
156
|
*/
|
|
157
|
-
updateMongoCollectionSync(request: Credal.UpdateMongoCollectionSyncRequest, requestOptions?:
|
|
157
|
+
updateMongoCollectionSync(request: Credal.UpdateMongoCollectionSyncRequest, requestOptions?: DocumentCollectionsClient.RequestOptions): core.HttpResponsePromise<Credal.MongoCollectionSyncResponse>;
|
|
158
158
|
private __updateMongoCollectionSync;
|
|
159
159
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
160
160
|
}
|
|
@@ -43,20 +43,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.DocumentCollectionsClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
51
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
|
-
class
|
|
52
|
-
constructor(
|
|
53
|
-
this._options =
|
|
52
|
+
class DocumentCollectionsClient {
|
|
53
|
+
constructor(options = {}) {
|
|
54
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* Add documents to a document collection. Note that the documents must already exist in the document catalog to use this endpoint. If you want to upload a new document to a collection, use the `uploadDocumentContents` endpoint.
|
|
57
58
|
*
|
|
58
59
|
* @param {Credal.AddDocumentsToCollectionRequest} request
|
|
59
|
-
* @param {
|
|
60
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
61
|
*
|
|
61
62
|
* @example
|
|
62
63
|
* await client.documentCollections.addDocumentsToCollection({
|
|
@@ -77,7 +78,7 @@ class DocumentCollections {
|
|
|
77
78
|
}
|
|
78
79
|
__addDocumentsToCollection(request, requestOptions) {
|
|
79
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
81
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
81
82
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
82
83
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
83
84
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/addDocumentsToCollection"),
|
|
@@ -90,6 +91,8 @@ class DocumentCollections {
|
|
|
90
91
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
91
92
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
92
93
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
94
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
95
|
+
logging: this._options.logging,
|
|
93
96
|
});
|
|
94
97
|
if (_response.ok) {
|
|
95
98
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -122,7 +125,7 @@ class DocumentCollections {
|
|
|
122
125
|
* Remove documents from a collection
|
|
123
126
|
*
|
|
124
127
|
* @param {Credal.RemoveDocumentsFromCollectionRequest} request
|
|
125
|
-
* @param {
|
|
128
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
126
129
|
*
|
|
127
130
|
* @example
|
|
128
131
|
* await client.documentCollections.removeDocumentsFromCollection({
|
|
@@ -143,7 +146,7 @@ class DocumentCollections {
|
|
|
143
146
|
}
|
|
144
147
|
__removeDocumentsFromCollection(request, requestOptions) {
|
|
145
148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
149
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
147
150
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
148
151
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
149
152
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/removeDocumentsFromCollection"),
|
|
@@ -156,6 +159,8 @@ class DocumentCollections {
|
|
|
156
159
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
157
160
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
158
161
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
162
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
163
|
+
logging: this._options.logging,
|
|
159
164
|
});
|
|
160
165
|
if (_response.ok) {
|
|
161
166
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -188,7 +193,7 @@ class DocumentCollections {
|
|
|
188
193
|
* List documents in a collection
|
|
189
194
|
*
|
|
190
195
|
* @param {Credal.ListDocumentsInCollectionRequest} request
|
|
191
|
-
* @param {
|
|
196
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
192
197
|
*
|
|
193
198
|
* @example
|
|
194
199
|
* await client.documentCollections.listDocumentsInCollection({
|
|
@@ -200,7 +205,7 @@ class DocumentCollections {
|
|
|
200
205
|
}
|
|
201
206
|
__listDocumentsInCollection(request, requestOptions) {
|
|
202
207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
208
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
204
209
|
const { collectionId } = request;
|
|
205
210
|
const _queryParams = {};
|
|
206
211
|
_queryParams.collectionId = collectionId;
|
|
@@ -213,6 +218,8 @@ class DocumentCollections {
|
|
|
213
218
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
214
219
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
215
220
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
221
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
222
|
+
logging: this._options.logging,
|
|
216
223
|
});
|
|
217
224
|
if (_response.ok) {
|
|
218
225
|
return {
|
|
@@ -248,7 +255,7 @@ class DocumentCollections {
|
|
|
248
255
|
* Create a new collection. The API key used will be added to the collection for future Requests
|
|
249
256
|
*
|
|
250
257
|
* @param {Credal.CreateCollectionRequest} request
|
|
251
|
-
* @param {
|
|
258
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
252
259
|
*
|
|
253
260
|
* @example
|
|
254
261
|
* await client.documentCollections.createCollection({
|
|
@@ -265,7 +272,7 @@ class DocumentCollections {
|
|
|
265
272
|
}
|
|
266
273
|
__createCollection(request, requestOptions) {
|
|
267
274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
275
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
269
276
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
270
277
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
271
278
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/createCollection"),
|
|
@@ -278,6 +285,8 @@ class DocumentCollections {
|
|
|
278
285
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
279
286
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
280
287
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
288
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
289
|
+
logging: this._options.logging,
|
|
281
290
|
});
|
|
282
291
|
if (_response.ok) {
|
|
283
292
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -310,7 +319,7 @@ class DocumentCollections {
|
|
|
310
319
|
* Delete the collection.
|
|
311
320
|
*
|
|
312
321
|
* @param {Credal.DeleteCollectionRequest} request
|
|
313
|
-
* @param {
|
|
322
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
314
323
|
*
|
|
315
324
|
* @example
|
|
316
325
|
* await client.documentCollections.deleteCollection({
|
|
@@ -322,7 +331,7 @@ class DocumentCollections {
|
|
|
322
331
|
}
|
|
323
332
|
__deleteCollection(request, requestOptions) {
|
|
324
333
|
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
334
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
326
335
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
327
336
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
328
337
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/deleteCollection"),
|
|
@@ -335,6 +344,8 @@ class DocumentCollections {
|
|
|
335
344
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
336
345
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
337
346
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
347
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
348
|
+
logging: this._options.logging,
|
|
338
349
|
});
|
|
339
350
|
if (_response.ok) {
|
|
340
351
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -367,7 +378,7 @@ class DocumentCollections {
|
|
|
367
378
|
* Credal lets you easily sync your MongoDB data for use in Collections and Agents. Create a new sync from a MongoDB collection to a Credal collection.
|
|
368
379
|
*
|
|
369
380
|
* @param {Credal.CreateMongoCollectionSyncRequest} request
|
|
370
|
-
* @param {
|
|
381
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
371
382
|
*
|
|
372
383
|
* @example
|
|
373
384
|
* await client.documentCollections.createMongoCollectionSync({
|
|
@@ -395,7 +406,7 @@ class DocumentCollections {
|
|
|
395
406
|
}
|
|
396
407
|
__createMongoCollectionSync(request, requestOptions) {
|
|
397
408
|
return __awaiter(this, void 0, void 0, function* () {
|
|
398
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
409
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
399
410
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
400
411
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
401
412
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/mongodb/createMongoSync"),
|
|
@@ -408,6 +419,8 @@ class DocumentCollections {
|
|
|
408
419
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
409
420
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
410
421
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
422
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
423
|
+
logging: this._options.logging,
|
|
411
424
|
});
|
|
412
425
|
if (_response.ok) {
|
|
413
426
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -440,7 +453,7 @@ class DocumentCollections {
|
|
|
440
453
|
* Credal lets you easily sync your MongoDB data for use in Collections and Agents. Update an existing sync from a MongoDB collection to a Credal collection via the `mongoCredentialId`, to disambiguate between multiple potential syncs to a given collection.
|
|
441
454
|
*
|
|
442
455
|
* @param {Credal.UpdateMongoCollectionSyncRequest} request
|
|
443
|
-
* @param {
|
|
456
|
+
* @param {DocumentCollectionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
444
457
|
*
|
|
445
458
|
* @example
|
|
446
459
|
* await client.documentCollections.updateMongoCollectionSync({
|
|
@@ -468,7 +481,7 @@ class DocumentCollections {
|
|
|
468
481
|
}
|
|
469
482
|
__updateMongoCollectionSync(request, requestOptions) {
|
|
470
483
|
return __awaiter(this, void 0, void 0, function* () {
|
|
471
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
484
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
472
485
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
473
486
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
474
487
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/documentCollections/mongodb/updateMongoSync"),
|
|
@@ -481,6 +494,8 @@ class DocumentCollections {
|
|
|
481
494
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
482
495
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
483
496
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
497
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
498
|
+
logging: this._options.logging,
|
|
484
499
|
});
|
|
485
500
|
if (_response.ok) {
|
|
486
501
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -522,4 +537,4 @@ class DocumentCollections {
|
|
|
522
537
|
});
|
|
523
538
|
}
|
|
524
539
|
}
|
|
525
|
-
exports.
|
|
540
|
+
exports.DocumentCollectionsClient = DocumentCollectionsClient;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import type * as Credal from "../../../index.js";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace SearchClient {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
10
|
+
export declare class SearchClient {
|
|
11
|
+
protected readonly _options: SearchClient.Options;
|
|
12
|
+
constructor(options?: SearchClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* Search across all documents in a document collection using the document metadata and contents.
|
|
15
15
|
*
|
|
16
16
|
* @param {Credal.SearchDocumentCollectionRequest} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* await client.search.searchDocumentCollection({
|
|
@@ -36,7 +36,7 @@ export declare class Search {
|
|
|
36
36
|
* }
|
|
37
37
|
* })
|
|
38
38
|
*/
|
|
39
|
-
searchDocumentCollection(request: Credal.SearchDocumentCollectionRequest, requestOptions?:
|
|
39
|
+
searchDocumentCollection(request: Credal.SearchDocumentCollectionRequest, requestOptions?: SearchClient.RequestOptions): core.HttpResponsePromise<Credal.SearchDocumentCollectionResponse>;
|
|
40
40
|
private __searchDocumentCollection;
|
|
41
41
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
42
42
|
}
|
|
@@ -43,20 +43,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.SearchClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
51
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
|
-
class
|
|
52
|
-
constructor(
|
|
53
|
-
this._options =
|
|
52
|
+
class SearchClient {
|
|
53
|
+
constructor(options = {}) {
|
|
54
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* Search across all documents in a document collection using the document metadata and contents.
|
|
57
58
|
*
|
|
58
59
|
* @param {Credal.SearchDocumentCollectionRequest} request
|
|
59
|
-
* @param {
|
|
60
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
61
|
*
|
|
61
62
|
* @example
|
|
62
63
|
* await client.search.searchDocumentCollection({
|
|
@@ -83,7 +84,7 @@ class Search {
|
|
|
83
84
|
}
|
|
84
85
|
__searchDocumentCollection(request, requestOptions) {
|
|
85
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
87
88
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
88
89
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
89
90
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/search/searchDocumentCollection"),
|
|
@@ -96,6 +97,8 @@ class Search {
|
|
|
96
97
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
97
98
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
98
99
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
100
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
101
|
+
logging: this._options.logging,
|
|
99
102
|
});
|
|
100
103
|
if (_response.ok) {
|
|
101
104
|
return {
|
|
@@ -140,4 +143,4 @@ class Search {
|
|
|
140
143
|
});
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
|
-
exports.
|
|
146
|
+
exports.SearchClient = SearchClient;
|