pub struct ClientBuilder { /* private fields */ }Expand description
Builds a Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn token(self, token: impl Into<Secret>) -> Self
pub fn token(self, token: impl Into<Secret>) -> Self
Authenticates with an API token, or a login token from
log_in.
Sourcepub fn basic_auth(
self,
username: impl Into<String>,
password: impl Into<Secret>,
) -> Self
pub fn basic_auth( self, username: impl Into<String>, password: impl Into<Secret>, ) -> Self
Authenticates with HTTP Basic.
Only the dynDNS update endpoint accepts this; the REST API needs
token.
Sourcepub fn base_url(self, base: impl Into<String>) -> Self
pub fn base_url(self, base: impl Into<String>) -> Self
Overrides the API root. Defaults to DEFAULT_BASE_URL.
Point this at a mock server in tests, or at a self-hosted desec-stack.
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Overrides the User-Agent.
Sourcepub fn rate_limits(self, limits: RateLimits) -> Self
pub fn rate_limits(self, limits: RateLimits) -> Self
Replaces the client-side rate limits.
Defaults to RateLimits::desec_defaults. Pass RateLimits::unlimited to send
requests as fast as the caller asks and deal with 429s reactively.
Sourcepub fn max_rate_limit_wait(self, max_wait: Duration) -> Self
pub fn max_rate_limit_wait(self, max_wait: Duration) -> Self
Longest the client-side limiter may sleep before giving up with
Error::RateLimitWouldBlock.
Defaults to 60 seconds, which admits the per-second and per-minute buckets but fails fast when an hourly or daily bucket is exhausted, rather than parking a task for hours.
Sourcepub fn max_retries(self, retries: u32) -> Self
pub fn max_retries(self, retries: u32) -> Self
Retries after the first attempt, for 429s, 5xxs and connection failures.
Defaults to 3; zero disables retrying.
Sourcepub fn max_retry_delay(self, delay: Duration) -> Self
pub fn max_retry_delay(self, delay: Duration) -> Self
Longest single retry sleep to accept. Defaults to 60 seconds.
A Retry-After longer than this fails with Error::RateLimited instead of
blocking.
Sourcepub fn http_client(self, http: Client) -> Self
pub fn http_client(self, http: Client) -> Self
Supplies a preconfigured reqwest::Client, for proxy or TLS settings this
builder does not expose. Overrides timeout and
user_agent.