Skip to content

Commit 70ced14

Browse files
authored
Merge pull request #231 from seamapi/update-feb20
feat: Update @seamapi/http to v1.25.0
2 parents 782a3a5 + 2864f1c commit 70ced14

File tree

8 files changed

+3232
-1145
lines changed

8 files changed

+3232
-1145
lines changed

.github/workflows/_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Package
3232
run: npm pack
3333
- name: Upload artifact
34-
uses: actions/upload-artifact@v3
34+
uses: actions/upload-artifact@v4
3535
with:
3636
name: build-${{ github.sha }}
3737
if-no-files-found: error

.github/workflows/_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
install_dependencies: 'false'
3232
- name: Download artifact
33-
uses: actions/download-artifact@v3
33+
uses: actions/download-artifact@v4
3434
with:
3535
name: ${{ inputs.artifact_name }}
3636
path: .

.github/workflows/check.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,24 @@ jobs:
7878
with:
7979
node-version: ${{ matrix.node }}
8080
- name: Download artifact
81-
uses: actions/download-artifact@v3
81+
uses: actions/download-artifact@v4
8282
with:
8383
name: ${{ needs.build.outputs.artifact_name }}
8484
path: .
8585
- name: Find packages
86-
uses: tj-actions/glob@v17
86+
uses: tj-actions/glob@v21
8787
id: packages
8888
with:
8989
files: '*.tgz'
9090
- name: Create package.json
91-
uses: DamianReeves/write-file-action@v1.2
91+
uses: DamianReeves/write-file-action@v1.3
9292
with:
9393
write-mode: overwrite
9494
path: package.json
9595
contents: |
9696
{"type":"module"}
9797
- name: Create index.js
98-
uses: DamianReeves/write-file-action@v1.2
98+
uses: DamianReeves/write-file-action@v1.3
9999
with:
100100
write-mode: overwrite
101101
path: index.js

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
fetch-depth: 0
2525
- name: Download artifact
26-
uses: actions/download-artifact@v3
26+
uses: actions/download-artifact@v4
2727
with:
2828
name: ${{ needs.build.outputs.artifact_name }}
2929
path: .
@@ -33,10 +33,10 @@ jobs:
3333
mkdir tmp
3434
outfile=tmp/changelog.txt
3535
echo "outfile=${outfile}" >> $GITHUB_OUTPUT
36-
npx standard-changelog@^2.0.0 --release-count 2 --infile $outfile.tmp --outfile $outfile.tmp
36+
npx standard-changelog@^5.0.0 --release-count 2 --infile $outfile.tmp --outfile $outfile.tmp
3737
sed '1,3d' $outfile.tmp > $outfile
3838
- name: Create GitHub release
39-
uses: softprops/action-gh-release@v1
39+
uses: softprops/action-gh-release@v2
4040
with:
4141
token: ${{ secrets.GH_TOKEN }}
4242
fail_on_unmatched_files: true

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2021-2023 Seam Labs, Inc.
3+
Copyright (c) 2021-2025 Seam Labs, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ Instead, it re-exports from a core set of Seam modules:
4343
- [Personal Access Token](#personal-access-token)
4444
- [Console Session Token](#console-session-token)
4545
- [Action Attempts](#action-attempts)
46+
- [Pagination](#pagination)
47+
- [Manually fetch pages with the nextPageCursor](#manually-fetch-pages-with-the-nextpagecursor)
48+
- [Iterate over all pages](#iterate-over-all-pages)
49+
- [Iterate over all resources](#iterate-over-all-resources)
50+
- [Return all resources across all pages as an array](#return-all-resources-across-all-pages-as-an-array)
4651
- [Interacting with Multiple Workspaces](#interacting-with-multiple-workspaces)
4752
- [Personal Access Token](#personal-access-token-1)
4853
- [Console Session Token](#console-session-token-1)
@@ -313,6 +318,67 @@ try {
313318

314319
[action attempt]: https://docs.seam.co/latest/core-concepts/action-attempts
315320

321+
### Pagination
322+
323+
Some Seam API endpoints that return lists of resources support pagination.
324+
Use the `SeamPaginator` class to fetch and process resources across multiple pages.
325+
326+
#### Manually fetch pages with the nextPageCursor
327+
328+
```ts
329+
const pages = seam.createPaginator(
330+
seam.devices.list({
331+
limit: 20,
332+
}),
333+
)
334+
335+
const [devices, { hasNextPage, nextPageCursor }] = await pages.firstPage()
336+
337+
if (hasNextPage) {
338+
const [moreDevices] = await pages.nextPage(nextPageCursor)
339+
}
340+
```
341+
342+
#### Iterate over all pages
343+
344+
```ts
345+
const pages = seam.createPaginator(
346+
seam.devices.list({
347+
limit: 20,
348+
}),
349+
)
350+
351+
for await (const devices of pages) {
352+
console.log(`There are ${devices.length} devices on this page.`)
353+
}
354+
```
355+
356+
#### Iterate over all resources
357+
358+
```ts
359+
const pages = seam.createPaginator(
360+
seam.devices.list({
361+
limit: 20,
362+
}),
363+
)
364+
365+
for await (const device of pages.flatten()) {
366+
console.log(devices.name)
367+
}
368+
```
369+
370+
#### Return all resources across all pages as an array
371+
372+
```ts
373+
const pages = seam.createPaginator(
374+
seam.devices.list({
375+
limit: 20,
376+
}),
377+
)
378+
379+
const devices = await pages.toArray()
380+
```
381+
316382
### Interacting with Multiple Workspaces
317383

318384
Some Seam API endpoints interact with multiple workspaces.

0 commit comments

Comments
 (0)