1.3.1 • Published 5 years ago
node-blizzard-caller v1.3.1
Index
Installation
npm install --save node-blizzard-caller@beta
How 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
1.3.1
5 years ago
1.3.0
5 years ago
1.2.3
6 years ago
1.1.0
6 years ago
1.0.0-rc.2
6 years ago
1.0.0-rc.1
6 years ago
1.0.0-rc.0
6 years ago
1.0.0-beta.3
6 years ago
1.0.0-beta.2
6 years ago
1.0.0-beta.1
6 years ago
1.0.0-beta.0
6 years ago
0.0.1-typescript.1
6 years ago
0.0.1-typescript.0
6 years ago
0.0.1-beta.6
6 years ago
0.0.1-beta.5
6 years ago
0.0.1-beta.4
6 years ago
0.0.1-beta.3
6 years ago
0.0.1-beta.2
6 years ago
0.0.1-beta.1
6 years ago
0.0.1-beta.0
6 years ago
1.0.1-beta.1
6 years ago
1.0.1-beta.0
6 years ago
1.0.0
6 years ago