S2 provides official SDKs across several languages to simplify working with our core APIs.
While the REST API can be used directly from any HTTP client, the SDKs provide higher-level abstractions (like the Producer API), retry and error handling logic, rich types, and more performant streaming transport implementations.
Official SDKs
Each repository also contains a variety of examples to demonstrate some common use cases.
The Python and Java SDKs currently use our gRPC API, which is now deprecated.We are actively updating them to use the new HTTP-based API and conform to the patterns described in this documentation.
Getting Started
Every SDK follows the same pattern: create a client with an access token, then navigate to basins and streams hierarchically.
import { S2 } from "@s2-dev/streamstore";
const client = new S2({
accessToken: process.env.S2_ACCESS_TOKEN!,
});
const basin = client.basin("my-basin");
const stream = basin.stream("my-stream");
package main
import (
"fmt"
"github.com/s2-streamstore/s2-sdk-go/s2"
)
func main() {
client := s2.NewFromEnvironment(nil)
basin := client.Basin("my-basin")
stream := basin.Stream("my-stream")
fmt.Printf("Created client for stream: %+v\n", stream)
}
use s2_sdk::{S2, types::S2Config};
let client = S2::new(S2Config::new(std::env::var("S2_ACCESS_TOKEN")?))?;
let basin = client.basin("my-basin".parse()?);
let stream = basin.stream("my-stream".parse()?);
From here, operations fall into two categories: account and basin operations for managing resources, and stream operations for reading and writing records. See configuration for details on endpoints, retry behavior, and environment variables.