Skip to content

@mcsb/api / Exports / HypixelResources

Class: HypixelResources

Interface for fetching resource endpoints from the Hypixel API. Resources are data returned by the API which do not require an API key to fetch and change very infrequently.

Unlike HypixelAPI and MojangAPI, this implementation of BaseAPI fetches all resources immediately, instead of waiting until you request them. Additionally, resources are refreshed at an interval, regardless of whether you are using them or not. This interval can be changed by HypixelResourcesOptions.refreshInterval. This is independent of the HttpClient cache policy. Thus, if your HttpClient cache returns the same value, nothing changes.

Hierarchy

Table of contents

Properties

Accessors

Methods

Properties

options

Protected Readonly options: Readonly<{ deferPolicy: null | IDeferPolicy<Response> ; httpClient: HttpClient ; refreshInterval: number }>

The options provided to the constructor, parsed by parseOptions.

Inherited from

BaseAPI.options

Defined in

packages/api/src/BaseAPI.ts:127

Accessors

achievements

get achievements(): Readonly<Record<string, { one_time: Readonly<Record<string, { name: string; description: string; legacy: boolean; points: number; gamePercentUnlocked: number; globalPercentUnlocked: number; secret: boolean; }>> ; tiered: Readonly<Record<string, Readonly<{ name: string; tiers: readonly Readonly<{ tier: number; amount: number; points: number; }>[]; description: string; }>>> ; total_legacy_points: number ; total_points: number }>>

Returns

Readonly<Record<string, { one_time: Readonly<Record<string, { name: string; description: string; legacy: boolean; points: number; gamePercentUnlocked: number; globalPercentUnlocked: number; secret: boolean; }>> ; tiered: Readonly<Record<string, Readonly<{ name: string; tiers: readonly Readonly<{ tier: number; amount: number; points: number; }>[]; description: string; }>>> ; total_legacy_points: number ; total_points: number }>>

Defined in

packages/api/src/HypixelResources.ts:230


challenges

get challenges(): Readonly<Record<string, Readonly<{ id: string ; name: string ; rewards: readonly Readonly<{ type: string; amount: number; }>[] }>[]>>

Returns

Readonly<Record<string, Readonly<{ id: string ; name: string ; rewards: readonly Readonly<{ type: string; amount: number; }>[] }>[]>>

Defined in

packages/api/src/HypixelResources.ts:237


companionRarities

get companionRarities(): readonly { color: "BLACK" | "DARK_BLUE" | "DARK_GREEN" | "DARK_AQUA" | "DARK_RED" | "DARK_PURPLE" | "GOLD" | "GRAY" | "DARK_GRAY" | "BLUE" | "GREEN" | "AQUA" | "RED" | "LIGHT_PURPLE" | "YELLOW" | "WHITE" | "OBFUSCATED" | "BOLD" | "STRIKE" | "UNDERLINE" | "ITALIC" | "RESET" = ZodEnumMinecraftFormatting; name: string }[]

Returns

readonly { color: "BLACK" | "DARK_BLUE" | "DARK_GREEN" | "DARK_AQUA" | "DARK_RED" | "DARK_PURPLE" | "GOLD" | "GRAY" | "DARK_GRAY" | "BLUE" | "GREEN" | "AQUA" | "RED" | "LIGHT_PURPLE" | "YELLOW" | "WHITE" | "OBFUSCATED" | "BOLD" | "STRIKE" | "UNDERLINE" | "ITALIC" | "RESET" = ZodEnumMinecraftFormatting; name: string }[]

Defined in

packages/api/src/HypixelResources.ts:287


companions

get companions(): readonly { key: string ; name: string ; package: string ; rarity: null | string }[]

Returns

readonly { key: string ; name: string ; package: string ; rarity: null | string }[]

Defined in

packages/api/src/HypixelResources.ts:280


flattenedQuests

get flattenedQuests(): Readonly<Record<string, { id: string ; name: string ; objectives: readonly Readonly<{ type: string; id: string; integer?: number | null | undefined; }>[] ; requirements: readonly Readonly<{ type: string; }>[] ; rewards: readonly Readonly<{ type: string; amount?: number | null | undefined; package?: string | null | undefined; }>[] }>>

Returns

Readonly<Record<string, { id: string ; name: string ; objectives: readonly Readonly<{ type: string; id: string; integer?: number | null | undefined; }>[] ; requirements: readonly Readonly<{ type: string; }>[] ; rewards: readonly Readonly<{ type: string; amount?: number | null | undefined; package?: string | null | undefined; }>[] }>>

Defined in

packages/api/src/HypixelResources.ts:251


games

get games(): Readonly<Record<string, HypixelGame>>

Returns

Readonly<Record<string, HypixelGame>>

Defined in

packages/api/src/HypixelResources.ts:223


guildAchievements

get guildAchievements(): Readonly<objectOutputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; lastUpdated: ZodReadonly<ZodOptional<ZodNullable<ZodEffects<ZodType<UnixDate, ZodTypeDef, UnixDate>, UnixDate, UnixDate>>>> ; one_time: ZodReadonly<ZodDefault<ZodRecord<ZodString, ZodUnknown>>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> ; tiered: ZodReadonly<ZodDefault<ZodRecord<ZodString, ZodObject<{ description: ZodString ; name: ZodString ; tiers: ZodReadonly<ZodDefault<ZodArray<ZodReadonly<ZodObject<{ amount: ZodNumber ; tier: ZodNumber }, "strip", ZodTypeAny, { amount: number ; tier: number }, { amount: number ; tier: number }>>, "many">>> }, "strip", ZodTypeAny, { description: string ; name: string ; tiers: readonly Readonly<{ tier: number; amount: number; }>[] }, { description: string ; name: string ; tiers?: { tier: number; amount: number; }[] }>>>> }, ZodTypeAny, "passthrough">>

Returns

Readonly<objectOutputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; lastUpdated: ZodReadonly<ZodOptional<ZodNullable<ZodEffects<ZodType<UnixDate, ZodTypeDef, UnixDate>, UnixDate, UnixDate>>>> ; one_time: ZodReadonly<ZodDefault<ZodRecord<ZodString, ZodUnknown>>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> ; tiered: ZodReadonly<ZodDefault<ZodRecord<ZodString, ZodObject<{ description: ZodString ; name: ZodString ; tiers: ZodReadonly<ZodDefault<ZodArray<ZodReadonly<ZodObject<{ amount: ZodNumber ; tier: ZodNumber }, "strip", ZodTypeAny, { amount: number ; tier: number }, { amount: number ; tier: number }>>, "many">>> }, "strip", ZodTypeAny, { description: string ; name: string ; tiers: readonly Readonly<{ tier: number; amount: number; }>[] }, { description: string ; name: string ; tiers?: { tier: number; amount: number; }[] }>>>> }, ZodTypeAny, "passthrough">>

Defined in

packages/api/src/HypixelResources.ts:259


petRarities

get petRarities(): readonly { color: "BLACK" | "DARK_BLUE" | "DARK_GREEN" | "DARK_AQUA" | "DARK_RED" | "DARK_PURPLE" | "GOLD" | "GRAY" | "DARK_GRAY" | "BLUE" | "GREEN" | "AQUA" | "RED" | "LIGHT_PURPLE" | "YELLOW" | "WHITE" | "OBFUSCATED" | "BOLD" | "STRIKE" | "UNDERLINE" | "ITALIC" | "RESET" = ZodEnumMinecraftFormatting; name: string }[]

Returns

readonly { color: "BLACK" | "DARK_BLUE" | "DARK_GREEN" | "DARK_AQUA" | "DARK_RED" | "DARK_PURPLE" | "GOLD" | "GRAY" | "DARK_GRAY" | "BLUE" | "GREEN" | "AQUA" | "RED" | "LIGHT_PURPLE" | "YELLOW" | "WHITE" | "OBFUSCATED" | "BOLD" | "STRIKE" | "UNDERLINE" | "ITALIC" | "RESET" = ZodEnumMinecraftFormatting; name: string }[]

Defined in

packages/api/src/HypixelResources.ts:273


pets

get pets(): readonly { key: string ; name: string ; package: string ; rarity: null | string }[]

Returns

readonly { key: string ; name: string ; package: string ; rarity: null | string }[]

Defined in

packages/api/src/HypixelResources.ts:266


quests

get quests(): Readonly<Record<string, { id: string ; name: string ; objectives: readonly Readonly<{ type: string; id: string; integer?: number | null | undefined; }>[] ; requirements: readonly Readonly<{ type: string; }>[] ; rewards: readonly Readonly<{ type: string; amount?: number | null | undefined; package?: string | null | undefined; }>[] }[]>>

Returns

Readonly<Record<string, { id: string ; name: string ; objectives: readonly Readonly<{ type: string; id: string; integer?: number | null | undefined; }>[] ; requirements: readonly Readonly<{ type: string; }>[] ; rewards: readonly Readonly<{ type: string; amount?: number | null | undefined; package?: string | null | undefined; }>[] }[]>>

Defined in

packages/api/src/HypixelResources.ts:244


skyBlockBingo

get skyBlockBingo(): null | Readonly<objectOutputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; goals: ZodDefault<ZodArray<ZodObject<{ id: ZodString ; lore: ZodOptional<ZodNullable<ZodString>> ; name: ZodString ; progress: ZodOptional<ZodNullable<ZodNumber>> ; requiredAmount: ZodOptional<ZodNullable<ZodNumber>> ; tiers: ZodOptional<ZodNullable<ZodArray<ZodNumber, "many">>> }, "strip", ZodTypeAny, { id: string ; lore?: null | string ; name: string ; progress?: null | number ; requiredAmount?: null | number ; tiers?: null | number[] }, { id: string ; lore?: null | string ; name: string ; progress?: null | number ; requiredAmount?: null | number ; tiers?: null | number[] }>, "many">> ; id: ZodNumber ; lastUpdated: ZodReadonly<ZodOptional<ZodNullable<ZodEffects<ZodType<UnixDate, ZodTypeDef, UnixDate>, UnixDate, UnixDate>>>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">>

Returns

null | Readonly<objectOutputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; goals: ZodDefault<ZodArray<ZodObject<{ id: ZodString ; lore: ZodOptional<ZodNullable<ZodString>> ; name: ZodString ; progress: ZodOptional<ZodNullable<ZodNumber>> ; requiredAmount: ZodOptional<ZodNullable<ZodNumber>> ; tiers: ZodOptional<ZodNullable<ZodArray<ZodNumber, "many">>> }, "strip", ZodTypeAny, { id: string ; lore?: null | string ; name: string ; progress?: null | number ; requiredAmount?: null | number ; tiers?: null | number[] }, { id: string ; lore?: null | string ; name: string ; progress?: null | number ; requiredAmount?: null | number ; tiers?: null | number[] }>, "many">> ; id: ZodNumber ; lastUpdated: ZodReadonly<ZodOptional<ZodNullable<ZodEffects<ZodType<UnixDate, ZodTypeDef, UnixDate>, UnixDate, UnixDate>>>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">>

Defined in

packages/api/src/HypixelResources.ts:323


skyBlockCollections

get skyBlockCollections(): Readonly<Record<string, Readonly<{ items: Readonly<Record<string, Readonly<{ name: string; tiers: readonly Readonly<{ tier: number; amountRequired: number; unlocks: readonly string[]; }>[]; maxTiers: number; }>>> ; name: string }>>>

Returns

Readonly<Record<string, Readonly<{ items: Readonly<Record<string, Readonly<{ name: string; tiers: readonly Readonly<{ tier: number; amountRequired: number; unlocks: readonly string[]; }>[]; maxTiers: number; }>>> ; name: string }>>>

Defined in

packages/api/src/HypixelResources.ts:294


skyBlockCurrentElection

get skyBlockCurrentElection(): Readonly<undefined | null | { candidates: readonly { key: string ; name: string ; perks: readonly Readonly<{ name: string; description: string; }>[] ; votes: number }[] ; year: number }>

Returns

Readonly<undefined | null | { candidates: readonly { key: string ; name: string ; perks: readonly Readonly<{ name: string; description: string; }>[] ; votes: number }[] ; year: number }>

Defined in

packages/api/src/HypixelResources.ts:319


skyBlockCurrentMayor

get skyBlockCurrentMayor(): null | Readonly<{ election: null | { candidates: readonly { name: string; key: string; perks: readonly Readonly<{ name: string; description: string; }>[]; votes: number; }[] ; year: number } ; key: string ; name: string ; perks: readonly Readonly<{ description: string ; name: string }>[] }>

Returns

null | Readonly<{ election: null | { candidates: readonly { name: string; key: string; perks: readonly Readonly<{ name: string; description: string; }>[]; votes: number; }[] ; year: number } ; key: string ; name: string ; perks: readonly Readonly<{ description: string ; name: string }>[] }>

Defined in

packages/api/src/HypixelResources.ts:315


skyBlockItems

get skyBlockItems(): readonly { ability_damage_scaling?: null | number ; can_have_attributes?: null | boolean ; cannot_reforge?: null | boolean ; catacombs_requirements?: null | readonly Readonly<{ type: string; dungeon_type?: string | null | undefined; level?: number | null | undefined; }>[] ; category?: null | string ; color?: null | string ; crystal?: null | string ; dungeon_item?: null | boolean ; dungeon_item_conversion_cost?: null | Readonly<{ essence_type: string; amount: number; }> ; durability?: null | number ; enchantments?: null | Readonly<Record<string, number>> ; furniture?: null | string ; gear_score?: null | number ; gemstone_slots?: null | readonly Readonly<{ slot_type: string; costs: readonly Readonly<{ type: string; coins?: number | null | undefined; item_id?: string | null | undefined; amount?: number | null | undefined; }>[]; }>[] ; generator?: null | string ; generator_tier?: null | number ; glowing?: null | boolean ; hide_from_viewrecipe_command?: null | boolean ; id: string ; item_specific?: null | Readonly<Record<string, unknown>> ; lose_motes_value_on_transfer?: null | boolean ; material: string ; motes_sell_price?: null | number ; museum?: null | boolean ; name: string ; npc_sell_price?: null | number ; origin?: null | string ; prestige?: null | Readonly<{ item_id: string; costs: readonly Readonly<{ type: string; item_id?: string | null | undefined; essence_type?: string | null | undefined; amount?: number | null | undefined; }>[]; }> ; private_island?: null | string ; rarity_salvageable?: null | boolean ; requirements?: null | readonly Readonly<{ type: string; skill?: string | null | undefined; level?: number | null | undefined; reward?: string | null | undefined; faction?: string | null | undefined; reputation?: number | null | undefined; ... 6 more ...; minimum_age?: number | ... 1 more ... | undefined; }>[] ; rift_transferrable?: null | boolean ; salvageable_from_recipe?: null | boolean ; salvages?: null | readonly Readonly<{ type: string; essence_type?: string | null | undefined; amount?: number | null | undefined; }>[] ; skin?: null | string ; soulbound?: null | string ; stats?: null | Readonly<Record<string, unknown>> ; sword_type?: null | string ; tier?: null | string ; tiered_stats?: null | Readonly<Record<string, readonly number[]>> ; unstackable?: null | boolean ; upgrade_costs?: null | readonly (readonly { type: string; item_id?: string | null | undefined; essence_type?: string | null | undefined; amount?: number | null | undefined; }[])[] }[]

Returns

readonly { ability_damage_scaling?: null | number ; can_have_attributes?: null | boolean ; cannot_reforge?: null | boolean ; catacombs_requirements?: null | readonly Readonly<{ type: string; dungeon_type?: string | null | undefined; level?: number | null | undefined; }>[] ; category?: null | string ; color?: null | string ; crystal?: null | string ; dungeon_item?: null | boolean ; dungeon_item_conversion_cost?: null | Readonly<{ essence_type: string; amount: number; }> ; durability?: null | number ; enchantments?: null | Readonly<Record<string, number>> ; furniture?: null | string ; gear_score?: null | number ; gemstone_slots?: null | readonly Readonly<{ slot_type: string; costs: readonly Readonly<{ type: string; coins?: number | null | undefined; item_id?: string | null | undefined; amount?: number | null | undefined; }>[]; }>[] ; generator?: null | string ; generator_tier?: null | number ; glowing?: null | boolean ; hide_from_viewrecipe_command?: null | boolean ; id: string ; item_specific?: null | Readonly<Record<string, unknown>> ; lose_motes_value_on_transfer?: null | boolean ; material: string ; motes_sell_price?: null | number ; museum?: null | boolean ; name: string ; npc_sell_price?: null | number ; origin?: null | string ; prestige?: null | Readonly<{ item_id: string; costs: readonly Readonly<{ type: string; item_id?: string | null | undefined; essence_type?: string | null | undefined; amount?: number | null | undefined; }>[]; }> ; private_island?: null | string ; rarity_salvageable?: null | boolean ; requirements?: null | readonly Readonly<{ type: string; skill?: string | null | undefined; level?: number | null | undefined; reward?: string | null | undefined; faction?: string | null | undefined; reputation?: number | null | undefined; ... 6 more ...; minimum_age?: number | ... 1 more ... | undefined; }>[] ; rift_transferrable?: null | boolean ; salvageable_from_recipe?: null | boolean ; salvages?: null | readonly Readonly<{ type: string; essence_type?: string | null | undefined; amount?: number | null | undefined; }>[] ; skin?: null | string ; soulbound?: null | string ; stats?: null | Readonly<Record<string, unknown>> ; sword_type?: null | string ; tier?: null | string ; tiered_stats?: null | Readonly<Record<string, readonly number[]>> ; unstackable?: null | boolean ; upgrade_costs?: null | readonly (readonly { type: string; item_id?: string | null | undefined; essence_type?: string | null | undefined; amount?: number | null | undefined; }[])[] }[]

Defined in

packages/api/src/HypixelResources.ts:308


skyBlockSkills

get skyBlockSkills(): Readonly<Record<string, Readonly<{ description: string ; levels: readonly Readonly<{ unlocks: readonly string[]; level: number; totalExpRequired: number; }>[] ; maxLevel: number ; name: string } & { getCollection: (this: { description: string ; levels: readonly Readonly<{ unlocks: readonly string[]; level: number; totalExpRequired: number; }>[] ; maxLevel: number ; name: string }) => Readonly<{ items: Readonly<Record<string, Readonly<{ name: string; tiers: readonly Readonly<{ tier: number; amountRequired: number; unlocks: readonly string[]; }>[]; maxTiers: number; }>>> ; name: string }> }>>>

Returns

Readonly<Record<string, Readonly<{ description: string ; levels: readonly Readonly<{ unlocks: readonly string[]; level: number; totalExpRequired: number; }>[] ; maxLevel: number ; name: string } & { getCollection: (this: { description: string ; levels: readonly Readonly<{ unlocks: readonly string[]; level: number; totalExpRequired: number; }>[] ; maxLevel: number ; name: string }) => Readonly<{ items: Readonly<Record<string, Readonly<{ name: string; tiers: readonly Readonly<{ tier: number; amountRequired: number; unlocks: readonly string[]; }>[]; maxTiers: number; }>>> ; name: string }> }>>>

Defined in

packages/api/src/HypixelResources.ts:301

Methods

destroy

destroy(): void

Shut down this HypixelResources by shutting down the HttpClient and stopping the resource refreshing interval.

Returns

void

Overrides

BaseAPI.destroy

Defined in

packages/api/src/HypixelResources.ts:188


fetchAchievements

Protected fetchAchievements(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:344


fetchChallenges

Protected fetchChallenges(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:355


fetchCompanionRarities

Protected fetchCompanionRarities(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:421


fetchCompanions

Protected fetchCompanions(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:410


fetchCurrentSkyBlockElection

Protected fetchCurrentSkyBlockElection(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:476


fetchCurrentSkyBlockMayor

Protected fetchCurrentSkyBlockMayor(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:465


fetchGames

Protected fetchGames(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:333


fetchGuildAchievements

Protected fetchGuildAchievements(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:377


fetchPetRarities

Protected fetchPetRarities(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:399


fetchPets

Protected fetchPets(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:388


fetchQuests

Protected fetchQuests(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:366


fetchSkyBlockBingo

Protected fetchSkyBlockBingo(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:487


fetchSkyBlockCollections

Protected fetchSkyBlockCollections(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:432


fetchSkyBlockItems

Protected fetchSkyBlockItems(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:454


fetchSkyBlockSkills

Protected fetchSkyBlockSkills(raw?): Promise<RawResponse>

Parameters

NameType
raw?true

Returns

Promise<RawResponse>

Defined in

packages/api/src/HypixelResources.ts:443


isReady

isReady(): boolean

Returns

boolean

Defined in

packages/api/src/HypixelResources.ts:193


rawRequest

Protected rawRequest(url): Promise<RawResponse>

Send a request to a given URL using this APIs HttpClient provided options. If the HttpClient has a cached response, then that response is returned immediately. Otherwise, we send a new request to the URL. Before sending the request, if an IDeferPolicy was provided to options, the defer policy is polled first.

Parameters

NameTypeDescription
urlstringThe complete URL to send a request to. Relative URLs are not supported.

Returns

Promise<RawResponse>

A Promise which resolves to a RawResponse from the API.

Throws

  • Error if the HTTP request fails

See

request

Inherited from

BaseAPI.rawRequest

Defined in

packages/api/src/BaseAPI.ts:184


refresh

refresh(): Promise<void>

Re-fetch all the resources from the API. This does not bypass the HttpClient cache, so any resources which are still cached in the HttpClient will not change from the client's cached value. The current resource values will remain available until they're overwritten by the incoming response. Each value is overwritten individually, meaning while the returned Promise is still pending, some values may be updated while others aren't.

Returns

Promise<void>

A Promise that resolves when all resources have been refreshed. Some resources may be refreshed before this Promise resolves.

Throws

  • Error if the HTTP request to any of the resources fails or is malformed.

Defined in

packages/api/src/HypixelResources.ts:144


request

Protected request<S, V>(path, raw, schema?, mutator?): Promise<RawResponse>

Send an API request to the given URL using the provided HttpClient and IDeferPolicy.

Type parameters

NameType
Sextends ZodObject<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, "passthrough", ZodTypeAny, objectOutputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">, objectInputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">>
VV

Parameters

NameTypeDescription
pathstringURL to send the request to. Relative URLs not supported.
rawtrueWhether to receive a RawResponse.
schema?SIn this overload, this value is unused. - The Zod schema to use to parse the API response.
mutator?(input: TypeOf<S>) => VIn this overload, this value is unused. - A function that takes in the schema-parsed response and returns another value. This can also be used to perform additional validation on the response and throw an Error if it fails.

Returns

Promise<RawResponse>

  • If raw is true, the RawResponse from rawRequest is returned.
  • If raw is false and the mutator argument is undefined, the API response parsed by the provided schema is returned.
  • If raw is false and a mutator argument is provided, the value returned by the mutator is returned.

Throws

  • Error if the HTTP request fails.
  • Error if the schema parsing fails.

See

https://zod.dev/

Overrides

BaseAPI.request

Defined in

packages/api/src/HypixelResources.ts:164

Protected request<S>(path, raw, schema, mutator): Promise<TypeOf<S>>

Send an API request to the given URL using the provided HttpClient and IDeferPolicy.

Type parameters

NameType
Sextends ZodObject<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, "passthrough", ZodTypeAny, objectOutputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">, objectInputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">>

Parameters

NameTypeDescription
pathstringURL to send the request to. Relative URLs not supported.
rawfalseWhether to receive a RawResponse.
schemaSThe Zod schema to use to parse the API response.
mutatorundefinedIn this overload, this value is unused. - A function that takes in the schema-parsed response and returns another value. This can also be used to perform additional validation on the response and throw an Error if it fails.

Returns

Promise<TypeOf<S>>

  • If raw is true, the RawResponse from rawRequest is returned.
  • If raw is false and the mutator argument is undefined, the API response parsed by the provided schema is returned.
  • If raw is false and a mutator argument is provided, the value returned by the mutator is returned.

Throws

  • Error if the HTTP request fails.
  • Error if the schema parsing fails.

See

https://zod.dev/

Overrides

BaseAPI.request

Defined in

packages/api/src/HypixelResources.ts:165

Protected request<S, V>(path, raw, schema, mutator): Promise<V>

Send an API request to the given URL using the provided HttpClient and IDeferPolicy.

Type parameters

NameType
Sextends ZodObject<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, "passthrough", ZodTypeAny, objectOutputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">, objectInputType<{ cause: ZodOptional<ZodNullable<ZodString>> ; global: ZodOptional<ZodNullable<ZodBoolean>> ; success: ZodBoolean ; throttle: ZodOptional<ZodNullable<ZodBoolean>> }, ZodTypeAny, "passthrough">>
VV

Parameters

NameTypeDescription
pathstringURL to send the request to. Relative URLs not supported.
rawfalseWhether to receive a RawResponse.
schemaSThe Zod schema to use to parse the API response.
mutator(input: TypeOf<S>) => VA function that takes in the schema-parsed response and returns another value. This can also be used to perform additional validation on the response and throw an Error if it fails.

Returns

Promise<V>

  • If raw is true, the RawResponse from rawRequest is returned.
  • If raw is false and the mutator argument is undefined, the API response parsed by the provided schema is returned.
  • If raw is false and a mutator argument is provided, the value returned by the mutator is returned.

Throws

  • Error if the HTTP request fails.
  • Error if the schema parsing fails.

See

https://zod.dev/

Overrides

BaseAPI.request

Defined in

packages/api/src/HypixelResources.ts:166


create

Static create(root, options?): Promise<HypixelResources>

Create a new instance of HypixelResources. Instead of using this directly, you may want to use ().

Parameters

NameTypeDescription
rootHypixelAPIParent instance of HypixelAPI.
options?HypixelResourcesOptionsOptions to use when creating the HypixelResources.

Returns

Promise<HypixelResources>

A Promise that resolves to a new HypixelResources instance. The Promise resolves after all resources have been fetched to avoid a ResourcesNotReadyError.

See

Defined in

packages/api/src/HypixelResources.ts:126

Released under the MIT License.