Socket
Socket
Sign inDemoInstall

@muffinking-jpeg/wg-api-lib

Package Overview
Dependencies
8
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @muffinking-jpeg/wg-api-lib

Lib for obtaining player statistics in games made by Wargaming.net


Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Install size
783 kB
Created
Weekly downloads
 

Readme

Source

WG-API-Lib

Available on:

EN | UA | RU

Description

This is NodeJS package for easy work with Wargaming.net API. In current version supports only World of Tanks and World of Tanks Blitz.

IMPORTANT!
Starting from october 14th 2022 support for .ru (CIS earlier) will be deprecated.
This package do not support Lesta Games API (and probably will not)

Installing

To install package type in console:

npm i @muffinking-jpeg/wg-api-lib

Usage

Initialization

To start using package import this as ES6 module (No support for CommonJS. Let's move forward) and initialize object with your WG api key.

import { wgApi } from '@muffinking-jpeg/wg-api-lib';

...

const api = new wgApi('Put your WG key here')

Best practice is to use environment variables or .env file to store api keys

File .env:

...
WG_API_KEY = "YourApiKey"
...

Your code:

import * as dotenv from 'dotenv';
import { wgApi } from '@muffinking-jpeg/wg-api-lib';
...

dotenv.config();

const apiKey = process.env['WG_API_KEY']
const api = new wgApi(apiKey)
...

Methods

.searchPlayer(paramsObject)

For searching players by name.

ParamsTypesMeaning
game:'wotb' | 'worldoftanks'Choosing the game
region:'eu' | 'na' | 'asia'Choose region of game
query:stringPlayer's name
.getPlayerData(paramsObject)

For loading player's statistics.

ParamsTypesMeaning
game:'wotb' | 'worldoftanks'Choosing the game
region:'eu' | 'na' | 'asia'Choose region of game
id:numberPlayer's id
.getPlayerAchievements(paramsObject)

For loading player's achievements.

ParamsTypesMeaning
game:'wotb' | 'worldoftanks'Choosing the game
region:'eu' | 'na' | 'asia'Choose region of game
id:numberPlayer's id

Examples

How to get players list
api.searchPlayer({
    game: 'wotblitz',
    query: 'Holly_Carbonara',
    region: 'eu'
  }).then(res => {
    //Your response handler here
  })
Get player's stats
api.getPlayerData({
    game: 'wotblitz',
    id: 594863503,
    region: 'eu'
  }).then(res => {
    //Your response handler here
  })
Get player's achievements
api.getPlayerAchievements({
    game: 'wotblitz',
    id: 594863503,
    region: 'eu'
  }).then(res => {
    //Your response handler here
  })

TODO

  • Check for undef and\or incorrect API key.
  • Expand methods availability for tanks\ships.
  • Add WOWS and WOT Console support.
  • Implementing every feature from Wargaming API reference
  • Better readme
  • Translating readme to more languages

NEVER PLANED

  • Support for Lesta Games API
  • Support for wargaming authentication (Maybe it will be another module. This feature requires http server)

Keywords

FAQs

Last updated on 15 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc