battlegrounds-revisited
v1.5.5
Published
PUBG Web API wrapper for nodejs
Downloads
2
Readme
PUBG Web API wrapper for node.js
Todo
- Telemetry
- Object class
- Applied Player class
- Spectators class (not yet introduced in API)
- Rounds class (not yet introduced in API)
- Tournaments
Install
Install via npm:
npm install battlegrounds-revisited
Usage
Requiring a module returns API class:
const battlegrounds = require('battlegrounds-revisited')
const api = new battlegrounds(APIKEY)
// 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
- apikey - your apikey (you can get it here)
- platform (optional) - default platform id to be included as a parameter in every method. Full list here)
API.getSamples(params)
Returns a Sample class
- date (optional) - an instance of Date class. Has to be at least 24hrs in the past. Default value is 24 hours ago.
API.getMatch(params)
Returns a Match class
- id - Match id
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
- id - Player id
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.
- id - Player id. Has a format of
account.x
where x - 32 char hex - attributes
- Name - Player name
- shardId - platform id (full list here))
- patchVersion
- titleId
- matches - An array of Player Matches
- assets - An array of Player Assets
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.
- id - Match id. Has a format of
a-b-b-b-c
where a - 8 char hex, b - 4 char hex, c - 12 char hex - attributes
- isCustomMatch
- createdAt - date when the object was created
- duration - duration time in seconds
- gameMode - game mode (for ex duo-fpp, squad-tpp, etc)
- patchVersion
- shardId - platform id (full list here)
- stats
- tags
- titleId - tournament title. For regular matches will be
bluehole-pubg
- titleId - tournament title. For regular matches will be
- rosters - An array of Rosters
- assets - An array of Assets
- rounds - An array of Rounds
- spectators - An array of Spectators
- participants - An array of Participants
Match.get()
Calls an API to get Match's full info and returns itself.
Participant
Represents a Match Participant.
- id - Participant id. Has a format of
a-b-b-b-c
where a - 8 char hex, b - 4 char hex, c - 12 char hex - attributes
- actor
- shardId - platform id (full list here))
- stats
- swimDistance
- DBNOs
- assists - assists
- boosts - boosts used
- damageDealt - damage dealt to others
- deathType - death type. Can be
byplayer
orsuicide
- deathType - death type. Can be
- headshotKills - headshot kills
- heals - heals
- killPlace - place by kills
- killPoints - kill points
- killPointsDelta
- killStreaks
- kills - kills
- lastKillPoints
- lastWinPoints
- longestKill
- mostDamage
- name - Player name
- playerId - Player id. Has a format of
account.x
where x - 32 char hex
- playerId - Player id. Has a format of
- revives - revives
- rideDistance - distance driven on a vehicle
- roadKills - kills by vehicle
- teamKills - team kills
- timeSurvived - total time survived in seconds
- vehicleDestroys - vehicles destroyed
- walkDistance - distance a Player has walked
- weaponsAcquired
- winPlace - win place
- winPoints - total win points
- winPointsDelta
Roster
Represents a team of Participants in a Match
- id - Roster id. Has a format of
a-b-b-b-c
where a - 8 char hex, b - 4 char hex, c - 12 char hex - attributes
- shardId - platform id (full list here))
- won - Boolean. Whenever Roster won or not
- stats
- rank - Roster rank
- teamId - Roster team number in Match in order of joining
- participants - Roster Participants
Asset
Represents an Asset with an attached resource
- id - Asset id. Has a format of
a-b-b-b-c
where a - 8 char hex, b - 4 char hex, c - 12 char hex - attributes
- URL - resource url. You can download it using fetch method
- createdAt - date when the object was created
- description
- name - for Match Assets will be
telemetry
- name - for Match Assets will be
Asset.fetch()
Fetches Asset content from URL. Returns different objects depending on type (name) of an Asset:
Sample
Represents a list of Matches
- id - Asset id. Has a format of
a-b-b-b-c
where a - 8 char hex, b - 4 char hex, c - 12 char hex - attributes
- createdAt - date when the object was created
- shardId - platform id (full list here))
- titleId - tournament title. For regular matches will be
bluehole-pubg
- titleId - tournament title. For regular matches will be
- matches - an array of Matches
Season
Represents a game Season
- id - Asset id. Has a format of
a-b-b-b-c
where a - 8 char hex, b - 4 char hex, c - 12 char hex - attributes
- isCurrentSeason - boolean that indicates if season is active or not
- isOffseason - boolean, true if season is not active
Season.get()
Queries all Seasons and finds needed one by id. Returns updated Season class
PlayerSeason
Represents Player Season stats
- attributes
- assists - Number of enemy players this player damaged that were killed by teammates
- boosts - Number of boost items used
- dBNOs - Number of enemy players knocked
- dailyKills
- damageDealt - Total damage dealt. Note: Self inflicted damage is subtracted
- days
- headshotKills - Number of enemy players killed with headshots
- heals - Number of healing items used
- killPoints - Points based on how many kills this player had
- kills - Number of enemy players killed
- longestKill
- longestTimeSurvived - Longest time survived in a match
- losses - Number of matches lost
- maxKillStreaks -
- mostSurvivalTime - Longest time survived in a match
- revives - Number of times this player revived teammates
- rideDistance - Total distance traveled in vehicles measured in meters
- roadKills - Number of kills while in a vehicle
- roundMostKills - Highest number of kills in a single match
- roundsPlayed - Number of matches played
- suicides - Number of self-inflicted deaths
- teamKills - Number of times this player killed a teammate
- timeSurvived - Total time survived
- top10s - Number of times this player made it to the top 10 in a match
- vehicleDestroys - Number of vehicles destroyed
- walkDistance - Total distance traveled on foot measured in meters
- weaponsAcquired - Number of weapons picked up
- weeklyKills
- winPoints
- wins - Number of matches won
- matchesSolo - solo tpp Match array
- matchesSoloFPP - solo fpp Match array
- matchesDuo - duo tpp Match array
- matchesDuoFPP - duo fpp Match array
- matchesSquad - squad tpp Match array
- matchesSquadFPP - squad fpp Match array
- season - Season
- player - Player