This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
forked from veekun/pokedex
-
Notifications
You must be signed in to change notification settings - Fork 38
GraphQL API how to filter Pokemon by game? #152
Comments
Hi, I came up with this query: query MyQuery {
pokemon_v2_pokemonspecies(
where: {
pokemon_v2_generation: {
pokemon_v2_versiongroups: {
pokemon_v2_versions: { name: { _eq: "red" } }
}
}
}
order_by: { order: asc }
) {
name
id
}
} You can substitute |
Here all versions: https://pokeapi.co/api/v2/version/?offset=0&limit=2000 |
Sorry this doesn't work it will return sandshrew and sandslash which are exclusive to blue, really appreciate the help though |
then we lack this info |
i wonder how serebii.net are doing this https://www.serebii.net/rb/exclusives.shtml i see the exclusives in the url maybe a flag on the pokemon |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hey I'm using the GraphQL API and I'm trying to filter Pokemon by game but it doesn't seem to be possible any ideas or suggestions?
so far i've tried a where clause on the version id in encounters and in game indices but with no success
an example of what i want is if i get pokemon from 0 - 30 with version name red i'd expect to see ekans and arbok but not sandshrew or sandslash
game indices example
pokemon_v2_pokemon(where: {pokemon_v2_pokemontypes: {type_id: {_in: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19]}, pokemon_v2_pokemon: {name: {_like: "%%"}}}, pokemon_v2_pokemongameindices: {pokemon_v2_version: {}, version_id: {_in: [1]}}}, order_by: {id: asc}, offset: 0, limit: 30)
species/generation/versions example
pokemon_v2_pokemon(where: {pokemon_v2_pokemontypes: {type_id: {_in: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19]}, pokemon_v2_pokemon: {name: {_like: "%%"}}}, pokemon_v2_pokemonspecy: {pokemon_v2_generation: {pokemon_v2_versiongroups: {pokemon_v2_versions: {id: {_in: [1]}}}}}}, order_by: {id: asc, pokemon_v2_pokemonspecy: {}}, offset: 0, limit: 30)
The text was updated successfully, but these errors were encountered: