Rust SDK
dinio-sdk is a typed, async client for the Dinio API. The dinio CLI is a
thin layer over it, so everything the CLI does — names instead of uuids, record values found
by their data, geo areas by name — is available to your own Rust code.
- Async, runtime-agnostic API: it never starts a runtime or spawns tasks. HTTP runs on
reqwest, so poll its futures in a Tokio runtime. - TLS via rustls and the OS trust store — no OpenSSL.
- API keys are a
Secrettype: redacted inDebug, never serialized. - Rust 1.85 or newer (edition 2024).
It covers the whole Dinio API — DNS hosting, DNS filtering, statistics and the audit log — like the TypeScript SDK.
Install
Section titled “Install”dinio-sdk comes from the Dinio Cargo registry, not crates.io. Add the registry to
~/.cargo/config.toml (or the project’s .cargo/config.toml):
[registries.dinio-public]index = "sparse+https://git.bitelex.com/api/packages/dinio-public/cargo/"then the crate, with Tokio to run its futures:
cargo add dinio-sdk --registry dinio-publiccargo add tokio --features macros,rt-multi-threadCI setup and the API reference: see Install › Rust SDK.
Quick start
Section titled “Quick start”use dinio_sdk::{Client, api::PageRequest};
#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = Client::builder() .base_url("https://api-dinio.bitelex.com") .api_key(std::env::var("DINIO_API_KEY")?) .build()?;
for zone in client.zones().list_all().await? { println!("{} {}", zone.name, zone.uuid); }
let zone = client.zones().get("example.com").await?; // uuid or name let page = client.records().list(zone.uuid, &Default::default(), PageRequest::default()).await?; println!("{} record values on the first page", page.items.len()); Ok(())}Layers
Section titled “Layers”The SDK has two layers, and you can mix them:
api— one method per API route, reached through the client:client.zones(),client.records(),client.health_checks(),client.geo_bans(). No logic beyond the request. See Resources.ops— functions composed fromapicalls that work by zone, name, type and data, the way the CLI does. See Working by name.
- Client — builder options, timeouts, health.
- Resources — every method, by resource.
- Working by name — records and geo areas by name.
- Errors —
Error,ApiErrorandErrorCode.