Rust SDK — jawb-sdk-rust
A Rust client library for jawbd's local /v1 HTTP API.
A Rust client library (in jawb-core/sdks/rust/) for jawbd's local
/v1 HTTP API: the same contract the jawb CLI speaks. Replies come back
as v1 envelopes (serde_json::Value), exactly as the CLI's --json
output.
use jawb_sdk_rust::Client;
// Finds the daemon and its token the way the CLI does:
// JAWB_DAEMON (default http://127.0.0.1:4180) and JAWB_DATA_DIR
// (default: the platform data dir) for daemon.token.
let client = Client::discover()?;
let obs = client.observe("https://example.com").await?;
println!("{}", obs["result"]);
// Explicit address and data dir; any /v1 route through call():
let client = Client::from_data_dir("http://127.0.0.1:4180", std::path::Path::new("/path/to/data_dir"))?;
let tab = client.open("https://example.com").await?;
let read = client
.call("GET", &format!("/v1/tabs/{tab}/content?format=md"), None)
.await?;
The client only talks to a loopback daemon (127.0.0.1 or localhost):
other addresses are refused, so the token never leaves your machine.
call returns the envelope even when ok is false; open and
observe turn an ok: false envelope into an error.
TypeScript and Python equivalents are placeholders
(jawb-core/sdks/typescript/, jawb-core/sdks/python/), not implemented
yet.