pub struct AbstractApi { /* private fields */ }Expand description
Client for Abstract API.
Implementations§
Source§impl AbstractApi
impl AbstractApi
Sourcepub fn new<S: Into<String>>(
http_client: HttpClient,
api_keys: Vec<(ApiType, S)>,
) -> Result<Self, Error>
pub fn new<S: Into<String>>( http_client: HttpClient, api_keys: Vec<(ApiType, S)>, ) -> Result<Self, Error>
Creates a new Abstract API client with the default HTTP client.
Sourcepub fn new_with_http_client(http_client: HttpClient) -> Self
pub fn new_with_http_client(http_client: HttpClient) -> Self
Creates a new Abstract API client that uses the given HTTP client.
Sourcepub fn new_with_api_key<S: Into<String>>(
api_type: ApiType,
api_key: S,
) -> Result<Self, Error>
pub fn new_with_api_key<S: Into<String>>( api_type: ApiType, api_key: S, ) -> Result<Self, Error>
Creates a new Abstract API client with the given API key set.
Sourcepub fn new_with_api_keys<S: Into<String>>(
api_keys: Vec<(ApiType, S)>,
) -> Result<Self, Error>
pub fn new_with_api_keys<S: Into<String>>( api_keys: Vec<(ApiType, S)>, ) -> Result<Self, Error>
Creates a new Abstract API client with the given API keys set.
Sourcepub fn set_api_key<S: Into<String>>(
&mut self,
api_type: ApiType,
api_key: S,
) -> Result<(), Error>
pub fn set_api_key<S: Into<String>>( &mut self, api_type: ApiType, api_key: S, ) -> Result<(), Error>
Sets an API key for an API.
Sourcepub fn set_api_keys<S: Into<String>>(
&mut self,
api_keys: Vec<(ApiType, S)>,
) -> Result<(), Error>
pub fn set_api_keys<S: Into<String>>( &mut self, api_keys: Vec<(ApiType, S)>, ) -> Result<(), Error>
Sets the API keys for specified APIs.
Sourcepub fn get_geolocation<S: AsRef<str>>(
&self,
ip_address: S,
) -> Result<Geolocation, Error>
pub fn get_geolocation<S: AsRef<str>>( &self, ip_address: S, ) -> Result<Geolocation, Error>
Upstream documentation: https://app.abstractapi.com/api/ip-geolocation/documentation
Sourcepub fn get_holidays<S: AsRef<str>>(
&self,
country: S,
year: S,
month: S,
day: S,
) -> Result<Holidays, Error>
pub fn get_holidays<S: AsRef<str>>( &self, country: S, year: S, month: S, day: S, ) -> Result<Holidays, Error>
Upstream documentation: https://app.abstractapi.com/api/holidays/documentation
Sourcepub fn get_latest_exchange_rates<S: AsRef<str>>(
&self,
base: S,
target: Option<S>,
) -> Result<ExchangeRatesResult, Error>
pub fn get_latest_exchange_rates<S: AsRef<str>>( &self, base: S, target: Option<S>, ) -> Result<ExchangeRatesResult, Error>
Upstream documentation: https://app.abstractapi.com/api/exchange-rates/documentation
Sourcepub fn get_historical_exchange_rates<S: AsRef<str>>(
&self,
base: S,
target: Option<S>,
date: S,
) -> Result<ExchangeRatesResult, Error>
pub fn get_historical_exchange_rates<S: AsRef<str>>( &self, base: S, target: Option<S>, date: S, ) -> Result<ExchangeRatesResult, Error>
Upstream documentation: https://app.abstractapi.com/api/exchange-rates/documentation
Sourcepub fn convert_currency<S: AsRef<str>>(
&self,
base: S,
target: S,
date: Option<S>,
base_amount: Option<u64>,
) -> Result<ConvertedExchangeRate, Error>
pub fn convert_currency<S: AsRef<str>>( &self, base: S, target: S, date: Option<S>, base_amount: Option<u64>, ) -> Result<ConvertedExchangeRate, Error>
Upstream documentation: https://app.abstractapi.com/api/exchange-rates/documentation
Sourcepub fn get_company_details<S: AsRef<str>>(
&self,
domain: Option<S>,
email: Option<S>,
) -> Result<CompanyDetails, Error>
pub fn get_company_details<S: AsRef<str>>( &self, domain: Option<S>, email: Option<S>, ) -> Result<CompanyDetails, Error>
Upstream documentation: https://app.abstractapi.com/api/company-enrichment/documentation
Sourcepub fn get_current_time<S: AsRef<str>>(
&self,
location: S,
) -> Result<LocationTime, Error>
pub fn get_current_time<S: AsRef<str>>( &self, location: S, ) -> Result<LocationTime, Error>
Upstream documentation: https://app.abstractapi.com/api/timezone/documentation
Sourcepub fn convert_time<S: AsRef<str>>(
&self,
base_location: S,
base_datetime: S,
target_location: S,
) -> Result<ConvertedTime, Error>
pub fn convert_time<S: AsRef<str>>( &self, base_location: S, base_datetime: S, target_location: S, ) -> Result<ConvertedTime, Error>
Upstream documentation: https://app.abstractapi.com/api/timezone/documentation
Sourcepub fn validate_email<S: AsRef<str>>(
&self,
email: S,
auto_correct: bool,
) -> Result<EmailDetails, Error>
pub fn validate_email<S: AsRef<str>>( &self, email: S, auto_correct: bool, ) -> Result<EmailDetails, Error>
Upstream documentation: https://app.abstractapi.com/api/email-validation/documentation
Sourcepub fn validate_phone<S: AsRef<str>>(
&self,
phone: S,
) -> Result<PhoneDetails, Error>
pub fn validate_phone<S: AsRef<str>>( &self, phone: S, ) -> Result<PhoneDetails, Error>
Upstream documentation: https://app.abstractapi.com/api/phone-validation/documentation
Sourcepub fn validate_vat<S: AsRef<str>>(
&self,
vat_number: S,
) -> Result<VatDetails, Error>
pub fn validate_vat<S: AsRef<str>>( &self, vat_number: S, ) -> Result<VatDetails, Error>
Upstream documentation: https://app.abstractapi.com/api/vat/documentation
Sourcepub fn calculate_vat<S: AsRef<str>>(
&self,
amount: f64,
country_code: S,
is_vat_incl: bool,
vat_category: Option<S>,
) -> Result<Vat, Error>
pub fn calculate_vat<S: AsRef<str>>( &self, amount: f64, country_code: S, is_vat_incl: bool, vat_category: Option<S>, ) -> Result<Vat, Error>
Upstream documentation: https://app.abstractapi.com/api/vat/documentation
Sourcepub fn get_vat_rates<S: AsRef<str>>(
&self,
country_code: S,
) -> Result<VatRates, Error>
pub fn get_vat_rates<S: AsRef<str>>( &self, country_code: S, ) -> Result<VatRates, Error>
Upstream documentation: https://app.abstractapi.com/api/vat/documentation