feed4rz / node-battlegrounds

PUBG Web API wrapper for nodejs
MIT License
12 stars 3 forks source link
api nodejs pubg

PUBG Web API wrapper for nodejs

Todo

Install

Clone this repo and include index.js or install via npm:

npm install battlegrounds

Usage

Requiring a module returns API class:

const battlegrounds = require('battlegrounds')

const api = new battlegrounds(APIKEY, 'pc-eu')

// Get a player
const res = await api.getPlayers({ names: ['shroud'] })

Description

The main focus of this module is it's ease of use.

For example, getting a player returns its class that contains other properties methods of which can be used:

const res = await api.getPlayers({ names: ['shroud'] })

// Is a member of Player class
const player = res[0]

// Get first match. Match class is returned
const match = player.matches[0].get()

Classes

List of all classes returned by a module

API(apikey[, platform])

Is returned by module when required

API.getSamples(params)

Returns a Sample class

API.getMatch(params)

Returns a Match class

Note: currently it is not possible to get custom Matches.

API.getPlayers(params)

Returns a list of Player classes

Note: at least one of those parameters have to be provided, in other cases "MissingParameter" error will be thrown

API.getPlayer(params)

Returns a Player class

API.getSeasons(params)

Returns a list of Season classes

API.getPlayerSeason(params)

Returns a PlayerSeason classes

Player

Represents a Player. If only contains its id, get method has to be called to get full info about itself.

Player.get()

Calls an API to get Player's full info and returns itself.

Match

Represents a Match. If only contains its id, get method has to be called to get full info about itself.

Match.get()

Calls an API to get Match's full info and returns itself.

Participant

Represents a Match Participant.

Roster

Represents a team of Participants in a Match

Asset

Represents an Asset with an attached resource

Asset.fetch()

Fetches Asset content from URL. Returns different objects depending on type (name) of an Asset:

Sample

Represents a list of Matches

Season

Represents a game Season

Season.get()

Queries all Seasons and finds needed one by id. Returns updated Season class

PlayerSeason

Represents Player Season stats