@threadmc/minecraft-api
Version:
An advanced Minecraft API client for interacting with piston-meta, minecraft servers, and more
62 lines (61 loc) • 2.31 kB
TypeScript
import { VersionType } from "./enums/VersionType.js";
import type { Version, VersionManifest, VersionDetails } from "./types/VersionManifest.js";
/**
* Low-level REST client for interacting with Mojang and piston-meta APIs.
* Handles fetching version manifests, version details, assets, libraries, and user data.
*/
export declare class Rest {
private VERSION_MANIFEST_DATA;
private initialized;
constructor();
private initialize;
fetchVersion(version: string): Promise<any>;
fetchVersions(type: VersionType): Promise<Version[]>;
fetchLatestVersion(type: VersionType): Promise<Version>;
/**
* Fetch the Minecraft version manifest from piston-meta.
* @returns The version manifest JSON.
*/
fetchVersionManifest(): Promise<any>;
/**
* Fetch the asset index for a specific version.
* @param version The version ID.
* @returns The asset index JSON.
*/
fetchAssetIndex(version: string): Promise<any>;
/**
* Download a Minecraft library JAR file as an ArrayBuffer.
* @param libraryPath The path to the library.
* @returns The library file as an ArrayBuffer.
*/
fetchLibrary(libraryPath: string): Promise<ArrayBuffer>;
/**
* Fetch a Mojang user profile by username.
* @param username The Minecraft username.
* @returns The user profile JSON.
*/
fetchUserProfile(username: string): Promise<any>;
/**
* Fetch the name history for a given UUID.
* @param uuid The user's UUID.
* @returns The name history array.
*/
fetchNameHistory(uuid: string): Promise<any>;
/**
* Fetch the skin and/or cape textures for a user by UUID.
* @param uuid The user's UUID (with or without dashes).
* @returns The textures object containing skin/cape URLs, or null if not found.
*/
fetchUserTextures(uuid: string): Promise<any>;
}
/**
* Fetch the Minecraft version manifest from piston-meta.
* @returns The version manifest JSON.
*/
export declare function fetchVersionManifest(): Promise<VersionManifest>;
/**
* Fetch detailed information about a specific Minecraft version.
* @param version The version ID.
* @returns The version details JSON.
*/
export declare function fetchVersionDetails(version: string): Promise<VersionDetails>;