All Projects → benweier → Blizzard.js

benweier / Blizzard.js

Licence: mit
A promise-based Node.JS library for the Blizzard Battle.net Community Platform API

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Blizzard.js

Before After Hook
wrap methods with before/after hooks
Stars: ✭ 49 (-56.64%)
Mutual labels:  api, promise
Poloniex Api Node
Poloniex API client for REST and WebSocket API
Stars: ✭ 138 (+22.12%)
Mutual labels:  api, promise
Toolkit
Collection of useful patterns
Stars: ✭ 137 (+21.24%)
Mutual labels:  api, promise
Apisauce
Axios + standardized errors + request/response transforms.
Stars: ✭ 2,303 (+1938.05%)
Mutual labels:  api, promise
Rapid.js
An ORM-like Interface and a Router For Your API Requests
Stars: ✭ 700 (+519.47%)
Mutual labels:  api, promise
Node Instagram
Instagram api client for node that support promises.
Stars: ✭ 185 (+63.72%)
Mutual labels:  api, promise
Mande
600 bytes convenient and modern wrapper around fetch
Stars: ✭ 154 (+36.28%)
Mutual labels:  api, promise
Fritzbox.js
☎️ The leading AVM Fritz!Box API for NodeJS and JavaScript.
Stars: ✭ 36 (-68.14%)
Mutual labels:  api, promise
Flowa
🔥Service level control flow for Node.js
Stars: ✭ 66 (-41.59%)
Mutual labels:  api, promise
Dualsense Windows
Windows API for the PS5 DualSense controller
Stars: ✭ 111 (-1.77%)
Mutual labels:  api
Boilerplate
🍪 ML application template to create API services around your ML code.
Stars: ✭ 112 (-0.88%)
Mutual labels:  api
Flare
Flare is a service that notify changes of HTTP endpoints
Stars: ✭ 110 (-2.65%)
Mutual labels:  api
Next
Directus is a real-time API and App dashboard for managing SQL database content. 🐰
Stars: ✭ 111 (-1.77%)
Mutual labels:  api
Traduora
Ever® Traduora - Open-Source Translation Management Platform
Stars: ✭ 1,580 (+1298.23%)
Mutual labels:  api
Simple token authentication
Simple (but safe) token authentication for Rails apps or API with Devise.
Stars: ✭ 1,474 (+1204.42%)
Mutual labels:  api
Psn Api
PlayStation Network API in python
Stars: ✭ 112 (-0.88%)
Mutual labels:  api
Ts3 Nodejs Library
TeamSpeak 3 Server Query Library supports SSH and RAW Query
Stars: ✭ 110 (-2.65%)
Mutual labels:  promise
Ssh2 Promise
ssh with promise/async await and typescript support
Stars: ✭ 110 (-2.65%)
Mutual labels:  promise
Overwatch Api
A RESTful API for the Overwatch Game
Stars: ✭ 112 (-0.88%)
Mutual labels:  api
Lyrics.ovh
Source of lyrics.ovh and API to search for lyrics of a song
Stars: ✭ 112 (-0.88%)
Mutual labels:  api

Blizzard.js

Travis Codecov Greenkeeper badge Gitter

Blizzard.js is a promise-based Node.js library for the Blizzard Community Platform API.

Install

Install blizzard.js and save to your package.json dependencies in one easy step:

With npm:

$ npm install blizzard.js --save

With yarn:

$ yarn add blizzard.js

Usage

Step 1: require() and initialize() Blizzard.js within your application:

const blizzard = require('blizzard.js').initialize({
  key: BLIZZARD_CLIENT_ID,
  secret: BLIZZARD_CLIENT_SECRET,
  origin: 'us', // optional
  locale: 'en_US' // optional
  token: '' // optional
});

Step 2: Fetch an API token, if one was not provided to intialize. You may prefetch a token however you like as documented by Client Credentials Flow

blizzard.getApplicationToken()
  .then(response => {
    blizzard.defaults.token = response.data.access_token
  });

Step 3: Call the API methods to request data:

blizzard.wow.character(['profile'], { origin: 'us', realm: 'amanthul', name: 'charni' })
  .then(response => {
    console.log(response.data);
  });

Full code example with async/await

const blizzard = require('blizzard.js').initialize({
  key: process.env.BLIZZARD_CLIENT_ID,
  secret: process.env.BLIZZARD_CLIENT_SECRET,
  origin: 'us',
  locale: 'en_US'
});

async function example () {
  try {
    await blizzard.getApplicationToken()
      .then(response => {
        blizzard.defaults.token = response.data.access_token
      });
    const item = await blizzard.wow.item({ id: 168185 });
    console.log(item)
  } catch (err) {
    console.error(err);
  }
}

example();

Battle.net API Key

Your private Blizzard API Client ID, Secret & token must be passed to .initialize(). Please see the documentation at the Blizzard Developer Portal to obtain your own Blizzard API credentials.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].