Skip to content

Extensions Reference⚓︎

PokeLance groups PokéAPI's ~60 resource categories into 11 extensions, each attached to the client as an attribute (client.berry, client.pokemon, ...). This page is the complete map: which extension owns which category, what identifier it takes, and any quirks worth knowing about.

Extensions are loaded automatically in setup_hook, you never construct them yourself.

How to read the tables⚓︎

  • Category is the API resource name (hyphenated, matching PokéAPI's own naming).
  • Methods are always get_<category> / fetch_<category> with hyphens turned into underscores, per Fetching Data.
  • Key is what you pass in: a name (str), an id (int), or both interchangeably.
  • Cache model notes anything non-obvious about how the result is stored.

client.berry, Berry

Category Key Returns
berry name or id models.Berry
berry-firmness name or id models.BerryFirmness
berry-flavor name or id models.BerryFlavor

client.contest, Contest

Category Key Returns
contest-type name or id models.ContestType
contest-effect id only models.ContestEffect (secondary cache)
super-contest-effect id only models.SuperContestEffect (secondary cache)

client.encounter, Encounter

Category Key Returns
encounter-method name or id models.EncounterMethod
encounter-condition name or id models.EncounterCondition
encounter-condition-value name or id models.EncounterConditionValue

client.evolution, Evolution

Category Key Returns
evolution-chain id only models.EvolutionChain (secondary cache)
evolution-trigger name or id models.EvolutionTrigger

client.game, Game

Category Key Returns
generation name or id models.Generation
pokedex name or id models.Pokedex
version name or id models.Version
version-group name or id models.VersionGroup

client.item, Item

Category Key Returns
item name or id models.Item
item-attribute name or id models.ItemAttribute
item-category name or id models.ItemCategory
item-fling-effect name or id models.ItemFlingEffect
item-pocket name or id models.ItemPocket

client.location, Location

Category Key Returns
location name or id models.Location
location-area name or id models.LocationArea
pal-park-area name or id models.PalParkArea
region name or id models.Region

client.machine, Machine

Category Key Returns
machine id only models.Machine (secondary cache)

client.move, Move

Category Key Returns
move name or id models.Move
move-ailment name or id models.MoveAilment
move-battle-style name or id models.MoveBattleStyle
move-category name or id models.MoveCategory
move-damage-class name or id models.MoveDamageClass
move-learn-method name or id models.MoveLearnMethod
move-target name or id models.MoveTarget

client.pokemon, Pokemon

Category Key Returns
ability name or id models.Ability
characteristic id only models.Characteristic (secondary cache)
egg-group name or id models.EggGroup
gender name or id models.Gender
growth-rate name or id models.GrowthRate
location-area-encounter name or id list[models.LocationAreaEncounter], a list, not a single model
nature name or id models.Nature
pokeathlon-stat name or id models.PokeathlonStat
pokemon name or id models.Pokemon
pokemon-color name or id models.PokemonColor
pokemon-form name or id models.PokemonForm
pokemon-habitat name or id models.PokemonHabitats
pokemon-shape name or id models.PokemonShape
pokemon-species name or id models.PokemonSpecies
stat name or id models.Stat
type name or id models.Type

client.pokemon.all_pokemons also gives you every known Pokémon name as a list[str], once endpoints are cached, handy for autocompletion.

client.utility, Utility

Category Key Returns
language name or id models.Language
api-metadata none models.APIMetadata, singleton, no list endpoint

Not part of getch_data / from_url

utility is not registered in ExtensionEnum, so getch_data and from_url can't dispatch to it. Call client.utility.fetch_language(...) / client.utility.fetch_api_metadata() directly instead.

Secondary caches (id-only, no list endpoint)⚓︎

A handful of categories, machine, evolution-chain, characteristic, contest-effect, super-contest-effect, language, api-metadata, use a secondary keyed cache instead of the regular BaseCache. PokéAPI doesn't give these a stable name, only a numeric id embedded in the resource URL, so they're addressed by id only, not name, and their endpoint registry (when one exists) keys by the id parsed out of the URL rather than a name field in the payload.

Here's the contrast in practice:

JSON
{
  "id": 1,
  "name": "cheri",
  "growth_time": 3,
  ...
}
Python
await client.berry.fetch_berry("cheri")  # or fetch_berry(1), both work
JSON
{
  "id": 1,
  "descriptions": [
    {
      "description": "Loves to eat",
      "language": {...},
    }
  ],
  ...
}
Python
await client.pokemon.fetch_characteristic(1)  # no name to fetch by

api-metadata has no list endpoint at all (it's a true singleton, GET /meta) and is gracefully skipped during setup_hook when populating the endpoint registries.

Programmatic access via ExtensionEnum⚓︎

If you're building something generic (a REPL, a lookup endpoint or a cli tool, ...), the categories above are also available as data through pokelance.constants.ExtensionEnum. Note that, because of the __get__ descriptor on BaseEnum this only applies when iterating the enum, direct attribute access like ExtensionEnum.Pokemon returns the underlying PokemonExtension object directly rather than the enum member:

Python
from pokelance.constants import ExtensionEnum

for ext in ExtensionEnum:
    print(f"{ext.name:<10} -> {', '.join(ext.value.categories)}")
Text Only
Berry      -> berry, berry-firmness, berry-flavor
Contest    -> contest-type, contest-effect, super-contest-effect
Encounter  -> encounter-method, encounter-condition, encounter-condition-value
Evolution  -> evolution-chain, evolution-trigger
Game       -> generation, pokedex, version, version-group
Item       -> item, item-attribute, item-category, item-fling-effect, item-pocket
Location   -> location, location-area, pal-park-area, region
Machine    -> machine
Move       -> move, move-ailment, move-battle-style, move-category, move-damage-class, move-learn-method, move-target
Pokemon    -> ability, characteristic, egg-group, gender, growth-rate, location-area-encounter, nature, pokeathlon-stat, pokemon, pokemon-color, pokemon-form, pokemon-habitat, pokemon-shape, pokemon-species, stat, type
Utility    -> language, api-metadata

This is exactly what powers getch_data's extension/category validation.

Comments