Skip to content
v3.0.0

Getting started

Install

The library is published on Maven Central as fr.tykok:pokeapi. Pick your build system:

build.gradle.kts
dependencies {
    implementation("fr.tykok:pokeapi:3.0.0")
}
build.gradle
dependencies {
    implementation 'fr.tykok:pokeapi:3.0.0'
}
pom.xml
<dependencies>
    <dependency>
        <groupId>fr.tykok</groupId>
        <artifactId>pokeapi</artifactId>
        <version>3.0.0</version>
    </dependency>
</dependencies>

Version

The snippets above are filled in at build time from the version this site was published for, so they always match the chip in the top-right corner. The Maven Central listing is the authoritative index of every published release.

Requirements

JVM 17 or later
Kotlin 2.1 or later
Transitive dependencies OkHttp, Jackson (jackson-module-kotlin)

First request

get and list are suspend functions, so they need a coroutine — here, suspend fun main():

import fr.tykok.pokeapi.PokeApi
import fr.tykok.pokeapi.entities.pokemon.Pokemon

suspend fun main() {
    val pikachu = PokeApi.get<Pokemon>(name = "pikachu")
    println(pikachu.name)   // pikachu
    println(pikachu.weight) // 60
}

From synchronous code — no coroutine in scope — use the blocking counterpart instead:

val pikachu = PokeApi.getBlocking<Pokemon>(name = "pikachu")

Head to Methods for every get/list overload, or browse the API Reference for every entity you can ask for.