Skip to content
v3.0.0
No. 001 Kotlin library

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
Latest version on Maven Central Javadoc License Discord

How it works

You never name an endpoint. You name a type, and PokeApi resolves the endpoint from it:

// inside a coroutine
val pikachu    = PokeApi.get<Pokemon>(name = "pikachu")       // GET /pokemon/pikachu
val cheriBerry = PokeApi.get<Berry>(id = 1)                   // GET /berry/1
val firstTen   = PokeApi.list<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. Each call above is suspend; a getBlocking/listBlocking counterpart exists for callers outside a coroutine.

Where to go next