spigotmc-api
v0.0.2
Published
A simple TypeScript wrapper around the SpigotMC's XenforoResourceManagerAPI
Downloads
3
Readme
Spigot TS API
A simple wrapper around XenforoResourceManagerAPI(An API that exposes some SpigotMC information)
Installation
# Use your own package manager
npm install -S spigotmc-api
Usage
import { SpigotAPI } from "spigotmc-api";
const api = new SpigotAPI();
const authorResponse = await api.author.find("xrexy");
if (authorResponse.status === "error") {
console.log(authorResponse.error, authorResponse.code);
console.log(authorResponse.exception);
return;
}
const author = authorResponse.value;
if (author === null) {
console.log("Author not found");
return;
}
const resourcesResponse = await api.resource.byAuthor(author.id.toString());
if (resourcesResponse.status === "success") {
console.log(
`Found ${resourcesResponse.value.length} resources by ${author.username}`
);
}