项目作者: loivis

项目描述 :
A GraphQL wrapper of pokeapi by TypeGraphQL
高级语言: TypeScript
项目地址: git://github.com/loivis/pokeapi-typegraphql.git
创建时间: 2019-04-28T19:24:28Z
项目社区:https://github.com/loivis/pokeapi-typegraphql

开源协议:

下载


pokeapi-typegraphql

An implementation of pokeapi.co with GraphQL using TypeGraphQL.

Schemas are created based on Pokeapi V2 API Reference but it doesn’t seem to be the latest. Some(but don’t remember which ones) are updated according to actual api responses by the time of coding in early May, 2019.

Try it out >>> >> > pokeapi-typegraphql on heroku < << <<<

CAUTION:
Some schema returns array with hundreds of elements, which causes the same amount of requests towards pokeapi.co.

pokeapi.co Fair Use Policy

  1. PokéAPI is free and open to use. It is also very popular. Because of this, we ask every developer to abide by our fair use policy. People not complying with the fair use policy will have their IP address permenantly banned.
  2. PokéAPI is primarily an educational tool, and we will not tolerate denial of service attacks preventing people from learning.
  3. Rules:
  4. Locally cache resources and images whenever you request them.
  5. Use the correct user-agent header in API requests.
  6. Be nice and friendly to your fellow PokéAPI developers.

TODO

  • [ ] InputUnion type to merge byId and byName as one (upstream feature not ready yet)

  • [ ] load all data in database(SQL/NoSQL?) to elimicate requests to pokeapi.co

Tryout locally

  1. yarn install && yarn dev

By default, server will listen on port 4000: http://localhost:4000/graphql

Query example

  1. {
  2. pokemonByID(id: 1) {
  3. name
  4. weight
  5. abilities {
  6. ability {
  7. name
  8. isMainSeries
  9. generation {
  10. name
  11. mainRegion {
  12. name
  13. }
  14. }
  15. }
  16. }
  17. sprites {
  18. frontDefault
  19. frontShiny
  20. frontFemale
  21. frontShinyFemale
  22. }
  23. }
  24. }

List of schemas

  • [x] Ability

  • [x] Berry

  • [x] BerryFirmness

  • [x] BerryFlavor

  • [x] Characteristic

  • [x] ContestEffect

  • [x] ContestType

  • [x] EggGroup

  • [x] EncounterCondition

  • [x] EncounterConditionValue

  • [x] EncounterMethod

  • [x] EvolutionChain

  • [x] EvolutionTrigger

  • [x] Gender

  • [x] Generation

  • [x] GrowthRate

  • [x] Item

  • [x] ItemAttribute

  • [x] ItemCategory

  • [x] ItemPocket

  • [x] Language

  • [x] Location

  • [x] LocationArea

  • [x] Machine

  • [x] Move

  • [x] MoveAilment

  • [x] MoveBattleStyle

  • [x] MoveCategory

  • [x] MoveDamageClass

  • [x] MoveLearnMethod

  • [x] MoveTarget

  • [x] Nature

  • [x] PalParkArea

  • [x] PokeathlonStat

  • [x] Pokedex

  • [x] Pokemon

  • [x] PokemonColor

  • [x] PokemonHabitat

  • [x] PokemonForm

  • [x] PokemonShape

  • [x] PokemonSpecies

  • [x] Region

  • [x] Stat

  • [x] SuperContestEffect

  • [x] Type

  • [x] Version

  • [x] VersionGroup