SC2 Ranks for Javascript
A NodeJS Javascript library for accessing the API from SC2 Ranks.
Get access to player, clan, team, and division stats with server-side Javascript.
Why?
I suck at Starcraft but I'm awesome at Javascript.
Installing
npm install sc2ranks
Usage
All examples require you to setup a connection to the API with your key. You can get your SC2 Ranks key from here.
var sc2 = ;var api = 'your-api-key';
Fetching data from the API
You can directly create Character
, Clan
, Team
, or Division
objects and
then fetch()
them, which will return a promise.
var character = api; character;
Using the Query Builder
;
Calling the API Directly
You can access the API functions directly off the connection object, returning a promise for the raw data response from SC2 Ranks.
api;
See the official SC2 Ranks documentation for details on these methods.
- getCharacterData (
battleNetId
,region
) - getClanData (
clanTag
,rankRegion
,options
)
More Examples
Fetching Character and Clan details
Also shows how to use fail()
in the promise chain to catch any errors and how
to inspect your api
instance to see how many credits you have left.
var character = api; character;
Get a player's 1v1 team(s)
;
Get detailed player information.
Use the fetchAll()
method on a Character
to get full team and clan info.
var character = api; character;
License
Copyright 2013 Brandon Valosek
sc2ranks-js is released under the MIT license.