Skip to main content

Crate hot_dev

Crate hot_dev 

Source
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.
BuildUpload
A build archive to upload.
BuildsResource
Uploads, deploys, and inspects builds.
CallOptions
Optional parameters for EventsResource::call_hot.
ContextResource
Manages encrypted project context variables.
DomainsResource
Manages custom domains.
EnvResource
Reads environment info and environment events.
EventsResource
Publishes and inspects Hot events.
FilesResource
Uploads, downloads, lists, and deletes files.
HotClient
Hot API v1 client. Construct it with HotClient::builder; the resource accessors mirror the Hot API resources.
HotClientBuilder
Builder for HotClient.
OrgResource
Reports organization usage and limits.
ProjectsResource
Manages projects.
RunsResource
Lists and inspects runs.
ServiceKeysResource
Creates and revokes scoped service keys.
SessionsResource
Creates and revokes scoped sessions.
StreamsResource
Subscribes to Hot run streams.
SubscribeWithEventOptions
Optional parameters for StreamsResource::subscribe_with_event.
WaitOptions
Optional parameters for StreamsResource::wait_for_run_result.

Enums§

Error
The error type for SDK operations.

Traits§

StreamEventExt
Convenience accessors for StreamEvent wire-format fields.

Type Aliases§

EventStream
A stream of Hot run-stream events.
JsonObject
A JSON object in the Hot API wire format.
Result
Result alias for SDK operations.
StreamEvent
One event from a Hot run stream (type, data_type, payload, run, …).