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

bs-api-core

v2.1.0

Published

Simple wrapper around the Blazing Sails rest api

Downloads

1

Readme

bs-api-core

Local cache is updated only once every 30min minimum when a command uses a certain endpoint

Implementation

const bswrapper = require('bs-api-core');
bswrapper.setApiKey('MYAPIKEY');

// Need async to use await!
async function exampleFunction(steamID){


	const myself = await bswrapper.getSinglePlayer(steamID); // Returns single user data (Currently not working due to formatting differences)

    const myMatches = await bswrapper.getSinglePlayerMatches(steamID); // Returns all matches for a single user

	const all = await bswrapper.getAllPlayers(); // Returns all player data
		
	const allMatches = await bswrapper.getAllMatches(); // Returns all match data
}

exampleFunction('MYSTEAMID64');

All Functions

  • setApiKey => Sets the BS api key
  • getSinglePlayer => Returns the data for a single user (Takes their steamID64 as input)
  • getSinglePlayerMatches => Returns all matches for a single user (Takes their steamID64 as input)
  • getAllPlayers => Returns the data for all players
  • getAllMatches => Returns the data for all matches

Force

Each of the above functions has a force alternative to bypass caching and pull direct from server, functionNameForce(), these however can only be used if your auth token has the permission to do so. Otherwise the api will ignore the request.

Example Responses

getSinglePlayer

{
  isValid: true,
  content: {
    id: '1',
    steam_id: '7659999999999999',
    display_name: 'Display_Name',
    level: '999',
    total_experience: '999999',
    br_games_played: '99',
    br_games_won: '66',
    conquest_games_played: '99',
    conquest_games_won: '66',
    cursed_games_played: '99',
    cursed_games_won: '66',
    first_seen: '1970-08-23 18:11:30',
    last_seen: '1970-10-20 21:19:56'
  }
}

getSinglePlayerMatches

{
    isValid : true,
    content: [
        {
            id: '1',
            display_name: 'Display_Name',
            player_steam_id: '7659999999999999',
            level: '999',
            experience: '999999',
            duration: '99',
            date: '1970-10-20 21:19:56'
        }
    ...]
}

getAllPlayers

{
    isValid : true,
    content: [
        {
            id: '1',
            steam_id: '7659999999999999',
            display_name: 'Display_Name',
            level: '999',
            total_experience: '999999',
            br_games_played: '99',
            br_games_won: '66',
            conquest_games_played: '99',
            conquest_games_won: '66',
            cursed_games_played: '99',
            cursed_games_won: '66',
            first_seen: '1970-08-23 18:11:30',
            last_seen: '1970-10-20 21:19:56'
        }
    ...]
}

getAllMatches

{
    isValid : true,
    content: [
        {
            id: '1',
            display_name: 'Display_Name',
            player_steam_id: '7659999999999999',
            level: '999',
            experience: '999999',
            duration: '99',
            date: '1970-10-20 21:19:56'
        }
    ...]
}