Expand description
Official Rust SDK for the Hot Dev API.
The client is a thin mirror of the Hot API v1 resources. Request and
response payloads use the Hot API wire format (event_type, stream_id,
event_data, …) as JsonObject values; the SDK never transforms
user-owned payloads such as event_data. SDK-only options use
Rust-idiomatic names (base_url, timeout).
use futures_util::StreamExt;
use hot_dev::{HotClient, StreamEventExt, SubscribeWithEventOptions};
use serde_json::json;
let client = HotClient::builder(std::env::var("HOT_API_KEY").unwrap()).build();
// base_url defaults to https://api.hot.dev. For local development with
// `hot dev`, use .base_url("http://localhost:4681").
let mut events = client.streams().subscribe_with_event(
json!({
"event_type": "team-agent:ask",
"event_data": { "question": "what is blocking launch?" },
}),
SubscribeWithEventOptions::default(),
);
while let Some(event) = events.next().await {
let event = event?;
if event.event_type() == "run:stop" {
println!("{:?}", event.run());
break;
}
}Authenticated clients should run server-side; browser or untrusted clients should call your own backend instead of embedding a Hot API key.
Structs§
- ApiError
- Structured error for non-2xx Hot API responses.
- Build
Upload - A build archive to upload.
- Builds
Resource - Uploads, deploys, and inspects builds.
- Call
Options - Optional parameters for
EventsResource::call_hot. - Context
Resource - Manages encrypted project context variables.
- Domains
Resource - Manages custom domains.
- EnvResource
- Reads environment info and environment events.
- Events
Resource - Publishes and inspects Hot events.
- Files
Resource - Uploads, downloads, lists, and deletes files.
- HotClient
- Hot API v1 client. Construct it with
HotClient::builder; the resource accessors mirror the Hot API resources. - HotClient
Builder - Builder for
HotClient. - OrgResource
- Reports organization usage and limits.
- Projects
Resource - Manages projects.
- Runs
Resource - Lists and inspects runs.
- Service
Keys Resource - Creates and revokes scoped service keys.
- Sessions
Resource - Creates and revokes scoped sessions.
- Streams
Resource - Subscribes to Hot run streams.
- Subscribe
With Event Options - Optional parameters for
StreamsResource::subscribe_with_event. - Wait
Options - Optional parameters for
StreamsResource::wait_for_run_result.
Enums§
- Error
- The error type for SDK operations.
Traits§
- Stream
Event Ext - Convenience accessors for
StreamEventwire-format fields.
Type Aliases§
- Event
Stream - A stream of Hot run-stream events.
- Json
Object - A JSON object in the Hot API wire format.
- Result
- Result alias for SDK operations.
- Stream
Event - One event from a Hot run stream (
type,data_type,payload,run, …).