pub struct SlackClientBuilder { /* private fields */ }Expand description
Builder for SlackClient.
Implementations§
Source§impl SlackClientBuilder
impl SlackClientBuilder
pub fn token(self, token: impl Into<String>) -> Self
Sourcepub fn http_client(self, http: Client) -> Self
pub fn http_client(self, http: Client) -> Self
Uses an existing reqwest::Client so the application and Slack share one connection pool.
Its own settings (timeouts, proxy, …) are used as they are.
Without it, the client is built with a 30 second request timeout and a 10 second connect timeout.
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Base URL of the API (default https://slack.com/api/). Set it for GovSlack
(https://slack-gov.com/api/) or for a mock server in tests.
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
How many times a request is resent after a 429, waiting for Retry-After each time.
The default is 0: a 429 is returned at once as SlackError::RateLimited with the
Retry-After value, because only the caller knows how long a request may wait.
Other failures (5xx, network errors) are never retried, to avoid posting twice.
Sourcepub fn build(self) -> SlackClient
pub fn build(self) -> SlackClient
Builds the client.
§Panics
When no http_client was given and the TLS backend cannot be initialized, like
reqwest::Client::new().