Expand description
§Rustemon 
This library is a wrapper for the awesome PokeApi, which provides all the informations you need about Pokémons !
Fully written in Rust, this library covers the whole PokeApi
REST api v2.
§How to import it ?
Adds the following in the dependencies of your Cargo.toml :
rustemon = "4.2.0"
§How to use it ?
As you noticed in the documentation of PokeApi, every endpoints and models are declared in groups.
The library kept this group oriented architecture !
§Features
To support easier export to other tooling and libraries, the serialize
feature enables PokeApi
structs to be compiled with serde::Serialize
.
This feature is disabled by default.
[dependencies]
rustemon = { version = "*", features = ["serialize"] }
§Models
All the models are located into the following module :
rustemon::model
For example, if you want the type Pokemon
located in the group pokemon
, it is located here :
rustemon::model::pokemon::Pokemon
§Endpoints
The endpoints follow the same naming rule, for example, if you want to call the evolution chain endpoint from the evolution group :
rustemon::evolution::evolution_chain
For each endpoints, 4 functions are defined :
get_page
: without parameters, calls the endpoint without any informations to retrieve the first page of the paginated response for the endpoint, as defined here,get_page_with_param
: allows you to modify the parameters for the paginated query,get_by_id
: calls the endpoint using the id of the targeted resource,get_by_name
: calls the endpoint using the name of the targeted resource.
The endpoints are all async ! Which means you NEED to add a async runtime (such as tokio for example), in order for the library to work.
§Caching
All calls to the API are cached by a middleware attached to the RustemonClient
you need to instanciate in order
to make calls to the PokeAPI
.
§Examples
Examples and use cases are available in the examples
folder. For instance, you can run the async_follow
example using
cargo run --example async_follow
§License
The license of the library can be found here.
§Contribution
If you find any bug or improvement that you find valuable, please fill an issue right there -> project issues
Modules§
- berries
- Berries endpoints group
- client
- Defines the client used to access Pokeapi.
- contests
- Contests endpoints group
- encounters
- Encounters endpoints group
- error
- Error package
- evolution
- Evolution endpoints group
- games
- Games endpoints group
- items
- Items endpoints group
- locations
- Locations endpoints group
- machines
- Machines endpoints group
- model
- Module containing all models returned by
PokeApi
. - moves
- Moves endpoints group
- pokemon
- Pokemon endpoints group
- utility
- Utility endpoints group
Traits§
- Follow
- Trait representing types that can be followed to ease navigation through the API.