Spring Boot library wrapper for PokéAPI.
- OpenFeign to interact with PokeAPI REST API
- Resources cached locally with Hazelcast
Add dependency to Github Package registry
The library is available in Github Package Registry:
-
Add the repository to the pom.xml
<repositories> <repository> <id>github</id> <name>GitHub dlfigueira spring-pokeapi</name> <url>https://maven.pkg.github.com/dlfigueira/spring-pokeapi</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories>
-
Add dependency
<dependencies> <dependency> <groupId>pt.figtreestudios</groupId> <artifactId>spring-pokeapi</artifactId> <version>1.0.0</version> </dependency> </dependencies>
-
Add server in .m2/settings.xml. ACCESS_TOKEN must have at least read:packages
<servers> <server> <id>github</id> <username>USER</username> <password>ACCESS_TOKEN</password> </server> </servers>
Alternatively, the source code can also be downloaded and installed in the local repository.
To use this library, add the following line to your Application class.
@Import(SpringPokeApiConfig.class)
This will bootstrap both OpenFeign and Hazelcast configurations. Or you can ignore this step and roll your own configurations.
This library exposes all resources as Spring components, which can be autowired into your code. Each component points to a separate resource in PokeAPI.
- PokeApiBerries
- PokeApiContests
- PokeApiEncounters
- PokeApiEvolution
- PokeApiGames
- PokeApiItems
- PokeApiLocations
- PokeApiMachines
- PokeApiMoves
- PokeApiPokemon
Each of these resources exposes a method to get all resources (paginated with a limit and offset) and methods to get resource by id or name, where available.
This project is licensed under the MIT license