hot-rust
Official Rust SDK for the Hot Dev API.
- crates.io:
hot-dev - Import:
hot_dev - Async (tokio); TLS via rustls
- MSRV: 1.82
Install
Quick Start
use StreamExt;
use ;
use json;
async
Authenticated clients should run server-side. Browser (wasm) apps and untrusted clients should call your own backend route instead of exposing a Hot API key. Most management endpoints require an API key. Sessions and service keys are permission-scoped and are mainly for event publishing and stream reads.
Errors
Non-2xx API responses return Error::Api(ApiError) with structured fields:
# async
Retries
JSON requests are retried automatically (at most twice) when the API responds
429 with a retry_after; other errors are returned as-is. Streaming and raw
requests are never retried.
Resources
HotClient mirrors the Hot API v1 resources:
client.events()— publish, list, get, inspect event runs, and call Hot functions withcall_hot(fn, args, opts)client.streams()— subscribe to run streams, wait for run results, and publish events atomically (reconnects automatically across the 5-minute SSE timeout; setreconnect: falseto opt out)client.runs()— list, inspect, and view run statsclient.files()— upload, download, list, and delete files (including multipart uploads)client.projects()— create, list, update, activate, deactivate, and delete projectsclient.builds()— upload, download, deploy, and look up live/deployed buildsclient.context()— manage encrypted project context variablesclient.domains()— register, verify, list, and delete custom domainsclient.sessions()— create and revoke scoped sessionsclient.service_keys()— create and revoke scoped service keysclient.org()— view usage and limitsclient.env()— read environment info and subscribe to environment events
Use client.request(...) for JSON endpoints that do not yet have a resource
helper, or client.request_builder(...) + client.execute(...) for full
control over the request.
client.env().subscribe() requires API key credentials and a live API pub/sub
backend; local API servers without pub/sub return a 503.
subscribe_with_event reconnects across the API's 5-minute SSE timeout and
stops after the first terminal run:* event it sees, so use
client.streams().subscribe directly if your app expects multiple independent
runs on the same stream.
Customizing the HTTP Client
Pass your own reqwest::Client for proxies, pools, or custom TLS:
let http = builder.build.unwrap;
let client = builder.http_client.build;
Do not set a client-wide timeout on a client used for SSE subscriptions — it
bounds the whole request, including the stream. Use the builder's timeout
(JSON requests only) instead.
Request Bodies
Body parameters accept any serde::Serialize value: serde_json::json!
literals, JsonObject maps, or your own #[derive(Serialize)] structs.
Responses are returned as JsonObject in the wire format.
Casing Policy
Core API request and response payloads use the Hot API wire format:
event_type, event_data, stream_id, and so on. SDK-only options use Rust
style names such as base_url and timeout.
The SDK never transforms user-owned payloads such as event_data.
Local Development
Related
License
Apache-2.0