Misar Docs
MisarMailMisar.BlogMisarReachMisarPostMisar.DevMisar PlatformMisar IdentityMisar Posts API
Sdks

Rust SDK

Official Misar.Dev SDK for Rust — build, deploy, and manage apps via api.misar.io/dev.

The official Misar.Dev client SDK for Rust.

Installation

Add to Cargo.toml:

[dependencies]
misar_dev = "1.0.0"
tokio = { version = "1", features = ["full"] }

The crate is named misar_dev. It is async and depends on tokio and reqwest.

Quick start

use misar_dev::MisarDevClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = MisarDevClient::new("mdk_your_api_key");

    let projects = client.projects_list().await?;
    println!("{projects}");
    Ok(())
}

For custom configuration (base URL, retries, timeout) use with_config:

use misar_dev::{MisarDevClient, ClientConfig};

let client = MisarDevClient::with_config(ClientConfig {
    api_key: "mdk_your_api_key".into(),
    base_url: "https://api.misar.io/dev".into(),
    max_retries: 3,
    timeout_secs: 30,
});

Configuration

Base URL https://api.misar.io/dev; auth Authorization: Bearer <key> (sent automatically via bearer_auth). Retries (default 3) apply to 429, 500, 502, 503, 504 with exponential backoff (base 500 ms). Default timeout 30 s. All methods return serde_json::Value.

Resources

This Rust port (v1.0.0) implements a subset of the full Misar.Dev API:

async fn projects_list(&self) -> Result<Value, MisarDevError>
async fn projects_create<B: Serialize>(&self, body: &B) -> Result<Value, MisarDevError>
async fn api_keys_list(&self) -> Result<Value, MisarDevError>
async fn usage_get(&self) -> Result<Value, MisarDevError>
async fn chat_complete<B: Serialize>(&self, body: &B) -> Result<Value, MisarDevError>
  • projectsprojects_list, projects_create
  • apiKeysapi_keys_list
  • usageusage_get
  • chatchat_complete

Error handling

All methods return Result<_, MisarDevError>. MisarDevError is an enum with these variants:

  • MisarDevError::Api { status, message, error_type } — non-200 API response
  • MisarDevError::Network(reqwest::Error) — transport/connection failure
  • MisarDevError::Json(serde_json::Error) — response deserialization failure
match client.projects_list().await {
    Ok(v) => println!("{v}"),
    Err(misar_dev::errors::MisarDevError::Api { status, message, .. }) =>
        eprintln!("API error {status}: {message}"),
    Err(e) => eprintln!("error: {e}"),
}