s2-sdk 0.22.0

Rust SDK for s2.dev
Documentation

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

Getting started

  1. Ensure you have added tokio and futures as dependencies.

    cargo add tokio --features full
    cargo add futures
    
  2. Add the s2-sdk dependency to your project:

    cargo add s2-sdk
    
  3. Generate an access token by logging into the web console at s2.dev.

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

Examples

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>

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 hi@s2.dev.

License

This project is licensed under the MIT License.