/QcStatsGraphQL

unofficial Quake Champions stats REST API V2 encapsulate with GraphQl

Primary LanguageJavaScriptMIT LicenseMIT

logo.png

Quake Champions Stats GraphQl GitHub CircleC

Quake Champions Stats REST API V2 encapsulate with GraphQl

The Rest api of stats.quake.com isn't very much public. I did scrape a little bit to get some endpoints. Probably not a good idea to use for big production. Ask Bethesda Softworks ™ LLC 💜

Highlights

  • Lederbord duel & tdm with seasons
  • Search for player
  • Player stats duel & tdm
  • Game id stats

Install

$ cd QcStatsGraphQL
$ yarn install

Usage

Code with Codesandbox

open this project on codesandbox and check the graphql playground

quake champions codesandbox

To launch on your local machine

$ yarn dev
$ nodemon -r esm server.js
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node -r esm server.js`
🚀 Server spawned at http://localhost:1337

To launch in production

to work on heroku add "heroku-postbuild": "yarn build" inside your package.json scripts

$ yarn build && node ./dist/index.js
$ build-esm
Copying lisense => dist/lisense
Copying src/schema.graphql => dist/src/schema.graphql
Compiling src/datasource.js => dist/src/datasource.js
Compiling index.js => dist/index.js
Compiling src/resolvers/Query.js => dist/src/resolvers/Query.js
Copying package.json => dist/package.json
Copying readme.md => dist/readme.md
🚀 Server spawned at http://localhost:1337

To add or mod a query

  • check the json endpoint
  • write the schema in ./src/schema.graphql
  • add the async function in ./src/datasource.js to bind rest api with schema/Query
  • add the type of resolvers in ./src/resolvers/Query.js

API

quake champions graphql

Example of gql Query

Get the quake Champions Leaderbord

{
  qcLeaderboard(board: "duel" season:"preseason1") {
    boardType
    entries{
      userName
      eloRating
    }
  }
}

quake champions graphql

Search for a player

{
  searchPlayer(search: "AMD") {
    entityId
    entityName
  }
}

quake champions graphql

Get Stats from a player name

{
  unamePlayer(name: "AMD.COOLLERZ") {
    name
    playerRatings{
      duel{
        rating
        history{
          eloRating
        }
      }
    }
}

quake champions graphql

Get all player stats from a game id

{
  gamesDetails(id: "bc40eff5-9235-11e9-af14-0003ffb6d7a2") {
    id
    mapName
    battleReportPersonalStatistics {
      nickname
      kills
      deaths
      squadChampionIndexArray
      lastSelectedChampion
      averageLifetime
      totalDamage
      megaHealthPickups
      heavyArmorPickups
      powerPickups
      bestWeapon
      bestWeaponAccuracyPercent
    }
  }
}

quake champions graphql

Maintainers