pub struct ClientBuilder { /* private fields */ }Expand description
Builder for HypixelClient.
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 used to authenticate keyed endpoints.
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Override the API base URL. Primarily useful for testing.
Sourcepub fn http_client(self, http: Client) -> Self
pub fn http_client(self, http: Client) -> Self
Supply a pre-configured reqwest::Client (proxies, custom TLS, etc.).
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set a per-request timeout. Ignored if a custom client is supplied.
Sourcepub fn retry_on_rate_limit(self, retries: u32) -> Self
pub fn retry_on_rate_limit(self, retries: u32) -> Self
Automatically retry rate-limited requests up to retries times,
waiting out the Retry-After interval (or one second) between
attempts. Off by default.
Sourcepub fn cache_ttl(self, ttl: Duration) -> Self
pub fn cache_ttl(self, ttl: Duration) -> Self
Cache successful responses in memory for ttl, keyed by path and
query. Off by default.
Repeated calls to snapshot endpoints (bazaar, resources, auctions) within the TTL are then served without hitting the API. Hypixel refreshes most snapshots every ~60 seconds, so TTLs beyond that only trade staleness for fewer requests.
Sourcepub fn build(self) -> HypixelClient
pub fn build(self) -> HypixelClient
Build the HypixelClient.