Package Exports
- node-blizzard-caller
- node-blizzard-caller/lib/caller/BaseCaller
- node-blizzard-caller/lib/caller/WarcraftCaller
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-blizzard-caller) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Blizzard Caller
Index
Installation
npm install --save node-blizzard-caller@betaHow to use
Simply instanciate a WarcraftCaller :
import { Callers } from 'node-blizzard-caller';
const battleNetApiKey = 'YOUR BATTLE.NET API KEY';
const warcraftCaller = new Callers.WarcraftCaller({ apiKey: battleNetApiKey });Environment variables
Callers from discard automatically try to load some informations from environments variables:
BATTLENET_CLIENT_ID: the battle.net client idBATTLENET_CLIENT_SECRET: the battle.net client secretBLIZZARD_CALLER_REGION: the battle.net region to useBLIZZARD_CALLER_LOCALE: the battle.net locale to use
It can be override by providing as first param this kind of config:
{
"apiKey": "",
"region": "",
"locale": ""
}There is a fallback to eu region if not provided and to each region default locale if locale not provided
Events
Callers extends EventEmitter and emit 2 events which you can listen on:
import { Events } from 'node-blizzard-caller/lib/caller/WarcraftCaller';
warcraftCaller.on(Events.Call, (url) => {
// url is the full URL called by discard
});
warcraftCaller.on(Events.Error, (err) => {
// describe itself
});Region & locale helper
import { Localization } from 'node-blizzard-caller';
// All available regions (typescript enum)
const regions = Localization.Region;
const region = regions.us;
// All available locales per regions (typescript enum)
const locales = Localization.Locale;
// Region's default locale
const locale = locales[ region ].default;
// Other locales
const locale = locales.es_MX;Further reading
Contributors
- Senorihl senorihl@gmail.com
License
- Apache-2.0 : http://opensource.org/licenses/Apache-2.0