Closed GregHanson closed 4 weeks ago
possibly a different issue, but I can't get rustemon::pokemon::pokemon::get_by_id
to work for those pokedex numbers either
Hey there! First of all, thanks for using rustemon!
I'm asking this to everyone submitting an issue: do you want to investigate yourself and contribute? Or you rather prefer me to check it?
It's up to you, please let me know ! 🙂
Hey @GregHanson !
I did some research and the endpoints on PokeApi answer undefined
rather than the json.
I bet the data for those pokemon variants are missing.
Might be worth to open an issue on their side?
@mlemesle thanks for the response! and sorry for the delay. I'll spend a little more time investigating now that I'm back from a work conference and I'll update the issue with my findings
Update: after a preliminary inspection, this rust library performs the same as other libraries such as go and python based ones. Trying a get for https://pokeapi.co/api/v2/pokemon/deoxys
fails for them as well.
Going further, https://pokeapi.co/api/v2/pokemon-species/deoxys seems to contain the information I'm looking for, specifically the varieties
field. Lists base name and additional forms and their corresponding urls for complete info:
"varieties": [
{
"is_default": true,
"pokemon": {
"name": "deoxys-normal",
"url": "https://pokeapi.co/api/v2/pokemon/386/"
}
},
{
"is_default": false,
"pokemon": {
"name": "deoxys-attack",
"url": "https://pokeapi.co/api/v2/pokemon/10001/"
}
},
{
"is_default": false,
"pokemon": {
"name": "deoxys-defense",
"url": "https://pokeapi.co/api/v2/pokemon/10002/"
}
},
{
"is_default": false,
"pokemon": {
"name": "deoxys-speed",
"url": "https://pokeapi.co/api/v2/pokemon/10003/"
}
}
]
So to solve my original goal of getting json info for all pokemon (including their corresponding forms), I can get that information there
As I'm gaining more familiarity with your library, I think the correct way I should be solving my problem is to instead use your provided follow()
function :
let all_pokemon = rustemon::pokemon::pokemon::get_all_entries(&client).await.unwrap();
for entry in all_pokemon.into_iter() {
let pokemon = res.follow(&client).await.unwrap()
...
}
and that should include all pokemon with their corresponding form-specific info by default
@mlemesle I feel like I might be hammering the pokemon API alot, by performing a .follow()
on each item from rustemon::pokemon::pokemon::get_all_entries(&client)
. Am I missing another feature of your library implementation?
@GregHanson You already use the get_all_entries
function. That basically fetches everything from the targeted endpoint. Are you sure the variants are just further in the resulting Vector?
Yeah, all the variants are added as some really high pokedex number, like deoxys attack is 10K:
"name": "deoxys-attack",
"url": "https://pokeapi.co/api/v2/pokemon/10001/"
after Percharunt at #1025, you start seeing all the variations for region, mega, giga max, etc:
deoxys-attack
deoxys-defense
deoxys-speed
wormadam-sandy
wormadam-trash
shaymin-sky
giratina-origin
rotom-heat
rotom-wash
rotom-frost
rotom-fan
rotom-mow
castform-sunny
castform-rainy
castform-snowy
basculin-blue-striped
darmanitan-zen
meloetta-pirouette
tornadus-therian
thundurus-therian
landorus-therian
kyurem-black
kyurem-white
keldeo-resolute
meowstic-female
aegislash-blade
pumpkaboo-small
pumpkaboo-large
pumpkaboo-super
gourgeist-small
gourgeist-large
gourgeist-super
venusaur-mega
charizard-mega-x
charizard-mega-y
blastoise-mega
alakazam-mega
gengar-mega
kangaskhan-mega
pinsir-mega
gyarados-mega
aerodactyl-mega
mewtwo-mega-x
mewtwo-mega-y
ampharos-mega
scizor-mega
heracross-mega
houndoom-mega
tyranitar-mega
blaziken-mega
gardevoir-mega
mawile-mega
aggron-mega
medicham-mega
manectric-mega
banette-mega
absol-mega
garchomp-mega
lucario-mega
abomasnow-mega
floette-eternal
latias-mega
latios-mega
swampert-mega
sceptile-mega
sableye-mega
altaria-mega
gallade-mega
audino-mega
sharpedo-mega
slowbro-mega
steelix-mega
pidgeot-mega
glalie-mega
diancie-mega
metagross-mega
kyogre-primal
groudon-primal
rayquaza-mega
pikachu-rock-star
pikachu-belle
pikachu-pop-star
pikachu-phd
pikachu-libre
pikachu-cosplay
hoopa-unbound
camerupt-mega
lopunny-mega
salamence-mega
beedrill-mega
rattata-alola
raticate-alola
raticate-totem-alola
pikachu-original-cap
pikachu-hoenn-cap
pikachu-sinnoh-cap
pikachu-unova-cap
pikachu-kalos-cap
pikachu-alola-cap
raichu-alola
sandshrew-alola
sandslash-alola
vulpix-alola
ninetales-alola
diglett-alola
dugtrio-alola
meowth-alola
persian-alola
geodude-alola
graveler-alola
golem-alola
grimer-alola
muk-alola
exeggutor-alola
marowak-alola
greninja-battle-bond
greninja-ash
zygarde-10-power-construct
zygarde-50-power-construct
zygarde-complete
gumshoos-totem
vikavolt-totem
oricorio-pom-pom
oricorio-pau
oricorio-sensu
lycanroc-midnight
wishiwashi-school
lurantis-totem
salazzle-totem
minior-orange-meteor
minior-yellow-meteor
minior-green-meteor
minior-blue-meteor
minior-indigo-meteor
minior-violet-meteor
minior-red
minior-orange
minior-yellow
minior-green
minior-blue
minior-indigo
minior-violet
mimikyu-busted
mimikyu-totem-disguised
mimikyu-totem-busted
kommo-o-totem
magearna-original
pikachu-partner-cap
marowak-totem
ribombee-totem
rockruff-own-tempo
lycanroc-dusk
araquanid-totem
togedemaru-totem
necrozma-dusk
necrozma-dawn
necrozma-ultra
pikachu-starter
eevee-starter
pikachu-world-cap
meowth-galar
ponyta-galar
rapidash-galar
slowpoke-galar
slowbro-galar
farfetchd-galar
weezing-galar
mr-mime-galar
articuno-galar
zapdos-galar
moltres-galar
slowking-galar
corsola-galar
zigzagoon-galar
linoone-galar
darumaka-galar
darmanitan-galar-standard
darmanitan-galar-zen
yamask-galar
stunfisk-galar
zygarde-10
cramorant-gulping
cramorant-gorging
toxtricity-low-key
eiscue-noice
indeedee-female
morpeko-hangry
zacian-crowned
zamazenta-crowned
eternatus-eternamax
urshifu-rapid-strike
zarude-dada
calyrex-ice
calyrex-shadow
venusaur-gmax
charizard-gmax
blastoise-gmax
butterfree-gmax
pikachu-gmax
meowth-gmax
machamp-gmax
gengar-gmax
kingler-gmax
lapras-gmax
eevee-gmax
snorlax-gmax
garbodor-gmax
melmetal-gmax
rillaboom-gmax
cinderace-gmax
inteleon-gmax
corviknight-gmax
orbeetle-gmax
drednaw-gmax
coalossal-gmax
flapple-gmax
appletun-gmax
sandaconda-gmax
toxtricity-amped-gmax
centiskorch-gmax
hatterene-gmax
grimmsnarl-gmax
alcremie-gmax
copperajah-gmax
duraludon-gmax
urshifu-single-strike-gmax
urshifu-rapid-strike-gmax
toxtricity-low-key-gmax
growlithe-hisui
arcanine-hisui
voltorb-hisui
electrode-hisui
typhlosion-hisui
qwilfish-hisui
sneasel-hisui
samurott-hisui
lilligant-hisui
zorua-hisui
zoroark-hisui
braviary-hisui
sliggoo-hisui
goodra-hisui
avalugg-hisui
decidueye-hisui
dialga-origin
palkia-origin
basculin-white-striped
basculegion-female
enamorus-therian
tauros-paldea-combat-breed
tauros-paldea-blaze-breed
tauros-paldea-aqua-breed
wooper-paldea
oinkologne-female
dudunsparce-three-segment
palafin-hero
maushold-family-of-three
tatsugiri-droopy
tatsugiri-stretchy
squawkabilly-blue-plumage
squawkabilly-yellow-plumage
squawkabilly-white-plumage
gimmighoul-roaming
koraidon-limited-build
koraidon-sprinting-build
koraidon-swimming-build
koraidon-gliding-build
miraidon-low-power-mode
miraidon-drive-mode
miraidon-aquatic-mode
miraidon-glide-mode
ursaluna-bloodmoon
ogerpon-wellspring-mask
ogerpon-hearthflame-mask
ogerpon-cornerstone-mask
terapagos-terastal
terapagos-stellar
I'll close this one as complete since my original question has been resolved. Thanks for the help!
@GregHanson No worries! Feel free to reach out if you have more questions!
I was following through the examples provided here and here to get all pokemon names, and then perform a corresponding lookup for each pokemon. There's a list of about 27 pokemon where
rustemon::pokemon::pokemon::get_by_name
does not work.Pretty sure these errors are all for pokemon with mutliple forms. Deoxys for example is
deoxys-normal
when you look at the pokemon API by # https://[pokeapi.co/api/v2/pokemon/386/](https://pokeapi.co/api/v2/pokemon/386/)Is there a better way to do a lookup for every pokemon?