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",
"version": "1.1.2",
"version": "1.1.3",
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
"keywords": [

@ -1,7 +1,32 @@
import { MojangServerStatus } from "@/types/mojang/server-status";
/**
* Represents the status of
* a service provided by Mojang.
*/
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.
*/
export enum Status {
export enum MojangServerStatus {
ONLINE = "ONLINE",
DEGRADED = "DEGRADED",
OFFLINE = "OFFLINE",

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