Ergonomic Constants
Every endpoint that takes a gamemode, mode, stat, or interval accepts a plain string, and the generated types keep you honest about which strings are valid. Raw PikaNetwork strings aren't always pleasant to read or autocomplete, though ("unrankedpractice", "HIGHEST_WIN_STREAK"). Alongside the raw values, the enum generator produces friendlier, IDE-autocompletable aliases: Gamemode, Mode, Stat, Interval, and StatKey.
They're structurally identical to the raw strings
import { Gamemode } from '@kyizl/craftify';
Gamemode.BedWars === 'bedwars';There's no wrapper type and no runtime conversion: Gamemode.BedWars is the string "bedwars". You can pass it anywhere a raw value is accepted, mix it with plain strings, JSON.stringify it, or use it as an object key, and all of that works exactly as it would with the raw string, because it is one.
Usage
import { Gamemode, Interval, Stat } from '@kyizl/craftify';
await pika.getLeaderboard({
gamemode: Gamemode.BedWars,
stat: Stat.BedWars.Kills,
interval: Interval.Weekly,
});Mode and Stat are namespaced by gamemode, since valid modes and stats differ per gamemode:
Mode.BedWars.Solo;
Mode.UnrankedPractice.Sumo;Reading profile stats by name
getProfileStats() returns a plain array (.find, .map, and spreading all work normally), with a non-enumerable .StatKey accessor attached for direct, autocomplete-friendly reads:
const stats = await pika.getProfileStats({
username: 'divena',
gamemode: Gamemode.BedWars,
});
stats.StatKey.BedWars.FinalKills;This only covers stats that actually appear on the profile-stats endpoint. Leaderboard-only stats, where the generated PikaNetworkStats value is null, aren't reachable through StatKey, since there's no per-player value to attach it to.
Where these come from
All five constants are generated by the same internal tooling described in Gamemodes and Enums, derived directly from the crawled gamemode, mode, and stat names.