Skip to content

s2-streamstore/s2-sdk-rust

Repository files navigation

Rust SDK for S2

The Rust SDK provides ergonomic wrappers and utilities to interact with the S2 API.

Getting started

  1. Ensure you have tokio added as a dependency. The SDK relies on Tokio for executing async code.

    cargo add tokio --features full
  2. Add the streamstore dependency to your project:

    cargo add streamstore
  3. Generate an authentication token by logging onto the web console at s2.dev.

  4. 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(())
    }

Examples

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").

SDK Docs and Reference

Head over to docs.rs for detailed documentation and crate reference.

Feedback

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.

Contributing

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.

Reach out to us

Join our Discord server. We would love to hear from you.

You can also email us at [email protected].

License

This project is licensed under the Apache-2.0 License.