Comparing version 1.49.0 to 1.50.0
{ | ||
"name": "seam", | ||
"version": "1.49.0", | ||
"version": "1.50.0", | ||
"description": "JavaScript SDK for the Seam API written in TypeScript.", | ||
@@ -68,3 +68,3 @@ "type": "module", | ||
"dependencies": { | ||
"@seamapi/http": "1.25.0", | ||
"@seamapi/http": "1.25.1", | ||
"@seamapi/types": "1.356.0", | ||
@@ -71,0 +71,0 @@ "@seamapi/webhook": "1.1.1", |
@@ -48,2 +48,3 @@ # Seam JavaScript SDK | ||
- [Manually fetch pages with the nextPageCursor](#manually-fetch-pages-with-the-nextpagecursor) | ||
- [Resume pagination](#resume-pagination) | ||
- [Iterate over all pages](#iterate-over-all-pages) | ||
@@ -343,2 +344,28 @@ - [Iterate over all resources](#iterate-over-all-resources) | ||
#### Resume pagination | ||
Get the first page on initial load: | ||
```ts | ||
const params = { limit: 20 } | ||
const pages = seam.createPaginator(seam.devices.list(params)) | ||
const [devices, pagination] = await pages.firstPage() | ||
localStorage.setItem('/seam/devices/list', JSON.stringify([params, pagination])) | ||
``` | ||
Get the next page at a later time: | ||
```ts | ||
const [params = {}, { hasNextPage = false, nextPageCursor = null } = {}] = | ||
JSON.parse(localStorage.getItem('/seam/devices/list') ?? '[]') | ||
if (hasNextPage) { | ||
const pages = seam.createPaginator(seam.devices.list(params)) | ||
const [moreDevices] = await pages.nextPage(nextPageCursor) | ||
} | ||
``` | ||
#### Iterate over all pages | ||
@@ -381,3 +408,3 @@ | ||
const devices = await pages.toArray() | ||
const devices = await pages.flattenToArray() | ||
``` | ||
@@ -384,0 +411,0 @@ |
26014
722
+ Added@seamapi/http@1.25.1(transitive)
- Removed@seamapi/http@1.25.0(transitive)
Updated@seamapi/http@1.25.1