https://github.com/iamgio/pokedex-java-api
:snake: Pokémon API for Java, 1st to 7th generation
https://github.com/iamgio/pokedex-java-api
api pokedex pokedex-api pokemon pokemon-java-api
Last synced: 6 months ago
JSON representation
:snake: Pokémon API for Java, 1st to 7th generation
- Host: GitHub
- URL: https://github.com/iamgio/pokedex-java-api
- Owner: iamgio
- License: apache-2.0
- Created: 2018-12-05T18:57:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-16T20:54:21.000Z (over 3 years ago)
- Last Synced: 2025-04-03T06:22:03.414Z (6 months ago)
- Topics: api, pokedex, pokedex-api, pokemon, pokemon-java-api
- Language: Java
- Homepage:
- Size: 91.8 KB
- Stars: 8
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
[](https://www.codacy.com/app/iAmGio/pokedex-java-api?utm_source=github.com&utm_medium=referral&utm_content=iAmGio/pokedex-java-api&utm_campaign=Badge_Grade) [](https://www.codefactor.io/repository/github/iamgio/pokedex-java-api)
# Pokédex Java API
_pokedex-java-api_ is the first wrapper for [pokeapi.co](https://pokeapi.co) written in pure Java.
# Why should I use PDJ API?
- [x] Fully documented
- [x] Everything is treated as an object
- [x] Mantainable and readable code# Maven
```xml
jitpack.io
https://jitpack.io
com.github.iAmGio
pokedex-java-api
VERSION
```# Gradle
```groovy
repositories {
maven {
url 'https://jitpack.io'
}
}
dependencies {
implementation 'com.github.iAmGio:pokedex-java-api:VERSION'
}
```# Manual / JAR
JAR files can be found in the [releases](https://github.com/iAmGio/pokedex-java-api/releases) tab.
# Getting started
To get started, let's try to get the types of [Bulbasaur](https://www.pokemon.com/us/pokedex/bulbasaur):
```java
public class Main {
public static void main(String[] args) {
Pokemon bulbasaur = Pokemon.fromName("bulbasaur");
Pair types = bulbasaur.getTypes();
System.out.println(types.getFirst());
System.out.println(types.getSecond());
}
}
```This will output:
```
GRASS
POISON
```Every component of the API (such as Pokémons, abilities, etc) can be instantiated by using two static methods: `fromName`, which takes the name as a string, and `fromId`, which takes the identifier as a number.
# Localized strings
An interesting part of this library is the one which collects strings from various languages, contained inside the [lang](https://github.com/iAmGio/pokedex-java-api/tree/master/src/main/java/eu/iamgio/pokedex/lang) package.
Every localized string is composed by two fields: `name` (String) and `language` (enum Language), and groups of them are stored inside specific lists, such as `LocalizedNames` or `FlavorList` (both extend `LocalizedNameList`). They have a `get(Language)` method which returns the string in the selected language.The particular one is `FlavorList`: a flavor is a localized string assigned within a version (or a version group) of the official game: having a flavor list, you will be able to do something like this:
```java
FlavorList flavors = ...;
String englishStringFromPearl = flavors.filterVersion(Version.PEARL).get(Language.ENGLISH);
```_Credits to this project and to pokeapi.co are appreciated._