1.1.0 • Published 5 years ago
siegegg-api v1.1.0
SiegeGG API
This package is a small library built for interation with the SiegeGG API. The package features full support for community and enterprise features. You can find details on the API here.
Usage
Before you start using this library, you need to register a SiegeGG account, if you have not already one, and then create an API application at the dev hub. There you will obtain an API token that authorizes your application.
const { SiegeGGApiClient } = require('siegegg-api');
const api = new SiegeGGApiClient({
// replace a_random_token with your obtained API token
token: 'a_random_token',
});
// using Promises
api.player('PENGU').then(player => console.log(player.nationality)); // Denmark
api.basic()
.news()
.then(articles => {
let authors = articles.data.map(article => article.author);
console.log(authors); // [TheRussianEwok, Boxi, ChankaNewsNetwork, ...]
});
// or using async/await
let player = await app.player('PENGU');
console.log(player.nationality); // Denmark
let articles = await app.basic().news();
let authors = articles.data.map(article => article.author);
console.log(authors); // [TheRussianEwok, Boxi, ChankaNewsNetwork, ...]
License
AGPL-v3.0