Giter Club home page Giter Club logo

pubg.io's Introduction

pubg.io

An ES6 Promise A+ Compliant NodeJS Library for the Official PlayerUnknown: Battlegrounds API.

PLEASE NOTE - This is an unfinished wrapper until the PUBG API is officially released to the public. Although tested, I can't guarantee this will consistently work until I have created a full release. You're free to test it if you have an API key, however and will accept collaborations. 🤘

Install

Install with Yarn

yarn add pubg.io

Install with NPM

npm install pubg.io

Import (ES6)

import { PUBGAPI } from 'pubg.io';

Defaults

Option Type Default Description
platform String 'PC' The platform to get data from. You can use PC or Xbox
region String 'EU' The region to get data from. See https://goo.gl/MqbFty for allowed regions.
query Object {} The Query String object to pass additional filters/requests.

Usage

const api = new PUBGAPI('InsertAPIKeyHere');

Match

https://developer.playbattlegrounds.com/docs/en/matches.html

Defaults & Limitations

  • Data retention period is 14 days
  • The max search time span between createdAt-start and createdAt-end is 14 days.
  • If you don’t specify createdAt-start, the default is now() - 14 days.
  • If you don’t specify createdAt-end, the default is now().
  • If you search for a time > now, the default is now().
  • If you search for a time before the retention period, the default is the retention period (now() - 14 days).
  • If createdAt-start >= createdAt-end, you will receive an error.

GET_MATCH

api.get('match', { id: Number, ...options }, (match, error) => {
	console.log(match || error);
});

GET_MATCHES

api.get('matches', { ...options }, (match, error) => {
	console.log(matches || error);
});

Filters

Use the query option to set filters/sorting parameters.

Oldest First

api.get('matches', { query: { sort: 'createdAt' } }, (match, error) => {
	console.log(match || error);
});

Newest First

api.get('matches', { query: { sort: '-createdAt' } }, (match, error) => {
	console.log(match || error);
});

Limit

// Limit to 2 items
api.get('matches', { query: { 'page[limit]': '2' } }, (match, error) => {
	console.log(match || error);
});

Offset

// Offset data by 2 items, returning item 2 through to 5.
api.get('matches', { query: { 'page[limit]': '5', 'page[offset]': '2' } }, (match, error) => {
	console.log(match || error);
});

Testing

Testing is carried out with Mocha. To test, run:

npm test

TODO

  • Build calls to GET_TELEMETRY data
  • Refactor/implement individual calls, i.e.,
import {
	PUBGAPI,
	Match,
	Matches
} from 'pubg.io';

const myAPI = new PUBGAPI(key);

const myMatch = new Match(key, ...options, callback);

pubg.io's People

Contributors

devjmd avatar ekralc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.