Documentation Index
Fetch the complete documentation index at: https://s2.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
List operations like listBasins, listStreams, and listAccessTokens return paginated results.
SDKs provide automatic pagination helpers that handle async fetching of subsequent pages transparently.
Usage
Instead of manually handling hasMore and startAfter cursor parameters, use the paginator variants which return an iterable that automatically fetches pages as needed:
TypeScript
Python
Go
Rust
// Iterate through all streams with automatic pagination
for await (const stream of basin.streams.listAll()) {
console.log(stream.name);
}
# Iterate through all streams with automatic pagination
async for stream in basin.list_all_streams():
print(stream.name)
// Iterate through all streams with automatic pagination
iter := basin.Streams.Iter(ctx, nil)
for iter.Next() {
stream := iter.Value()
fmt.Println(stream.Name)
}
if err := iter.Err(); err != nil {
log.Fatal(err)
}
// Iterate through all streams with automatic pagination
let mut stream = basin.list_all_streams(ListAllStreamsInput::new());
while let Some(info) = stream.next().await {
let info = info?;
println!("{}", info.name);
}
Filtering
Paginators accept the same filter options as their single-page list analogs:
TypeScript
Python
Go
Rust
// List streams with a prefix filter
for await (const stream of basin.streams.listAll({ prefix: "events/" })) {
console.log(stream.name);
}
# List streams with a prefix filter
async for stream in basin.list_all_streams(prefix="events/"):
print(stream.name)
// List streams with a prefix filter
iter = basin.Streams.Iter(ctx, &s2.ListStreamsArgs{Prefix: "events/"})
for iter.Next() {
fmt.Println(iter.Value().Name)
}
if err := iter.Err(); err != nil {
log.Fatal(err)
}
// List streams with a prefix filter
let input = ListAllStreamsInput::new().with_prefix("events/".parse()?);
let mut stream = basin.list_all_streams(input);
while let Some(info) = stream.next().await {
println!("{}", info?.name);
}
Deleted Resources
Paginators automatically filter out resources that are pending deletion. This is useful because delete operations mark resources for deletion, but actual garbage collection happens asynchronously.
To include deleted resources in the results:
TypeScript
Python
Go
Rust
// Include streams that are being deleted
for await (const stream of basin.streams.listAll({ includeDeleted: true })) {
console.log(stream.name, stream.deletedAt);
}
# Include streams that are being deleted
async for stream in basin.list_all_streams(include_deleted=True):
print(stream.name, stream.deleted_at)
// Include streams that are being deleted
iter = basin.Streams.Iter(ctx, &s2.ListStreamsArgs{IncludeDeleted: true})
for iter.Next() {
stream := iter.Value()
fmt.Println(stream.Name, stream.DeletedAt)
}
if err := iter.Err(); err != nil {
log.Fatal(err)
}
// Include streams that are being deleted
let input = ListAllStreamsInput::new().with_include_deleted(true);
let mut stream = basin.list_all_streams(input);
while let Some(info) = stream.next().await {
let info = info?;
println!("{} {:?}", info.name, info.deleted_at);
}