17 releases (10 breaking)
| new 0.93.2 | Nov 7, 2025 |
|---|---|
| 0.92.0 | Oct 23, 2025 |
| 0.1.0 |
|
#132 in Configuration
8,370 downloads per month
Used in superposition_provider
5.5MB
84K
SLoC
Superposition SDK
Superposition SDK is a rust client for the Superposition platform, designed to facilitate the integration of Superposition's capabilities into rust applications. Read the complete documentation at Superposition SDK Documentation or docs.rs
Installation
Add the following to your Cargo.toml:
[dependencies]
superposition_sdk = "<version>"
Initialization
use anyhow::Result; // anyhow is optional and used to simplify this example
use superposition_sdk::{Client, Config};
/// Create a Superposition SDK client with the given URL
pub fn create_client(url: String, token: String) -> Result<Client> {
let config = Config::builder()
.endpoint_url(url)
.bearer_token(token.into())
.behavior_version_latest()
.build();
let client = Client::from_conf(config);
Ok(client)
}
Usage
The SDK provides commands for every API call that Superposition supports. Below is an example of how to use the SDK to list default configs.
use anyhow::Result; // anyhow is optional and used to simplify this example
use superposition_sdk::types::DefaultConfigFull;
/// Fetch all default configs using the Superposition SDK
pub async fn fetch_default_configs(
client: &superposition_sdk::Client,
workspace_id: &str,
org_id: &str,
) -> Result<Vec<DefaultConfigFull>> {
let response = client
.list_default_configs()
.workspace_id(workspace_id)
.org_id(org_id)
.set_count(Some(1000))
.send()
.await
.map_err(|e| anyhow::anyhow!("Failed to fetch default configs: {}", e))?;
let configs: Vec<DefaultConfigFull> = Vec::from(response.data());
// do stuff with the configs
Ok(configs)
}
Dependencies
~6–29MB
~498K SLoC