Loyalty operations

Get the configuration for all platform interactions

Loyalty operations are responsible for communicating with multiple APIs.

The namespace is of course called loyalty. All methods return promises. The general design of the namespace follows this pattern unless stated otherwise:

📘

General call:

sdk.loyalty.someMethod(filtersObject).then((responseObject) => {
    // do something with responseObject
});

The responses are comprised of different objects you can find here.

General operations

Get config

Method: getConfig()

This method returns all points configuration for all platform interactions.

📘

Example call:

sdk.loyalty.getConfig().then((responseObject) => {
    // do something with responseObject
});

Example result

{
   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: []
            }
         ],
         discussionPost: [
            {
              id: "CREATE",
              points: 0,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "MODERATE",
              points: -1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_LIKE",
              points: 1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_DISLIKE",
              points: -1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_LOVE",
              points: 2,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_LAUGH",
              points: 1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_CARE",
              points: 1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_WOW",
              points: 1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_SAD",
              points: 1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
            {
              id: "REACTION_ANGRY",
              points: 1,
              multiplier: 1,
              conditions: [],
              alternative: {},
            },
      },
      tiers: [
         {
            enabled: true,
            id: "diamond",
           	label: "Diamond",
            points: 75000
         },
         {
            enabled: true,
            id: "platinum",
           	label: "Platinum",
            points: 25000
         },
         {
            enabled: true,
            id: "gold",
           	label: "Gold",
            points: 10000
         },
         {
            enabled: true,
            id: "silver",
           	label: "Silver",
            points: 1500
         },
         {
            enabled: true,
            id: "bronze",
           	label: "Bronze",
            points: 0
         }
      ],
      badges: {
         general: [],
         predictor: [
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: null,
                  predictionsMade: null,
                  correctPredictions: 10
               },
               id: "predictor_newbie",
               label: "Predictor newbie",
               assets: {
                 mainImageUrl: "https://en.wikipedia.org/wiki/Image/media/File:Image_created_with_a_mobile_phone.pngg
               },
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: null,
                  predictionsMade: null,
                  correctPredictions: 100
               },
               id: "predictor_top",
               label: "Predictor top",
               assets: null,
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: null,
                  predictionsMade: null,
                  correctPredictions: 1000
               },
               id: "predictor_scorer",
               label: "Predictor scorer",
               assets: null,
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: null,
                  predictionsMade: null,
                  correctPredictions: 5000
               },
               id: "predictor_guru",
               label: "Predictor guru",
               assets: null,
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: null,
                  predictionsMade: null,
                  correctPredictions: 10000
               },
               id: "predictor_legend",
               label: "Predictor legend",
               assets: null,
               enabled: true
            }
         ],
         topX: [
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: 1,
                  predictionsMade: null,
                  correctPredictions: null
               },
               id: "topx_newbie",
               label: "Top x newbie",
               assets: {
                 mainImageUrl: "https://en.wikipedia.org/wiki/Image/media/File:Image_created_with_a_mobile_phone.pngg
               },
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: 10,
                  predictionsMade: null,
                  correctPredictions: null
               },
               id: "topx_regular",
               label: "Top x regular",
               assets: null,
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: 50,
                  predictionsMade: null,
                  correctPredictions: null
               },
               id: "topx_captain",
               label: "Top x captain",
               assets: null,
               enabled: true
            }
         ],
         matchQuiz: [
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: 1,
                  predictionsMade: null,
                  correctPredictions: null
               },
               id: "matchquiz_newbie",
               label: "Match Quiz newbie",
               assets: {
                 mainImageUrl: "https://en.wikipedia.org/wiki/Image/media/File:Image_created_with_a_mobile_phone.pngg
               },
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: 10,
                  predictionsMade: null,
                  correctPredictions: null
               },
               id: "matchquiz_regular",
               label: "Match quiz regular",
               assets: null,
               enabled: true
            },
            {
               requirements: {
                  points: null,
                  entityId: null,
                  entityType: null,
                  gameParticipationCount: 50,
                  predictionsMade: null,
                  correctPredictions: null
               },
               id: "matchquiz_captain",
               label: "Match quiz captain",
               assets: null,
               enabled: true
            }
         ]
      }
   }
}

Get config VERSION 2

Method: getConfigV2(disableCache?)

This method returns loyalty configuration with new badges structure.

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.getConfigV2().then((responseObject) => {
    // do something with responseObject
});

Example result

{
   enabled: true,
   clientId: "productiontesting1",
   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: []
         },
         {
            id: "ARTICLE_CONSUMED",
            weight: 3,
            multiplier: 1,
            conditions: []
         },
         {
            id: "VIDEO_CONSUMED",
            weight: 3,
            multiplier: 1,
            conditions: []
         },
         {
            id: "SHORT_VIDEO_CONSUMED",
            weight: 1,
            multiplier: 1,
            conditions: []
         },
         {
            id: "LONG_VIDEO_CONSUMED",
            weight: 5,
            multiplier: 1,
            conditions: []
         },
         {
            id: "AUDIO_CONSUMED",
            weight: 3,
            multiplier: 1,
            conditions: []
         },
         {
            id: "GALLERY_CONSUMED",
            weight: 3,
            multiplier: 1,
            conditions: []
         },
         {
            id: "IMAGE_CONSUMED",
            weight: 1,
            multiplier: 1,
            conditions: []
         },
         {
            id: "POLL_VOTE",
            weight: 1,
            multiplier: 1,
            conditions: []
         },
         {
            id: "ADD_POST",
            weight: 5,
            multiplier: 1,
            conditions: []
         },
         {
            id: "ADD_REACTION",
            weight: 1,
            multiplier: 1,
            conditions: []
         },
         {
            id: "DELETE_POST",
            weight: 1,
            multiplier: 1,
            conditions: []
         },
         {
            id: "PRIVATE_LEAGUE_CREATE",
            weight: 10,
            multiplier: 1,
            conditions: []
         },
         {
            id: "PRIVATE_LEAGUE_JOIN",
            weight: 3,
            multiplier: 1,
            conditions: []
         },
         {
            id: "PRIVATE_LEAGUE_LEAVE",
            weight: 0,
            multiplier: 1,
            conditions: []
         },
         {
            id: "CLASSIC_QUIZ_PARTICIPATION",
            weight: 5,
            multiplier: 1,
            conditions: []
         },
         {
            id: "EITHER_OR_PARTICIPATION",
            weight: 5,
            multiplier: 1,
            conditions: []
         },
         {
            id: "POTM_VOTE",
            weight: 1,
            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
            }
         ],
         predictor: [
            {
               id: "FT_1X2",
               points: 10,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "HT_1X2",
               points: 8,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "HT_FT",
               points: 30,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE",
               points: 50,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE_HT",
               points: 30,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE_ADVANCED",
               points: 50,
               multiplier: 1,
               conditions: [],
               alternative: {
                  CORRECT_OUTCOME_1X2: 5,
                  CORRECT_HOME_GOALS: 5,
                  CORRECT_AWAY_GOALS: 5,
                  CORRECT_GOAL_DIFFERENCE: 5
               }
            },
            {
               id: "DOUBLE_CHANCE",
               points: 3,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "BOTH_TEAMS_SCORE",
               points: 6,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE",
               points: 9,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE_TWICE",
               points: 23,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE_HATTRICK",
               points: 45,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE_FIRST_GOAL",
               points: 17,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_YELLOW_CARD",
               points: 8,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_RED_CARD",
               points: 40,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "RED_CARD_MATCH",
               points: 25,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PENALTY_MATCH",
               points: 17,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_0_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_1_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_2_5",
               points: 8,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_3_5",
               points: 7,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_4_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_5_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_6_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_6_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_7_5",
               points: 13,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_8_5",
               points: 15,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_9_5",
               points: 13,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_10_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_11_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_12_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_13_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORNERS_MATCH",
               points: 37,
               multiplier: 1,
               conditions: [],
               alternative: {}
            }
         ],
         activity: [
            {
               id: "LIKE",
               points: 0,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "DISLIKE",
               points: 0,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "COMMENT",
               points: 0,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "SHARE",
               points: 0,
               multiplier: 1,
               conditions: [],
               alternative: {}
            }
         ],
         topX: [
            {
               id: "FT_1X2",
               points: 10,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE",
               points: 50,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE_ADVANCED",
               points: 50,
               multiplier: 1,
               conditions: [],
               alternative: {
                  CORRECT_OUTCOME_1X2: 5,
                  CORRECT_HOME_GOALS: 5,
                  CORRECT_AWAY_GOALS: 5,
                  CORRECT_GOAL_DIFFERENCE: 5
               }
            }
         ],
         matchQuiz: [
            {
               id: "FT_1X2",
               points: 10,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "HT_1X2",
               points: 8,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "HT_FT",
               points: 36,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE",
               points: 50,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE_HT",
               points: 21,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORRECT_SCORE_ADVANCED",
               points: 50,
               multiplier: 1,
               conditions: [],
               alternative: {
                  CORRECT_OUTCOME_1X2: 5,
                  CORRECT_HOME_GOALS: 5,
                  CORRECT_AWAY_GOALS: 5,
                  CORRECT_GOAL_DIFFERENCE: 5
               }
            },
            {
               id: "DOUBLE_CHANCE",
               points: 3,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "BOTH_TEAMS_SCORE",
               points: 6,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE",
               points: 9,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE_TWICE",
               points: 23,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE_HATTRICK",
               points: 45,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_SCORE_FIRST_GOAL",
               points: 17,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_YELLOW_CARD",
               points: 8,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PLAYER_RED_CARD",
               points: 40,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "RED_CARD_MATCH",
               points: 9,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "PENALTY_MATCH",
               points: 6,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_0_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_1_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_2_5",
               points: 8,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_3_5",
               points: 7,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_4_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_5_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_GOALS_6_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_6_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_7_5",
               points: 13,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_8_5",
               points: 15,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_9_5",
               points: 13,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_10_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_11_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_12_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "OVER_CORNERS_13_5",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "CORNERS_MATCH",
               points: 37,
               multiplier: 1,
               conditions: [],
               alternative: {}
            }
         ],
         discussionPost: [
            {
               id: "CREATE",
               points: 0,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "MODERATE",
               points: -1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_LIKE",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_DISLIKE",
               points: -1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_LOVE",
               points: 2,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_LAUGH",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_CARE",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_WOW",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_SAD",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            },
            {
               id: "REACTION_ANGRY",
               points: 1,
               multiplier: 1,
               conditions: [],
               alternative: {}
            }
         ]
      },
      tiers: [
         {
            enabled: true,
            id: "diamond",
            points: 75000,
            label: "Диамант"
         },
         {
            enabled: true,
            id: "platinum",
            points: 25000,
            label: "Платина"
         },
         {
            enabled: true,
            id: "gold",
            points: 10000,
            label: "Злато"
         },
         {
            enabled: true,
            id: "silver",
            points: 1500,
            label: "Сребро"
         },
         {
            enabled: true,
            id: "bronze",
            points: 0,
            label: "Бронз"
         }
      ],
      badges: {
         predictor: [
            {
               assets: null,
               requirements: {
                  correctPredictions: null,
                  points: 0
               },
               id: "ucl_maniac",
               enabled: true,
               label: "ШЛ Маняк",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  correctPredictions: 10,
                  points: 100
               },
               id: "predictor_newbie",
               enabled: true,
               label: "Дебютант",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  correctPredictions: 100,
                  points: 0
               },
               id: "predictor_top",
               enabled: true,
               label: "Майстор",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  correctPredictions: 1000,
                  points: 0
               },
               id: "predictor_scorer",
               enabled: true,
               label: "Топ Реализатор",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  correctPredictions: 5000,
                  points: 0
               },
               id: "predictor_guru",
               enabled: true,
               label: "Гуру",
               description: "",
               flags: []
            }
         ],
         topX: [
            {
               assets: null,
               requirements: {
                  points: 0
               },
               id: "topx_newbie",
               enabled: true,
               label: "Топ 7 Дебютант",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  points: 0
               },
               id: "topx_regular",
               enabled: true,
               label: "Топ 7 Титуляр",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  points: 0
               },
               id: "topx_captain",
               enabled: true,
               label: "Топ 7 Капитан",
               description: "",
               flags: []
            }
         ],
         matchQuiz: [
            {
               assets: null,
               requirements: {
                  points: 0
               },
               id: "matchquiz_newbie",
               enabled: true,
               label: "Дебютант",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  points: 0
               },
               id: "matchquiz_regular",
               enabled: true,
               label: "Титуляр",
               description: "",
               flags: []
            },
            {
               assets: null,
               requirements: {
                  points: 0
               },
               id: "matchquiz_captain",
               enabled: true,
               label: "Капитан",
               description: "",
               flags: []
            }
         ],
         games: [],
         football: [],
         classicQuizzes: [],
         eitherOr: [],
         discussions: [],
         voting: {
            potm: [],
            poll: []
         }
      }
   }
}

Get available badges

Method: getClientBadges()

Methods returns all available badges for client.

📘

Example call:

sdk.loyalty.getClientBadges().then((responseObject) => {
    // do something with responseObject
});

Example result

{
   general: [],
   predictor: [
      "predictor_newbie",
      "predictor_top",
      "predictor_guru"
   ],
   topX: [
      "topx_regular"
   ],
   matchQuiz: [
      "matchquiz_regular"
   ]
}

Get available badges VERSION 2

Method: getClientBadgesV2()

Methods returns all available badges for 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.getClientBadgesV2().then((responseObject) => {
    // do something with responseObject
});

Example result

{
   predictor: [
      "ucl_maniac",
      "predictor_newbie",
      "predictor_top",
      "predictor_scorer",
      "predictor_guru"
   ],
   topX: [
      "topx_newbie",
      "topx_regular",
      "topx_captain"
   ],
   matchQuiz: [
      "matchquiz_newbie",
      "matchquiz_regular",
      "matchquiz_captain"
   ],
   games: [],
   football: [],
   classicQuizzes: [],
   eitherOr: [],
   discussions: [],
   potm: [],
   poll: []
}

Templates and leaderboards operations

Get all templates

Method: getTemplates(filters?, disableCache?)

Methods retuns list of all created templates for specific client.

Available options for filters:

  • flags:string. Templates flags.
  • status: string. Templates' status. Can be PENDING, LIVE, SETTLED.
  • type:string. Templates' types. Can be PRIMARY, CUSTOM, GAME, PROFILE.
  • activeFrom:string. Templates who are before or equal to template's toDate property. .
  • activeTo:string. Templates who are after or equal to template's toDate property.
  • createdFrom:string. Templates who are after or equal to template's createdAt property.
  • createdTo:string. Templates who are before or equal to template's createdAt property.
  • updatedFrom:string. Templates who are after or equal to template's updatedAt property.
  • updatedTo:string. Templates who are before or equal to template's updatedAt property.

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).then((responseObject) => {
   // Handle response
});

Example result

{
   meta: {
      totalItems: 3
   },
   data: [
      {
        id: "competition:premier-league",
        name: "Premier League (England)'s Leaderboard",
        description: "Some description",
        type: "PRIMARY",
        fromDate: "2022-07-01",
        toDate: "2023-06-30",
        markets: null,
        teamIds: null,
        matchIds: null,
        gameIds: null,
        gameTypes: null,
        competitionIds: [
           "3"
        ],
        groups: [
          {
            label: "Week 31",
            filters: {
              fromDate: "2024-04-02",
              toDate: "2024-04-04",
              matchIds: [
                    "fb:m:158704",
                    "fb:m:158711",
                    "fb:m:158698",
                    "fb:m:158703",
                    "fb:m:158692",
                    "fb:m:158685",
                    "fb:m:158763",
                    "fb:m:158742",
                    "fb:m:158695",
                    "fb:m:158712"
              ]
          	},
           	groupId: "week_31"
        	}
    		],
        rules: "Rules for participating in template.",
        flags: ["This", "is", "string", "array"],
        images: {
          main: "some-photo-url",
          cover: "some-photo-url",
          mobile: "some-photo-url"
        },
        excludedProfileIds: null,
        labels: {
          label: "label"
        },
        customFields: {
          custom: "fields"
        },
        related: [
          {
            entityId: "team:leicester-city",
            entityType: "TEMPLATE"
          }
        ],
        branding: BrandingModel,
        createdAt: "2023-03-01T10:10:50Z",
        updatedAt: "2023-03-01T10:10:50Z"
      },
      {
        id: "market:ft-1x2",
        name: "Championship (England)'s Leaderboard",
        description: "Some description",
        type: "PRIMARY",
        fromDate: "2022-07-01",
        toDate: "2023-06-30",
        markets: [
           "FT_1X2"
        ],
        teamIds: null,
        matchIds: null,
        gameIds: null,
        gameTypes: null,
        competitionIds: null,
        groups: null,
        rules: "Rules for participating in template.",
        flags: ["This", "is", "string", "array"],
        images: {
          main: "some-photo-url",
          cover: "some-photo-url",
          mobile: "some-photo-url"
        },
        excludedProfileIds: ["some-profile-id"],
        related: null,
        branding: BrandingModel,
        createdAt: "2023-03-01T10:10:50Z",
        updatedAt: "2023-03-01T10:10:50Z"
      },
      {
        id: "team:leicester-city",
        name: "Leicester City's Leaderboard",
        type: "PRIMARY",
        fromDate: "2022-07-01",
        toDate: "2023-06-30",
        markets: null,
        teamIds: [
           "81"
        ],
        matchIds: null,
        gameIds: null,
        gameTypes: null,
        competitionIds: null,
        groups: null,
        rules: 'Rules for participating in template.',
        flags: ['This', 'is', 'string', 'array'],
        images: {
          main: "some-photo-url",
          cover: "some-photo-url",
          mobile: "some-photo-url"
        },
        excludedProfileIds: ["profile-id-1", "profile-id-2"],
        related: [
          {
            entityId: "competition:premier-league",
            entityType: "TEMPLATE"
          }
        ],
        branding: BrandingModel,
        createdAt: "2023-03-01T10:10:50Z",
        updatedAt: "2023-03-01T10:10:50Z"
      }
   ]
}

Get single template

Method: getTemplateById(templateId, disableCache?)

Methods returns specified template.

The response from API is cached for 10 minutes. 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.getTemplateById("competition:premier-league", true)
.then((responseObject) => {
   // Handle response
})
.catch((error) => {
  // Throws error message 
)};

Example result

{
  id: "competition:premier-league",
  name: "Premier League (England)'s Leaderboard",
  description: "Best league in the world",
  type: "PRIMARY",
  fromDate: "2022-07-01",
  toDate: "2023-06-30",
  markets: null,
  teamIds: null,
  matchIds: null,
  gameIds: null,
  gameTypes: null,
  competitionIds: [
    "3"
  ],
  groups:[
    {
      label: "Week 31",
      filters: {
        fromDate: "2024-04-02",
        toDate: "2024-04-04",
        matchIds:[
          "fb:m:158704",
          "fb:m:158711",
          "fb:m:158698",
          "fb:m:158703",
          "fb:m:158692",
         	"fb:m:158685",
         	"fb:m:158763",
          "fb:m:158742",
          "fb:m:158695",
          "fb:m:158712"
          ]
        },
        groupId: "week_31"
     }
  ],
  rules: 'Rules for participating in template.',
  flags: ['This', 'is', 'string', 'array'],
  excludedProfileIds: ["profile-id-1", "profile-id-2"],
  related: [
    {
      entityId: "team:leicester-city",
      entityType: "TEMPLATE"
    }
  ],
  labels: {
    new: "new",
    label_: "label_",
    field3: "new label 3"
  },
  customFields: {
    new: "new",
    custom_: "custom_",
    field3: "new custom field 3"
  },
  branding: BrandingModel,
  createdAt: "2023-03-01T10:10:50Z",
  updatedAt: "2023-03-01T10:10:50Z"
}

Get template winners

Method: getTemplateWinners(templateId)

Method returns winners for the specific template.

📘

Example call:

sdk.loyalty.getTemplateWinners("templateId").then((responseObject) => {
   // Returns winners for the specific template
});

Example response:

{
   contestId: "2neVcxhVwZw3eCy7Xt5LiV",
   contestType: "TEMPLATE",
   contestModel: TemplateModel,
   description: "description",
   userList: [
      {
         position: "big winner",
         profileId: "profileId",
         profileModel: ProfileModel,
         note: "The winner",
         tags: [
            "big_prizezzzzz",
           	"champion"
         ]
      }
   ]
}

Get leaderboard for a template

Method: getLeaderboard(templateId, filters?, disableCache?)

Returns a leaderboard for specific template. Supports pagination.

Available options for filters:

  • groupId: string. Filter the template's standings by template's group ID.
  • 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.

📘

Example call:

const filters = {
   groupId: "group_1",
   limit: 2,
   page: 2
}
sdk.loyalty.getLeaderboard("competition:premier-league", filters).then((responseObject) => {
   // Handle response
});

Example response:

{
   meta: {
      rankType: "COMPETITION",
      fromDate: "2022-07-01",
      toDate: "2023-06-30",
      pagination: {
         currentPage: 2,
         itemsPerPage: 2,
         totalItems: 10,
         numberOfPages: 5
      }
   },
   data: [
      {
         position: 1,
         profileId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
         profileModel: ProfileModel,
         points: 30,
         predictionsMade: 3
      },
      {
         position: 2,
         profileId: "Y44CxUzkpHdypYxcVVlwIQiLNtD2",
         profileModel: ProfileModel,
         points: 20,
         predictionsMade: 2
      }
   ]
}

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.

📘

Example call:

const filters = {
   limit: 2,
   page: 2
}
sdk.loyalty.getLeaderboardForGame("3xtM4jU7jaXe82KnxrTKaJ", filters).then((responseObject) => {
   // Handle response
});

Example result

{
   meta: {
      rankType: "GAME",
      fromDate: null,
      toDate: null,
      pagination: {
         currentPage: 2,
         itemsPerPage: 2,
         totalItems: 10,
         numberOfPages: 5
      }
   },
   data: [
      {
         position: 1,
         profileId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
         profileModel: ProfileModel,
         points: 30,
         predictionsMade: 3
      },
      {
         position: 2,
         profileId: "Y44CxUzkpHdypYxcVVlwIQiLNtD2",
         profileModel: ProfileModel,
         points: 20,
         predictionsMade: 2
      }
   ]
}

Get leaderboard for a league

Method: getLeaderboardForLeague(leagueId, filters?)

Returns a leaderboard for specific league. Supports pagination.

Available options for filters:

  • limit:number. How many leaderboards will be returned in list.
  • page: number. The number of the page.
  • templateId: string. You can filter the leaderboard of league by template ID.

📘

Example call:

const filters = {
   limit: 2,
   page: 2,
   templateId: "template-id"
}
sdk.loyalty.getLeaderboardForLeague("3xtM4jU7jaXe82KnxrTKaJ", filters).then((responseObject) => {
   // Handle response
});

Example result

{
   meta: {
      templateId: "template-id",
      privateLeagueId: "3xtM4jU7jaXe82KnxrTKaJ",
      fromDate: null,
      toDate: null,
      pagination: {
         currentPage: 2,
         itemsPerPage: 2,
         totalItems: 10,
         numberOfPages: 5
      }
   },
   data: [
      {
         position: 1,
         profileId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
         profileModel: ProfileModel,
         points: 30,
         predictionsMade: 3
      },
      {
         position: 2,
         profileId: "Y44CxUzkpHdypYxcVVlwIQiLNtD2",
         profileModel: ProfileModel,
         points: 20,
         predictionsMade: 2
      }
   ]
}

Get match models for specific template

Method: getTemplateMatches(templateId, groupId?, disableCache?)

Returns a list of matches for the specified template.

When groupId paramater is not provided, then the method will return all models for all entities that are specified in the template (competitions, teams and matches) with the from date and to date.

When groupId paramater is provided, then the method will return the matches only in the specific group.

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.getTemplateMatches("3Tv70DrdNKNVOuvAEHtVLV").then((responseObject) => {
   // Handle response
});

Example result

[
   {
      id: "fb:m:158704",
      kickoffAt: "2024-04-02T18:30:00Z",
      finishedAt: null,
      updatedAt: "2024-04-01T11:36:08Z",
      availableMarkets: [
         "FT_1X2",
         "HT_1X2",
         "HT_FT",
         "BOTH_TEAMS_SCORE",
         "OVER_GOALS_0_5",
         "OVER_GOALS_1_5",
         "OVER_GOALS_2_5",
         "OVER_GOALS_3_5",
         "OVER_GOALS_4_5",
         "OVER_GOALS_5_5",
         "OVER_GOALS_6_5",
         "OVER_CORNERS_6_5",
         "OVER_CORNERS_7_5",
         "OVER_CORNERS_8_5",
         "OVER_CORNERS_9_5",
         "OVER_CORNERS_10_5",
         "OVER_CORNERS_11_5",
         "OVER_CORNERS_12_5",
         "OVER_CORNERS_13_5",
         "DOUBLE_CHANCE",
         "PLAYER_SCORE",
         "PLAYER_YELLOW_CARD",
         "PLAYER_RED_CARD",
         "RED_CARD_MATCH",
         "PENALTY_MATCH",
         "PLAYER_SCORE_FIRST_GOAL",
         "CORNERS_MATCH",
         "CORRECT_SCORE",
         "CORRECT_SCORE_HT",
         "CORRECT_SCORE_ADVANCED",
         "PLAYER_SCORE_HATTRICK",
         "PLAYER_SCORE_TWICE"
      ],
      homeTeam: {
         id: "fb:t:8103",
         country: {
            id: "fb:cnt:1522",
            alias: null,
            countryCode: "ENG",
            assets: {
               flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
            },
            name: "England"
         },
         gender: "male",
         assets: {
            logo: "https://football.fansunitedassets.com/team/7fda2846-54ec-40f3-a988-12905c4eb075.png"
         },
         name: "Newcastle United",
         code: "NEW",
         national: false,
         fullName: null,
         shortName: null
      },
      awayTeam: {
         id: "fb:t:896",
         country: {
            id: "fb:cnt:1522",
            alias: null,
            countryCode: "ENG",
            assets: {
               flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
            },
            name: "England"
         },
         gender: "male",
         assets: {
            logo: "https://football.fansunitedassets.com/team/d737bd7f-eb2a-4f60-a498-2f3757ce5ca2.png"
         },
         name: "Everton",
         code: "EVE",
         national: false,
         fullName: null,
         shortName: null
      },
      isDeleted: false,
      lineupsConfirmed: false,
      startedAt: null,
      minute: null,
      scores: {
         ftScore: {
            homeGoals: null,
            awayGoals: null
         },
         htScore: {
            homeGoals: null,
            awayGoals: null
         },
         aetScore: {
            homeGoals: null,
            awayGoals: null
         },
         aggScore: {
            homeGoals: null,
            awayGoals: null
         },
         penScore: {
            homeGoals: null,
            awayGoals: null
         }
      },
      context: {
         competition: {
            id: "fb:c:3",
            country: {
               id: "fb:cnt:1522",
               alias: null,
               countryCode: "ENG",
               assets: {
                  flag: "https://football.fansunitedassets.com/country/3a930dd8-8e19-11eb-b60d-42010a84003b.png"
               },
               name: "England"
            },
            gender: "male",
            assets: {
               logo: "https://football.fansunitedassets.com/competition/42108c2a-8c4e-11eb-aff3-42010a8400d1.png"
            },
            type: "league",
            name: "Premier League"
         }
      },
      status: {
         type: "notstarted",
         subType: "not_started"
      }
   }
]

User rankings

Get user own rankings

Method: getOwnRankings(filters?, disableCache?)

Methods returns user's own rankings.

Filters options:

  • limit: number. How mani rankings will be returned from API. By default it will return 10 items per page.
  • page: number. Which page to be returned. By default is first page.
  • sortOder: SortOrder. Union type 'asc' | 'desc'. By default the order is desc (comes from descending).
  • type: RankingsType. Union type 'game' | 'template'. By default the response will contaion both types.
  • leaderboardIds: string[]. List of strings. The response will contain only provided game or template ids.

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:

const filters = {
   limit: 2,
   page: 2,
   sortOrder: 'asc',
   type: 'game'
};

const disableCache = true;

sdk.loyalty.getOwnRankings(filters, disableCache).then((responseObject) => {
   // Handle response
});

Example result

{
    meta: {
        pagination: {
            currentPage: 2,
            itemsPerPage: 2,
            totalItems: 12,
            numberOfPages: 2
        }
    },
    data: [
        {
            id: "1Tvag5OuxUnOgqRr4MGWAQ",
            rankType: "GAME",
            position: 1,
            points: 60
        },
        {
            id: "2qzP5Ahc6uKiuNL2OU5or",
            rankType: "GAME",
            position: 2,
            points: 40
        }
    ]
}

Get user rankings

Method: getUserRankings(userId, filters?, disableCache?)

Methods returns user's rankings.

Filters options:

  • limit: number. How mani rankings will be returned from API. By default it will return 10 items per page.
  • page: number. Which page to be returned. By default is first page.
  • sortOder: SortOrder. Union type 'asc' | 'desc'. By default the order is desc (comes from descending).
  • type: RankingsType. Union type 'game' | 'template'. By default the response will contaion both types.
  • leaderboardIds: string[]. List of strings. The response will contain only provided game or template ids.

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:

const filters = {
   limit: 2,
   page: 2,
   sortOrder: 'asc',
   type: 'game'
};

const disableCache = true;

sdk.loyalty.getOwnRankings("user-id", filters, disableCache).then((responseObject) => {
   // Handle response
});
{
    meta: {
        pagination: {
            currentPage: 2,
            itemsPerPage: 2,
            totalItems: 12,
            numberOfPages: 2
        }
    },
    data: [
        {
            id: "1Tvag5OuxUnOgqRr4MGWAQ",
            rankType: "GAME",
            position: 1,
            points: 60
        },
        {
            id: "2qzP5Ahc6uKiuNL2OU5or",
            rankType: "GAME",
            position: 2,
            points: 40
        }
    ]
}

Get highest success rate

Method: getHighestSuccessRate(filters?, disableCache?)

Method returns first 100 users with highest success rate who have placed at least 100 predictions.

Optional argument filters is type HighestSuccessRateFilters and when provided, JS SDK will return first 100 users with highest success rate for the provided filters.

The response from API is cached for 8 hours. 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.getHighestSuccessRate().then((responseObject) => {
   // Returns 100 users who have placed at least 100 predictions across all markets
});

const filters = { market: "CORRECT_SCORE" };

sdk.loyalty.getHighestSuccessRate(filters).then((responseObject) => {
   // Returns 100 users who have placed at least 100 predictions for CORRECT_SCORE market
});
[
   {
      position: 1,
      points: 1412,
      predictionsMade: 325,
      profileId: "BRLWNsotfsRdmA0EHq0GzkjeRRD2",
      profileModel: ProfileModel,
      successRatePercent: 46
   },
   {
      position: 2,
      points: 1002,
      predictionsMade: 218,
      profileId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
      profileModel: ProfileModel,
      successRatePercent: 33
   }
]

Others

Get entities follows

Method: getEntitiesFollows(filters, disableCache?)

Method returns count of users who have followed/favourited provided entities from filters param.

Argument filters is type EntitiesFollowsFilters and it's required. However there is limitation how many ids per entity you can provide - the maximum is 24. If provided more than 24, JS SDK will throw an exception.

The response from API is cached for 10 minutes. With disableCache argument you can avoid cached response.
If no value is provided it will be set to false by default.

📘

Example call:

const filters = {
   footballCompetitions: ["fb:c:3"],
   footballTeams: ["fb:t:889"],
   footballPlayers: ["fb:p:49123"]
};

sdk.loyalty.getEntitiesFollows(filters).then((responseObject) => {
   // Returns entities (id and models) and their users follows count per client.
});
{
   breakdown: [
      {
         id: "fb:c:3",
         count: 6,
         model: CompetitionBasicModel
      },
     	{
         id: "fb:t:889",
         count: 6,
         model: TeamBasicModel
      },
    	{
         id: "fb:p:49123",
         count: 6,
         model: PlayerBasicModel
      }
   ],
   total: 18
}