dazzle

Dazzle is a simple Dota 2 Api Wrapper for Node

Dazzle - a Dota 2 Api Wrapper for Node

Dazzle is a lightweight, easy-to-use API client for the Dota 2 WebAPI http://wiki.teamfortress.com/wiki/WebAPI#Dota_2. Check it out on github @ https://github.com/JamieLottering/dazzle-node

npm install dazzle
Get a Steam API key at http://steamcommunity.com/dev/apikey
var dazzle = require('dazzle');
var dota2Api = new dazzle('apikey');
dota2Api.getHeroes(function (err, response) {
    var heroes = response.heroes;
});
dota2Api.getMatchHistory(function (err, response) {
    var matches = response.matches;
});

To create your own API method simply extend the client like so:

dota2Api.extend('myFancyMethod', function (params, next) {
    // do somethin cool here
    this.invoke('MethodName')
        .using(params)
        .on('InterfaceName')
        .then(next);
});

dota2Api.myFancyMethod({}, function (err, response) {
    // hey it works!
});

For a list of methods and interfaces see http://wiki.teamfortress.com/wiki/WebAPI#Dota_2. Note that you dont need to include the app ID (aka _570), this is added automatically.

The MIT License (MIT)

Jamie Lottering GitHubhttp://well.iotwitter