pub struct ClientBuilder { /* private fields */ }Expand description
Builds a Client.
URLs must be https, except on a loopback host (a local mock server).
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
The API’s base URL. Default DEFAULT_BASE_URL.
Sourcepub fn token_url(self, url: impl Into<String>) -> Self
pub fn token_url(self, url: impl Into<String>) -> Self
The token endpoint’s URL. Default DEFAULT_TOKEN_URL.
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
The User-Agent. Default DEFAULT_USER_AGENT.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
The whole-request timeout. Default DEFAULT_TIMEOUT.
Sourcepub fn http_client(self, http: Client) -> Self
pub fn http_client(self, http: Client) -> Self
Sends with your own reqwest::Client (to share its connection pool,
proxy or TLS settings) instead of building one.
ClientBuilder::user_agent and ClientBuilder::timeout are then
not applied: set them on your client. Build it with
.redirect(reqwest::redirect::Policy::none()): a client that follows
redirects would carry the bearer token (and the refresh token’s
request) to wherever the redirect points. This crate can’t check
that for you.
Sourcepub fn build(self) -> Result<Client, Error>
pub fn build(self) -> Result<Client, Error>
The client.
§Errors
Error::Config: a URL that doesn’t parse or isn’t https (or
loopback), or a User-Agent that isn’t a valid header value.
Error::Transport: the TLS backend couldn’t start.