The Rust SDK provides ergonomic interface and utilities to interact with the S2 API.
-
Ensure you have added tokio and futures as dependencies.
cargo add tokio --features full cargo add futures
-
Add the
s2-sdkdependency to your project:cargo add s2-sdk
-
Generate an access token by logging into the web console at s2.dev.
-
Perform an operation.
use s2_sdk::{ S2, types::{ListBasinsInput, S2Config}, }; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let s2 = S2::new(S2Config::new("<YOUR_ACCESS_TOKEN>"))?; let page = s2.list_basins(ListBasinsInput::new()).await?; println!("My basins: {:?}", page.values); Ok(()) }
The examples directory in this repository contains a variety of
example use cases demonstrating how to use the SDK effectively.
You might have to set either one or all of these env vars based on the example you run.
export S2_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export S2_BASIN="<YOUR_BASIN_NAME>"
export S2_STREAM="<YOUR_STREAM_NAME>"
cargo run --example <example_name>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 MIT License.