pub struct ClientBuilder { /* private fields */ }Expand description
Builder for Client. Tunes timeouts, retry, UA, base URL, custom HTTP.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new(username: impl Into<String>, api_key: impl Into<String>) -> Self
pub fn new(username: impl Into<String>, api_key: impl Into<String>) -> Self
Start a builder with credentials. Call Self::build to finalize.
Sourcepub fn base_url(self, v: impl Into<String>) -> Self
pub fn base_url(self, v: impl Into<String>) -> Self
Override the API base URL (useful for mock servers).
Sourcepub fn connect_timeout(self, v: Duration) -> Self
pub fn connect_timeout(self, v: Duration) -> Self
TCP connect timeout (default 10s).
Sourcepub fn user_agent(self, v: impl Into<String>) -> Self
pub fn user_agent(self, v: impl Into<String>) -> Self
Override the User-Agent header (default clicksend-rs/<version>).
Sourcepub fn retry(self, v: RetryConfig) -> Self
pub fn retry(self, v: RetryConfig) -> Self
Configure retry behavior. Default is no retry.
Sourcepub fn http_client(self, http: HttpClient) -> Self
pub fn http_client(self, http: HttpClient) -> Self
Plug your own reqwest::Client — timeout/connect/UA on the builder are
then ignored.
Sourcepub fn build(self) -> Result<Client, ClickSendError>
pub fn build(self) -> Result<Client, ClickSendError>
Finalize. Errors with ClickSendError::InvalidConfig on empty creds.
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more