1.3.1 • Published 5 years ago

node-blizzard-caller v1.3.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
5 years ago

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 id
  • BATTLENET_CLIENT_SECRET: the battle.net client secret
  • BLIZZARD_CALLER_REGION: the battle.net region to use
  • BLIZZARD_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

See full docs

Contributors

License

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-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