agma-io.js
v1.2.2
Published
A simple, easy to use promise-based module for interacting with some Agma.io APIs.
Readme
agma-io.js
A simple, easy to use promise-based module for interacting with some Agma.io APIs.
Table of Contents
Installing
Using NPM:
$ npm i agma-io.jsUsing Yarn:
$ yarn add agma-io.jsExample
Get all servers
const { getServers } = require("agma-io.js");
(async () => {
const servers = await getServers();
})();Get all servers by given region
const { getServers } = require("agma-io.js");
(async () => {
const euServers = await getServers("EU");
})();Get the mass leaderboard of a server by server id
const { getMassLeaderboard } = require("agma-io.js");
(async () => {
const selffeedEuMassLeaderboard = await getMassLeaderboard(29);
})();Get the global levels leaderboard
const { getLevelsLeaderboard } = require("agma-io.js");
(async () => {
const levelsLeaderboard = await getLevelsLeaderboard();
})();Get a user by username
NOTE: This uses the Battle Royale API. This means that if the given user hasn't played Battle Royale yet, it will return an error.
const { getBattleRoyaleUser } = require("agma-io.js");
(async () => {
const user = await getBattleRoyaleUser("Nuke");
})();Of course you can use .then() and things like that.
const { getBattleRoyaleUser } = require("agma-io.js");
getBattleRoyaleUser("Nuke")
.then((user) => {
console.log(user);
})
.catch((err) => {
console.log(err);
});