The Rust SDK provides ergonomic wrappers and utilities to interact with the S2 API.
-
Ensure you have
tokio
added as a dependency. The SDK relies on Tokio for executing async code.cargo add tokio --features full
-
Add the
streamstore
dependency to your project:cargo add streamstore
-
Generate an authentication token by logging onto the web console at s2.dev.
-
Make a request using SDK client.
#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let config = s2::ClientConfig::new("<YOUR AUTH TOKEN>"); let client = s2::Client::new(config); let basins = client.list_basins(Default::default()).await?; println!("My basins: {:?}", basins); Ok(()) }
The examples
directory in this repository contains a variety of
example use cases demonstrating how to use the SDK effectively.
Run any example using the following command:
export S2_AUTH_TOKEN="<YOUR AUTH TOKEN>"
cargo run --example <example_name>
Note
You might want to update the basin name in the example before running since
basin names are globally unique and each example uses the same basin name
("my-favorite-basin"
).
Head over to docs.rs for detailed documentation and crate reference.
We use Github Issues to track feature requests and issues with the SDK. If you wish to provide feedback, report a bug or request a feature, feel free to open a Github issue.
Developers are welcome to submit Pull Requests on the repository. If there is no tracking issue for the bug or feature request corresponding to the PR, we encourage you to open one for discussion before submitting the PR.
Join our Discord server. We would love to hear from you.
You can also email us at hi@s2.dev.
This project is licensed under the Apache-2.0 License.