Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nippy.la/llms.txt

Use this file to discover all available pages before exploring further.

getState() checks a user’s state in a campaign before attempting a spin.

Usage

const state = await nippy.getState({
  userId: 'user-123',
  campaignId: 'camp-abc'
})

Parameters

userId
string
required
User identifier from your system. Example: user-123.
campaignId
string
required
Campaign ID. Example: camp-abc.

Response

eligible
boolean
Whether the user can spin right now.
ineligibilityReason
string | null
Reason the user cannot spin. Values: cooldown_active, spin_limit_reached, campaign_ended, or null.
spinsUsed
number
Number of spins used by the user in the campaign.
spinsAllowed
number
Maximum allowed spins. -1 means unlimited.
nextEligibleAt
string | null
ISO 8601 timestamp when the user can spin again.
pendingClaim
object | null
Pending prize to claim, if one exists.
pendingClaim.spinId
string
Spin ID associated with the pending claim.
pendingClaim.gift
object
Pending prize to claim.
pendingClaim.expiresAt
string
Deadline to claim the prize.