battlenet-api
Advanced tools
Comparing version 0.1.5 to 0.2.0
@@ -11,3 +11,3 @@ /** | ||
auction: require('./wow/auction'), | ||
battlepet: require('./wow/battlepet'), | ||
battlePet: require('./wow/battlepet'), | ||
challenge: require('./wow/challenge'), | ||
@@ -20,3 +20,3 @@ character: require('./wow/character'), | ||
quest: require('./wow/quest'), | ||
realmstatus: require('./wow/realm'), | ||
realmStatus: require('./wow/realm'), | ||
recipe: require('./wow/recipe'), | ||
@@ -23,0 +23,0 @@ spell: require('./wow/spell') |
@@ -31,3 +31,3 @@ /** | ||
var options = extend(defaults, params); | ||
options.url = 'https://' + options.region + options.host + options.path; | ||
options.url = 'https://' + options.origin + options.host + options.path; | ||
@@ -34,0 +34,0 @@ request(options, function(err, resp, body) { |
@@ -11,7 +11,7 @@ /** | ||
return function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/achievement/' + id, | ||
@@ -18,0 +18,0 @@ }, callback); |
@@ -11,7 +11,7 @@ /** | ||
return function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
realm = params.realm; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/auction/data/' + realm | ||
@@ -18,0 +18,0 @@ }, callback); |
@@ -13,7 +13,7 @@ /** | ||
ability: function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/battlePet/ability/' + id | ||
@@ -24,7 +24,7 @@ }, callback); | ||
species: function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/battlePet/species/' + id | ||
@@ -35,3 +35,3 @@ }, callback); | ||
stats: function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id, | ||
@@ -45,3 +45,3 @@ query = { | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/battlePet/stats/' + id, | ||
@@ -48,0 +48,0 @@ qs: query |
@@ -13,7 +13,7 @@ /** | ||
realmLeaderboard: function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
realm = params.realm; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/challenge/' + realm | ||
@@ -24,7 +24,7 @@ }, callback); | ||
regionLeaderboard: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
path: '/wow/challenge/region' | ||
origin: origin, | ||
path: '/wow/challenge/origin' | ||
}, callback); | ||
@@ -31,0 +31,0 @@ } |
@@ -11,3 +11,3 @@ /** | ||
function character(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
realm = params.realm, | ||
@@ -18,3 +18,3 @@ name = params.name, | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/character/' + realm + '/' + name, | ||
@@ -21,0 +21,0 @@ qs: { |
@@ -13,6 +13,6 @@ /** | ||
battlegroups: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/battlegroups' | ||
@@ -23,6 +23,6 @@ }, callback); | ||
characterRaces: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/character/races' | ||
@@ -33,6 +33,6 @@ }, callback); | ||
characterClasses: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/character/classes' | ||
@@ -43,6 +43,6 @@ }, callback); | ||
characterAchievement: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/character/achievements' | ||
@@ -53,6 +53,6 @@ }, callback); | ||
guildRewards: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/guild/rewards' | ||
@@ -63,6 +63,6 @@ }, callback); | ||
guildPerks: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/guild/perks' | ||
@@ -73,6 +73,6 @@ }, callback); | ||
itemClasses: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/item/classes' | ||
@@ -83,6 +83,6 @@ }, callback); | ||
talents: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/talents' | ||
@@ -93,6 +93,6 @@ }, callback); | ||
petTypes: function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/data/pet/types' | ||
@@ -99,0 +99,0 @@ }, callback); |
@@ -11,3 +11,3 @@ /** | ||
function guild(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
realm = params.realm, | ||
@@ -18,3 +18,3 @@ name = params.name, | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/guild/' + realm + '/' + name, | ||
@@ -30,3 +30,3 @@ qs: { | ||
profile: function(params, callback) { | ||
params.field = []; | ||
params.fields = []; | ||
guild(params, callback); | ||
@@ -33,0 +33,0 @@ }, |
@@ -13,7 +13,7 @@ /** | ||
item: function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/item/' + id | ||
@@ -24,7 +24,7 @@ }, callback); | ||
set: function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/item/set/' + id | ||
@@ -31,0 +31,0 @@ }, callback); |
@@ -13,7 +13,7 @@ /** | ||
leaderboards: function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
bracket = params.bracket; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/leaderboard/' + bracket | ||
@@ -20,0 +20,0 @@ }, callback); |
@@ -11,7 +11,7 @@ /** | ||
return function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/quest/' + id | ||
@@ -18,0 +18,0 @@ }, callback); |
@@ -11,7 +11,11 @@ /** | ||
return function(params, callback) { | ||
var region = params.region; | ||
var origin = params.origin, | ||
realms = params.realms.join(',') || ''; | ||
battleNetApiRequest({ | ||
region: region, | ||
path: '/wow/realm/status' | ||
origin: origin, | ||
path: '/wow/realm/status', | ||
qs: { | ||
realms: realms | ||
} | ||
}, callback); | ||
@@ -18,0 +22,0 @@ }; |
@@ -11,7 +11,7 @@ /** | ||
return function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/recipe/' + id | ||
@@ -18,0 +18,0 @@ }, callback); |
@@ -11,7 +11,7 @@ /** | ||
return function(params, callback) { | ||
var region = params.region, | ||
var origin = params.origin, | ||
id = params.id; | ||
battleNetApiRequest({ | ||
region: region, | ||
origin: origin, | ||
path: '/wow/spell/' + id | ||
@@ -18,0 +18,0 @@ }, callback); |
@@ -5,3 +5,3 @@ { | ||
"description": "A wrapper for the Battle.net API", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/benweier/battlenet-api", | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
102
README.md
@@ -97,3 +97,3 @@ # Battle.net API | ||
**ALL** API methods take `region` as one of its parameters. The possible values are `us`, `eu`, `kr`, `tw`. The China API is unavailable at this time. | ||
**ALL** API methods take `origin` as one of the parameters. This indicates which regional API endpoint to use. The possible values are `us`, `eu`, `kr`, `tw`. The China API is unavailable at this time. | ||
@@ -107,3 +107,3 @@ --- | ||
`region` [`us`, `eu`, `kr`, `tw`] | ||
`origin` [`us`, `eu`, `kr`, `tw`] | ||
@@ -125,3 +125,3 @@ `id` the unique achievement ID. | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -146,3 +146,3 @@ `realm` the slugified realm name. | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -154,3 +154,3 @@ `id` the unique ID of the battle pet ability. | ||
```javascript | ||
bnet.wow.battlepet.ability({region: 'us', id: 640}, callback); | ||
bnet.wow.battlePet.ability({region: 'us', id: 640}, callback); | ||
``` | ||
@@ -163,3 +163,3 @@ | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -171,3 +171,3 @@ `id` the unique ID of the battle pet species. | ||
```javascript | ||
bnet.wow.battlepet.species({region: 'us', id: 258}, callback); | ||
bnet.wow.battlePet.species({region: 'us', id: 258}, callback); | ||
``` | ||
@@ -180,3 +180,3 @@ | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -190,3 +190,3 @@ `id` the unique ID of the battle pet species. | ||
```javascript | ||
bnet.wow.battlepet.stats({region: 'us', id: 258, fields: { level: 25, breedId: 5, qualityId: 4 }}, callback); | ||
bnet.wow.battlePet.stats({region: 'us', id: 258, fields: { level: 25, breedId: 5, qualityId: 4 }}, callback); | ||
``` | ||
@@ -203,3 +203,3 @@ | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -218,3 +218,3 @@ `realm` the slugified realm name. | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -234,3 +234,3 @@ *Usage* | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -454,3 +454,3 @@ `realm` the slugified realm of the character. | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -471,3 +471,3 @@ `id` the unique item id. | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -489,3 +489,3 @@ `id` the unique item set id. | ||
`region` [`us`, `eu`, `kr`, `tw`]. | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
@@ -558,2 +558,14 @@ `realm` the slugified realm of the guild. | ||
*Parameters* | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
`bracket` [`2v2`, `3v3`, `5v5`, `rbg`] | ||
*Usage* | ||
```javascript | ||
bnet.wow.pvp({region: 'us', bracket: '2v2'}, callback); | ||
``` | ||
--- | ||
@@ -564,2 +576,14 @@ | ||
*Parameters* | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
`id` the unique quest id. | ||
*Usage* | ||
```javascript | ||
bnet.wow.quest({region: 'us', quest: 13146}, callback); | ||
``` | ||
--- | ||
@@ -570,9 +594,40 @@ | ||
*Parameters* | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
`fields` [optional] an array of one or more realms to limit. | ||
*Usage* | ||
All realms | ||
```javascript | ||
bnet.wow.realmStatus({region: 'us']}, callback); | ||
``` | ||
Selected realms | ||
```javascript | ||
bnet.wow.realmStatus({region: 'us', realms: ['proudmoore', 'blackrock', 'frostmourne']]}, callback); | ||
``` | ||
--- | ||
#### Status | ||
<a name="recipe"></a> | ||
### Recipe | ||
*Parameters* | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
`id` the unique recipe id. | ||
*Usage* | ||
All realms | ||
```javascript | ||
bnet.wow.recipe({region: 'us', id: 33994]}, callback); | ||
``` | ||
--- | ||
@@ -583,2 +638,13 @@ | ||
--- | ||
*Parameters* | ||
`origin` [`us`, `eu`, `kr`, `tw`]. | ||
`id` the unique spell id. | ||
*Usage* | ||
All realms | ||
```javascript | ||
bnet.wow.spell({region: 'us', id: 8056]}, callback); | ||
``` |
26994
21
536
632