Pagination
Every list method returns a page holding the current items, a total (when the API reports it), and a link to the next page. You can iterate one page or transparently across all of them.
Iterate across all pages
- Node.js
- Go
- Rust
A page is async-iterable across every page:
const rooms = await client.rooms.list({ perPage: 50 });
for await (const room of rooms) {
console.log(room.roomId);
}
ListAutoPaging returns a Go 1.23 range-over-func iterator:
for room, err := range client.Rooms.ListAutoPaging(ctx, videosdk.RoomListParams{}) {
if err != nil {
return err
}
fmt.Println(room.RoomID)
}
list_stream yields every item across every page:
use futures_util::StreamExt;
let mut rooms = Box::pin(client.rooms().list_stream(RoomListParams {
per_page: Some(50),
..Default::default()
}));
while let Some(room) = rooms.next().await {
println!("{}", room?.room_id);
}
Work with a single page
- Node.js
- Go
- Rust
const first = await client.rooms.list({ perPage: 20 });
first.data; // items on this page
first.total; // total across all pages, when reported
first.hasNextPage; // whether another page exists
page, err := client.Rooms.List(ctx, videosdk.RoomListParams{
ListParams: videosdk.ListParams{PerPage: videosdk.Int(20)},
})
for _, room := range page.Data {
fmt.Println(room.RoomID)
}
if page.HasNextPage() {
page, err = page.NextPage(ctx)
}
let first = client
.rooms()
.list(RoomListParams {
per_page: Some(20),
..Default::default()
})
.await?;
for room in &first.data {
println!("{}", room.room_id);
}
first.total(); // total across all pages, when reported
if let Some(next) = first.next_page().await? {
// ... work with the next page
}
Parameters
Every list method accepts a page number, a page size, and a cursor (from a previous page) alongside its own filters.
- Node.js
- Go
- Rust
await client.rooms.list({ page: 2, perPage: 50 });
client.Rooms.List(ctx, videosdk.RoomListParams{
ListParams: videosdk.ListParams{Page: videosdk.Int(2), PerPage: videosdk.Int(50)},
})
client.rooms().list(RoomListParams {
page: Some(2),
per_page: Some(50),
..Default::default()
}).await?;
Got a Question? Ask us on discord

