Struct square_rust::http::client::config::SquareHttpClientConfigBuilder
source · pub struct SquareHttpClientConfigBuilder { /* private fields */ }
Expand description
Builder for HTTP client settings Default values are used for any settings that are not explicitly set
Example - Create a new HTTP client with specific settings
use square_rust::http::client::config::SquareHttpClientConfig;
use square_rust::http::headers::Headers;
let http_client_configuration =
SquareHttpClientConfig::builder()
.timeout(15)
.user_agent(String::from("some_user_agent"))
.default_headers(Headers::default())
.build();
Example - Create a new HTTP client with default settings
use square_rust::http::client::config::SquareHttpClientConfig;
let http_client_configuration = SquareHttpClientConfig::builder().build();
Implementations§
source§impl SquareHttpClientConfigBuilder
impl SquareHttpClientConfigBuilder
Builder for HTTP client settings
sourcepub fn user_agent(&mut self, user_agent: String) -> &mut Self
pub fn user_agent(&mut self, user_agent: String) -> &mut Self
Sets the specific User Agent to use for requests
sourcepub fn default_headers(&mut self, default_headers: Headers) -> &mut Self
pub fn default_headers(&mut self, default_headers: Headers) -> &mut Self
Sets the default headers to send with each request
sourcepub fn retry_configuration(
&mut self,
retry_configuration: RetryConfig
) -> &mut Self
pub fn retry_configuration( &mut self, retry_configuration: RetryConfig ) -> &mut Self
Sets the retry configuration
sourcepub fn build(&self) -> SquareHttpClientConfig
pub fn build(&self) -> SquareHttpClientConfig
Builds the HTTP client configuration
Trait Implementations§
source§impl Default for SquareHttpClientConfigBuilder
impl Default for SquareHttpClientConfigBuilder
source§fn default() -> SquareHttpClientConfigBuilder
fn default() -> SquareHttpClientConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for SquareHttpClientConfigBuilder
impl Send for SquareHttpClientConfigBuilder
impl Sync for SquareHttpClientConfigBuilder
impl Unpin for SquareHttpClientConfigBuilder
impl UnwindSafe for SquareHttpClientConfigBuilder
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