JS SDK: Add Geo and query data to servers
Some checks failed
Publish JS SDK / docker (push) Failing after 18s
Some checks failed
Publish JS SDK / docker (push) Failing after 18s
This commit is contained in:
parent
856e445182
commit
9d594a8c37
@ -1,11 +1,11 @@
|
|||||||
import { WebRequest } from "@/lib/web-request";
|
import {WebRequest} from "@/lib/web-request";
|
||||||
import { HttpMethod } from "@/types/http-method";
|
import {HttpMethod} from "@/types/http-method";
|
||||||
import { MojangServerStatusResponse } from "@/types/mojang/server-status-response";
|
import {MojangServerStatusResponse} from "@/types/mojang/server-status-response";
|
||||||
import { CachedPlayer } from "@/types/player/player";
|
import {CachedPlayer} from "@/types/player/player";
|
||||||
import { SkinPart } from "@/types/player/skin-part";
|
import {SkinPart} from "@/types/player/skin-part";
|
||||||
import { CachedBedrockMinecraftServer } from "@/types/server/bedrock/server";
|
import {CachedBedrockMinecraftServer} from "@/types/server/bedrock/server";
|
||||||
import { CachedJavaMinecraftServer } from "@/types/server/java-server";
|
import {CachedJavaMinecraftServer} from "@/types/server/java-server";
|
||||||
import { ServerPlatform } from "@/types/server/platform";
|
import {ServerPlatform} from "@/types/server/platform";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a player by their username or UUID.
|
* Get a player by their username or UUID.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { RestfulMCAPIError } from "@/types/error";
|
import {RestfulMCAPIError} from "@/types/error";
|
||||||
import { HttpMethod } from "@/types/http-method";
|
import {HttpMethod} from "@/types/http-method";
|
||||||
|
|
||||||
const API_ENDPOINT = "https://api.restfulmc.cc"; // The API endpoint to use
|
const API_ENDPOINT = "https://api.restfulmc.cc"; // The API endpoint to use
|
||||||
|
|
||||||
|
2
JS-SDK/src/types/dns/dns-record.d.ts
vendored
2
JS-SDK/src/types/dns/dns-record.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { RecordType } from "@/type/dns/record-type";
|
import {RecordType} from "@/type/dns/record-type";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An A record.
|
* An A record.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { MojangServerStatus } from "@/types/mojang/server-status";
|
import {MojangServerStatus} from "@/types/mojang/server-status";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the status of
|
* Represents the status of
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ProfileAction } from "@/types/player/profile-action";
|
import {ProfileAction} from "@/types/player/profile-action";
|
||||||
import { SkinModel } from "@/types/player/skin-model";
|
import {SkinModel} from "@/types/player/skin-model";
|
||||||
import { SkinPart } from "@/types/player/skin-part";
|
import {SkinPart} from "@/types/player/skin-part";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cacheable {@link Player}.
|
* A cacheable {@link Player}.
|
||||||
|
4
JS-SDK/src/types/server/bedrock/server.d.ts
vendored
4
JS-SDK/src/types/server/bedrock/server.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import { Edition } from "@/types/server/bedrock/edition";
|
import {Edition} from "@/types/server/bedrock/edition";
|
||||||
import { MinecraftServer } from "@/types/server/server";
|
import {MinecraftServer} from "@/types/server/server";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cacheable {@link BedrockMinecraftServer}.
|
* A cacheable {@link BedrockMinecraftServer}.
|
||||||
|
38
JS-SDK/src/types/server/java-server.d.ts
vendored
38
JS-SDK/src/types/server/java-server.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { MinecraftServer } from "@/types/server/server";
|
import {MinecraftServer} from "@/types/server/server";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cacheable {@link JavaMinecraftServer}.
|
* A cacheable {@link JavaMinecraftServer}.
|
||||||
@ -25,6 +25,17 @@ export interface JavaMinecraftServer extends MinecraftServer {
|
|||||||
*/
|
*/
|
||||||
favicon?: Favicon | undefined;
|
favicon?: Favicon | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The software of this server, present if query is on.
|
||||||
|
*/
|
||||||
|
software?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugins on this server, present if
|
||||||
|
* query is on and plugins are present.
|
||||||
|
*/
|
||||||
|
plugins?: Plugin[] | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Forge mod information for this server, undefined if none.
|
* The Forge mod information for this server, undefined if none.
|
||||||
* <p>
|
* <p>
|
||||||
@ -41,6 +52,16 @@ export interface JavaMinecraftServer extends MinecraftServer {
|
|||||||
*/
|
*/
|
||||||
forgeData?: ForgeData | undefined;
|
forgeData?: ForgeData | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main world of this server, present if query is on.
|
||||||
|
*/
|
||||||
|
world?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this server support querying?
|
||||||
|
*/
|
||||||
|
queryEnabled: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this server preview chat?
|
* Does this server preview chat?
|
||||||
*
|
*
|
||||||
@ -112,6 +133,21 @@ type Favicon = {
|
|||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A plugin for a server.
|
||||||
|
*/
|
||||||
|
type Plugin = {
|
||||||
|
/**
|
||||||
|
* The name of this plugin.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this plugin.
|
||||||
|
*/
|
||||||
|
version: string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forge mod information for a server.
|
* Forge mod information for a server.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ARecord, SRVRecord } from "@/types/dns/dns-record";
|
import {ARecord, SRVRecord} from "@/types/dns/dns-record";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model representing a Minecraft server.
|
* A model representing a Minecraft server.
|
||||||
@ -24,6 +24,11 @@ export type MinecraftServer = {
|
|||||||
*/
|
*/
|
||||||
records: ARecord | SRVRecord[];
|
records: ARecord | SRVRecord[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Geo location of this server, undefined if unknown.
|
||||||
|
*/
|
||||||
|
geo?: GeoLocation | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player counts of this server.
|
* The player counts of this server.
|
||||||
*/
|
*/
|
||||||
@ -35,6 +40,51 @@ export type MinecraftServer = {
|
|||||||
motd: MOTD;
|
motd: MOTD;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Geo location of a server.
|
||||||
|
*/
|
||||||
|
type GeoLocation = {
|
||||||
|
/**
|
||||||
|
* The continent of this server.
|
||||||
|
*/
|
||||||
|
continent: LocationData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The country of this server.
|
||||||
|
*/
|
||||||
|
country: LocationData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The city of this server, undefined if unknown.
|
||||||
|
*/
|
||||||
|
city?: string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The latitude of this server.
|
||||||
|
*/
|
||||||
|
latitude: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The longitude of this server.
|
||||||
|
*/
|
||||||
|
longitude: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data for a location.
|
||||||
|
*/
|
||||||
|
type LocationData = {
|
||||||
|
/**
|
||||||
|
* The location code.
|
||||||
|
*/
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location name.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player count data for a server.
|
* Player count data for a server.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { getMojangServerStatus } from "@/index";
|
import {getMojangServerStatus} from "@/index";
|
||||||
import { MojangServerStatusResponse } from "@/types/mojang/server-status-response";
|
import {MojangServerStatusResponse} from "@/types/mojang/server-status-response";
|
||||||
import { expect, test } from "bun:test";
|
import {expect, test} from "bun:test";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a test to ensure retrieving
|
* Run a test to ensure retrieving
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { getPlayer, getSkinPart } from "@/index";
|
import {getPlayer, getSkinPart} from "@/index";
|
||||||
import { RestfulMCAPIError } from "@/types/error";
|
import {RestfulMCAPIError} from "@/types/error";
|
||||||
import { CachedPlayer } from "@/types/player/player";
|
import {CachedPlayer} from "@/types/player/player";
|
||||||
import { SkinPart } from "@/types/player/skin-part";
|
import {SkinPart} from "@/types/player/skin-part";
|
||||||
import { expect, test } from "bun:test";
|
import {expect, test} from "bun:test";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a test to ensure retrieving
|
* Run a test to ensure retrieving
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
import {
|
import {getJavaServerFavicon, getMinecraftServer, isMojangBlocked, ServerPlatform,} from "@/index";
|
||||||
ServerPlatform,
|
import {RestfulMCAPIError} from "@/types/error";
|
||||||
getJavaServerFavicon,
|
import {CachedBedrockMinecraftServer} from "@/types/server/bedrock/server";
|
||||||
getMinecraftServer,
|
import {CachedJavaMinecraftServer} from "@/types/server/java-server";
|
||||||
isMojangBlocked,
|
import {expect, test} from "bun:test";
|
||||||
} from "@/index";
|
|
||||||
import { RestfulMCAPIError } from "@/types/error";
|
|
||||||
import { CachedBedrockMinecraftServer } from "@/types/server/bedrock/server";
|
|
||||||
import { CachedJavaMinecraftServer } from "@/types/server/java-server";
|
|
||||||
import { expect, test } from "bun:test";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a test to ensure retrieving a
|
* Run a test to ensure retrieving a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user