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-client

v0.0.1-beta.4

Published

Asnychronous typescript wrapper for official PUBG API

Downloads

11

Readme

TypeScript version Node.js version

pubg-client

🚀 A TypeScript wrapper for official PUBG API

👩🏻‍💻 This project was setup by node-typescript-boilerplate

🌟 pubg-client offers:

API Documentation

see Generated document

Installation

To start, just install the pubg-client into your node.js project.

use npm

npm install pubg-client

or yarn

yarn add pubg-client

Import module

You can import pubg-client module in two ways:

  1. import the module and set api key
import api from 'pubg-client';
// or const api = require('pubg-client').default;
api.key = 'your_api_key';
  1. create new instance
import { createInstance } from 'pubg-client';
// or const { createInstance } = require('pubg-client');
const api = new createInstance('your_api_key');

Set environment

You can change API host and gzip compression option

// change API host to your custom API server
api.prefix = 'http://example.com'
// enable gzip compression on response
api.gzip = true
// disable gzip compression on response (default value: false)
api.gzip = false

Usage

Basic API example

Ex1. Search player 'leichtjoon' in 'steam' region

const res = await api.players('steam', 'leichtjoon')

Ex2. Search one player by player's unique id

const res = await api.player('steam', 'account.183bc4b2c3404935baf3d56fb434b393')

Ex3. Get all available seasons in 'xbox' region

const res = await api.seasons('xbox')
// api.seasons('kakao')
// api.seasons('console')
// api.seasons('steam')

Ex4. Get player's lifetime stat

const res = await api.lifetime('steam', 'account.183bc4b2c3404935baf3d56fb434b393')

Ex5. Get season stat of player

const res = await api.stat('steam', 'account.183bc4b2c3404935baf3d56fb434b393', 'division.bro.official.pc-2018-08')

Ex6. Get leaderboard of season

const res = await api.leaderboards('pc-krjp', 'division.bro.official.pc-2018-08', 'solo')

Functional API example

$platform and $user properties provide API calls through functional interfaces. See Documentation

Ex1. Search player 'leichtjoon' in 'steam' region

const res = await api.$platform('steam').players('leichtjoon')

Ex2. Get match data

const res = await api.$platform('steam').match('f7d6e66d-6fab-42ee-82cd-65650251ca29')

Ex3. Search one player by player's unique id

const res = await api.$platform('steam').$user('account.183bc4b2c3404935baf3d56fb434b393').json()

Ex4. Get player's lifetime stat

const res = await api.$platform('steam').$user('account.183bc4b2c3404935baf3d56fb434b393').lifetime()

Ex5. Get season stat of player

const res = await api.$platform('steam').$user('account.183bc4b2c3404935baf3d56fb434b393').stat('division.bro.official.pc-2018-08')

Parameters

The range of values of the platform and region parameters follows the official PUBG document. See Making Requests

Development

🏃🏽 pubg-client library was developed by using:

  • TypeScript 4.0
  • ESLint with some initial rules recommendation
  • Jest for fast unit testing and code coverage
  • Type definitions for Node.js and Jest
  • Prettier to enforce consistent code style
  • Simple example of TypeScript code and unit test
  • .editorconfig for consistent file format

License

Licensed under the APLv2. See the LICENSE file for details.