Reference / @getenginex/sdk-igaming / ReferralsApi
ReferralsApi
The player's referrals. All three methods require login. Whoever is signing up passes the code in the core's auth.register({ referralCode }); the register here is for someone who already has an account.
Methods
get()
get(
params?,options?):Promise<ReferralInfo>
The player's referral code, link and totals.
Parameters
params?
options?
Returns
Promise<ReferralInfo>
Example
const referral = await igaming.referrals.get()
console.log(referral.code, referral.link, referral.totalEarned)Throws
UNAUTHENTICATED without a session; VALIDATION_ERROR in validation: 'strict' if a money value is not a finite number or if a counter is not an integer ≥ 0.
listHistory()
listHistory(
input?,options?):Promise<ReferralHistory>
Referral history, paginated. Pagination comes inside data (not in the envelope's meta): the SDK builds the Page and computes totalPages (0 without items); a page beyond the end returns items: [].
Parameters
input?
options?
Returns
Promise<ReferralHistory>
Example
const { items, totalPages, completedCount } = await igaming.referrals.listHistory({ perPage: 20 })
items.forEach((r) => console.log(r.refereeEmailMasked, r.status))Throws
CONFIGURATION_ERROR (without a request) for a page that is not an integer ≥ 1 or a perPage outside 1–100 or not an integer; UNAUTHENTICATED without a session; VALIDATION_ERROR in validation: 'strict' if the status is unknown or the money is not a finite number.
register()
register(
input,options?):Promise<RegisteredReferral>
Registers another player's referral code on the logged-in account (after signup). Answers HTTP 201.
Parameters
input
options?
Returns
Promise<RegisteredReferral>
Example
const result = await igaming.referrals.register({ code: 'ANA123' })
console.log(result.status, result.refereeBonus)Throws
CONFIGURATION_ERROR (without a request) if code is not non-empty text; UNAUTHENTICATED without a session; the service refuses a nonexistent, already used or out-of-rule code: decide by error.code (the contract does not list the codes).