0.6.1 • Published 11 years ago

armory v0.6.1

Weekly downloads
43
License
-
Repository
github
Last release
11 years ago

node-armory

A simple node.js wrapper around Blizzard's REST API for World of Warcraft.

Installation

npm install armory

Documentation

All options objects can have the following properties:

  • names|ids
  • region (optional)
  • locale (optional)
  • lastModified (optional)

Note: names and ids are interchangeable, and locale and lastModified do not affect all API methods.


auction(options, callback)

auction(realms, region, locale, callback)

Retrieves an array of auction data URLs.

auctionData(options, callback)

auctionData(realms, region, locale, callback)

Retrieves an object of data from the first auction data URL provided by the API.

armory.auctionData('Shadowmoon', function(err, res) {

    var agiPots = res.alliance.auctions.filter(function(auction) {
        return auction.item === 58145;
    });
});

The first argument can be a string, an array, or an object.

Auction API Documentation


arena(options, callback)

arena('Name_Size_Realm', region, locale, callback)

Retrieves an object containing data about an arena team.

armory.arena('No Dairy_2v2_Shadowmoon', function(err, team) {

    var ratio = team.gamesWon / team.gamesLost;
});

options can be a string in the form 'Name_Size_Realm' or an object with the following additional properties:

  • size (optional)
  • realm (optional)

Strings in the form 'Name_Size_Realm', 'Name_Size', or 'Name_Realm' can be used in the names property. Parameters specified in these strings will override those provided in the options object.

Arena Team API Documentation


character(options, callback)

character('Name_Realm', region, locale, callback)

Retrieves an object containing data about a character.

guild(options, callback)

guild('Name_Realm', region, locale, callback)

Retrieves an object containing data about a guild.

armory.guild({
    names: 'The Gentlemens Club',
    fields: ['members'],
    realm: 'Shadowmoon'

}, function(err, guild) {

    var dwarves = guild.members.filter(function(member) {
        return member.character.race === 3;

    }).map(function(member) {
        return member.character.name;
    });

    var hairColors = [];

    armory.character({
        names: dwarves,
        fields: ['appearance'],
        realm: 'Shadowmoon'

    }, function(err, character) {
        if (err) return;
        hairColors.push(character.appearance.hairColor);
    });
});

options can be a string in the form 'Name_Realm' or an object with the following additional properties:

  • fields (optional): must be an array
  • realm (optional)

Strings in the form 'Name_Realm' can be used in the names property. Parameters specified in these strings will override those provided in the options object.

Character API Documentation

Guild API Documentation


item(options, callback)

item(ids, region, locale, callback)

Retrieves an object containing data about an item.

quest(options, callback)

quest(ids, region, locale, callback)

Retrieves an object containing data about a quest.

recipe(options, callback)

recipe(ids, region, locale, callback)

Retrieves an object containing data about a recipe.

var avgILvl = 0,
    i = 0;

armory.item([28275, 27903, 28041], function(err, item) {
    avgILvl += item.itemLevel;
    i++;

    if (i === 3) {
        avgILvl /= 3;
    }
});

The first argument can be a single item ID, an array of IDs, or an object.

Item API Documentation


ladder(options, callback)

ladder(sizes, battlegroup, region, locale, callback)

Retrieves an array of objects containing data about arena teams for the given ladder and battlegroup.

armory.ladder('2v2', 'Vindication', function(err, ladder) {

    var factionCount = ladder.reduce(function(array, team) {
        array[team.side === 'alliance' ? 0 : 1]++;
        return array;
    }, [0, 0])
});

The first argument can be a single ladder type, an array of ladder types, or an object with the following additional properties:

  • battlegroup

realmStatus(realms, region, locale, callback)

Retrieves an array containing the status of one or more realms.

armory.realmStatus(function(err, realms) {

    var queued = realms.filter(function(realm) {
        return realm.queue;
    });
});

A realm name or array of realm names can be passed as the first argument. If no names are provided, the status of all realms will be returned.

Realm Status API Documentation


battlegroups(region, locale, callback)

Retrieves a static array of all battlegroup names.

characterAchievements(region, locale, callback)

Retrieves a static array of all character achievements.

classes(region, locale, callback)

Retrieves a static array of data about character classes.

guildAchievements(region, locale, callback)

Retrieves a static array of all guild achievements.

perks(region, locale, callback)

Retrieves a static array of data about guild perks.

races(region, locale, callback)

Retrieves a static array of data about character races.

rewards(region, locale, callback)

Retrieves a static array of data about guild rewards.

armory.classes('es_MX', function(err, res) {
    console.log('Yo puede jugar un ' + res[9].name);
});

Data API Documentation


Properties

defaultRegion

The region to use if none is specified. 'us' by default.

publicKey, privateKey

Keys to use for generating an authorization header.

Authentication Documentation

Notes on usage:

  • If an error occurs (including API errors), it will be passed as an Error object to the first argument of the callback with its message in the message property. Otherwise, the API response will passed as the second argument.
  • Except for realmStatus(), all methods invoke the callback once for each resource requested.
  • lastModified must be a GMT Unix timestamp. If the requested resource has not been modified since the time of lastModifed, the callback will be invoked with both arguments empty.
  • Locale documentation.
0.6.1

11 years ago

0.6.0

11 years ago

0.5.0

12 years ago

0.4.2

12 years ago

0.4.1

12 years ago

0.4.0

13 years ago

0.3.1

13 years ago

0.3.0

13 years ago

0.2.1

13 years ago

0.2.0

13 years ago

0.1.3

13 years ago

0.1.2

13 years ago

0.1.1

13 years ago

0.1.0

13 years ago