Skip to content

API Reference ​

Classes ​

ClassDescription
KeyvCacheuses keyv's in-memory adapter by default. pass a persistent adapter such as @keyv/redis for shared or persistent caching.
NetworkAPIErrorbase error for failures raised by a network stats API client
NetworkAuthExhaustedErrorindicates that all configured API credentials have been exhausted.
NetworkBadRequestErrorindicates a malformed request.
NetworkClientshared foundation for per-network clients
NetworkHTTPErrora generic HTTP failure (405/500/502/503/504/etc.) that isn't one of the more specific cases below.
NetworkRateLimitErrorindicates that the upstream API is rate-limiting requests (HTTP 429). back off!
NetworkValidationErrorindicates that the response does not conform to the expected schema.
NullCacheno-op cache for callers who want caching disabled entirely
PikaNetworkClienttyped, runtime-validated client
TokenBucketRateLimiter-

Interfaces ​

InterfaceDescription
BatchOptions-
GetLeaderboardParams-
GetProfileStatsParams-
GetTotalsParams-
LeaderboardEntry-
LeaderboardPage-
NetworkCachecaches network responses to avoid redundant requests. uses keyv's in-memory adapter by default. pass a persistent adapter for shared or durable caching.
NetworkClientOptions-
PikaNetworkClientOptions-
ProfileStat-
RateLimiterOptionsproactive token-bucket rate limiter for APIs that provide no RateLimit-* headers
RequestConfig-

Type Aliases ​

Type AliasDescription
BatchResult-
ClanMember-
PikaNetworkClanResponse-
PikaNetworkGamemode-
PikaNetworkInterval-
PikaNetworkLeaderboardResponse-
PikaNetworkMode-
PikaNetworkProfileDonorRank-
PikaNetworkProfileFriend-
PikaNetworkProfileResponse-
PikaNetworkRankScope-
PikaNetworkStat-
PikaNetworkStatKey-
PikaNetworkTotalsResponse-
ProfileStatAccessorprovides direct access to profile stats through the StatKey hierarchy. stats that were not fetched or have no recorded value resolve to null.
ProfileStatsprofile stats returned as a normal ProfileStat[] with an additional non-enumerable StatKey accessor for direct, autocomplete-friendly lookup.

Variables ​

VariableDescription
Gamemodeergonomic alias
Interval-
Mode-
PikaNetworkClanResponseSchemaGET /clans/
PikaNetworkDefaultBaseUrlshared PikaNetwork client defaults
PikaNetworkDefaultRateLimitREVIEW: derived from live API load testing (approximated). override via rateLimit when using different request constraints.
PikaNetworkGamemodes-
PikaNetworkIntervals-
PikaNetworkLeaderboardResponseSchema-
PikaNetworkModesvalid mode values per gamemode
PikaNetworkProfileDonorRankSchema-
PikaNetworkProfileResponseSchemaGET /profile/
PikaNetworkProfileStatsResponseSchemaGET /profile/{username}/leaderboard
PikaNetworkRecapResponseSchemaGET /recaps/
PikaNetworkRequiredMode-
PikaNetworkStatAliasesquerying the alias returns the same data as the canonical stat
PikaNetworkStats-
PikaNetworkTotalsResponseSchema-
Stat-
StatKey-
YearlyCapableGamemodesinterval=yearly doesn't work outside these gamemodes. enforced at the type and request level.

Functions ​

FunctionDescription
getTopRankReturns the highest donor or staff rank in the requested scope.
setLogLevel-
toLeaderboardPage-
withStatKeyAccessorwraps a raw ProfileStat[] with the .StatKey.<Gamemode>.<Stat> accessor indexed via a Map for O(1) reads without mutating the caller's input array.

Distributed under the MIT License.