@credal/sdk 0.1.1 → 0.1.2

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.
Files changed (28) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +13 -0
  3. package/dist/cjs/api/resources/documentCollections/client/Client.js +59 -0
  4. package/dist/cjs/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.ts +15 -0
  5. package/dist/cjs/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.js +5 -0
  6. package/dist/cjs/api/resources/documentCollections/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.d.ts +7 -0
  8. package/dist/cjs/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.js +5 -0
  9. package/dist/cjs/api/resources/documentCollections/types/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/documentCollections/types/index.js +1 -0
  11. package/dist/cjs/core/fetcher/index.d.ts +1 -1
  12. package/dist/cjs/version.d.ts +1 -1
  13. package/dist/cjs/version.js +1 -1
  14. package/dist/esm/Client.mjs +2 -2
  15. package/dist/esm/api/resources/documentCollections/client/Client.d.mts +13 -0
  16. package/dist/esm/api/resources/documentCollections/client/Client.mjs +59 -0
  17. package/dist/esm/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.mts +15 -0
  18. package/dist/esm/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.mjs +4 -0
  19. package/dist/esm/api/resources/documentCollections/client/requests/index.d.mts +1 -0
  20. package/dist/esm/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.d.mts +7 -0
  21. package/dist/esm/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.mjs +4 -0
  22. package/dist/esm/api/resources/documentCollections/types/index.d.mts +1 -0
  23. package/dist/esm/api/resources/documentCollections/types/index.mjs +1 -0
  24. package/dist/esm/core/fetcher/index.d.mts +1 -1
  25. package/dist/esm/version.d.mts +1 -1
  26. package/dist/esm/version.mjs +1 -1
  27. package/package.json +1 -1
  28. package/reference.md +65 -0
@@ -50,8 +50,8 @@ class CredalClient {
50
50
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
51
51
  "X-Fern-Language": "JavaScript",
52
52
  "X-Fern-SDK-Name": "@credal/sdk",
53
- "X-Fern-SDK-Version": "0.1.1",
54
- "User-Agent": "@credal/sdk/0.1.1",
53
+ "X-Fern-SDK-Version": "0.1.2",
54
+ "User-Agent": "@credal/sdk/0.1.2",
55
55
  "X-Fern-Runtime": core.RUNTIME.type,
56
56
  "X-Fern-Runtime-Version": core.RUNTIME.version,
57
57
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -74,6 +74,19 @@ export declare class DocumentCollections {
74
74
  */
75
75
  removeDocumentsFromCollection(request: Credal.RemoveDocumentsFromCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<void>;
76
76
  private __removeDocumentsFromCollection;
77
+ /**
78
+ * List documents in a collection
79
+ *
80
+ * @param {Credal.ListDocumentsInCollectionRequest} request
81
+ * @param {DocumentCollections.RequestOptions} requestOptions - Request-specific configuration.
82
+ *
83
+ * @example
84
+ * await client.documentCollections.listDocumentsInCollection({
85
+ * collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
86
+ * })
87
+ */
88
+ listDocumentsInCollection(request: Credal.ListDocumentsInCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<Credal.ListDocumentsInCollectionResponse>;
89
+ private __listDocumentsInCollection;
77
90
  /**
78
91
  * Create a new collection. The API key used will be added to the collection for future Requests
79
92
  *
@@ -184,6 +184,65 @@ class DocumentCollections {
184
184
  }
185
185
  });
186
186
  }
187
+ /**
188
+ * List documents in a collection
189
+ *
190
+ * @param {Credal.ListDocumentsInCollectionRequest} request
191
+ * @param {DocumentCollections.RequestOptions} requestOptions - Request-specific configuration.
192
+ *
193
+ * @example
194
+ * await client.documentCollections.listDocumentsInCollection({
195
+ * collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
196
+ * })
197
+ */
198
+ listDocumentsInCollection(request, requestOptions) {
199
+ return core.HttpResponsePromise.fromPromise(this.__listDocumentsInCollection(request, requestOptions));
200
+ }
201
+ __listDocumentsInCollection(request, requestOptions) {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ var _a, _b, _c, _d;
204
+ const { collectionId } = request;
205
+ const _queryParams = {};
206
+ _queryParams["collectionId"] = collectionId;
207
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
208
+ url: core.url.join((_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/listDocumentsInCollection"),
209
+ method: "GET",
210
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
211
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
212
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
213
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
214
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
215
+ });
216
+ if (_response.ok) {
217
+ return {
218
+ data: _response.body,
219
+ rawResponse: _response.rawResponse,
220
+ };
221
+ }
222
+ if (_response.error.reason === "status-code") {
223
+ throw new errors.CredalError({
224
+ statusCode: _response.error.statusCode,
225
+ body: _response.error.body,
226
+ rawResponse: _response.rawResponse,
227
+ });
228
+ }
229
+ switch (_response.error.reason) {
230
+ case "non-json":
231
+ throw new errors.CredalError({
232
+ statusCode: _response.error.statusCode,
233
+ body: _response.error.rawBody,
234
+ rawResponse: _response.rawResponse,
235
+ });
236
+ case "timeout":
237
+ throw new errors.CredalTimeoutError("Timeout exceeded when calling GET /v0/documentCollections/listDocumentsInCollection.");
238
+ case "unknown":
239
+ throw new errors.CredalError({
240
+ message: _response.error.errorMessage,
241
+ rawResponse: _response.rawResponse,
242
+ });
243
+ }
244
+ });
245
+ }
187
246
  /**
188
247
  * Create a new collection. The API key used will be added to the collection for future Requests
189
248
  *
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
8
+ * }
9
+ */
10
+ export interface ListDocumentsInCollectionRequest {
11
+ /**
12
+ * The ID of the document collection to list documents from.
13
+ */
14
+ collectionId: string;
15
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  export { type AddDocumentsToCollectionRequest } from "./AddDocumentsToCollectionRequest.js";
2
2
  export { type RemoveDocumentsFromCollectionRequest } from "./RemoveDocumentsFromCollectionRequest.js";
3
+ export { type ListDocumentsInCollectionRequest } from "./ListDocumentsInCollectionRequest.js";
3
4
  export { type CreateCollectionRequest } from "./CreateCollectionRequest.js";
4
5
  export { type DeleteCollectionRequest } from "./DeleteCollectionRequest.js";
5
6
  export { type CreateMongoCollectionSyncRequest } from "./CreateMongoCollectionSyncRequest.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Credal from "../../../index.js";
5
+ export interface ListDocumentsInCollectionResponse {
6
+ resourceIdentifiers: Credal.ResourceIdentifier[];
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  export * from "./CreateCollectionResponse.js";
2
2
  export * from "./DeleteCollectionResponse.js";
3
+ export * from "./ListDocumentsInCollectionResponse.js";
3
4
  export * from "./MongoSourceFieldsConfig.js";
4
5
  export * from "./MongoCollectionSyncConfig.js";
5
6
  export * from "./MongoCollectionSyncResponse.js";
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CreateCollectionResponse.js"), exports);
18
18
  __exportStar(require("./DeleteCollectionResponse.js"), exports);
19
+ __exportStar(require("./ListDocumentsInCollectionResponse.js"), exports);
19
20
  __exportStar(require("./MongoSourceFieldsConfig.js"), exports);
20
21
  __exportStar(require("./MongoCollectionSyncConfig.js"), exports);
21
22
  __exportStar(require("./MongoCollectionSyncResponse.js"), exports);
@@ -6,4 +6,4 @@ export { Supplier } from "./Supplier.js";
6
6
  export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
7
7
  export type { RawResponse, WithRawResponse } from "./RawResponse.js";
8
8
  export { HttpResponsePromise } from "./HttpResponsePromise.js";
9
- export { BinaryResponse } from "./BinaryResponse.js";
9
+ export type { BinaryResponse } from "./BinaryResponse.js";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.1";
1
+ export declare const SDK_VERSION = "0.1.2";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.1";
4
+ exports.SDK_VERSION = "0.1.2";
@@ -14,8 +14,8 @@ export class CredalClient {
14
14
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
15
15
  "X-Fern-Language": "JavaScript",
16
16
  "X-Fern-SDK-Name": "@credal/sdk",
17
- "X-Fern-SDK-Version": "0.1.1",
18
- "User-Agent": "@credal/sdk/0.1.1",
17
+ "X-Fern-SDK-Version": "0.1.2",
18
+ "User-Agent": "@credal/sdk/0.1.2",
19
19
  "X-Fern-Runtime": core.RUNTIME.type,
20
20
  "X-Fern-Runtime-Version": core.RUNTIME.version,
21
21
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -74,6 +74,19 @@ export declare class DocumentCollections {
74
74
  */
75
75
  removeDocumentsFromCollection(request: Credal.RemoveDocumentsFromCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<void>;
76
76
  private __removeDocumentsFromCollection;
77
+ /**
78
+ * List documents in a collection
79
+ *
80
+ * @param {Credal.ListDocumentsInCollectionRequest} request
81
+ * @param {DocumentCollections.RequestOptions} requestOptions - Request-specific configuration.
82
+ *
83
+ * @example
84
+ * await client.documentCollections.listDocumentsInCollection({
85
+ * collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
86
+ * })
87
+ */
88
+ listDocumentsInCollection(request: Credal.ListDocumentsInCollectionRequest, requestOptions?: DocumentCollections.RequestOptions): core.HttpResponsePromise<Credal.ListDocumentsInCollectionResponse>;
89
+ private __listDocumentsInCollection;
77
90
  /**
78
91
  * Create a new collection. The API key used will be added to the collection for future Requests
79
92
  *
@@ -148,6 +148,65 @@ export class DocumentCollections {
148
148
  }
149
149
  });
150
150
  }
151
+ /**
152
+ * List documents in a collection
153
+ *
154
+ * @param {Credal.ListDocumentsInCollectionRequest} request
155
+ * @param {DocumentCollections.RequestOptions} requestOptions - Request-specific configuration.
156
+ *
157
+ * @example
158
+ * await client.documentCollections.listDocumentsInCollection({
159
+ * collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
160
+ * })
161
+ */
162
+ listDocumentsInCollection(request, requestOptions) {
163
+ return core.HttpResponsePromise.fromPromise(this.__listDocumentsInCollection(request, requestOptions));
164
+ }
165
+ __listDocumentsInCollection(request, requestOptions) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ var _a, _b, _c, _d;
168
+ const { collectionId } = request;
169
+ const _queryParams = {};
170
+ _queryParams["collectionId"] = collectionId;
171
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
172
+ url: core.url.join((_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/listDocumentsInCollection"),
173
+ method: "GET",
174
+ headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
175
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
176
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
177
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
178
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
179
+ });
180
+ if (_response.ok) {
181
+ return {
182
+ data: _response.body,
183
+ rawResponse: _response.rawResponse,
184
+ };
185
+ }
186
+ if (_response.error.reason === "status-code") {
187
+ throw new errors.CredalError({
188
+ statusCode: _response.error.statusCode,
189
+ body: _response.error.body,
190
+ rawResponse: _response.rawResponse,
191
+ });
192
+ }
193
+ switch (_response.error.reason) {
194
+ case "non-json":
195
+ throw new errors.CredalError({
196
+ statusCode: _response.error.statusCode,
197
+ body: _response.error.rawBody,
198
+ rawResponse: _response.rawResponse,
199
+ });
200
+ case "timeout":
201
+ throw new errors.CredalTimeoutError("Timeout exceeded when calling GET /v0/documentCollections/listDocumentsInCollection.");
202
+ case "unknown":
203
+ throw new errors.CredalError({
204
+ message: _response.error.errorMessage,
205
+ rawResponse: _response.rawResponse,
206
+ });
207
+ }
208
+ });
209
+ }
151
210
  /**
152
211
  * Create a new collection. The API key used will be added to the collection for future Requests
153
212
  *
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
8
+ * }
9
+ */
10
+ export interface ListDocumentsInCollectionRequest {
11
+ /**
12
+ * The ID of the document collection to list documents from.
13
+ */
14
+ collectionId: string;
15
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -1,5 +1,6 @@
1
1
  export { type AddDocumentsToCollectionRequest } from "./AddDocumentsToCollectionRequest.mjs";
2
2
  export { type RemoveDocumentsFromCollectionRequest } from "./RemoveDocumentsFromCollectionRequest.mjs";
3
+ export { type ListDocumentsInCollectionRequest } from "./ListDocumentsInCollectionRequest.mjs";
3
4
  export { type CreateCollectionRequest } from "./CreateCollectionRequest.mjs";
4
5
  export { type DeleteCollectionRequest } from "./DeleteCollectionRequest.mjs";
5
6
  export { type CreateMongoCollectionSyncRequest } from "./CreateMongoCollectionSyncRequest.mjs";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Credal from "../../../index.mjs";
5
+ export interface ListDocumentsInCollectionResponse {
6
+ resourceIdentifiers: Credal.ResourceIdentifier[];
7
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -1,5 +1,6 @@
1
1
  export * from "./CreateCollectionResponse.mjs";
2
2
  export * from "./DeleteCollectionResponse.mjs";
3
+ export * from "./ListDocumentsInCollectionResponse.mjs";
3
4
  export * from "./MongoSourceFieldsConfig.mjs";
4
5
  export * from "./MongoCollectionSyncConfig.mjs";
5
6
  export * from "./MongoCollectionSyncResponse.mjs";
@@ -1,5 +1,6 @@
1
1
  export * from "./CreateCollectionResponse.mjs";
2
2
  export * from "./DeleteCollectionResponse.mjs";
3
+ export * from "./ListDocumentsInCollectionResponse.mjs";
3
4
  export * from "./MongoSourceFieldsConfig.mjs";
4
5
  export * from "./MongoCollectionSyncConfig.mjs";
5
6
  export * from "./MongoCollectionSyncResponse.mjs";
@@ -6,4 +6,4 @@ export { Supplier } from "./Supplier.mjs";
6
6
  export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
7
7
  export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
8
8
  export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
9
- export { BinaryResponse } from "./BinaryResponse.mjs";
9
+ export type { BinaryResponse } from "./BinaryResponse.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.1";
1
+ export declare const SDK_VERSION = "0.1.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.1.1";
1
+ export const SDK_VERSION = "0.1.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "repository": "github:credal-ai/credal-typescript-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -962,6 +962,71 @@ await client.documentCollections.removeDocumentsFromCollection({
962
962
  </dl>
963
963
  </details>
964
964
 
965
+ <details><summary><code>client.documentCollections.<a href="/src/api/resources/documentCollections/client/Client.ts">listDocumentsInCollection</a>({ ...params }) -> Credal.ListDocumentsInCollectionResponse</code></summary>
966
+ <dl>
967
+ <dd>
968
+
969
+ #### 📝 Description
970
+
971
+ <dl>
972
+ <dd>
973
+
974
+ <dl>
975
+ <dd>
976
+
977
+ List documents in a collection
978
+
979
+ </dd>
980
+ </dl>
981
+ </dd>
982
+ </dl>
983
+
984
+ #### 🔌 Usage
985
+
986
+ <dl>
987
+ <dd>
988
+
989
+ <dl>
990
+ <dd>
991
+
992
+ ```typescript
993
+ await client.documentCollections.listDocumentsInCollection({
994
+ collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
995
+ });
996
+ ```
997
+
998
+ </dd>
999
+ </dl>
1000
+ </dd>
1001
+ </dl>
1002
+
1003
+ #### ⚙️ Parameters
1004
+
1005
+ <dl>
1006
+ <dd>
1007
+
1008
+ <dl>
1009
+ <dd>
1010
+
1011
+ **request:** `Credal.ListDocumentsInCollectionRequest`
1012
+
1013
+ </dd>
1014
+ </dl>
1015
+
1016
+ <dl>
1017
+ <dd>
1018
+
1019
+ **requestOptions:** `DocumentCollections.RequestOptions`
1020
+
1021
+ </dd>
1022
+ </dl>
1023
+ </dd>
1024
+ </dl>
1025
+
1026
+ </dd>
1027
+ </dl>
1028
+ </details>
1029
+
965
1030
  <details><summary><code>client.documentCollections.<a href="/src/api/resources/documentCollections/client/Client.ts">createCollection</a>({ ...params }) -> Credal.CreateCollectionResponse</code></summary>
966
1031
  <dl>
967
1032
  <dd>