pub struct HttpConfig {
pub base_url: Url,
pub timeout: Duration,
pub max_retries: u32,
pub user_agent: String,
pub testnet: bool,
pub credentials: Option<ApiCredentials>,
}Expand description
Configuration for the HTTP client
Fields§
§base_url: UrlBase URL for API requests
timeout: DurationRequest timeout
max_retries: u32Maximum number of retries
user_agent: StringUser agent string
testnet: boolWhether to use testnet
credentials: Option<ApiCredentials>API credentials
Implementations§
Source§impl HttpConfig
impl HttpConfig
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the timeout for requests
Sourcepub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
Set the maximum number of retries
Sourcepub fn with_user_agent(self, user_agent: String) -> Self
pub fn with_user_agent(self, user_agent: String) -> Self
Set the user agent string
Sourcepub fn with_oauth2(self, client_id: String, client_secret: String) -> Self
pub fn with_oauth2(self, client_id: String, client_secret: String) -> Self
Set OAuth2 credentials
Sourcepub fn has_credentials(&self) -> bool
pub fn has_credentials(&self) -> bool
Check if credentials are configured
Sourcepub fn credentials(&self) -> Option<&ApiCredentials>
pub fn credentials(&self) -> Option<&ApiCredentials>
Get the credentials
Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpConfig
impl Debug for HttpConfig
Source§impl Default for HttpConfig
impl Default for HttpConfig
Source§impl<'de> Deserialize<'de> for HttpConfig
impl<'de> Deserialize<'de> for HttpConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for HttpConfig
impl Display for HttpConfig
Auto Trait Implementations§
impl Freeze for HttpConfig
impl RefUnwindSafe for HttpConfig
impl Send for HttpConfig
impl Sync for HttpConfig
impl Unpin for HttpConfig
impl UnwindSafe for HttpConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.