Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

battlenet-api

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

battlenet-api - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

239

lib/wow/character.js

@@ -10,237 +10,106 @@ /**

var character = {
function character (params, callback) {
var region = params.region,
realm = params.realm,
name = params.name,
fields = params.fields.join(',');
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: fields
}
}, callback);
}
return {
profile: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name
}, callback);
params.fields = [];
character(params, callback);
},
achievements: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'achievements'
}
}, callback);
params.fields = ['achievements'];
character(params, callback);
},
appearance: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'appearance'
}
}, callback);
params.fields = ['appearance'];
character(params, callback);
},
guild: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'guild'
}
}, callback);
params.fields = ['guild'];
character(params, callback);
},
hunterPets: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'hunterPets'
}
}, callback);
params.fields = ['hunterPets'];
character(params, callback);
},
items: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'items'
}
}, callback);
params.fields = ['items'];
character(params, callback);
},
mounts: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'mounts'
}
}, callback);
params.fields = ['mounts'];
character(params, callback);
},
pets: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'pets'
}
}, callback);
params.fields = ['pets'];
character(params, callback);
},
petSlots: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'petSlots'
}
}, callback);
params.fields = ['petSlots'];
character(params, callback);
},
progression: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'progression'
}
}, callback);
params.fields = ['progression'];
character(params, callback);
},
pvp: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'pvp'
}
}, callback);
params.fields = ['pvp'];
character(params, callback);
},
quests: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'quests'
}
}, callback);
params.fields = ['quests'];
character(params, callback);
},
reputation: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'reputation'
}
}, callback);
params.fields = ['reputation'];
character(params, callback);
},
stats: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'stats'
}
}, callback);
params.fields = ['stats'];
character(params, callback);
},
talents: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'talents'
}
}, callback);
params.fields = ['talents'];
character(params, callback);
},
titles: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'titles'
}
}, callback);
params.fields = ['titles'];
character(params, callback);
},
audit: function(params, callback) {
var region = params.region,
realm = params.realm,
name = params.name;
params.fields = ['audit'];
character(params, callback);
},
battleNetApiRequest({
region: region,
path: '/wow/character/' + realm + '/' + name,
qs: {
fields: 'audit'
}
}, callback);
aggregate: function (params, callback) {
character(params, callback);
}

@@ -250,4 +119,2 @@

return character;
})();

@@ -5,3 +5,3 @@ {

"description": "A wrapper for the Battle.net API",
"version": "0.1.3",
"version": "0.1.4",
"homepage": "https://github.com/benweier/battlenet-api",

@@ -8,0 +8,0 @@ "license": "MIT",

@@ -1,4 +0,313 @@

battlenet-api
=============
# Battle.net API
A Node JS wrapper for the Battle.net API.
A Node JS wrapper for the Battle.net API
# Install
Add `battlenet-api` to your application's `package.json` file and run:
```
npm install
```
Alternatively:
```
npm install battlenet-api --save
```
# How to use
Simply `require()` the Battle.net API within your application:
```javascript
var bnet = require('battlenet-api');
```
And then access the API methods to request data:
```javascript
bnet.wow.character.profile(obj, callback);
```
# Documentation
Each API method receives a parameters object for the request, and a callback function to execute once the request has completed. The available request parameters are explained for each method below.
`callback` takes three arguments: `error`, `response`, and `body`.
## Overview
### World of Warcraft
* Achievement
* Auction
* Battle Pet
* Ability
* Species
* Stats
* Challenge
* Realm Leaderboard
* Region Leaderboard
* Character
* Profile
* Achievements
* Appearance
* Guild
* Hunter Pets
* Items
* Mounts
* Pets
* Pet Slots
* Progression
* PVP
* Quests
* Reputation
* Stats
* Talents
* Titles
* Audit
* Guild
* Item
* Item
* Item Set
* PVP
* Leaderboard
* Quest
* Realm Status
* Recipe
* Spell
## World of Warcraft
The World of Warcraft API methods are available through the `wow` object of the Battle.net API.
```javascript
var wow = bnet.wow;
```
Each API method will take `region` as one of its parameters. The possible values are `us`, `eu`, `kr`, `tw`.
### Achievement
*Parameters*
`region` the region of the achievment.
`id` the unique achievement ID.
*Usage*
```javascript
bnet.wow.achievement({region: 'us', id: 2144}, function(err, resp, body) {
console.log(body);
});
```
### Character
All character requests require the following parameters:
`region` the region of the character.
`realm` the slugified realm of the character.
`name` the name of the character.
#### Profile
Returns basic profile data about the character.
*Usage*
```javascript
bnet.wow.character.profile({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Achievements
Returns the achievement data of the character.
*Usage*
```javascript
bnet.wow.character.achievements({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Appearance
Returns the appearance data of the character.
*Usage*
```javascript
bnet.wow.character.appearance({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Guild
Returns the guild data of the character.
*Usage*
```javascript
bnet.wow.character.guild({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Hunter Pets
Returns the hunter pet data of the character (where applicable).
*Usage*
```javascript
bnet.wow.character.hunterPets({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Items
Returns the item data of the character.
*Usage*
```javascript
bnet.wow.character.items({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Mounts
Returns the mount data of the character.
*Usage*
```javascript
bnet.wow.character.mounts({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Pets
Returns the pet data of the character.
*Usage*
```javascript
bnet.wow.character.pets({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Pet Slots
Returns the pet slots data of the character.
*Usage*
```javascript
bnet.wow.character.petSlots({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Progression
Returns the progression data of the character.
*Usage*
```javascript
bnet.wow.character.progression({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### PVP
Returns the PVP data of the character.
*Usage*
```javascript
bnet.wow.character.pvp({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Quests
Returns the quest data of the character.
*Usage*
```javascript
bnet.wow.character.quests({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Reputation
Returns the reputation data of the character.
*Usage*
```javascript
bnet.wow.character.reputation({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Stats
Returns the statistics data of the character.
*Usage*
```javascript
bnet.wow.character.stats({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Talents
Returns the talent data of the character.
*Usage*
```javascript
bnet.wow.character.talents({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Titles
Returns the title data of the character.
*Usage*
```javascript
bnet.wow.character.titles({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Audit
Returns an audit of the character's equipment.
*Usage*
```javascript
bnet.wow.character.audit({region: 'us', realm: 'proudmoore', name: 'charni'}, function(err, resp, body) {
console.log(body);
});
```
#### Aggregate
Returns the specified character fields aggregated in a single request.
*Parameters*
`fields` an array of one or more character fields.
*Usage*
```javascript
bnet.wow.character.aggregate({region: 'us', realm: 'proudmoore', name: 'charni', fields: ['pets', 'petSlots']}, function(err, resp, body) {
console.log(body);
});
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc