npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pubg-api

v1.1.2

Published

An open-source wrapper for the official PlayerUnknown's Battleground API

Downloads

22

Readme

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 defaut.

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
  • [x] Implement rxjs observable alternative to promise
  • [ ] Allow selecting a specific shard for each call, instead of setting a default shard
  • [ ] Wrap multiple shard functions