Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/hypixel/Client.ts>Client

With thorough IntelliSense support & 100% test coverage, this is an unopinionated async/await API wrapper for Hypixel's Public API. It is developed in TypeScript complete with documentation, typed interfaces for all API responses (and an OpenAPI 3.0 schema!), built-in rate-limit handling, flexible cache support, helper functions, and support for undocumented endpoints.
Latest
class Client
import { Client } from "https://deno.land/x/hypixel@v3.1.1/Client.ts";

Constructors

new
Client(key: string, options?: ClientOptions)

Create a new instance of the API client.

Properties

private
readonly
apiKey: string
private
readonly
optional
cache: ClientOptions["cache"]
private
readonly
emitter: EventEmitter
private
readonly
queue: Queue
private
readonly
retries: number
private
readonly
timeout: number
private
readonly
userAgent: string
protected
rateLimit: RateLimitData
findGuild: FindGuild

Returns the id of the requested guild if found.

friends: Friends

Returns friendships for given player.

guild: Guild

Returns the guild by the requested ID if found.

player: Player

Returns a player's data, such as game stats.

recentGames: RecentGames

Returns recent games of a player. A maximum of 100 games are returned and recent games are only stored for up to 3 days at this time.

resources: Resources

Relatively static Hypixel resources that don't change often at all.

skyblock: SkyBlock

All SkyBlock related endpoints.

status: Status

Returns online status information for given player, including game, mode and map when available.

Methods

private
callMethod<T extends Components.Schemas.ApiSuccess & { cause?: string; } & { cloudflareCache?: DefaultMeta["cloudflareCache"]; }>(
path: string,
parameters: Parameters,
noRateLimit: boolean,
includeApiKey: boolean,
): Promise<T>
private
createActionableCall<T extends Components.Schemas.ApiSuccess>(path: string, parameters?: Parameters): ActionableCall<T>
private
executeActionableCall<T extends Components.Schemas.ApiSuccess>(call: ActionableCall<T>): Promise<T>
private
getRateLimitHeaders(headers: Record<string, string>): void
boosters(): Promise<ResultObject<Paths.Boosters.Get.Responses.$200, ["success"]>>

Returns list of boosters.

call<T extends Components.Schemas.ApiSuccess>(path: string, parameters?: Parameters): Promise<T & { cached?: boolean; }>

The raw query method used by this library. You may use this if you need to use an undocumented method with this library.

gameCounts(): Promise<ResultObject<Paths.GameCounts.Get.Responses.$200, ["success"]>>

Returns the current player count along with the player count of each public game + mode on the server.

key(): Promise<ResultObject<Paths.Key.Get.Responses.$200, ["record"]>>

Returns information regarding given key.

leaderboards(): Promise<ResultObject<Paths.Leaderboards.Get.Responses.$200, ["leaderboards"]>>

Returns a list of the official leaderboards and their current standings for games on the network.

off<E extends keyof ClientEvents>(event: E, listener: ClientEvents[E]): this
on<E extends keyof ClientEvents>(event: E, listener: ClientEvents[E]): this
once<E extends keyof ClientEvents>(event: E, listener: ClientEvents[E]): this
playerCount(): Promise<ResultObject<Paths.PlayerCount.Get.Responses.$200, ["success"]>>

Returns current player count.

watchdogstats(): Promise<ResultObject<Paths.Watchdogstats.Get.Responses.$200, ["success"]>>

Returns some statistics about Watchdog & bans.

Static Properties

private
readonly
endpoint: URL
interface Client
import { type Client } from "https://deno.land/x/hypixel@v3.1.1/Client.ts";

Methods

on(event: "limited", listener: (limit: number, reset: Date) => void): this

Listen to the "limited" event which emits when the client starts limiting your calls due to hitting the rate limit.

on(event: "reset", listener: () => void): this

Listen to the "reset" event which emits when the API rate limit resets.

once(event: "limited", listener: (limit: number, reset: Date) => void): this

Listen once to the "limited" event which emits when the client starts limiting your calls due to hitting the rate limit.

once(event: "reset", listener: () => void): this

Listen once to the "reset" event which emits when the API rate limit resets.

off(event: "limited", listener: () => void): this

Remove your function listening to the "limited" event.

off(event: "reset", listener: () => void): this

Remove your function listening to the "reset" event.