Skip to content

SkyBlock Resources

The resources module (skyblock-resources.ts) parses the static SkyBlock resource endpoints (/resources/skyblock/*). Each function mirrors the raw Hypixel API JSON field-for-field into readonly, fully-typed objects with no computed or derived values. Missing numbers become 0, missing strings become "", boolean fields are true only when the raw value is exactly true, and epoch-ms timestamps become Date or null. Every parser returns null when its input is not a non-array object.

parseSkyBlockSkills

Parses the SkyBlock skill registry (/resources/skyblock/skills) into a typed object.

ts
function parseSkyBlockSkills(
  raw: Record<string, unknown>,
): SkyBlockSkillsResource | null;

Null / empty behavior

  • Returns null when raw is not a non-array object.
  • skills is keyed by raw skill key; only object values are kept.
  • Each skill's levels is built from the raw levels array (non-object entries skipped); each level's unlocks is [] when missing or not an array.
  • lastUpdated is null when its epoch-ms timestamp is absent or unparseable.

parseSkyBlockCollections

Parses the SkyBlock collection registry (/resources/skyblock/collections) into a typed object.

ts
function parseSkyBlockCollections(
  raw: Record<string, unknown>,
): SkyBlockCollectionsResource | null;

Null / empty behavior

  • Returns null when raw is not a non-array object.
  • collections is keyed by raw category key; items within each category is keyed by raw item key. Only object values are kept at both levels.
  • Each definition's tiers is built from the raw tiers array (non-object entries skipped); each tier's unlocks is [] when missing or not an array.
  • lastUpdated is null when absent or unparseable.

parseSkyBlockElection

Parses the SkyBlock election (/resources/skyblock/election) into a typed object.

ts
function parseSkyBlockElection(
  raw: Record<string, unknown>,
): SkyBlockElectionResource | null;

Null / empty behavior

  • Returns null when raw is not a non-array object.
  • mayor is null when the raw mayor.name is empty.
  • lastElection is read from the raw mayor.election object and is always present.
  • currentElection is null when the raw current field is not an object.
  • A candidate's perks (and the mayor's perks) are [] when the raw perks is missing or not an array.
  • minister is null when the raw mayor.minister is not an object; a minister's perk is null when the raw minister.perk is not an object.
  • lastUpdated is null when absent or unparseable.

parseSkyBlockBingo

Parses the SkyBlock bingo event resource (/resources/skyblock/bingo) into a typed object.

ts
function parseSkyBlockBingo(
  raw: Record<string, unknown>,
): SkyBlockBingoResource | null;

Null / empty behavior

  • Returns null when raw is not a non-array object.
  • goals is built from the raw goals array (non-object entries skipped); each goal's fullLore and tiers are [] when missing or not arrays.
  • A goal's requiredAmount is the raw requiredAmount when it is a number, otherwise null.
  • lastUpdated, start, and end are null when their epoch-ms timestamps are absent or unparseable.

Returned type tree

SkyBlockSkillsResource

The object returned by parseSkyBlockSkills.

ts
interface SkyBlockSkillsResource {
  readonly lastUpdated: Date | null;
  readonly version: string;
  readonly skills: Record<string, SkyBlockSkill>;
}
FieldNotes
lastUpdatedResource last-updated timestamp.
versionResource version (raw version).
skillsSkills keyed by raw skill key.

SkyBlockSkill

ts
interface SkyBlockSkill {
  readonly name: string;
  readonly description: string;
  readonly maxLevel: number;
  readonly levels: SkyBlockSkillLevel[];
}
FieldRaw key
namename
descriptiondescription
maxLevelmaxLevel
levelslevels

SkyBlockSkillLevel

ts
interface SkyBlockSkillLevel {
  readonly level: number;
  readonly totalExpRequired: number;
  readonly unlocks: string[];
}
FieldRaw key
levellevel
totalExpRequiredtotalExpRequired
unlocksunlocks

SkyBlockCollectionsResource

The object returned by parseSkyBlockCollections.

ts
interface SkyBlockCollectionsResource {
  readonly lastUpdated: Date | null;
  readonly version: string;
  readonly collections: Record<string, SkyBlockCollectionCategory>;
}
FieldNotes
lastUpdatedResource last-updated timestamp.
versionResource version (raw version).
collectionsCategories keyed by raw category key.

SkyBlockCollectionCategory

ts
interface SkyBlockCollectionCategory {
  readonly name: string;
  readonly items: Record<string, SkyBlockCollectionDefinition>;
}
FieldNotes
nameCategory name (raw name).
itemsCollection definitions keyed by raw key.

SkyBlockCollectionDefinition

ts
interface SkyBlockCollectionDefinition {
  readonly name: string;
  readonly maxTiers: number;
  readonly tiers: SkyBlockCollectionTier[];
}
FieldRaw key
namename
maxTiersmaxTiers
tierstiers

SkyBlockCollectionTier

ts
interface SkyBlockCollectionTier {
  readonly tier: number;
  readonly amountRequired: number;
  readonly unlocks: string[];
}
FieldRaw key
tiertier
amountRequiredamountRequired
unlocksunlocks

SkyBlockElectionResource

The object returned by parseSkyBlockElection.

ts
interface SkyBlockElectionResource {
  readonly lastUpdated: Date | null;
  readonly mayor: SkyBlockElectionMayor | null;
  readonly lastElection: SkyBlockElection;
  readonly currentElection: SkyBlockElection | null;
}
FieldNotes
lastUpdatedResource last-updated timestamp.
mayorCurrent mayor, or null when the raw mayor.name is empty.
lastElectionLast election (raw mayor.election).
currentElectionOngoing election (raw current), or null.

SkyBlockElectionMayor

ts
interface SkyBlockElectionMayor {
  readonly name: string;
  readonly keyBenefit: string;
  readonly perks: SkyBlockElectionPerk[];
  readonly minister: SkyBlockElectionMinister | null;
}
FieldNotes
nameMayor name (raw mayor.name).
keyBenefitKey benefit (raw mayor.key).
perksMayor perks (raw mayor.perks).
ministerActive minister, or null.

SkyBlockElectionMinister

ts
interface SkyBlockElectionMinister {
  readonly name: string;
  readonly keyBenefit: string;
  readonly perk: SkyBlockElectionPerk | null;
}
FieldNotes
nameMinister name (raw minister.name).
keyBenefitKey benefit (raw minister.key).
perkMinister perk (raw minister.perk), or null.

SkyBlockElection

Used for both lastElection and currentElection.

ts
interface SkyBlockElection {
  readonly year: number;
  readonly candidates: SkyBlockElectionCandidate[];
}
FieldRaw key
yearyear
candidatescandidates

SkyBlockElectionCandidate

ts
interface SkyBlockElectionCandidate {
  readonly name: string;
  readonly keyBenefit: string;
  readonly perks: SkyBlockElectionPerk[];
  readonly votesReceived: number;
}
FieldRaw key
namename
keyBenefitkey
perksperks
votesReceivedvotes

SkyBlockElectionPerk

Used by mayors, candidates, and ministers.

ts
interface SkyBlockElectionPerk {
  readonly name: string;
  readonly description: string;
  readonly minister: boolean;
}
FieldRaw key
namename
descriptiondescription
ministerminister

SkyBlockBingoResource

The object returned by parseSkyBlockBingo.

ts
interface SkyBlockBingoResource {
  readonly lastUpdated: Date | null;
  readonly id: number;
  readonly name: string;
  readonly start: Date | null;
  readonly end: Date | null;
  readonly modifier: string;
  readonly goals: SkyBlockBingoGoal[];
}
FieldNotes
lastUpdatedResource last-updated timestamp.
idEvent id (raw id).
nameEvent name (raw name).
start / endEvent start / end timestamps.
modifierEvent modifier (raw modifier).
goalsGoal definitions (raw goals).

SkyBlockBingoGoal

ts
interface SkyBlockBingoGoal {
  readonly id: string;
  readonly name: string;
  readonly lore: string;
  readonly fullLore: string[];
  readonly progress: number;
  readonly tiers: number[];
  readonly requiredAmount: number | null;
}
FieldNotes
idGoal id (raw id).
nameGoal name (raw name).
loreSingle-line lore (raw lore).
fullLoreMulti-line lore (raw fullLore).
progressRaw progress.
tiersTier thresholds (raw tiers).
requiredAmountRaw requiredAmount when numeric, otherwise null.

Released under the MIT License.