api-swgoh-help-premium

Connection wrapper for api.swgoh.help, Based on api-swgoh-help (premium client)

Usage no npm install needed!

<script type="module">
  import apiSwgohHelpPremium from 'https://cdn.skypack.dev/api-swgoh-help-premium';
</script>

README

api-swgoh-help

Setup

Install via npm:

npm install api-swgoh-help-premium

You need to have a premium client running locally

Require and initialize connection:

const ApiSwgohHelp = require('api-swgoh-help-premium');
const swapi = new ApiSwgohHelp({
    protocol: 'http',
    host: 'localhost',
    port: 1234
  });

Usage

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 );

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 );