Skip to main content

Crate dinio_sdk

Crate dinio_sdk 

Source
Expand description

Rust SDK for the Dinio platform API (Core REST API, /api/v1).

§Quick start

use dinio_sdk::Client;
use dinio_sdk::ops::{self, AddValue};

let client = Client::builder()
    .base_url("https://api-dinio.bitelex.com")
    .api_key("du_...")
    .build()?;

// Zones are addressed by name or uuid.
let zone = client.zones().get("example.com").await?;

// Core wants full owner names; `qualify_name` turns zone-file style names into them.
let name = ops::qualify_name("www", &zone.name)?;
let added = ops::add_value(
    &client,
    &zone,
    &name,
    "A",
    AddValue { data: "192.0.2.10".into(), ..Default::default() },
)
.await?;
println!("added {} (TTL {})", added.value.data, added.ttl);

§Layers

  • api: one method per Core route, reached from the Client (client.zones(), client.records(), …). Resources are addressed by uuid, as Core does. Use it when you keep uuids yourself.
  • ops: name-based operations composed from api calls: a record value by its (name, type, data), geo bans by area name, owner names zone-file style.
  • models: the wire shapes of Core resources.

§Authentication

A Core-issued API key, sent as Authorization: Bearer <key>: either a personal key (du_…, access to every zone the user is a member of) or a zone key (dz_…, access to that one zone); ApiKeyKind::of tells them apart. Core shows a key only once, when it issues it (api::Zones::create_api_key, api::Users::create_api_key), and keeps only its hash. Core decides what a key may do; the SDK does not repeat its rules.

§Errors

Every call returns Result. Error::Api keeps Core’s error.code, message and details; the other variants say whether the request was never answered, the answer was not Core’s, or the SDK refused the input before sending anything.

§Runtime

The SDK is async, starts no runtime and spawns no tasks. The HTTP layer (reqwest) needs a tokio runtime to poll the returned futures.

Modules§

api
One function per Core route, no logic beyond building the request and decoding the envelope. Modules follow ../core/src/api/router.ts (non-admin routes only).
models
Wire shapes of Core resources (../core/src/models.ts). Enums are string labels on the wire (../core/src/api/enum_labels.ts); unknown labels must not fail deserialization. Timestamps are Unix seconds unless a field says otherwise.
ops
Name-based operations composed from api calls: addressing a record value by (name, type, data), geo bans by area name, client identities and sinkhole lists by name, sinkhole rules by pattern, certificates by a name they cover, zone members by email, the zone of a host name, owner names zone-file style.

Structs§

ApiError
Core’s error envelope plus the HTTP status it came with.
Client
A configured connection to one Core endpoint; the entry point of the SDK.
ClientBuilder
Configuration for a Client, from Client::builder.
CursorPage
One page of a cursor-paginated list (/audit-logs).
Meta
Pagination info; Core sends it only on page-numbered lists (/zones, /records).
Page
One page of a paginated list.
Secret
A secret string (API key). Deserializable (Core returns a new key once, when it issues it), but deliberately not Serialize, so it cannot leak into JSON output by accident.
Uuid
A Universally Unique Identifier (UUID).

Enums§

ApiKeyKind
Which kind of API key a key is, read from its prefix. Core decides by the same prefix, so this is known without a request.
Credentials
How the client authenticates.
Error
Everything an SDK call can fail with.
ErrorCode
error.code values Core sends (../core/src/api/errors.ts, auth.ts). Unknown codes are kept as ErrorCode::Other so a newer Core never breaks parsing.
Timestamp
A point in time for a from/to filter: a SystemTime, or text Core parses itself (ISO 8601 with an offset, e.g. 2026-10-27T09:00:00+01:00).

Type Aliases§

Result
Result with the SDK’s Error.