@credal/sdk 0.1.0 → 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 (40) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/copilots/types/ResponseChunk.d.ts +1 -0
  3. package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +1 -1
  4. package/dist/cjs/api/resources/documentCatalog/client/Client.js +1 -1
  5. package/dist/cjs/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +2 -2
  6. package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +15 -2
  7. package/dist/cjs/api/resources/documentCollections/client/Client.js +61 -2
  8. package/dist/cjs/api/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.d.ts +1 -1
  9. package/dist/cjs/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.ts +15 -0
  10. package/dist/cjs/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.js +5 -0
  11. package/dist/cjs/api/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.d.ts +1 -1
  12. package/dist/cjs/api/resources/documentCollections/client/requests/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.d.ts +7 -0
  14. package/dist/cjs/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.js +5 -0
  15. package/dist/cjs/api/resources/documentCollections/types/index.d.ts +1 -0
  16. package/dist/cjs/api/resources/documentCollections/types/index.js +1 -0
  17. package/dist/cjs/core/fetcher/index.d.ts +1 -1
  18. package/dist/cjs/version.d.ts +1 -1
  19. package/dist/cjs/version.js +1 -1
  20. package/dist/esm/Client.mjs +2 -2
  21. package/dist/esm/api/resources/copilots/types/ResponseChunk.d.mts +1 -0
  22. package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +1 -1
  23. package/dist/esm/api/resources/documentCatalog/client/Client.mjs +1 -1
  24. package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.mts +2 -2
  25. package/dist/esm/api/resources/documentCollections/client/Client.d.mts +15 -2
  26. package/dist/esm/api/resources/documentCollections/client/Client.mjs +61 -2
  27. package/dist/esm/api/resources/documentCollections/client/requests/CreateMongoCollectionSyncRequest.d.mts +1 -1
  28. package/dist/esm/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.d.mts +15 -0
  29. package/dist/esm/api/resources/documentCollections/client/requests/ListDocumentsInCollectionRequest.mjs +4 -0
  30. package/dist/esm/api/resources/documentCollections/client/requests/UpdateMongoCollectionSyncRequest.d.mts +1 -1
  31. package/dist/esm/api/resources/documentCollections/client/requests/index.d.mts +1 -0
  32. package/dist/esm/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.d.mts +7 -0
  33. package/dist/esm/api/resources/documentCollections/types/ListDocumentsInCollectionResponse.mjs +4 -0
  34. package/dist/esm/api/resources/documentCollections/types/index.d.mts +1 -0
  35. package/dist/esm/api/resources/documentCollections/types/index.mjs +1 -0
  36. package/dist/esm/core/fetcher/index.d.mts +1 -1
  37. package/dist/esm/version.d.mts +1 -1
  38. package/dist/esm/version.mjs +1 -1
  39. package/package.json +1 -1
  40. package/reference.md +68 -4
@@ -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.0",
54
- "User-Agent": "@credal/sdk/0.1.0",
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) });
@@ -4,4 +4,5 @@
4
4
  export interface ResponseChunk {
5
5
  message: string;
6
6
  dataChunk: string;
7
+ structuredOutput?: unknown;
7
8
  }
@@ -37,7 +37,7 @@ export declare class DocumentCatalog {
37
37
  * @example
38
38
  * await client.documentCatalog.uploadDocumentContents({
39
39
  * documentName: "My Document",
40
- * documentContents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
40
+ * documentContents: "Lorem ipsum...",
41
41
  * documentExternalId: "73eead26-d124-4940-b329-5f068a0a8db9",
42
42
  * allowedUsersEmailAddresses: ["jack@credal.ai", "ravin@credal.ai"],
43
43
  * uploadAsUserEmail: "jack@credal.ai"
@@ -61,7 +61,7 @@ class DocumentCatalog {
61
61
  * @example
62
62
  * await client.documentCatalog.uploadDocumentContents({
63
63
  * documentName: "My Document",
64
- * documentContents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
64
+ * documentContents: "Lorem ipsum...",
65
65
  * documentExternalId: "73eead26-d124-4940-b329-5f068a0a8db9",
66
66
  * allowedUsersEmailAddresses: ["jack@credal.ai", "ravin@credal.ai"],
67
67
  * uploadAsUserEmail: "jack@credal.ai"
@@ -5,7 +5,7 @@
5
5
  * @example
6
6
  * {
7
7
  * documentName: "My Document",
8
- * documentContents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
8
+ * documentContents: "Lorem ipsum...",
9
9
  * documentExternalId: "73eead26-d124-4940-b329-5f068a0a8db9",
10
10
  * allowedUsersEmailAddresses: ["jack@credal.ai", "ravin@credal.ai"],
11
11
  * uploadAsUserEmail: "jack@credal.ai"
@@ -24,7 +24,7 @@ export interface UploadDocumentContentsRequest {
24
24
  documentExternalId: string;
25
25
  /** The external URL of the document you want to upload. If provided Credal will link to this URL. */
26
26
  documentExternalUrl?: string;
27
- /** Optional JSON representing any custom metdata for this document */
27
+ /** Optional JSON representing any custom metadata for this document */
28
28
  customMetadata?: unknown;
29
29
  /** If specified, document will also be added to a particular document collection */
30
30
  collectionId?: string;
@@ -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
  *
@@ -113,7 +126,7 @@ export declare class DocumentCollections {
113
126
  *
114
127
  * @example
115
128
  * await client.documentCollections.createMongoCollectionSync({
116
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
129
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
117
130
  * collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a",
118
131
  * config: {
119
132
  * syncName: "My sales transcripts",
@@ -142,7 +155,7 @@ export declare class DocumentCollections {
142
155
  *
143
156
  * @example
144
157
  * await client.documentCollections.updateMongoCollectionSync({
145
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
158
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
146
159
  * mongoCredentialId: "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc",
147
160
  * config: {
148
161
  * syncName: "My recent summarized sales transcripts",
@@ -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
  *
@@ -309,7 +368,7 @@ class DocumentCollections {
309
368
  *
310
369
  * @example
311
370
  * await client.documentCollections.createMongoCollectionSync({
312
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
371
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
313
372
  * collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a",
314
373
  * config: {
315
374
  * syncName: "My sales transcripts",
@@ -381,7 +440,7 @@ class DocumentCollections {
381
440
  *
382
441
  * @example
383
442
  * await client.documentCollections.updateMongoCollectionSync({
384
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
443
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
385
444
  * mongoCredentialId: "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc",
386
445
  * config: {
387
446
  * syncName: "My recent summarized sales transcripts",
@@ -5,7 +5,7 @@ import * as Credal from "../../../../index.js";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
8
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
9
9
  * collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a",
10
10
  * config: {
11
11
  * syncName: "My sales transcripts",
@@ -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 });
@@ -5,7 +5,7 @@ import * as Credal from "../../../../index.js";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
8
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
9
9
  * mongoCredentialId: "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc",
10
10
  * config: {
11
11
  * syncName: "My recent summarized sales transcripts",
@@ -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.0";
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.0";
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.0",
18
- "User-Agent": "@credal/sdk/0.1.0",
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) });
@@ -4,4 +4,5 @@
4
4
  export interface ResponseChunk {
5
5
  message: string;
6
6
  dataChunk: string;
7
+ structuredOutput?: unknown;
7
8
  }
@@ -37,7 +37,7 @@ export declare class DocumentCatalog {
37
37
  * @example
38
38
  * await client.documentCatalog.uploadDocumentContents({
39
39
  * documentName: "My Document",
40
- * documentContents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
40
+ * documentContents: "Lorem ipsum...",
41
41
  * documentExternalId: "73eead26-d124-4940-b329-5f068a0a8db9",
42
42
  * allowedUsersEmailAddresses: ["jack@credal.ai", "ravin@credal.ai"],
43
43
  * uploadAsUserEmail: "jack@credal.ai"
@@ -25,7 +25,7 @@ export class DocumentCatalog {
25
25
  * @example
26
26
  * await client.documentCatalog.uploadDocumentContents({
27
27
  * documentName: "My Document",
28
- * documentContents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
28
+ * documentContents: "Lorem ipsum...",
29
29
  * documentExternalId: "73eead26-d124-4940-b329-5f068a0a8db9",
30
30
  * allowedUsersEmailAddresses: ["jack@credal.ai", "ravin@credal.ai"],
31
31
  * uploadAsUserEmail: "jack@credal.ai"
@@ -5,7 +5,7 @@
5
5
  * @example
6
6
  * {
7
7
  * documentName: "My Document",
8
- * documentContents: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
8
+ * documentContents: "Lorem ipsum...",
9
9
  * documentExternalId: "73eead26-d124-4940-b329-5f068a0a8db9",
10
10
  * allowedUsersEmailAddresses: ["jack@credal.ai", "ravin@credal.ai"],
11
11
  * uploadAsUserEmail: "jack@credal.ai"
@@ -24,7 +24,7 @@ export interface UploadDocumentContentsRequest {
24
24
  documentExternalId: string;
25
25
  /** The external URL of the document you want to upload. If provided Credal will link to this URL. */
26
26
  documentExternalUrl?: string;
27
- /** Optional JSON representing any custom metdata for this document */
27
+ /** Optional JSON representing any custom metadata for this document */
28
28
  customMetadata?: unknown;
29
29
  /** If specified, document will also be added to a particular document collection */
30
30
  collectionId?: string;
@@ -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
  *
@@ -113,7 +126,7 @@ export declare class DocumentCollections {
113
126
  *
114
127
  * @example
115
128
  * await client.documentCollections.createMongoCollectionSync({
116
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
129
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
117
130
  * collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a",
118
131
  * config: {
119
132
  * syncName: "My sales transcripts",
@@ -142,7 +155,7 @@ export declare class DocumentCollections {
142
155
  *
143
156
  * @example
144
157
  * await client.documentCollections.updateMongoCollectionSync({
145
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
158
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
146
159
  * mongoCredentialId: "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc",
147
160
  * config: {
148
161
  * syncName: "My recent summarized sales transcripts",
@@ -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
  *
@@ -273,7 +332,7 @@ export class DocumentCollections {
273
332
  *
274
333
  * @example
275
334
  * await client.documentCollections.createMongoCollectionSync({
276
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
335
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
277
336
  * collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a",
278
337
  * config: {
279
338
  * syncName: "My sales transcripts",
@@ -345,7 +404,7 @@ export class DocumentCollections {
345
404
  *
346
405
  * @example
347
406
  * await client.documentCollections.updateMongoCollectionSync({
348
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
407
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
349
408
  * mongoCredentialId: "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc",
350
409
  * config: {
351
410
  * syncName: "My recent summarized sales transcripts",
@@ -5,7 +5,7 @@ import * as Credal from "../../../../index.mjs";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
8
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
9
9
  * collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a",
10
10
  * config: {
11
11
  * syncName: "My sales transcripts",
@@ -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 {};
@@ -5,7 +5,7 @@ import * as Credal from "../../../../index.mjs";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
8
+ * mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
9
9
  * mongoCredentialId: "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc",
10
10
  * config: {
11
11
  * syncName: "My recent summarized sales transcripts",
@@ -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.0";
1
+ export declare const SDK_VERSION = "0.1.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.1.0";
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.0",
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
@@ -612,8 +612,7 @@ await client.copilots.deleteCopilot({
612
612
  ```typescript
613
613
  await client.documentCatalog.uploadDocumentContents({
614
614
  documentName: "My Document",
615
- documentContents:
616
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
615
+ documentContents: "Lorem ipsum...",
617
616
  documentExternalId: "73eead26-d124-4940-b329-5f068a0a8db9",
618
617
  allowedUsersEmailAddresses: ["jack@credal.ai", "ravin@credal.ai"],
619
618
  uploadAsUserEmail: "jack@credal.ai",
@@ -963,6 +962,71 @@ await client.documentCollections.removeDocumentsFromCollection({
963
962
  </dl>
964
963
  </details>
965
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
+
966
1030
  <details><summary><code>client.documentCollections.<a href="/src/api/resources/documentCollections/client/Client.ts">createCollection</a>({ ...params }) -> Credal.CreateCollectionResponse</code></summary>
967
1031
  <dl>
968
1032
  <dd>
@@ -1129,7 +1193,7 @@ Credal lets you easily sync your MongoDB data for use in Collections and Agents.
1129
1193
 
1130
1194
  ```typescript
1131
1195
  await client.documentCollections.createMongoCollectionSync({
1132
- mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
1196
+ mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
1133
1197
  collectionId: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a",
1134
1198
  config: {
1135
1199
  syncName: "My sales transcripts",
@@ -1210,7 +1274,7 @@ Credal lets you easily sync your MongoDB data for use in Collections and Agents.
1210
1274
 
1211
1275
  ```typescript
1212
1276
  await client.documentCollections.updateMongoCollectionSync({
1213
- mongoURI: "mongodb+srv://cluster0.hzwklqn.mongodb.net/Cluster0?retryWrites=true&w=majority",
1277
+ mongoURI: "mongodb+srv://cluster0.abcdefg.mongodb.net/Cluster0?retryWrites=true&w=majority",
1214
1278
  mongoCredentialId: "5988ed76-6ee1-11ef-97dd-1fca54b7c4bc",
1215
1279
  config: {
1216
1280
  syncName: "My recent summarized sales transcripts",