pub struct WritAgentBuilder { /* private fields */ }Expand description
Configuration builder. build() performs no network I/O (and no filesystem
discovery); the only I/O it can do is reading the CA file passed to
WritAgentBuilder::ca_pem_file. discover() runs the full DESIGN.md §4
algorithm for whichever of base URL / token was not provided.
Implementations§
Source§impl WritAgentBuilder
impl WritAgentBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Base URL of the daemon, e.g. http://127.0.0.1:8131. No trailing /v1 —
the SDK appends path prefixes itself. A trailing / is stripped.
Sourcepub fn token(self, token: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
Bearer token (wlt_ runtime token, wlk_ scoped key, or wlo_ OAuth
token) — treated as an opaque string.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Per-request timeout (default 30 s). run_and_wait and events() manage
their own deadlines.
Sourcepub fn ca_pem_file(self, path: impl Into<PathBuf>) -> Self
pub fn ca_pem_file(self, path: impl Into<PathBuf>) -> Self
PEM file of the daemon’s local CA (~/.writ/tls/ca.pem) for the HTTPS twin
port. Read (filesystem only) at build()/discover() time.
Sourcepub fn build(self) -> Result<WritAgent>
pub fn build(self) -> Result<WritAgent>
Build the client from explicit options (env WRIT_API_URL/WRIT_TOKEN
fill gaps; base URL defaults to http://127.0.0.1:8131). No network or
filesystem discovery, no liveness probe. Fails with a discovery error
when no token can be resolved.
Sourcepub async fn discover(self) -> Result<WritAgent>
pub async fn discover(self) -> Result<WritAgent>
Full discovery (DESIGN.md §4) for whichever of base URL / token this
builder does not already have: env overrides, then the runtime.json
candidate walk with a 2 s GET /v1/agent liveness probe per candidate
(stale descriptors fall through to the next candidate).
Trait Implementations§
Source§impl Clone for WritAgentBuilder
impl Clone for WritAgentBuilder
Source§fn clone(&self) -> WritAgentBuilder
fn clone(&self) -> WritAgentBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more