pub struct ClientBuilder { /* private fields */ }Expand description
Builds TypeSafeClients.
Explicit options take precedence over environment variables, which take precedence over defaults. Empty or whitespace-only environment values are ignored.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn api_key(self, api_key: impl Into<String>) -> Self
pub fn api_key(self, api_key: impl Into<String>) -> Self
Set the API key. Required unless ENV_API_KEY is set.
Sourcepub fn model(self, model: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
Set the default model (default: jev-latest).
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Set the API root (default: https://api.typesafe.ai).
Sourcepub fn retry(self, retry: RetryPolicy) -> Self
pub fn retry(self, retry: RetryPolicy) -> Self
Set the retry policy (default: RetryPolicy::default).
Sourcepub fn default_headers(self, headers: HeaderMap) -> Self
pub fn default_headers(self, headers: HeaderMap) -> Self
Additional headers to send with every request. Authorization,
Accept, and Content-Type remain managed by the SDK.
Sourcepub fn http_client(self, client: Client) -> Self
pub fn http_client(self, client: Client) -> Self
Supply a preconfigured reqwest client.
The timeout and default_headers options are ignored when a client
is supplied, and the supplied client’s configuration wins. The caller
is then responsible for its hardening (TLS verification, redirect
policy, timeouts) — the SDK’s defaults (redirects disabled, 60s
timeout, rustls with certificate verification) no longer apply.
Sourcepub fn build(self) -> Result<TypeSafeClient, Error>
pub fn build(self) -> Result<TypeSafeClient, Error>
Build the client.