Skip to content

hkwu/wargamer

Repository files navigation

Wargamer

npm npm Travis License: MIT

A promise-based Node.js client library for the Wargaming.net API. Supports all of the documented APIs listed in the API reference.

  • World of Tanks
  • World of Tanks Blitz
  • World of Tanks Console
  • World of Warships
  • World of Warplanes
  • Wargaming.net

This library currently supports Node 4 and above.

Installation

npm install --save wargamer

or

yarn add wargamer

UMD builds are available as well.

<script src="wargamer.min.js"></script>
<script>
  const Wargamer = window.Wargamer;
  const wot = new Wargamer.WorldOfTanks({ /* ... */ });
</script>

The UMD distribution is hosted by the following CDNs:

Usage

Below is a sample of Wargamer code. More details and examples are available on the documentation site.

import Wargamer from 'wargamer';

const wot = Wargamer.WoT({ realm: 'ru', applicationId: 'application_id'});

wot.get('account/list', { search: 'Straik' })
  .then((response) => {
    console.log(response.meta); // { count: 100 }
    console.log(response.data); // [{ nickname: 'Straik', account_id: 73892 }, ...]
  })
  .catch((error) => {
    console.log(error.message);
  });

References