File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,37 @@ On timeout, an `APIConnectionTimeoutError` is thrown.
131131
132132Note that requests which time out will be [ retried twice by default] ( #retries ) .
133133
134+ ## Auto-pagination
135+
136+ List methods in the Arcade API are paginated.
137+ You can use the ` for await … of ` syntax to iterate through items across all pages:
138+
139+ ``` ts
140+ async function fetchAllUserConnectionResponses(params ) {
141+ const allUserConnectionResponses = [];
142+ // Automatically fetches more pages as needed.
143+ for await (const userConnectionResponse of client .admin .userConnections .list ()) {
144+ allUserConnectionResponses .push (userConnectionResponse );
145+ }
146+ return allUserConnectionResponses ;
147+ }
148+ ```
149+
150+ Alternatively, you can request a single page at a time:
151+
152+ ``` ts
153+ let page = await client .admin .userConnections .list ();
154+ for (const userConnectionResponse of page .items ) {
155+ console .log (userConnectionResponse );
156+ }
157+
158+ // Convenience methods are provided for manually paginating:
159+ while (page .hasNextPage ()) {
160+ page = await page .getNextPage ();
161+ // ...
162+ }
163+ ```
164+
134165## Advanced Usage
135166
136167### Accessing raw Response data (e.g., headers)
You can’t perform that action at this time.
0 commit comments