mountos_admin_sdk/lib.rs
1//! Rust SDK for the mountOS provider API.
2//!
3//! Wraps the appserv provider API (`/api/v1/*`) with ED25519 JWT authentication.
4//! Construct a [`Client`] from a [`Config`] and call typed methods grouped by
5//! resource, e.g. `client.accounts.list(..)`.
6//!
7//! ```no_run
8//! use mountos_admin_sdk::{Client, Config};
9//!
10//! # async fn run() -> Result<(), mountos_admin_sdk::Error> {
11//! let client = Client::new(Config {
12//! base_url: "https://appserv.example.com".into(),
13//! private_key: "<base64 ED25519 key>".into(),
14//! ..Default::default()
15//! })?;
16//!
17//! let account = client.accounts.get(1).await?;
18//! println!("{}", account.name);
19//! # Ok(())
20//! # }
21//! ```
22//!
23//! The `private_key` is a base64-encoded ED25519 key - either a 32-byte seed or
24//! a 64-byte seed+public-key. JWT tokens are signed locally and cached for ~55
25//! minutes (1h TTL with a 5-minute refresh margin).
26
27#![forbid(unsafe_code)]
28
29mod auth;
30mod client_gen;
31mod dashboard_user;
32mod errors;
33mod http;
34mod providers;
35mod types_gen;
36
37pub use client_gen::*;
38pub use dashboard_user::sign_dashboard_user;
39pub use errors::Error;
40pub use providers::*;
41pub use types_gen::*;
42
43// Re-exported so callers can build `serde_json::Value` fields (e.g.
44// `provider_info`) without taking their own version-matched dependency.
45pub use serde_json;