pub struct ClientBuilder { /* private fields */ }Expand description
Builder for Client. Explicit values win over environment variables.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
API root without trailing slash. Falls back to TYPESAFE_BASE_URL, then
DEFAULT_BASE_URL.
Sourcepub fn model(self, model: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
Default model for Client::system_one. Falls back to TYPESAFE_DEFAULT_MODEL,
then DEFAULT_MODEL. Pin a versioned id (e.g. jev-1.13.0) once thresholds are tuned.
Sourcepub fn retry(self, retry: RetryPolicy) -> Self
pub fn retry(self, retry: RetryPolicy) -> Self
Retry policy. Defaults to RetryPolicy::default.
Sourcepub fn http_client(self, http: Client) -> Self
pub fn http_client(self, http: Client) -> Self
Reuse an existing reqwest::Client (TLS backend, proxies, pools). When set, this
crate’s own TLS features are irrelevant.
Sourcepub fn build(self) -> Result<Client>
pub fn build(self) -> Result<Client>
Build the client.
§Errors
Error::Config when no API key is set (builder or TYPESAFE_API_KEY), when the
default HTTP client cannot be built, or when this crate was compiled without a TLS
backend (default-features = false, neither rustls nor native-tls) and no
http_client was supplied to stand in for one.