abstractapi-rs
Rust API bindings for the Abstract HTTP API.
APIs
abstractapi-rs is compatible with v1 versions of the following API's that Abstract provides:
- Verify
- Lookup
- Create
Usage
Add abstractapi to dependencies in your Cargo.toml:
[]
= "0.1.*"
Getting Started
In order to interact with the APIs, you need to create a client (AbstractApi) first:
let mut abstractapi = default;
Then you should set an API key specific for the API you would like to use. Here is an example for Geolocation API:
abstractapi.set_api_key.unwrap;
See ApiType enum for currently supported APIs.
The next step would be calling the function related to the API you want to use:
let geolocation: Geolocation = abstractapi.get_geolocation.unwrap;
Function parameters and return values (Structs) are directly mapped from the official API documentation so you may frequently need to refer to it for the meaning of these fields.
Tips
- You can use the
preludemodule for glob-importing the common types. - There are alternative constructor methods available for creating a client with API keys. (e.g.
new_with_api_keys)
Here is a full example that shows the basic usage of phone validation API:
use *;
Examples
Look through the examples folder to see how the library can be used for integrating different APIs.
Contributing
Pull requests are welcome!
License
All code is dual-licensed under The MIT License and Apache 2.0 License.