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

api-swgoh-help

v3.3.0

Published

Connection wrapper for api.swgoh.help

Downloads

19

Readme

api-swgoh-help

JavaScript client wrapper for the API at https://api.swgoh.help (Version 3.x.x)

For api access or support, please visit us on discord: https://discord.gg/kau4XTB

Setup

Install via npm:

npm install api-swgoh-help

Require and initialize connection:

const ApiSwgohHelp = require('api-swgoh-help');
const swapi = new ApiSwgohHelp({
	"username":"YOUR_USERNAME",
	"password":"YOUR_PASSWORD"
});

API Access Token

This package is set up to auto-connect, acquire, and float your access token for a 59 minute lifetime before auto-expiration.

To acquire a new token manually:

let acquiredToken = await swapi.connect();

Usage

Payloads

For current structure and available payload parameters for each available endpoint, see full api documentation at https://api.swgoh.help/swgoh

Fetch

/swgoh/* endpoints can be fetched via the prepared methods below, or with the generic fetch method shown here.

The response from api is structured as an object with: "result" containing any results returned from request, "error" containing any errors returned from request, "warning" containing any warnings returned from request

let { result, error, warning } = await swapi.fetch( 'player',  payload );
let { result, error, warning } = await swapi.fetch( 'guild',   payload );
let { result, error, warning } = await swapi.fetch( 'units',   payload );
let { result, error, warning } = await swapi.fetch( 'data',    payload );
let { result, error, warning } = await swapi.fetch( 'zetas',   payload );
let { result, error, warning } = await swapi.fetch( 'squads',  payload );
let { result, error, warning } = await swapi.fetch( 'events',  payload );
let { result, error, warning } = await swapi.fetch( 'battles', payload );

Player profiles

let { result, error, warning } = await swapi.fetchPlayer( payload );
console.log( result );

Guild profiles

let { result, error, warning } = await swapi.fetchGuild( payload );
console.log( result );

Units index

let { result, error, warning } = await swapi.fetchUnits( payload );
console.log( result );

Game details / support data

let { result, error, warning } = await swapi.fetchData( payload );
console.log( result );

Zeta recommendations

let { result, error, warning } = await swapi.fetchZetas();
console.log( result );

Squad recommendations

let { result, error, warning } = await swapi.fetchSquads();
console.log( result );

Current event schedule

let { result, error, warning } = await swapi.fetchEvents( payload );
console.log( result );

Current campaigns and battles

let { result, error, warning } = await swapi.fetchBattles( payload );
console.log( result );

Utilities

Unit (base) stats

Calculate one or more unit stats from a profile roster array Optionally include flags for Crinolo's stat api

let payload  = { allycode:123456789 };
let { result, error, warning } = await swapi.fetchPlayer( payload );

const units  = [ result.roster[10], result.roster[20] ];
const stats  = await swapi.rosterStats( units, [ "includeMods","withModCalc","gameStyle" ] );

Calculate one or more player's specific unit stats from units index Optionally include flags for Crinolo's stat api

let payload  = { allycodes:[ 123456789, 234567890 ] };
let { result, error, warning } = await swapi.fetchUnits( payload );

const unit   = {"DARTHTRAYA":result["DARTHTRAYA"]};
const stats  = await swapi.unitStats( unit, [ "includeMods","withModCalc","gameStyle" ] );

Calculate player unit stats including mods Optionally include flags for Crinolo's stat api

let allycode = 123456789;
const baseId = "BB8"; //null for all units
const stats  = await swapi.calcStats( allycode, baseId, [ "includeMods","withModCalc","gameStyle" ] );

Available language clients

  • NodeJS: https://github.com/r3volved/api-swgoh-help/tree/node
  • PHP: https://github.com/r3volved/api-swgoh-help/tree/php
  • Java: https://github.com/j0rdanit0/api-swgoh-help
  • C#: https://github.com/SdtBarbarossa/SWGOH-Help-Api-C-Sharp
  • Python: https://github.com/platzman/swgoh.help.python