Giter VIP home page Giter VIP logo

pubg_api's Introduction

Nodejs Wrapper for the official PUBG API

npm 0.0.5

Intro

This is a universal wrapper/client for the official PlayerUnknown's BattleGround's API that runs on Node JS and the browser.

Project owner is Wobow, and is open to contribution.

It includes helpers to do the following :

Matches

  • Load and filter matches
  • Load a specific match

Table of contents

Installation

$ npm install pubg-api@latest -S

Usage

After installation, you can import the module to your project using require.

const Pubgapi = require('pubg-api');

const apiInstance = new Pubgapi('<apiKey>');

The module exposes a class that represents an instance of the api, given an official API key that you must provide.

You can then interract with the instance of the API. All routes use promises by default.

For example :

apiInstance
    .loadMatches(options)
    .then(matches => {
        // success
    }, err => {
        // handle error
    });

You can force the wrapper to return rxjs' Observables only by specifying with the asyncType options:

const apiInstance = new PubgApi('<apiKey>', {asyncType: 'observable'});

or

apiInstance.asyncType = 'observable';

then

apiInstance
    .loadMatches(options) // <-- Now returns an Observable
    .subscribe(matches => {
        // success
    }, err => {
        // handle error
    });

Status

This tab highlight the status of each route and function attached to it.

Route Function Status Version
/matches PubgApi.loadMatches Deprecated ^0.0.1
/matches/{id} PubgApi.loadMatchById Up to date ^0.0.1
/players/ PubgApi.searchPlayers Up to date ^1.0.0
/players/{id} PubgApi.loadPlayerById Up to date ^1.0.0
telemetry PubgApi.loadTelemetry Up to date ^0.6.0
/status PubgApi.healthStatus Up to date ^0.0.1

Contributing

If you want to contribute, open a pull request. Unless the change you are requesting is a hotfix for the latest stable version, you should always pull from develop.

Branch organisation

master is the branch where we try to have the latest stable version up to date. Every new version shall be tagged properly with its version, followed by a release. One cannot push to this branch without a code review from the code owners. Use develop instead.

develop is the branch used to iterate the development versions of the wrapper. It should always be based on master. All unstable versions of the wrapper will be tested on this branch.

Versioning

We will follow the naming convention of major.minor.build.

Lint

We are using eslint to check the code syntax, and are using the AirBnB style guide for Javascript. To run the lint :

$ npm run lint

Be sure to clean your code before submitting it.

Building

To build the wrapper, run

$ npm run build

It will generate the file lib/pubg-api.js using babel.

Publishing

Run

$ npm publish

It will automatically check lint, unit tests and build the lib properly before publishing. The version must be bumped manually.

Tests

You can run the unit tests executing npm test. To execute the tests, you must provide an environnment variable PUBG_API_KEY_TEST set with the api key you want to use to run the tests.

$ export PUBG_API_KEY_TEST=<your API key>
$ npm test

Roadmap & Guidelines

The goal of this wrapper is to simplify access to the API, and give a broader spectrum of functions to help developers use the API to its full potential.

This includes developping functions that computes multiple API calls and responses.

  • Implement Telemetry
  • Implement rxjs observable alternative to promise
  • Allow selecting a specific shard for each call, instead of setting a default shard
  • Wrap multiple shard functions

pubg_api's People

Contributors

kyleruscigno avatar ryancopley avatar wobow avatar zoidyzoidzoid avatar

Watchers

 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.