Skip to content

Commit ce296a1

Browse files
committed
SDK regeneration
1 parent e86c36f commit ce296a1

File tree

15 files changed

+276
-50
lines changed

15 files changed

+276
-50
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@credal/sdk",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"private": false,
55
"repository": "github:credal-ai/credal-typescript-sdk",
66
"type": "commonjs",

reference.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,71 @@ await client.documentCollections.removeDocumentsFromCollection({
962962
</dl>
963963
</details>
964964

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+
9651030
<details><summary><code>client.documentCollections.<a href="/src/api/resources/documentCollections/client/Client.ts">createCollection</a>({ ...params }) -> Credal.CreateCollectionResponse</code></summary>
9661031
<dl>
9671032
<dd>

src/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export class CredalClient {
5353
{
5454
"X-Fern-Language": "JavaScript",
5555
"X-Fern-SDK-Name": "@credal/sdk",
56-
"X-Fern-SDK-Version": "0.1.1",
57-
"User-Agent": "@credal/sdk/0.1.1",
56+
"X-Fern-SDK-Version": "0.1.2",
57+
"User-Agent": "@credal/sdk/0.1.2",
5858
"X-Fern-Runtime": core.RUNTIME.type,
5959
"X-Fern-Runtime-Version": core.RUNTIME.version,
6060
},

src/api/resources/documentCollections/client/Client.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,83 @@ export class DocumentCollections {
206206
}
207207
}
208208

209+
/**
210+
* List documents in a collection
211+
*
212+
* @param {Credal.ListDocumentsInCollectionRequest} request
213+
* @param {DocumentCollections.RequestOptions} requestOptions - Request-specific configuration.
214+
*
215+
* @example
216+
* await client.documentCollections.listDocumentsInCollection({
217+
* collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
218+
* })
219+
*/
220+
public listDocumentsInCollection(
221+
request: Credal.ListDocumentsInCollectionRequest,
222+
requestOptions?: DocumentCollections.RequestOptions,
223+
): core.HttpResponsePromise<Credal.ListDocumentsInCollectionResponse> {
224+
return core.HttpResponsePromise.fromPromise(this.__listDocumentsInCollection(request, requestOptions));
225+
}
226+
227+
private async __listDocumentsInCollection(
228+
request: Credal.ListDocumentsInCollectionRequest,
229+
requestOptions?: DocumentCollections.RequestOptions,
230+
): Promise<core.WithRawResponse<Credal.ListDocumentsInCollectionResponse>> {
231+
const { collectionId } = request;
232+
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
233+
_queryParams["collectionId"] = collectionId;
234+
const _response = await (this._options.fetcher ?? core.fetcher)({
235+
url: core.url.join(
236+
(await core.Supplier.get(this._options.baseUrl)) ??
237+
(await core.Supplier.get(this._options.environment)) ??
238+
environments.CredalEnvironment.Production,
239+
"/v0/documentCollections/listDocumentsInCollection",
240+
),
241+
method: "GET",
242+
headers: mergeHeaders(
243+
this._options?.headers,
244+
mergeOnlyDefinedHeaders({ Authorization: await this._getAuthorizationHeader() }),
245+
requestOptions?.headers,
246+
),
247+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
248+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
249+
maxRetries: requestOptions?.maxRetries,
250+
abortSignal: requestOptions?.abortSignal,
251+
});
252+
if (_response.ok) {
253+
return {
254+
data: _response.body as Credal.ListDocumentsInCollectionResponse,
255+
rawResponse: _response.rawResponse,
256+
};
257+
}
258+
259+
if (_response.error.reason === "status-code") {
260+
throw new errors.CredalError({
261+
statusCode: _response.error.statusCode,
262+
body: _response.error.body,
263+
rawResponse: _response.rawResponse,
264+
});
265+
}
266+
267+
switch (_response.error.reason) {
268+
case "non-json":
269+
throw new errors.CredalError({
270+
statusCode: _response.error.statusCode,
271+
body: _response.error.rawBody,
272+
rawResponse: _response.rawResponse,
273+
});
274+
case "timeout":
275+
throw new errors.CredalTimeoutError(
276+
"Timeout exceeded when calling GET /v0/documentCollections/listDocumentsInCollection.",
277+
);
278+
case "unknown":
279+
throw new errors.CredalError({
280+
message: _response.error.errorMessage,
281+
rawResponse: _response.rawResponse,
282+
});
283+
}
284+
}
285+
209286
/**
210287
* Create a new collection. The API key used will be added to the collection for future Requests
211288
*
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
/**
6+
* @example
7+
* {
8+
* collectionId: "82e4b12a-6990-45d4-8ebd-85c00e030c24"
9+
* }
10+
*/
11+
export interface ListDocumentsInCollectionRequest {
12+
/**
13+
* The ID of the document collection to list documents from.
14+
*/
15+
collectionId: string;
16+
}

src/api/resources/documentCollections/client/requests/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export { type AddDocumentsToCollectionRequest } from "./AddDocumentsToCollectionRequest.js";
22
export { type RemoveDocumentsFromCollectionRequest } from "./RemoveDocumentsFromCollectionRequest.js";
3+
export { type ListDocumentsInCollectionRequest } from "./ListDocumentsInCollectionRequest.js";
34
export { type CreateCollectionRequest } from "./CreateCollectionRequest.js";
45
export { type DeleteCollectionRequest } from "./DeleteCollectionRequest.js";
56
export { type CreateMongoCollectionSyncRequest } from "./CreateMongoCollectionSyncRequest.js";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as Credal from "../../../index.js";
6+
7+
export interface ListDocumentsInCollectionResponse {
8+
resourceIdentifiers: Credal.ResourceIdentifier[];
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from "./CreateCollectionResponse.js";
22
export * from "./DeleteCollectionResponse.js";
3+
export * from "./ListDocumentsInCollectionResponse.js";
34
export * from "./MongoSourceFieldsConfig.js";
45
export * from "./MongoCollectionSyncConfig.js";
56
export * from "./MongoCollectionSyncResponse.js";

src/core/fetcher/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export { Supplier } from "./Supplier.js";
66
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
77
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
88
export { HttpResponsePromise } from "./HttpResponsePromise.js";
9-
export { BinaryResponse } from "./BinaryResponse.js";
9+
export type { BinaryResponse } from "./BinaryResponse.js";

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const SDK_VERSION = "0.1.1";
1+
export const SDK_VERSION = "0.1.2";

0 commit comments

Comments
 (0)