Loyalty operations
Loyalty operations are responsible for communicating with multiple APIs.
Each method that works with statistical data also converts your IDs to the desired ID provider for easier and quicker development.
The general design of the namespace follows this pattern:
val response = sdk.loyalty().someMethod(...)
// do something with response object
General operations
Get config
Method: getConfig()
This method returns all points configuration for all platform interactions.
Example call:
val loyaltyConfig: LoyaltyConfig? = sdk.loyalty().getConfig(filtersObject)
{
enabled: true,
conditions: {
list: [
"FULL_PROFILE",
"FAVOURITE_TEAM"
]
},
actions: {
value: [
{
id: "LIKE",
weight: 1,
multiplier: 1,
conditions: []
},
{
id: "DISLIKE",
weight: 1,
multiplier: 1,
conditions: []
},
{
id: "CLICK_AD",
weight: 7,
multiplier: 1,
conditions: []
},
{
id: "COMMENT",
weight: 5,
multiplier: 1,
conditions: []
},
{
id: "CONTENT_CONSUMED",
weight: 2,
multiplier: 1,
conditions: []
},
{
id: "CONVERT",
weight: 10,
multiplier: 1,
conditions: []
},
{
id: "PAGE_VIEW",
weight: 1,
multiplier: 1,
conditions: []
},
{
id: "SHARE",
weight: 4,
multiplier: 1,
conditions: []
},
{
id: "PROFILE_UPDATE",
weight: 1,
multiplier: 1,
conditions: []
},
{
id: "MANAGE_INTERESTS",
weight: 2,
multiplier: 1,
conditions: []
},
{
id: "PREDICTION_MADE",
weight: 2,
multiplier: 1,
conditions: []
},
{
id: "GAME_PARTICIPATION",
weight: 5,
multiplier: 1,
conditions: []
}
]
},
rewards: {
points: {
general: [
{
id: "registration",
points: 0
},
{
id: "add_interest",
points: 0
},
{
id: "add_birthdate",
points: 0
},
{
id: "add_country",
points: 0
},
{
id: "add_gender",
points: 0
},
{
id: "add_avatar",
points: 0
}
],
comments: [],
predictor: [
{
id: "FT_1X2",
points: 10,
multiplier: 1,
conditions: []
},
{
id: "HT_1X2",
points: 8,
multiplier: 1,
conditions: []
},
{
id: "HT_FT",
points: 36,
multiplier: 1,
conditions: []
},
{
id: "CORRECT_SCORE",
points: 50,
multiplier: 1,
conditions: []
},
{
id: "DOUBLE_CHANCE",
points: 3,
multiplier: 1,
conditions: []
},
{
id: "BOTH_TEAMS_SCORE",
points: 6,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE",
points: 9,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE_TWICE",
points: 23,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE_HATTRICK",
points: 45,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE_FIRST_GOAL",
points: 17,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_YELLOW_CARD",
points: 8,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_RED_CARD",
points: 40,
multiplier: 1,
conditions: []
},
{
id: "RED_CARD_MATCH",
points: 25,
multiplier: 1,
conditions: []
},
{
id: "PENALTY_MATCH",
points: 17,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_0_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_1_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_2_5",
points: 8,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_3_5",
points: 7,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_4_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_5_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_6_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_6_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_7_5",
points: 13,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_8_5",
points: 15,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_9_5",
points: 13,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_10_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_11_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_12_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_13_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "CORNERS_MATCH",
points: 37,
multiplier: 1,
conditions: []
}
],
activity: [
{
id: "LIKE",
points: 0,
multiplier: 1,
conditions: []
},
{
id: "DISLIKE",
points: 0,
multiplier: 1,
conditions: []
},
{
id: "COMMENT",
points: 0,
multiplier: 1,
conditions: []
},
{
id: "SHARE",
points: 0,
multiplier: 1,
conditions: []
}
],
topX: [
{
id: "FT_1X2",
points: 10,
multiplier: 1,
conditions: []
},
{
id: "CORRECT_SCORE",
points: 50,
multiplier: 1,
conditions: []
}
],
matchQuiz: [
{
id: "FT_1X2",
points: 10,
multiplier: 1,
conditions: []
},
{
id: "HT_1X2",
points: 8,
multiplier: 1,
conditions: []
},
{
id: "HT_FT",
points: 36,
multiplier: 1,
conditions: []
},
{
id: "CORRECT_SCORE",
points: 50,
multiplier: 1,
conditions: []
},
{
id: "DOUBLE_CHANCE",
points: 3,
multiplier: 1,
conditions: []
},
{
id: "BOTH_TEAMS_SCORE",
points: 6,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE",
points: 9,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE_TWICE",
points: 23,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE_HATTRICK",
points: 45,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_SCORE_FIRST_GOAL",
points: 17,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_YELLOW_CARD",
points: 8,
multiplier: 1,
conditions: []
},
{
id: "PLAYER_RED_CARD",
points: 40,
multiplier: 1,
conditions: []
},
{
id: "RED_CARD_MATCH",
points: 25,
multiplier: 1,
conditions: []
},
{
id: "PENALTY_MATCH",
points: 17,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_0_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_1_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_2_5",
points: 8,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_3_5",
points: 7,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_4_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_5_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_GOALS_6_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_6_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_7_5",
points: 13,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_8_5",
points: 15,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_9_5",
points: 13,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_10_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_11_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_12_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "OVER_CORNERS_13_5",
points: 1,
multiplier: 1,
conditions: []
},
{
id: "CORNERS_MATCH",
points: 37,
multiplier: 1,
conditions: []
}
]
},
tiers: [
{
enabled: true,
id: "diamond",
points: 75000
},
{
enabled: true,
id: "platinum",
points: 25000
},
{
enabled: true,
id: "gold",
points: 10000
},
{
enabled: true,
id: "silver",
points: 1500
},
{
enabled: true,
id: "bronze",
points: 0
}
],
badges: {
general: [],
predictor: [
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: null,
predictionsMade: null,
correctPredictions: 10
},
id: "predictor_newbie",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: null,
predictionsMade: null,
correctPredictions: 100
},
id: "predictor_top",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: null,
predictionsMade: null,
correctPredictions: 1000
},
id: "predictor_scorer",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: null,
predictionsMade: null,
correctPredictions: 5000
},
id: "predictor_guru",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: null,
predictionsMade: null,
correctPredictions: 10000
},
id: "predictor_legend",
enabled: true
}
],
topX: [
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: 1,
predictionsMade: null,
correctPredictions: null
},
id: "topx_newbie",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: 10,
predictionsMade: null,
correctPredictions: null
},
id: "topx_regular",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: 50,
predictionsMade: null,
correctPredictions: null
},
id: "topx_captain",
enabled: true
}
],
matchQuiz: [
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: 1,
predictionsMade: null,
correctPredictions: null
},
id: "matchquiz_newbie",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: 10,
predictionsMade: null,
correctPredictions: null
},
id: "matchquiz_regular",
enabled: true
},
{
requirements: {
points: null,
entityId: null,
entityType: null,
gameParticipationCount: 50,
predictionsMade: null,
correctPredictions: null
},
id: "matchquiz_captain",
enabled: true
}
]
}
}
}
Get available badges
Method: getClientBadges()
Methods returns all available badges for client.
Example call:
val response = sdk.loyalty().getClientBadges() val clientBadges = response.data
Templates and leaderboards operations
Get all templates
Method: getTemplates(disableCache?)
Methods retuns list of all created templates for specific client.
The response from API is cached for 1 hour. With disableCache
argument you can avoid cached response.
If no value is provided it will be set to false by default.
Example call:
sdk.loyalty().getTemplates(true)
Get leaderboard for a game
Method: getLeaderboardForGame(gameId, filters?, disableCache?)
Returns a leaderboard for specific game. Supports pagination.
Available options for filters:
- limit:
number
. How many leaderboards will be returned in list. - page:
number
. The number of the page.
The response from API is cached for 1 hour. With disableCache
argument you can avoid cached response.
If no value is provided it will be set to false by default.
sdk.loyalty().getLeaderboardForGame("3xtM4jU7jaXe82KnxrTKaJ", filters)
Updated 11 months ago