pub struct ClientBuilder { /* private fields */ }Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn secret_key(self, secret_key: impl Into<String>) -> Self
pub fn secret_key(self, secret_key: impl Into<String>) -> Self
Sets the Alpaca API secret key.
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Overrides the default data API base URL.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets the request timeout for the internally constructed reqwest::Client.
Building fails if reqwest_client(...) is also used because the injected
client owns its own timeout configuration.
Sourcepub fn reqwest_client(self, reqwest_client: Client) -> Self
pub fn reqwest_client(self, reqwest_client: Client) -> Self
Injects a preconfigured reqwest::Client for advanced transport tuning.
The injected client owns reqwest-level behavior such as connection
pooling, proxy behavior, default headers, and timeout settings. Build
validation rejects conflicting builder settings such as timeout(...).
Sourcepub fn observer(self, observer: Arc<dyn TransportObserver>) -> Self
pub fn observer(self, observer: Arc<dyn TransportObserver>) -> Self
Registers an immutable observer for successful transport responses.
Observers receive endpoint metadata only. They cannot change request execution or response shaping.
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Sets the maximum number of retry attempts for one request.
This applies to server-error retries by default. HTTP 429 retries only
participate when Self::retry_on_429 is enabled.
Sourcepub fn retry_on_429(self, retry_on_429: bool) -> Self
pub fn retry_on_429(self, retry_on_429: bool) -> Self
Enables or disables automatic retries on HTTP 429 responses.
This setting is disabled by default and affects only 429 responses. It
does not automatically enable honoring Retry-After.
Sourcepub fn respect_retry_after(self, respect_retry_after: bool) -> Self
pub fn respect_retry_after(self, respect_retry_after: bool) -> Self
Enables or disables honoring the Retry-After response header.
This setting only participates when 429 retries are enabled with
Self::retry_on_429. If a 429 response omits Retry-After, the
transport falls back to the configured backoff schedule.
Sourcepub fn base_backoff(self, base_backoff: Duration) -> Self
pub fn base_backoff(self, base_backoff: Duration) -> Self
Sets the base retry backoff used by the shared HTTP transport.
Sourcepub fn max_backoff(self, max_backoff: Duration) -> Self
pub fn max_backoff(self, max_backoff: Duration) -> Self
Sets the maximum retry backoff used by the shared HTTP transport.
Sourcepub fn retry_jitter(self, retry_jitter: Duration) -> Self
pub fn retry_jitter(self, retry_jitter: Duration) -> Self
Adds a bounded random delay on top of each computed retry wait.
Jitter helps concurrent callers avoid retrying in lockstep. The transport keeps the added delay within the configured retry budget and maximum backoff constraints.
Sourcepub fn total_retry_budget(self, total_retry_budget: Duration) -> Self
pub fn total_retry_budget(self, total_retry_budget: Duration) -> Self
Sets an optional elapsed-time budget for one request’s retry loop.
The transport subtracts the request’s retry-loop elapsed time from this
budget before each retry decision. The remaining budget then caps each
scheduled retry wait, including waits derived from Retry-After and
waits with jitter enabled.
Sourcepub fn credentials_from_env(self) -> Result<Self, Error>
pub fn credentials_from_env(self) -> Result<Self, Error>
Loads credentials from APCA_API_KEY_ID and APCA_API_SECRET_KEY.
If both variables are unset, the builder is left unchanged. If only one
side is set, this returns Error::InvalidConfiguration.
Sourcepub fn credentials_from_env_names(
self,
api_key_var: &str,
secret_key_var: &str,
) -> Result<Self, Error>
pub fn credentials_from_env_names( self, api_key_var: &str, secret_key_var: &str, ) -> Result<Self, Error>
Loads credentials from the provided environment variable names.
If both variables are unset, the builder is left unchanged. If only one
side is set, this returns Error::InvalidConfiguration.
Sourcepub fn max_in_flight(self, max_in_flight: usize) -> Self
pub fn max_in_flight(self, max_in_flight: usize) -> Self
Sets the maximum number of concurrent in-flight requests.
Trait Implementations§
Source§impl Clone for ClientBuilder
impl Clone for ClientBuilder
Source§fn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more