Closed ImperialSquid closed 2 years ago
Scratch that, just spotted that this is already a thing by calling APIResourceList instead!
Though maybe adding in that using None as the ID does the same thing would be a nice pythonic addition "simple is better than complex" and all that, having to use an entirely separate method to get the resource list seems a little obtuse
Problem
PokeAPI gives a resource list if you access an endpoint but don't give a resource ID (https://pokeapi.co/docs/v2#resource-listspagination-section) however this library doesn't allow for that since resource IDs are validated as being either strings or ints
Why It's Useful
There are a fair few endpoints where the valid ids are not continuous so scanning through one by one until you get a 404 will end up missing some resources and doing an exhaustive search is unfeasible since there's no way to know what the last one might be (hard coding is also not an option since it'll inevitably need updating each game)
Suggested Fix
It's not my library so obviously your call but a simple fix by just be to allow Nones as resource IDs to specify that you want the list instead? This should work for every endpoint already anyway