rankade-js-api
v1.0.16
Published
Rankade API JavaScript implementation
Downloads
24
Readme
Node.js module for rankade API
API reference https://rankade.com/api
Install
yarn add rankade-js-api
Usage
API access
In order to use API for your group you need to obtain API credentials by following that instructions https://rankade.com/api#intro
Example
'use strict'
const Rankade = require('rankade-js-lib')
// obtain credentials from group's API setting page
const rankade = new Rankade(
'https://api.endpoint',
'key',
'secret',
1500 // timeout
)
rankade.auth.auth()
.then(success => {
rankade.quota.quota()
.then(success => {
let quota = success.data.success
console.log(quota)
}).catch(error => {
let errorFound = rankade.errors.parse(error)
console.log(errorFound)
})
}).catch(error => {
let errorFound = rankade.errors.parse(error)
console.log(errorFound)
})
Reference
Authentication
- rankade.auth.auth() perform authentication and obtain the JWT token used for other API calls
- rankade.auth.getAccessToken() retrieve the JWT token string
- rankade.auth.setAccessToken(token) set the JWT token string
- rankade.auth.isExpired() check if the token provided with the rankade.auth.auth() method is expired or not
Games
- rankade.games.popular() retrieve rankade's popular games
- rankade.games.list() retrieve group's games
- rankade.games.search(name) search a game by giving a name or part of
- rankade.games.create(name) create a game by name and retrieve it
Matches
- rankade.matches.create(matches, dryrun) create matches by giving an array of objects accordant to specifications https://rankade.com/api#post-matches-match (see below the Match's object properties detail captcher)
- rankade.matches.exists(id) check if a match already exists
- rankade.matches.status() retrieve matches' queue/elaboration status
- rankade.matches.list(subset = 'main', page = 1) retrieve group's matches
Players
- rankade.players.players(page) retrieve group's players
- rankade.players.player(name) create a ghost player
Subsets
- rankade.subsets.list() retrieve group's subsets
Rankings
- rankade.rankings.list(subset = 'main', match = 'last', page = 1) retrieve group's rankings
Quota
- rankade.quota.quota() retrieve group's API quota usage
Change log
- 2022-06-03 dependencies packages upgrade to latest version
- 2021-09-29 dependencies packages upgrade
- 2020-12-15 error object check in parse() function, readme edits
- 2020-07-18 reformat code
- 2020-04-01 added the rankade.matches.list method
- 2019-08-21 added the rankade.rankings.list and rankade.subsets.list methods
- 2019-08-08 added the rankade.players.player(name) method
- 2019-06-26 added the rankade.auth.setAccessToken(token) method and updated the readme file
- 2019-06-18 added the rankade.setKey(key), rankade.setSecret(secret) methods and players pagination
- 2019-05-29 added the rankade.auth.isExpired() method and updated the readme file
- 2019-05-23 api errors parsing
- 2019-05-22 started implementation of basic calls