pub struct WebClient {
pub http_client: Client,
pub api_keys: ApiKeys,
pub config: ClientConfig,
pub http_config: HttpConfig,
}Expand description
A client for interacting with various web APIs and services
Fields§
§http_client: ClientHTTP client for making requests
api_keys: ApiKeysType-safe API keys
config: ClientConfigType-safe configuration
http_config: HttpConfigHTTP configuration
Implementations§
Source§impl WebClient
impl WebClient
Sourcepub fn with_config(http_config: HttpConfig) -> Result<Self>
pub fn with_config(http_config: HttpConfig) -> Result<Self>
Create with custom HTTP configuration
Sourcepub fn with_api_key<S1: Into<String>, S2: Into<String>>(
self,
service: S1,
api_key: S2,
) -> Self
pub fn with_api_key<S1: Into<String>, S2: Into<String>>( self, service: S1, api_key: S2, ) -> Self
Set API key for a service (for backwards compatibility)
Sourcepub fn with_twitter_token<S: Into<String>>(self, token: S) -> Self
pub fn with_twitter_token<S: Into<String>>(self, token: S) -> Self
Set Twitter/X Bearer Token
Sourcepub fn with_exa_key<S: Into<String>>(self, key: S) -> Self
pub fn with_exa_key<S: Into<String>>(self, key: S) -> Self
Set Exa API key
Sourcepub fn with_dexscreener_key<S: Into<String>>(self, key: S) -> Self
pub fn with_dexscreener_key<S: Into<String>>(self, key: S) -> Self
Set DexScreener API key (if required)
Sourcepub fn with_news_api_key<S: Into<String>>(self, key: S) -> Self
pub fn with_news_api_key<S: Into<String>>(self, key: S) -> Self
Set News API key
Sourcepub fn set_config<S: Into<String>>(&mut self, key: S, value: S)
pub fn set_config<S: Into<String>>(&mut self, key: S, value: S)
Set configuration option (for backwards compatibility)
Sourcepub fn get_api_key(&self, service: &str) -> Option<&String>
pub fn get_api_key(&self, service: &str) -> Option<&String>
Get API key for a service
Sourcepub fn get_config(&self, key: &str) -> Option<String>
pub fn get_config(&self, key: &str) -> Option<String>
Get config value (for backwards compatibility)
Sourcepub async fn get_with_headers(
&self,
url: &str,
headers: HashMap<String, String>,
) -> Result<String>
pub async fn get_with_headers( &self, url: &str, headers: HashMap<String, String>, ) -> Result<String>
Make a GET request with headers and retry logic
Sourcepub async fn get_with_params(
&self,
url: &str,
params: &HashMap<String, String>,
) -> Result<String>
pub async fn get_with_params( &self, url: &str, params: &HashMap<String, String>, ) -> Result<String>
Make GET request with query parameters
Sourcepub async fn get_with_params_and_headers(
&self,
url: &str,
params: &HashMap<String, String>,
headers: HashMap<String, String>,
) -> Result<String>
pub async fn get_with_params_and_headers( &self, url: &str, params: &HashMap<String, String>, headers: HashMap<String, String>, ) -> Result<String>
Make GET request with query parameters and headers
Sourcepub async fn post<T: Serialize>(&self, url: &str, body: &T) -> Result<Value>
pub async fn post<T: Serialize>(&self, url: &str, body: &T) -> Result<Value>
Make a POST request with JSON body
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebClient
impl !RefUnwindSafe for WebClient
impl Send for WebClient
impl Sync for WebClient
impl Unpin for WebClient
impl !UnwindSafe for WebClient
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