pub struct ClientBuilder { /* private fields */ }Expand description
Configures and builds a client.
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
The API key. Without it the client reads the API key environment
variable (API_KEY_ENV).
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
The API base URL. Defaults to the production URL
(DEFAULT_BASE_URL).
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
The timeout of each attempt, from connecting until the response body has been read. Defaults to 30 s.
Sourcepub fn retry(self, retry: RetryPolicy) -> Self
pub fn retry(self, retry: RetryPolicy) -> Self
The retry policy. Defaults to RetryPolicy::default.
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Retries after the first attempt, keeping the rest of the policy.
Sourcepub fn project(self, project: impl Into<String>) -> Self
pub fn project(self, project: impl Into<String>) -> Self
Act inside one project: its id, or ext:<externalId>. Sent as the
project header on every request. With a project API key it may be
omitted (the key already names its project).
Sourcepub fn stream_base_url(self, stream_base_url: impl Into<String>) -> Self
pub fn stream_base_url(self, stream_base_url: impl Into<String>) -> Self
Where the event stream is served, for an API that has one. Defaults to the stream’s production URL, or to the origin of the base URL when that is not the API’s production URL.
Sourcepub fn http_client(self, client: Client) -> Self
pub fn http_client(self, client: Client) -> Self
A reqwest client to send requests with, to bring your own proxy,
TLS or connection pool settings. The per-attempt timeout and the
User-Agent of this crate still apply.
Sourcepub fn build(self) -> Result<Client, Error>
pub fn build(self) -> Result<Client, Error>
Builds the client.
§Errors
Error::Config when there is no API key, the project is longer than
200 characters, or the HTTP client cannot be created.