Coder Social home page Coder Social logo

mokyox / graphql-pokeapi Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.87 MB

A GraphQL implementation of the PokeAPI using Apollo-GraphQL.

License: MIT License

TypeScript 100.00%
pokeapi graphql pokemon pokemon-api graphql-pokemon pokedex apollo-graphql pokemon-graphql pokeapi-graphql pokedex-data

graphql-pokeapi's Introduction

apollo-graphql-pokeapi

An GraphQL implementation of the PokeAPI using Apollo-GraphQL.

Sample Query

{
  getPokemon(id: 249) {
    id
    name
    abilities {
      is_hidden
      ability {
        name
      }
    }
    stats {
      base_stat
      stat {
        name
      }
    }
  }
  getDescription(id: 249) {
    flavor_text
    language {
      name
    }
    version {
      name
    }
  }
}

Sample Result

{
  "data": {
    "getPokemon": {
      "id": 249,
      "name": "lugia",
      "abilities": [
        {
          "is_hidden": false,
          "ability": {
            "name": "pressure"
          }
        },
        {
          "is_hidden": true,
          "ability": {
            "name": "multiscale"
          }
        }
      ],
      "stats": [
        {
          "base_stat": 106,
          "stat": {
            "name": "hp"
          }
        },
        {
          "base_stat": 90,
          "stat": {
            "name": "attack"
          }
        },
        {
          "base_stat": 130,
          "stat": {
            "name": "defense"
          }
        },
        {
          "base_stat": 90,
          "stat": {
            "name": "special-attack"
          }
        },
        {
          "base_stat": 154,
          "stat": {
            "name": "special-defense"
          }
        },
        {
          "base_stat": 110,
          "stat": {
            "name": "speed"
          }
        }
      ]
    },
    "getDescription": {
      "flavor_text": "Lugia’s wings pack devastating power—a light fluttering of its\nwings can blow apart regular houses. As a result, this\nPokémon chooses to live out of sight deep under the sea.",
      "language": {
        "name": "en"
      },
      "version": {
        "name": "alpha-sapphire"
      }
    }
  }
}

Notes:

  • PokeAPI is missing Pokedex entries for some generation 2 and 3 Pokemon. Therefore getDescription returns Pokedex entries from Pokemon: Alpha Sapphire for Generation I ~ VI Pokemon and Pokemon: Sword entries for Generation VII and Generation VIII Pokemon.

  • This Graph API only contains a few data fields that I plan on consuming myself for a project. Feel free to contribute to adding extra fields by adding an issue or PR.

graphql-pokeapi's People

Contributors

dependabot[bot] avatar mokyox avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.