@truefoundry/trueforge-sdk 0.2.0-rc.6 → 0.2.0-rc.8

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/README.md CHANGED
@@ -18,6 +18,7 @@ When auth is enabled on the server, pass an ID token via the optional `token` cl
18
18
  - [Exception Handling](#exception-handling)
19
19
  - [Streaming Response](#streaming-response)
20
20
  - [Binary Response](#binary-response)
21
+ - [Pagination](#pagination)
21
22
  - [Advanced](#advanced)
22
23
  - [Subpackage Exports](#subpackage-exports)
23
24
  - [Additional Headers](#additional-headers)
@@ -497,6 +498,29 @@ const text = new TextDecoder().decode(bytes);
497
498
 
498
499
  </details>
499
500
 
501
+ ## Pagination
502
+
503
+ List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items:
504
+
505
+ ```typescript
506
+ import { TrueForge } from "@truefoundry/trueforge-sdk";
507
+
508
+ const client = new TrueForge({ baseUrl: "YOUR_BASE_URL", token: "YOUR_TOKEN" });
509
+ const pageableResponse = await client.agents.list();
510
+ for await (const item of pageableResponse) {
511
+ console.log(item);
512
+ }
513
+
514
+ // Or you can manually iterate page-by-page
515
+ let page = await client.agents.list();
516
+ while (page.hasNextPage()) {
517
+ page = page.getNextPage();
518
+ }
519
+
520
+ // You can also access the underlying response
521
+ const response = page.response;
522
+ ```
523
+
500
524
  ## Advanced
501
525
 
502
526
  ### Subpackage Exports
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@truefoundry/trueforge-sdk",
46
- "X-Fern-SDK-Version": "0.2.0-rc.6",
47
- "User-Agent": "@truefoundry/trueforge-sdk/0.2.0-rc.6",
46
+ "X-Fern-SDK-Version": "0.2.0-rc.8",
47
+ "User-Agent": "@truefoundry/trueforge-sdk/0.2.0-rc.8",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -11,7 +11,7 @@ export declare class AgentsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
12
12
  constructor(options: AgentsClient.Options);
13
13
  /**
14
- * TypeScript TrueForge SDK samples (stream and non-stream) for creating a session and turn against this agent.
14
+ * TrueForge SDK samples (TypeScript and Python, stream and non-stream) for a session and turn against this agent.
15
15
  *
16
16
  * @param {string} agent_id - Immutable agent identifier.
17
17
  * @param {TrueForge.internal.GetCodeSnippetsAgentsRequest} request
@@ -56,7 +56,7 @@ class AgentsClient {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
58
  /**
59
- * TypeScript TrueForge SDK samples (stream and non-stream) for creating a session and turn against this agent.
59
+ * TrueForge SDK samples (TypeScript and Python, stream and non-stream) for a session and turn against this agent.
60
60
  *
61
61
  * @param {string} agent_id - Immutable agent identifier.
62
62
  * @param {TrueForge.internal.GetCodeSnippetsAgentsRequest} request
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.0-rc.6";
1
+ export declare const SDK_VERSION = "0.2.0-rc.8";
@@ -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.2.0-rc.6";
4
+ exports.SDK_VERSION = "0.2.0-rc.8";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@truefoundry/trueforge-sdk",
9
- "X-Fern-SDK-Version": "0.2.0-rc.6",
10
- "User-Agent": "@truefoundry/trueforge-sdk/0.2.0-rc.6",
9
+ "X-Fern-SDK-Version": "0.2.0-rc.8",
10
+ "User-Agent": "@truefoundry/trueforge-sdk/0.2.0-rc.8",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -11,7 +11,7 @@ export declare class AgentsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
12
12
  constructor(options: AgentsClient.Options);
13
13
  /**
14
- * TypeScript TrueForge SDK samples (stream and non-stream) for creating a session and turn against this agent.
14
+ * TrueForge SDK samples (TypeScript and Python, stream and non-stream) for a session and turn against this agent.
15
15
  *
16
16
  * @param {string} agent_id - Immutable agent identifier.
17
17
  * @param {TrueForge.internal.GetCodeSnippetsAgentsRequest} request
@@ -20,7 +20,7 @@ export class AgentsClient {
20
20
  this._options = normalizeClientOptionsWithAuth(options);
21
21
  }
22
22
  /**
23
- * TypeScript TrueForge SDK samples (stream and non-stream) for creating a session and turn against this agent.
23
+ * TrueForge SDK samples (TypeScript and Python, stream and non-stream) for a session and turn against this agent.
24
24
  *
25
25
  * @param {string} agent_id - Immutable agent identifier.
26
26
  * @param {TrueForge.internal.GetCodeSnippetsAgentsRequest} request
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.0-rc.6";
1
+ export declare const SDK_VERSION = "0.2.0-rc.8";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.2.0-rc.6";
1
+ export const SDK_VERSION = "0.2.0-rc.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truefoundry/trueforge-sdk",
3
- "version": "0.2.0-rc.6",
3
+ "version": "0.2.0-rc.8",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "main": "./dist/cjs/index.js",
package/reference.md CHANGED
@@ -94,7 +94,19 @@ List configured agents for the tenant, ordered by name. Optional `agent_name` fi
94
94
  <dd>
95
95
 
96
96
  ```typescript
97
- await client.agents.list();
97
+ const pageableResponse = await client.agents.list();
98
+ for await (const item of pageableResponse) {
99
+ console.log(item);
100
+ }
101
+
102
+ // Or you can manually iterate page-by-page
103
+ let page = await client.agents.list();
104
+ while (page.hasNextPage()) {
105
+ page = page.getNextPage();
106
+ }
107
+
108
+ // You can also access the underlying response
109
+ const response = page.response;
98
110
 
99
111
  ```
100
112
  </dd>
@@ -916,7 +928,19 @@ List schedules for the tenant, newest first.
916
928
  <dd>
917
929
 
918
930
  ```typescript
919
- await client.schedules.list();
931
+ const pageableResponse = await client.schedules.list();
932
+ for await (const item of pageableResponse) {
933
+ console.log(item);
934
+ }
935
+
936
+ // Or you can manually iterate page-by-page
937
+ let page = await client.schedules.list();
938
+ while (page.hasNextPage()) {
939
+ page = page.getNextPage();
940
+ }
941
+
942
+ // You can also access the underlying response
943
+ const response = page.response;
920
944
 
921
945
  ```
922
946
  </dd>
@@ -1317,7 +1341,19 @@ List runs of a schedule, newest `scheduled_for` first. Available to its creator
1317
1341
  <dd>
1318
1342
 
1319
1343
  ```typescript
1320
- await client.schedules.listRuns("schedule_id");
1344
+ const pageableResponse = await client.schedules.listRuns("schedule_id");
1345
+ for await (const item of pageableResponse) {
1346
+ console.log(item);
1347
+ }
1348
+
1349
+ // Or you can manually iterate page-by-page
1350
+ let page = await client.schedules.listRuns("schedule_id");
1351
+ while (page.hasNextPage()) {
1352
+ page = page.getNextPage();
1353
+ }
1354
+
1355
+ // You can also access the underlying response
1356
+ const response = page.response;
1321
1357
 
1322
1358
  ```
1323
1359
  </dd>
@@ -1389,7 +1425,19 @@ List the sessions (newest first by default).
1389
1425
  <dd>
1390
1426
 
1391
1427
  ```typescript
1392
- await client.sessions.list();
1428
+ const pageableResponse = await client.sessions.list();
1429
+ for await (const item of pageableResponse) {
1430
+ console.log(item);
1431
+ }
1432
+
1433
+ // Or you can manually iterate page-by-page
1434
+ let page = await client.sessions.list();
1435
+ while (page.hasNextPage()) {
1436
+ page = page.getNextPage();
1437
+ }
1438
+
1439
+ // You can also access the underlying response
1440
+ const response = page.response;
1393
1441
 
1394
1442
  ```
1395
1443
  </dd>
@@ -1787,7 +1835,19 @@ List session events as `{ turn_id, event }` across the active turn branch (newes
1787
1835
  <dd>
1788
1836
 
1789
1837
  ```typescript
1790
- await client.sessions.listEvents("session_id");
1838
+ const pageableResponse = await client.sessions.listEvents("session_id");
1839
+ for await (const item of pageableResponse) {
1840
+ console.log(item);
1841
+ }
1842
+
1843
+ // Or you can manually iterate page-by-page
1844
+ let page = await client.sessions.listEvents("session_id");
1845
+ while (page.hasNextPage()) {
1846
+ page = page.getNextPage();
1847
+ }
1848
+
1849
+ // You can also access the underlying response
1850
+ const response = page.response;
1791
1851
 
1792
1852
  ```
1793
1853
  </dd>
@@ -1858,7 +1918,19 @@ List turns for a session (newest first by default), token-paginated. Only the se
1858
1918
  <dd>
1859
1919
 
1860
1920
  ```typescript
1861
- await client.sessions.listTurns("session_id");
1921
+ const pageableResponse = await client.sessions.listTurns("session_id");
1922
+ for await (const item of pageableResponse) {
1923
+ console.log(item);
1924
+ }
1925
+
1926
+ // Or you can manually iterate page-by-page
1927
+ let page = await client.sessions.listTurns("session_id");
1928
+ while (page.hasNextPage()) {
1929
+ page = page.getNextPage();
1930
+ }
1931
+
1932
+ // You can also access the underlying response
1933
+ const response = page.response;
1862
1934
 
1863
1935
  ```
1864
1936
  </dd>
@@ -2234,7 +2306,19 @@ Paginated persisted events for a turn (insertion order by default). Only the ses
2234
2306
  <dd>
2235
2307
 
2236
2308
  ```typescript
2237
- await client.sessions.listTurnEvents("session_id", "turn_id");
2309
+ const pageableResponse = await client.sessions.listTurnEvents("session_id", "turn_id");
2310
+ for await (const item of pageableResponse) {
2311
+ console.log(item);
2312
+ }
2313
+
2314
+ // Or you can manually iterate page-by-page
2315
+ let page = await client.sessions.listTurnEvents("session_id", "turn_id");
2316
+ while (page.hasNextPage()) {
2317
+ page = page.getNextPage();
2318
+ }
2319
+
2320
+ // You can also access the underlying response
2321
+ const response = page.response;
2238
2322
 
2239
2323
  ```
2240
2324
  </dd>
@@ -3052,7 +3136,7 @@ await client.internal.sessions.getOrCreateByExternalId({
3052
3136
  <dl>
3053
3137
  <dd>
3054
3138
 
3055
- TypeScript TrueForge SDK samples (stream and non-stream) for creating a session and turn against this agent.
3139
+ TrueForge SDK samples (TypeScript and Python, stream and non-stream) for a session and turn against this agent.
3056
3140
  </dd>
3057
3141
  </dl>
3058
3142
  </dd>