pub struct ClientBuilder { /* private fields */ }Expand description
Builder for Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn url(self, u: impl Into<String>) -> Self
pub fn url(self, u: impl Into<String>) -> Self
Set the base URL of the Zammad instance, e.g. https://help.example.com.
Trailing slashes are tolerated and trimmed.
Sourcepub fn timeout(self, d: Duration) -> Self
pub fn timeout(self, d: Duration) -> Self
Set the per-request timeout. Defaults to 60 seconds when Self::http_client
is not supplied; ignored otherwise.
Sourcepub fn user_agent(self, ua: impl Into<String>) -> Self
pub fn user_agent(self, ua: impl Into<String>) -> Self
Override the User-Agent header. Defaults to zammad-api/<version>.
Sourcepub fn http_client(self, http: Http) -> Self
pub fn http_client(self, http: Http) -> Self
Supply a preconfigured reqwest::Client (proxies, custom TLS,
connection pooling, middleware, …).
When set, Self::timeout and Self::user_agent are ignored - they
belong to the underlying HTTP client.
Sourcepub fn build(self) -> Result<Client>
pub fn build(self) -> Result<Client>
Finalize the builder.
§Errors
Returns Error::Config when the URL or auth is missing, and
Error::InvalidUrl / Error::Http for parse or HTTP-stack
initialisation failures.
Trait Implementations§
Source§impl Debug for ClientBuilder
impl Debug for ClientBuilder
Source§impl Default for ClientBuilder
impl Default for ClientBuilder
Source§fn default() -> ClientBuilder
fn default() -> ClientBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ClientBuilder
impl !UnwindSafe for ClientBuilder
impl Freeze for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin 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