PokeApi
A Kotlin wrapper for pokeapi.co. One generic
get() resolves the endpoint from the entity type you ask for, then maps the
JSON response into a data class.
- Kotlin 2.1
- JVM 17
- MIT
- Endpoints
- 48
- Entity groups
- 11
- Coordinates
- fr.tykok:pokeapi
How it works¶
You never name an endpoint. You name a type, and PokeApi resolves the endpoint from it:
val pikachu = PokeApi.get<Pokemon>(name = "pikachu") // GET /pokemon/pikachu
val cheriBerry = PokeApi.get<Berry>(id = 1) // GET /berry/1
val firstTen = PokeApi.get<Pokemon>(limit = 10, offset = 0) // GET /pokemon?offset=0&limit=10
Every response is mapped into a Kotlin data class, so the compiler — not the JSON — tells you what a resource contains.
Where to go next¶
- Getting started — add the dependency to Gradle or Maven
- Methods — the three
get()overloads and their parameters - API Reference — all 48 endpoints, grouped
- Contributing — issues and pull requests welcome