openapp-sdk 0.1.56

Rust-first OpenApp SDK: thin facade over openapp-sdk-core for direct Cargo integration.
Documentation

openapp-sdk (Rust)

Official Rust SDK for OpenApp.

Installation

From the monorepo, add it as a path dependency:

[dependencies]
openapp-sdk = { path = "packages/sdk/rust" }

Release automation publishes the core crates and this facade crate to crates.io from sdk-rust-v* tags. Once the published artifacts are available in your registry, consumers can use the normal crates.io dependency form:

[dependencies]
openapp-sdk = "0.1"

Requirements

  • Rust stable (currently 1.95.x; MSRV declared in Cargo.toml)
  • OpenApp API key

Quick start

use openapp_sdk::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::builder()
        .api_key(std::env::var("OPENAPP_API_KEY")?)
        .build()?;

    let orgs = client.orgs().list().await?;
    println!("{orgs:?}");
    Ok(())
}

Error handling

use openapp_sdk::{Client, SdkError};

async fn list_orgs(api_key: String) {
    let client = match Client::builder().api_key(api_key).build() {
        Ok(c) => c,
        Err(err) => {
            eprintln!("config/auth error: {err}");
            return;
        }
    };

    match client.orgs().list().await {
        Ok(orgs) => println!("{orgs:?}"),
        Err(SdkError::Auth(msg)) => eprintln!("auth error: {msg}"),
        Err(SdkError::Api(api)) => eprintln!("api error: {} {}", api.status, api.message),
        Err(other) => eprintln!("transport/sdk error: {other}"),
    }
}

Maintainer docs

Internal development, CI, and release notes are documented in ../docs/RUST_MAINTAINERS.md and ../docs/SDK_DEVELOPMENT_POLICY.md.