pub struct IpApiClient {
pub client: Client,
pub limiter: Option<DefaultDirectRateLimiter>,
pub api_key: Option<String>,
}
Expand description
The main client for the ip-api.com API.
Fields§
§client: Client
The client to use for the requests.
limiter: Option<DefaultDirectRateLimiter>
The rate limiter to use for the requests.
api_key: Option<String>
The API key to use for the requests.
Implementations§
Source§impl IpApiClient
impl IpApiClient
Sourcepub fn new_with_api_key(api_key: String) -> Self
pub fn new_with_api_key(api_key: String) -> Self
Creates a new IpApiClient with an API key.
Trait Implementations§
Source§impl AsyncIpApi for IpApiClient
impl AsyncIpApi for IpApiClient
Source§async fn query_api_default(
&self,
ip: &str,
) -> Result<IpDefaultResponse, IpApiError>
async fn query_api_default( &self, ip: &str, ) -> Result<IpDefaultResponse, IpApiError>
Queries the API with the default fields. Read more
Source§async fn query_api_fully(&self, ip: &str) -> Result<IpFullResponse, IpApiError>
async fn query_api_fully(&self, ip: &str) -> Result<IpFullResponse, IpApiError>
Queries the API with all fields. Read more
Source§async fn query_api<T>(&self, ip: &str) -> Result<T, IpApiError>where
T: DeserializeOwned,
async fn query_api<T>(&self, ip: &str) -> Result<T, IpApiError>where
T: DeserializeOwned,
Queries the API with a custom struct. Read more
Source§fn get_http_client(&self) -> &Client
fn get_http_client(&self) -> &Client
Gets you the async http client. Read more
Source§impl Default for IpApiClient
impl Default for IpApiClient
Source§impl IpApi for IpApiClient
impl IpApi for IpApiClient
Source§fn get_rate_limiter(&self) -> &Option<DefaultDirectRateLimiter>
fn get_rate_limiter(&self) -> &Option<DefaultDirectRateLimiter>
Gets the rate limiter. Read more
Auto Trait Implementations§
impl !Freeze for IpApiClient
impl !RefUnwindSafe for IpApiClient
impl Send for IpApiClient
impl Sync for IpApiClient
impl Unpin for IpApiClient
impl !UnwindSafe for IpApiClient
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