Rust SDK
Install and use the Misar.IO Rust SDK
Installation
Add to Cargo.toml:
[dependencies]
misario = "0.1"
tokio = { version = "1", features = ["full"] }
Quick Start
use misario::MisarIOClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = MisarIOClient::new(std::env::var("MISARIO_API_KEY")?);
let profile = client.account().get().await?;
println!("Hello, {}!", profile.display_name);
Ok(())
}
Available Methods
| Method | Description |
|--------|-------------|
| client.account().get() | Get the current account profile |
| client.account().update(request) | Update account details |
| client.sessions().list() | List active sessions |
| client.sessions().revoke(id) | Revoke a session |
| client.keys().list() | List API keys |
| client.keys().create(request) | Create an API key |
| client.keys().revoke(id) | Revoke an API key |
| client.sso().token(request) | Generate a cross-TLD SSO token |
Error Handling
use misario::Error;
match client.account().get().await {
Ok(profile) => println!("Hello, {}!", profile.display_name),
Err(Error::Api { status, message }) => eprintln!("API error {}: {}", status, message),
Err(e) => eprintln!("Error: {}", e),
}