api/internal/gamification/game_rewards library

getRewards parsing, ported from iOS GameRewards.swift. Every field is read defensively: an unknown or mistyped field degrades to null, only a missing id drops an entry, and nothing here throws.

Classes

GameExpiredChance
One chance that expired unplayed.
GameReward
One grant from the active, used or expired-grants lists. An unknown type skips it; a grant with nothing to show is dropped.
GameRewardChance
One unplayed chance. A missing or unreadable expiry sorts last; only a missing chance id drops the entry.
GameRewardsChancesContent
GameRewardsEmptyContent
GameRewardsHiddenContent
The slot hides: the backend hid it or sent an unknown content kind.
GameRewardsResponse
The getRewards response.
GameRewardsRewardContent
GameRewardsWidget
The widget object: what the digia_rewards_widget slot shows.
GameRewardsWidgetContent
The widget's content, in the backend's kinds. Anything else reads as null and the slot hides.
GameRewardValue
A grant's value, in integer minor units with an ISO currency code.

Enums

GameRewardType
A grant's reward type. Anything else skips the grant.

Functions

gameRewardsEndsIn(DateTime? expiresAt, {DateTime? now}) → String?
"Ends in 3d" / "Ends in 5h" / "Ends in 12m": the largest whole unit, at least a minute; null when the expiry is unknown or already past.