pub struct AkribesClientBuilder { /* private fields */ }Implementations§
Source§impl AkribesClientBuilder
impl AkribesClientBuilder
Sourcepub fn project_id(self, project_id: i64) -> Self
pub fn project_id(self, project_id: i64) -> Self
Set the project ID. Required for project-scoped operations (scripts, executions, etc.). Omit for global-only usage (list_projects, etc.).
Sourcepub fn token(self, token: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
Initial authentication token. Either:
- a service token (the secret part of
AKRIBES_SERVICE_TOKEN_<NAME>=<scope>:<secret>), or - a scoped token of the form
akribes_tk_<...>(legacyaura_tk_<...>still accepted) minted viacrate::sub::tokens::TokensClient::mint.
Sourcepub fn on_behalf_of(self, email: impl Into<String>) -> Self
pub fn on_behalf_of(self, email: impl Into<String>) -> Self
Set the X-Akribes-User header sent on every outbound request.
Used by the server for metrics attribution when a backend (typically holding a service token) acts on behalf of an end user. Advisory only — does not grant any permission. Authorization remains based on the bearer token’s scope.
Mirrors the TS AkribesClientOptions.onBehalfOf and Python
AkribesClient(on_behalf_of=...) knobs. Use
AkribesClient::set_on_behalf_of to update the value at runtime.
let client = AkribesClient::builder("http://localhost:3001")
.project_id(2)
.token(std::env::var("AKRIBES_SERVICE_TOKEN").unwrap())
.on_behalf_of("alice@acme.com")
.build();Sourcepub fn http_client(self, client: Client) -> Self
pub fn http_client(self, client: Client) -> Self
Use a pre-configured reqwest::Client so multiple AkribesClients
can share a connection pool, proxy settings, or TLS configuration.
If not called, a default reqwest::Client is created with a 60s
request timeout and a 10s connect timeout.
Sourcepub fn ingest_poll_timeout(self, timeout: Duration) -> Self
pub fn ingest_poll_timeout(self, timeout: Duration) -> Self
Override the deadline documents().ingest() waits for a still-converting
blob before surfacing AkribesError::Transient.
Resolution order at build time:
- This builder param if set.
AKRIBES_SDK_INGEST_TIMEOUT_SECSenv var (parsed asu64seconds;0and unparseable values are ignored).- [
DEFAULT_INGEST_POLL_TIMEOUT_SECS] (300 s).
Setting this to a very short duration is occasionally useful in tests that want to assert the timeout path. Setting it absurdly long (hours) just shifts the failure mode — the server has its own conversion timeouts.
Sourcepub fn build(self) -> AkribesClient
pub fn build(self) -> AkribesClient
Build the client.