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 = ;const swapi = "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;
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;let result error warning = await swapi;let result error warning = await swapi;let result error warning = await swapi;let result error warning = await swapi;let result error warning = await swapi;let result error warning = await swapi;let result error warning = await swapi;
Player profiles
let result error warning = await swapi;console;
Guild profiles
let result error warning = await swapi;console;
Units index
let result error warning = await swapi;console;
Game details / support data
let result error warning = await swapi;console;
Zeta recommendations
let result error warning = await swapi;console;
Squad recommendations
let result error warning = await swapi;console;
Current event schedule
let result error warning = await swapi;console;
Current campaigns and battles
let result error warning = await swapi;console;
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; const units = resultroster10 resultroster20 ;const stats = await swapi;
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; const unit = "DARTHTRAYA":result"DARTHTRAYA";const stats = await swapi;
Calculate player unit stats including mods Optionally include flags for Crinolo's stat api
let allycode = 123456789;const baseId = "BB8"; //null for all unitsconst stats = await swapi;