Update the JS SDK to support the new layout of the /mojang/status endpoint
All checks were successful
Publish JS SDK / docker (push) Successful in 21s

This commit is contained in:
Braydon 2024-04-18 13:18:00 -04:00
parent fd16430307
commit cb0280f817
4 changed files with 30 additions and 5 deletions

@ -1,6 +1,6 @@
{ {
"name": "restfulmc-lib", "name": "restfulmc-lib",
"version": "1.1.2", "version": "1.1.3",
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>", "author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.", "description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
"keywords": [ "keywords": [

@ -1,7 +1,32 @@
import { MojangServerStatus } from "@/types/mojang/server-status";
/** /**
* Represents the status of * Represents the status of
* a service provided by Mojang. * a service provided by Mojang.
*/ */
export type MojangServerStatusResponse = { export type MojangServerStatusResponse = {
[endpoint: string]: Status; /**
* A list of Mojang servers.
*/
servers: MojangServer[];
};
/**
* A Mojang server.
*/
type MojangServer = {
/**
* The name of this server.
*/
name: string;
/**
* The endpoint to this server.
*/
endpoint: string;
/**
* The status of this server.
*/
status: MojangServerStatus;
}; };

@ -1,7 +1,7 @@
/** /**
* The status of a service. * The status of a service.
*/ */
export enum Status { export enum MojangServerStatus {
ONLINE = "ONLINE", ONLINE = "ONLINE",
DEGRADED = "DEGRADED", DEGRADED = "DEGRADED",
OFFLINE = "OFFLINE", OFFLINE = "OFFLINE",

@ -8,6 +8,6 @@ import { expect, test } from "bun:test";
* successful. * successful.
*/ */
test("ensureServerStatusCheckSuccess", async () => { test("ensureServerStatusCheckSuccess", async () => {
const status: MojangServerStatusResponse = await getMojangServerStatus(); // Get Mojang service status const response: MojangServerStatusResponse = await getMojangServerStatus(); // Get Mojang service status
expect(status).toBeDefined(); expect(response).toBeDefined();
}); });