@credal/sdk 0.0.27 → 0.0.29
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/api/resources/copilots/client/Client.d.ts +18 -9
- package/api/resources/copilots/client/Client.js +121 -52
- package/api/resources/documentCatalog/client/Client.d.ts +6 -3
- package/api/resources/documentCatalog/client/Client.js +40 -16
- package/api/resources/documentCollections/client/Client.d.ts +12 -6
- package/api/resources/documentCollections/client/Client.js +80 -32
- package/api/resources/permissionsService/client/Client.d.ts +6 -3
- package/api/resources/permissionsService/client/Client.js +48 -21
- package/api/resources/search/client/Client.d.ts +2 -1
- package/api/resources/search/client/Client.js +16 -7
- package/api/resources/users/client/Client.d.ts +2 -1
- package/api/resources/users/client/Client.js +8 -2
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/Fetcher.js +7 -0
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/dist/api/resources/copilots/client/Client.d.ts +18 -9
- package/dist/api/resources/copilots/client/Client.js +121 -52
- package/dist/api/resources/documentCatalog/client/Client.d.ts +6 -3
- package/dist/api/resources/documentCatalog/client/Client.js +40 -16
- package/dist/api/resources/documentCollections/client/Client.d.ts +12 -6
- package/dist/api/resources/documentCollections/client/Client.js +80 -32
- package/dist/api/resources/permissionsService/client/Client.d.ts +6 -3
- package/dist/api/resources/permissionsService/client/Client.js +48 -21
- package/dist/api/resources/search/client/Client.d.ts +2 -1
- package/dist/api/resources/search/client/Client.js +16 -7
- package/dist/api/resources/users/client/Client.d.ts +2 -1
- package/dist/api/resources/users/client/Client.js +8 -2
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/Fetcher.js +7 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/errors/CredalError.d.ts +4 -1
- package/dist/errors/CredalError.js +4 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/errors/CredalError.d.ts +4 -1
- package/errors/CredalError.js +4 -7
- package/package.json +3 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -72,12 +72,15 @@ class DocumentCatalog {
|
|
|
72
72
|
* })
|
|
73
73
|
*/
|
|
74
74
|
uploadDocumentContents(request, requestOptions) {
|
|
75
|
+
return core.HttpResponsePromise.fromPromise(this.__uploadDocumentContents(request, requestOptions));
|
|
76
|
+
}
|
|
77
|
+
__uploadDocumentContents(request, requestOptions) {
|
|
75
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
79
|
var _a, _b, _c;
|
|
77
80
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
78
81
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/catalog/uploadDocumentContents"),
|
|
79
82
|
method: "POST",
|
|
80
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
83
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
81
84
|
contentType: "application/json",
|
|
82
85
|
requestType: "json",
|
|
83
86
|
body: serializers.UploadDocumentContentsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -86,17 +89,21 @@ class DocumentCatalog {
|
|
|
86
89
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
87
90
|
});
|
|
88
91
|
if (_response.ok) {
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
return {
|
|
93
|
+
data: serializers.UploadDocumentResponse.parseOrThrow(_response.body, {
|
|
94
|
+
unrecognizedObjectKeys: "passthrough",
|
|
95
|
+
allowUnrecognizedUnionMembers: true,
|
|
96
|
+
allowUnrecognizedEnumValues: true,
|
|
97
|
+
breadcrumbsPrefix: ["response"],
|
|
98
|
+
}),
|
|
99
|
+
rawResponse: _response.rawResponse,
|
|
100
|
+
};
|
|
95
101
|
}
|
|
96
102
|
if (_response.error.reason === "status-code") {
|
|
97
103
|
throw new errors.CredalError({
|
|
98
104
|
statusCode: _response.error.statusCode,
|
|
99
105
|
body: _response.error.body,
|
|
106
|
+
rawResponse: _response.rawResponse,
|
|
100
107
|
});
|
|
101
108
|
}
|
|
102
109
|
switch (_response.error.reason) {
|
|
@@ -104,12 +111,14 @@ class DocumentCatalog {
|
|
|
104
111
|
throw new errors.CredalError({
|
|
105
112
|
statusCode: _response.error.statusCode,
|
|
106
113
|
body: _response.error.rawBody,
|
|
114
|
+
rawResponse: _response.rawResponse,
|
|
107
115
|
});
|
|
108
116
|
case "timeout":
|
|
109
117
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/catalog/uploadDocumentContents.");
|
|
110
118
|
case "unknown":
|
|
111
119
|
throw new errors.CredalError({
|
|
112
120
|
message: _response.error.errorMessage,
|
|
121
|
+
rawResponse: _response.rawResponse,
|
|
113
122
|
});
|
|
114
123
|
}
|
|
115
124
|
});
|
|
@@ -127,12 +136,15 @@ class DocumentCatalog {
|
|
|
127
136
|
* })
|
|
128
137
|
*/
|
|
129
138
|
syncSourceByUrl(request, requestOptions) {
|
|
139
|
+
return core.HttpResponsePromise.fromPromise(this.__syncSourceByUrl(request, requestOptions));
|
|
140
|
+
}
|
|
141
|
+
__syncSourceByUrl(request, requestOptions) {
|
|
130
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
143
|
var _a, _b, _c;
|
|
132
144
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
133
145
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/catalog/syncSourceByUrl"),
|
|
134
146
|
method: "POST",
|
|
135
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
147
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
136
148
|
contentType: "application/json",
|
|
137
149
|
requestType: "json",
|
|
138
150
|
body: serializers.SyncSourceByUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -141,17 +153,21 @@ class DocumentCatalog {
|
|
|
141
153
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
142
154
|
});
|
|
143
155
|
if (_response.ok) {
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
return {
|
|
157
|
+
data: serializers.SyncSourceByUrlResponse.parseOrThrow(_response.body, {
|
|
158
|
+
unrecognizedObjectKeys: "passthrough",
|
|
159
|
+
allowUnrecognizedUnionMembers: true,
|
|
160
|
+
allowUnrecognizedEnumValues: true,
|
|
161
|
+
breadcrumbsPrefix: ["response"],
|
|
162
|
+
}),
|
|
163
|
+
rawResponse: _response.rawResponse,
|
|
164
|
+
};
|
|
150
165
|
}
|
|
151
166
|
if (_response.error.reason === "status-code") {
|
|
152
167
|
throw new errors.CredalError({
|
|
153
168
|
statusCode: _response.error.statusCode,
|
|
154
169
|
body: _response.error.body,
|
|
170
|
+
rawResponse: _response.rawResponse,
|
|
155
171
|
});
|
|
156
172
|
}
|
|
157
173
|
switch (_response.error.reason) {
|
|
@@ -159,12 +175,14 @@ class DocumentCatalog {
|
|
|
159
175
|
throw new errors.CredalError({
|
|
160
176
|
statusCode: _response.error.statusCode,
|
|
161
177
|
body: _response.error.rawBody,
|
|
178
|
+
rawResponse: _response.rawResponse,
|
|
162
179
|
});
|
|
163
180
|
case "timeout":
|
|
164
181
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/catalog/syncSourceByUrl.");
|
|
165
182
|
case "unknown":
|
|
166
183
|
throw new errors.CredalError({
|
|
167
184
|
message: _response.error.errorMessage,
|
|
185
|
+
rawResponse: _response.rawResponse,
|
|
168
186
|
});
|
|
169
187
|
}
|
|
170
188
|
});
|
|
@@ -202,12 +220,15 @@ class DocumentCatalog {
|
|
|
202
220
|
* })
|
|
203
221
|
*/
|
|
204
222
|
metadata(request, requestOptions) {
|
|
223
|
+
return core.HttpResponsePromise.fromPromise(this.__metadata(request, requestOptions));
|
|
224
|
+
}
|
|
225
|
+
__metadata(request, requestOptions) {
|
|
205
226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
206
227
|
var _a, _b, _c;
|
|
207
228
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
208
229
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/catalog/metadata"),
|
|
209
230
|
method: "PATCH",
|
|
210
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
231
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
211
232
|
contentType: "application/json",
|
|
212
233
|
requestType: "json",
|
|
213
234
|
body: serializers.DocumentMetadataPatchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -216,12 +237,13 @@ class DocumentCatalog {
|
|
|
216
237
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
217
238
|
});
|
|
218
239
|
if (_response.ok) {
|
|
219
|
-
return;
|
|
240
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
220
241
|
}
|
|
221
242
|
if (_response.error.reason === "status-code") {
|
|
222
243
|
throw new errors.CredalError({
|
|
223
244
|
statusCode: _response.error.statusCode,
|
|
224
245
|
body: _response.error.body,
|
|
246
|
+
rawResponse: _response.rawResponse,
|
|
225
247
|
});
|
|
226
248
|
}
|
|
227
249
|
switch (_response.error.reason) {
|
|
@@ -229,12 +251,14 @@ class DocumentCatalog {
|
|
|
229
251
|
throw new errors.CredalError({
|
|
230
252
|
statusCode: _response.error.statusCode,
|
|
231
253
|
body: _response.error.rawBody,
|
|
254
|
+
rawResponse: _response.rawResponse,
|
|
232
255
|
});
|
|
233
256
|
case "timeout":
|
|
234
257
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling PATCH /v0/catalog/metadata.");
|
|
235
258
|
case "unknown":
|
|
236
259
|
throw new errors.CredalError({
|
|
237
260
|
message: _response.error.errorMessage,
|
|
261
|
+
rawResponse: _response.rawResponse,
|
|
238
262
|
});
|
|
239
263
|
}
|
|
240
264
|
});
|
|
@@ -46,7 +46,8 @@ export declare class DocumentCollections {
|
|
|
46
46
|
* }]
|
|
47
47
|
* })
|
|
48
48
|
*/
|
|
49
|
-
addDocumentsToCollection(request: Credal.AddDocumentsToCollectionRequest, requestOptions?: DocumentCollections.RequestOptions):
|
|
49
|
+
addDocumentsToCollection(request: Credal.AddDocumentsToCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<void>;
|
|
50
|
+
private __addDocumentsToCollection;
|
|
50
51
|
/**
|
|
51
52
|
* Remove documents from a collection
|
|
52
53
|
*
|
|
@@ -67,7 +68,8 @@ export declare class DocumentCollections {
|
|
|
67
68
|
* }]
|
|
68
69
|
* })
|
|
69
70
|
*/
|
|
70
|
-
removeDocumentsFromCollection(request: Credal.RemoveDocumentsFromCollectionRequest, requestOptions?: DocumentCollections.RequestOptions):
|
|
71
|
+
removeDocumentsFromCollection(request: Credal.RemoveDocumentsFromCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<void>;
|
|
72
|
+
private __removeDocumentsFromCollection;
|
|
71
73
|
/**
|
|
72
74
|
* Create a new collection. The API key used will be added to the collection for future Requests
|
|
73
75
|
*
|
|
@@ -84,7 +86,8 @@ export declare class DocumentCollections {
|
|
|
84
86
|
* }]
|
|
85
87
|
* })
|
|
86
88
|
*/
|
|
87
|
-
createCollection(request: Credal.CreateCollectionRequest, requestOptions?: DocumentCollections.RequestOptions):
|
|
89
|
+
createCollection(request: Credal.CreateCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<Credal.CreateCollectionResponse>;
|
|
90
|
+
private __createCollection;
|
|
88
91
|
/**
|
|
89
92
|
* Delete the collection.
|
|
90
93
|
*
|
|
@@ -96,7 +99,8 @@ export declare class DocumentCollections {
|
|
|
96
99
|
* collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a"
|
|
97
100
|
* })
|
|
98
101
|
*/
|
|
99
|
-
deleteCollection(request: Credal.DeleteCollectionRequest, requestOptions?: DocumentCollections.RequestOptions):
|
|
102
|
+
deleteCollection(request: Credal.DeleteCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<Credal.DeleteCollectionResponse>;
|
|
103
|
+
private __deleteCollection;
|
|
100
104
|
/**
|
|
101
105
|
* 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.
|
|
102
106
|
*
|
|
@@ -124,7 +128,8 @@ export declare class DocumentCollections {
|
|
|
124
128
|
* }
|
|
125
129
|
* })
|
|
126
130
|
*/
|
|
127
|
-
createMongoCollectionSync(request: Credal.CreateMongoCollectionSyncRequest, requestOptions?: DocumentCollections.RequestOptions):
|
|
131
|
+
createMongoCollectionSync(request: Credal.CreateMongoCollectionSyncRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<Credal.MongoCollectionSyncResponse>;
|
|
132
|
+
private __createMongoCollectionSync;
|
|
128
133
|
/**
|
|
129
134
|
* 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.
|
|
130
135
|
*
|
|
@@ -152,6 +157,7 @@ export declare class DocumentCollections {
|
|
|
152
157
|
* }
|
|
153
158
|
* })
|
|
154
159
|
*/
|
|
155
|
-
updateMongoCollectionSync(request: Credal.UpdateMongoCollectionSyncRequest, requestOptions?: DocumentCollections.RequestOptions):
|
|
160
|
+
updateMongoCollectionSync(request: Credal.UpdateMongoCollectionSyncRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<Credal.MongoCollectionSyncResponse>;
|
|
161
|
+
private __updateMongoCollectionSync;
|
|
156
162
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
157
163
|
}
|
|
@@ -79,12 +79,15 @@ class DocumentCollections {
|
|
|
79
79
|
* })
|
|
80
80
|
*/
|
|
81
81
|
addDocumentsToCollection(request, requestOptions) {
|
|
82
|
+
return core.HttpResponsePromise.fromPromise(this.__addDocumentsToCollection(request, requestOptions));
|
|
83
|
+
}
|
|
84
|
+
__addDocumentsToCollection(request, requestOptions) {
|
|
82
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
86
|
var _a, _b, _c;
|
|
84
87
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
85
88
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/documentCollections/addDocumentsToCollection"),
|
|
86
89
|
method: "POST",
|
|
87
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
90
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
88
91
|
contentType: "application/json",
|
|
89
92
|
requestType: "json",
|
|
90
93
|
body: serializers.AddDocumentsToCollectionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -93,12 +96,13 @@ class DocumentCollections {
|
|
|
93
96
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
94
97
|
});
|
|
95
98
|
if (_response.ok) {
|
|
96
|
-
return;
|
|
99
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
97
100
|
}
|
|
98
101
|
if (_response.error.reason === "status-code") {
|
|
99
102
|
throw new errors.CredalError({
|
|
100
103
|
statusCode: _response.error.statusCode,
|
|
101
104
|
body: _response.error.body,
|
|
105
|
+
rawResponse: _response.rawResponse,
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
108
|
switch (_response.error.reason) {
|
|
@@ -106,12 +110,14 @@ class DocumentCollections {
|
|
|
106
110
|
throw new errors.CredalError({
|
|
107
111
|
statusCode: _response.error.statusCode,
|
|
108
112
|
body: _response.error.rawBody,
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
109
114
|
});
|
|
110
115
|
case "timeout":
|
|
111
116
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/documentCollections/addDocumentsToCollection.");
|
|
112
117
|
case "unknown":
|
|
113
118
|
throw new errors.CredalError({
|
|
114
119
|
message: _response.error.errorMessage,
|
|
120
|
+
rawResponse: _response.rawResponse,
|
|
115
121
|
});
|
|
116
122
|
}
|
|
117
123
|
});
|
|
@@ -137,12 +143,15 @@ class DocumentCollections {
|
|
|
137
143
|
* })
|
|
138
144
|
*/
|
|
139
145
|
removeDocumentsFromCollection(request, requestOptions) {
|
|
146
|
+
return core.HttpResponsePromise.fromPromise(this.__removeDocumentsFromCollection(request, requestOptions));
|
|
147
|
+
}
|
|
148
|
+
__removeDocumentsFromCollection(request, requestOptions) {
|
|
140
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
150
|
var _a, _b, _c;
|
|
142
151
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
143
152
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/documentCollections/removeDocumentsFromCollection"),
|
|
144
153
|
method: "DELETE",
|
|
145
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
154
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
146
155
|
contentType: "application/json",
|
|
147
156
|
requestType: "json",
|
|
148
157
|
body: serializers.RemoveDocumentsFromCollectionRequest.jsonOrThrow(request, {
|
|
@@ -153,12 +162,13 @@ class DocumentCollections {
|
|
|
153
162
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
154
163
|
});
|
|
155
164
|
if (_response.ok) {
|
|
156
|
-
return;
|
|
165
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
157
166
|
}
|
|
158
167
|
if (_response.error.reason === "status-code") {
|
|
159
168
|
throw new errors.CredalError({
|
|
160
169
|
statusCode: _response.error.statusCode,
|
|
161
170
|
body: _response.error.body,
|
|
171
|
+
rawResponse: _response.rawResponse,
|
|
162
172
|
});
|
|
163
173
|
}
|
|
164
174
|
switch (_response.error.reason) {
|
|
@@ -166,12 +176,14 @@ class DocumentCollections {
|
|
|
166
176
|
throw new errors.CredalError({
|
|
167
177
|
statusCode: _response.error.statusCode,
|
|
168
178
|
body: _response.error.rawBody,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
169
180
|
});
|
|
170
181
|
case "timeout":
|
|
171
182
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling DELETE /v0/documentCollections/removeDocumentsFromCollection.");
|
|
172
183
|
case "unknown":
|
|
173
184
|
throw new errors.CredalError({
|
|
174
185
|
message: _response.error.errorMessage,
|
|
186
|
+
rawResponse: _response.rawResponse,
|
|
175
187
|
});
|
|
176
188
|
}
|
|
177
189
|
});
|
|
@@ -193,12 +205,15 @@ class DocumentCollections {
|
|
|
193
205
|
* })
|
|
194
206
|
*/
|
|
195
207
|
createCollection(request, requestOptions) {
|
|
208
|
+
return core.HttpResponsePromise.fromPromise(this.__createCollection(request, requestOptions));
|
|
209
|
+
}
|
|
210
|
+
__createCollection(request, requestOptions) {
|
|
196
211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
197
212
|
var _a, _b, _c;
|
|
198
213
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
199
214
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/documentCollections/createCollection"),
|
|
200
215
|
method: "POST",
|
|
201
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
216
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
202
217
|
contentType: "application/json",
|
|
203
218
|
requestType: "json",
|
|
204
219
|
body: serializers.CreateCollectionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -207,17 +222,21 @@ class DocumentCollections {
|
|
|
207
222
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
208
223
|
});
|
|
209
224
|
if (_response.ok) {
|
|
210
|
-
return
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
225
|
+
return {
|
|
226
|
+
data: serializers.CreateCollectionResponse.parseOrThrow(_response.body, {
|
|
227
|
+
unrecognizedObjectKeys: "passthrough",
|
|
228
|
+
allowUnrecognizedUnionMembers: true,
|
|
229
|
+
allowUnrecognizedEnumValues: true,
|
|
230
|
+
breadcrumbsPrefix: ["response"],
|
|
231
|
+
}),
|
|
232
|
+
rawResponse: _response.rawResponse,
|
|
233
|
+
};
|
|
216
234
|
}
|
|
217
235
|
if (_response.error.reason === "status-code") {
|
|
218
236
|
throw new errors.CredalError({
|
|
219
237
|
statusCode: _response.error.statusCode,
|
|
220
238
|
body: _response.error.body,
|
|
239
|
+
rawResponse: _response.rawResponse,
|
|
221
240
|
});
|
|
222
241
|
}
|
|
223
242
|
switch (_response.error.reason) {
|
|
@@ -225,12 +244,14 @@ class DocumentCollections {
|
|
|
225
244
|
throw new errors.CredalError({
|
|
226
245
|
statusCode: _response.error.statusCode,
|
|
227
246
|
body: _response.error.rawBody,
|
|
247
|
+
rawResponse: _response.rawResponse,
|
|
228
248
|
});
|
|
229
249
|
case "timeout":
|
|
230
250
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/documentCollections/createCollection.");
|
|
231
251
|
case "unknown":
|
|
232
252
|
throw new errors.CredalError({
|
|
233
253
|
message: _response.error.errorMessage,
|
|
254
|
+
rawResponse: _response.rawResponse,
|
|
234
255
|
});
|
|
235
256
|
}
|
|
236
257
|
});
|
|
@@ -247,12 +268,15 @@ class DocumentCollections {
|
|
|
247
268
|
* })
|
|
248
269
|
*/
|
|
249
270
|
deleteCollection(request, requestOptions) {
|
|
271
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCollection(request, requestOptions));
|
|
272
|
+
}
|
|
273
|
+
__deleteCollection(request, requestOptions) {
|
|
250
274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
275
|
var _a, _b, _c;
|
|
252
276
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
253
277
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/documentCollections/deleteCollection"),
|
|
254
278
|
method: "DELETE",
|
|
255
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
279
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
256
280
|
contentType: "application/json",
|
|
257
281
|
requestType: "json",
|
|
258
282
|
body: serializers.DeleteCollectionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -261,17 +285,21 @@ class DocumentCollections {
|
|
|
261
285
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
262
286
|
});
|
|
263
287
|
if (_response.ok) {
|
|
264
|
-
return
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
288
|
+
return {
|
|
289
|
+
data: serializers.DeleteCollectionResponse.parseOrThrow(_response.body, {
|
|
290
|
+
unrecognizedObjectKeys: "passthrough",
|
|
291
|
+
allowUnrecognizedUnionMembers: true,
|
|
292
|
+
allowUnrecognizedEnumValues: true,
|
|
293
|
+
breadcrumbsPrefix: ["response"],
|
|
294
|
+
}),
|
|
295
|
+
rawResponse: _response.rawResponse,
|
|
296
|
+
};
|
|
270
297
|
}
|
|
271
298
|
if (_response.error.reason === "status-code") {
|
|
272
299
|
throw new errors.CredalError({
|
|
273
300
|
statusCode: _response.error.statusCode,
|
|
274
301
|
body: _response.error.body,
|
|
302
|
+
rawResponse: _response.rawResponse,
|
|
275
303
|
});
|
|
276
304
|
}
|
|
277
305
|
switch (_response.error.reason) {
|
|
@@ -279,12 +307,14 @@ class DocumentCollections {
|
|
|
279
307
|
throw new errors.CredalError({
|
|
280
308
|
statusCode: _response.error.statusCode,
|
|
281
309
|
body: _response.error.rawBody,
|
|
310
|
+
rawResponse: _response.rawResponse,
|
|
282
311
|
});
|
|
283
312
|
case "timeout":
|
|
284
313
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling DELETE /v0/documentCollections/deleteCollection.");
|
|
285
314
|
case "unknown":
|
|
286
315
|
throw new errors.CredalError({
|
|
287
316
|
message: _response.error.errorMessage,
|
|
317
|
+
rawResponse: _response.rawResponse,
|
|
288
318
|
});
|
|
289
319
|
}
|
|
290
320
|
});
|
|
@@ -317,12 +347,15 @@ class DocumentCollections {
|
|
|
317
347
|
* })
|
|
318
348
|
*/
|
|
319
349
|
createMongoCollectionSync(request, requestOptions) {
|
|
350
|
+
return core.HttpResponsePromise.fromPromise(this.__createMongoCollectionSync(request, requestOptions));
|
|
351
|
+
}
|
|
352
|
+
__createMongoCollectionSync(request, requestOptions) {
|
|
320
353
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
354
|
var _a, _b, _c;
|
|
322
355
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
323
356
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/documentCollections/mongodb/createMongoSync"),
|
|
324
357
|
method: "POST",
|
|
325
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
358
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
326
359
|
contentType: "application/json",
|
|
327
360
|
requestType: "json",
|
|
328
361
|
body: serializers.CreateMongoCollectionSyncRequest.jsonOrThrow(request, {
|
|
@@ -333,17 +366,21 @@ class DocumentCollections {
|
|
|
333
366
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
334
367
|
});
|
|
335
368
|
if (_response.ok) {
|
|
336
|
-
return
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
369
|
+
return {
|
|
370
|
+
data: serializers.MongoCollectionSyncResponse.parseOrThrow(_response.body, {
|
|
371
|
+
unrecognizedObjectKeys: "passthrough",
|
|
372
|
+
allowUnrecognizedUnionMembers: true,
|
|
373
|
+
allowUnrecognizedEnumValues: true,
|
|
374
|
+
breadcrumbsPrefix: ["response"],
|
|
375
|
+
}),
|
|
376
|
+
rawResponse: _response.rawResponse,
|
|
377
|
+
};
|
|
342
378
|
}
|
|
343
379
|
if (_response.error.reason === "status-code") {
|
|
344
380
|
throw new errors.CredalError({
|
|
345
381
|
statusCode: _response.error.statusCode,
|
|
346
382
|
body: _response.error.body,
|
|
383
|
+
rawResponse: _response.rawResponse,
|
|
347
384
|
});
|
|
348
385
|
}
|
|
349
386
|
switch (_response.error.reason) {
|
|
@@ -351,12 +388,14 @@ class DocumentCollections {
|
|
|
351
388
|
throw new errors.CredalError({
|
|
352
389
|
statusCode: _response.error.statusCode,
|
|
353
390
|
body: _response.error.rawBody,
|
|
391
|
+
rawResponse: _response.rawResponse,
|
|
354
392
|
});
|
|
355
393
|
case "timeout":
|
|
356
394
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/documentCollections/mongodb/createMongoSync.");
|
|
357
395
|
case "unknown":
|
|
358
396
|
throw new errors.CredalError({
|
|
359
397
|
message: _response.error.errorMessage,
|
|
398
|
+
rawResponse: _response.rawResponse,
|
|
360
399
|
});
|
|
361
400
|
}
|
|
362
401
|
});
|
|
@@ -389,12 +428,15 @@ class DocumentCollections {
|
|
|
389
428
|
* })
|
|
390
429
|
*/
|
|
391
430
|
updateMongoCollectionSync(request, requestOptions) {
|
|
431
|
+
return core.HttpResponsePromise.fromPromise(this.__updateMongoCollectionSync(request, requestOptions));
|
|
432
|
+
}
|
|
433
|
+
__updateMongoCollectionSync(request, requestOptions) {
|
|
392
434
|
return __awaiter(this, void 0, void 0, function* () {
|
|
393
435
|
var _a, _b, _c;
|
|
394
436
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
395
437
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CredalEnvironment.Production, "/v0/documentCollections/mongodb/updateMongoSync"),
|
|
396
438
|
method: "POST",
|
|
397
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.
|
|
439
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@credal/sdk", "X-Fern-SDK-Version": "0.0.29", "User-Agent": "@credal/sdk/0.0.29", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
398
440
|
contentType: "application/json",
|
|
399
441
|
requestType: "json",
|
|
400
442
|
body: serializers.UpdateMongoCollectionSyncRequest.jsonOrThrow(request, {
|
|
@@ -405,17 +447,21 @@ class DocumentCollections {
|
|
|
405
447
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
406
448
|
});
|
|
407
449
|
if (_response.ok) {
|
|
408
|
-
return
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
450
|
+
return {
|
|
451
|
+
data: serializers.MongoCollectionSyncResponse.parseOrThrow(_response.body, {
|
|
452
|
+
unrecognizedObjectKeys: "passthrough",
|
|
453
|
+
allowUnrecognizedUnionMembers: true,
|
|
454
|
+
allowUnrecognizedEnumValues: true,
|
|
455
|
+
breadcrumbsPrefix: ["response"],
|
|
456
|
+
}),
|
|
457
|
+
rawResponse: _response.rawResponse,
|
|
458
|
+
};
|
|
414
459
|
}
|
|
415
460
|
if (_response.error.reason === "status-code") {
|
|
416
461
|
throw new errors.CredalError({
|
|
417
462
|
statusCode: _response.error.statusCode,
|
|
418
463
|
body: _response.error.body,
|
|
464
|
+
rawResponse: _response.rawResponse,
|
|
419
465
|
});
|
|
420
466
|
}
|
|
421
467
|
switch (_response.error.reason) {
|
|
@@ -423,12 +469,14 @@ class DocumentCollections {
|
|
|
423
469
|
throw new errors.CredalError({
|
|
424
470
|
statusCode: _response.error.statusCode,
|
|
425
471
|
body: _response.error.rawBody,
|
|
472
|
+
rawResponse: _response.rawResponse,
|
|
426
473
|
});
|
|
427
474
|
case "timeout":
|
|
428
475
|
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/documentCollections/mongodb/updateMongoSync.");
|
|
429
476
|
case "unknown":
|
|
430
477
|
throw new errors.CredalError({
|
|
431
478
|
message: _response.error.errorMessage,
|
|
479
|
+
rawResponse: _response.rawResponse,
|
|
432
480
|
});
|
|
433
481
|
}
|
|
434
482
|
});
|
|
@@ -42,7 +42,8 @@ export declare class PermissionsService {
|
|
|
42
42
|
* userEmail: "john.smith@foo.com"
|
|
43
43
|
* })
|
|
44
44
|
*/
|
|
45
|
-
checkResourceAuthorizationForUser(request: Credal.CheckResourceAuthorizationForUserRequest, requestOptions?: PermissionsService.RequestOptions):
|
|
45
|
+
checkResourceAuthorizationForUser(request: Credal.CheckResourceAuthorizationForUserRequest, requestOptions?: PermissionsService.RequestOptions): core.HttpResponsePromise<Credal.CheckResourceAuthorizationResponse>;
|
|
46
|
+
private __checkResourceAuthorizationForUser;
|
|
46
47
|
/**
|
|
47
48
|
* Admin endpoint to check whether the specified user is authorized to read the specified set of resources.
|
|
48
49
|
*
|
|
@@ -62,7 +63,8 @@ export declare class PermissionsService {
|
|
|
62
63
|
* userEmail: "john.smith@foo.com"
|
|
63
64
|
* })
|
|
64
65
|
*/
|
|
65
|
-
checkBulkResourcesAuthorizationForUser(request: Credal.CheckBulkResourcesAuthorizationForUserRequest, requestOptions?: PermissionsService.RequestOptions):
|
|
66
|
+
checkBulkResourcesAuthorizationForUser(request: Credal.CheckBulkResourcesAuthorizationForUserRequest, requestOptions?: PermissionsService.RequestOptions): core.HttpResponsePromise<Credal.CheckBulkResourcesAuthorizationResponse>;
|
|
67
|
+
private __checkBulkResourcesAuthorizationForUser;
|
|
66
68
|
/**
|
|
67
69
|
* Admin endpoint to list all resources that the specified user is authorized to read. Note this endpoint returns cached results and may not be up-to-date. You can use the checkResourceAuthorizationForUser endpoint with disableCache set to true to get the most up-to-date results.
|
|
68
70
|
*
|
|
@@ -74,6 +76,7 @@ export declare class PermissionsService {
|
|
|
74
76
|
* userEmail: "john.smith@foo.com"
|
|
75
77
|
* })
|
|
76
78
|
*/
|
|
77
|
-
listCachedAuthorizedResourcesForUser(request: Credal.ListCachedAuthorizedResourcesForUserRequest, requestOptions?: PermissionsService.RequestOptions):
|
|
79
|
+
listCachedAuthorizedResourcesForUser(request: Credal.ListCachedAuthorizedResourcesForUserRequest, requestOptions?: PermissionsService.RequestOptions): core.HttpResponsePromise<Credal.AuthorizedResourceListPage>;
|
|
80
|
+
private __listCachedAuthorizedResourcesForUser;
|
|
78
81
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
79
82
|
}
|