Match Quiz operations
Let your users play match quizzes
Match Quiz operations are responsible for communicating with the Prediction API in the context of a Match Quiz game.
Games (a.k.a. Match Quiz editions) are created by the staff members using their tokens in the Management Portal.
The following methods provide the functionality for end-users' interactions with the game.
Each method that works with statistical data also converts your IDs to the desired ID provider for easier and quicker development.
The namespace is of course called matchQuiz. All methods return promises. The general design of the namespace follows this pattern unless stated otherwise:
sdk.matchQuiz.someMethod(filtersObject).then((responseObject) => {
// do something with responseObject
});
Game related operations
The following methods are relating to the game instance.
Play the game
Method: play({})
Submits the user's predictions for a specific game.
Options object:
- gameInstanceId: string. The game instance ID
- fixtures: array of objects. Contains a list of fixtures and predictions for each of the games in the game instance. Each object should contain:
- matchId: string. The ID of the match. It should exist in the game instance.
- market: String. Any option of the list of supported markets. Keep in mind that some markets are disallowed, because of data coverage reasons.
- prediction: Object. The prediction for this match
- value: String, Boolean or Number depending on the market
- playerId: String. Optional. Used only for player related markets.
N.B: User predicts for CORRECT_SCORE
market value: 0:0
. In this case for market PLAYER_SCORE_FIRST_GOAL
playerId can be null.
In this meaning user predicts that there will be no player scorer (nobody will score in this match).
N.B: User can predict for Match Quiz game that there will be own goal. To do that client needs to provide playerId: "OWN_GOAL"
for market PLAYER_SCORE_FIRST_GOAL
.
N.B. The order of fixtures
need to be the same as the order of the fixtures in the game
sdk.matchQuiz
.play({
gameInstanceId: 'ZLk',
fixtures: [
{
matchId: 'fb:m:425669548',
market: 'HT_1X2',
prediction: {
value: '1',
},
},
{
matchId: 'fb:m:425669548',
market: 'CORRECT_SCORE', // same goes for CORRECT_SCORE_HT and CORRECT_SCORE_ADVANCED
prediction: {
value: '1:2',
},
},
{
matchId: 'fb:m:425669548',
market: 'PLAYER_SCORE_FIRST_GOAL',
prediction: {
value: true,
playerId: 'fb:p:43400',//null is acceptable ONLY for PLAYER_SCORE_FIRST_GOAL
},
},
{
matchId: 'fb:m:425669548',
market: 'CORNERS_MATCH',
prediction: {
value: 11,
},
},
{
matchId: 'fb:m:425669548',
market: 'RED_CARD_MATCH',
prediction: {
value: true,
},
},
{
matchId: 'fb:m:425669548',
market: 'PENALTY_MATCH',
prediction: {
value: false,
},
},
],
})
.then((responseObject) => {
// do something with responseObject
});
Example result
{
id: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2_g_3xtM4jU7jaXe82KnxrTKaJ",
gameInstanceId: "3xtM4jU7jaXe82KnxrTKaJ",
gameType: "MATCH_QUIZ",
wager: null,
totalFixtures: 6,
settledFixtures: 0,
userId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
fixtures: [
{
market: "HT_1X2",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: MatchBasicModel,
prediction: {
value: "1",
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "CORRECT_SCORE",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: MatchBasicModel,
prediction: {
value: "3:1",
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "PLAYER_SCORE_FIRST_GOAL",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: MatchBasicModel,
prediction: {
value: true,
playerId: "fb:p:41754",
playerModel: PlayerBasicModel
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "CORNERS_MATCH",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: MatchBasicModel,
prediction: {
value: 11,
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "RED_CARD_MATCH",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: MatchBasicModel,
prediction: {
value: false,
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "PENALTY_MATCH",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: MatchBasicModel,
prediction: {
value: true,
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
}
],
status: "ACTIVE",
tiebreaker: null,
points: 0,
createdAt: "2022-03-04T08:11:59Z",
updatedAt: "2022-03-04T08:11:59Z"
}
Delete game participations
Method: delete(gameInstanceId)
Deletes the user's participation (all game predictions) in a specific game.
sdk.matchQuiz
.delete('GSGUDDW5xVNSo7I0ujVbsNBoeMz2_g_3xtM4jU7jaXe82KnxrTKaJ')
.then((responseObject) => {
// do something with responseObject
});
Example result
// returns 200 OK status code and boolean variable
Get games
Method: getGames(filters?, disableCache?)
Returns a list of Match Quiz game instances, paginated.
If no value is passed to disableCache (undefined) it will be set to false.
Filters object:
- limit: number. The number of games to be returned.
- startAfter: string. The ID after which the games should be listed. To be used in the context of infinite scroll/pagination.
- status: string. Options include: "OPEN", "LIVE", "PENDING", "CANCELED", "CLOSED", "SETTLED"
- gameIds: array. An array of Game IDs
- sortOrder: string. Options are: desc and asc. Games will be returned sorted by predictions cutoff. So for example when asc value is provided the games will be sorted by earliest predictions cutoff time. By default is desc (latest predictions cutoff time).
sdk.matchQuiz.getGames({}).then((responseObject) => {
// do something with responseObject
});
Example result
{
meta: {
pagination: {
nextPageStartsAfter: "3xtM4jU7jaXe82KnxrTKaJ",
itemsPerPage: 20
}
},
data: [
{
id: "3xtM4jU7jaXe82KnxrTKaJ",
title: "Match Quiz: Chelsea vs Wolves",
description: "Guess the 6 markets in the match. This game is with demo purposes only. No rewards will be available at the end.",
type: "MATCH_QUIZ",
status: "OPEN",
predictionsCutoff: "2022-05-01T08:15:30Z",
scheduleOpenAt: "2022-05-01T07:00:30Z",
fixtures: [
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "HT_1X2",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "CORRECT_SCORE",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "PLAYER_SCORE_FIRST_GOAL",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "CORNERS_MATCH",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "PENALTY_MATCH",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "RED_CARD_MATCH",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
}
],
participantsCount: 663,
rules: 'Rules for participating in the game.',
flags: ['This', 'is', 'string', 'array'],
excludedProfileIds: ["profile-id-1", "profile-id-2"],
related: [
{
entityId: "game-id",
entityType: "game"
}
],
labels: {
label: "label"
},
customFields: {
custom: "fields"
},
images: null,
createdAt: "2022-02-18T11:22:12Z",
updatedAt: "2022-02-18T11:22:12Z"
}
]
}
Get game by ID
Method: getGameById(gameId, disableCache?)
Returns a particular Match Quiz game instance.
If no value is passed to disableCache (undefined) it will be set to false.
sdk.matchQuiz.getGameById('game-instance-id').then((responseObject) => {
// do something with responseObject
});
Example result
{
id: "3xtM4jU7jaXe82KnxrTKaJ",
title: "Match Quiz: Chelsea vs Wolves",
description: "Guess the 6 markets in the match. This game is with demo purposes only. No rewards will be available at the end.",
type: "MATCH_QUIZ",
status: "OPEN",
predictionsCutoff: "2022-05-01T08:15:30Z",
fixtures: [
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "HT_1X2",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "CORRECT_SCORE",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "PLAYER_SCORE_FIRST_GOAL",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "CORNERS_MATCH",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "PENALTY_MATCH",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
},
{
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
market: "RED_CARD_MATCH",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
}
}
],
participantsCount: 123,
rules: 'Rules for participating in the game.',
flags: ['This', 'is', 'string', 'array'],
excludedProfileIds: ["profile-id-1", "profile-id-2"],
related: [
{
entityId: "game-id",
entityType: "game"
}
],
adContent: "<p>Ad content</p>",
labels: {
new: "new",
label_: "label_",
field3: "new label 3"
},
customFields: {
new: "new",
custom_: "custom_",
field3: "new custom field 3"
},
createdAt: "2022-02-18T11:22:12Z",
updatedAt: "2022-02-18T11:22:12Z"
}
Get game predictions
Method: getGamePredictions(gameId, filters?, disableCache?)
Returns predictions for particular Match Quiz game.
If no value is passed to disableCache (undefined) it will be set to false.
Filters object:
- limit: number. The number of predictions to be returned.
- startAfter: string. The ID after which the predictions should be listed. To be used in the context of infinite scroll/pagination.
sdk.matchQuiz.getGamePredictions('game-instance-id').then((responseObject) => {
// do something with responseObject
});
Example result
{
meta: {
pagination: {
nextPageStartsAfter:
"ygLWDk3V7kYeC7drW9bzD6dMkWZ2_g_3jWDkLOHhKtWAakeEfjZ1A",
itemsPerPage: 20,
},
},
data: [
{
id: "ygLWDk3V7kYeC7drW9bzD6dMkWZ2_g_3jWDkLOHhKtWAakeEfjZ1A",
gameInstanceId: "3jWDkLOHhKtWAakeEfjZ1A",
gameType: "MATCH_QUIZ",
wager: null,
totalFixtures: 1,
settledFixtures: 0,
userId: "ygLWDk3V7kYeC7drW9bzD6dMkWZ2",
fixtures: [
{
market: "FT_1X2",
matchId: "fb:m:842091979",
matchType: "FOOTBALL",
matchModel: MatchBasicModel,
prediction: {
value: "1",
playerId: null,
playerModel: null,
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
},
},
]
status: "ACTIVE",
tiebreaker: null,
points: 0,
createdAt: "2022-02-16T10:38:37Z",
updatedAt: "2022-02-16T10:38:37Z",
]
}
Get game results
Method: getGameResults(gameId, filters?, disableCache?)
Returns the leaderboard for a specific game. Has pagination.
If no value is passed to disableCache (undefined) it will be set to false.
Filters object:
- limit: number. The number of games to be returned.
- startAfter: string. The ID after which the results should be listed. To be used in the context of infinite scroll/pagination.
- status: string. Options include: "OPEN", "LIVE", "PENDING", "CANCELED", "CLOSED", "SETTLED"
sdk.matchQuiz.getGameResults('game-instance-id').then((responseObject) => {
// do something with responseObject
});
Example result
{
meta: {
pagination: {
nextPageStartsAfter: "user-id",
itemsPerPage: 20
}
},
data: [
{
userId: "user-id",
points: 10,
results: [
{
matchId: "matchId",
outcome: "outcome"
}
]
tiebreaker: {
goldenGoal: 30
}
]
}
Get markets results for specific game
Method: getMarketsResultsForGame(gameId, disableCache?)
Returns the market correct results for provided game id.
If no value is passed to disableCache (undefined) it will be set to false.
Example call
sdk.topX.getMarketsResultsForGame('game-id').then((responseObject) => {
// do something with responseObject
});
Example result
{
gameId: "game-id"
results: [
{
matchId: "32152513",
market: "FT_1X2",
result: "1",
matchModel: MatchBasicModel,
matchStatus: {
type: "finished",
subType: "finished
}
},
{
matchId: "32152513",
market: "CORRECT_SCORE",
result: "2:1",
matchModel: MatchBasicModel,
matchStatus: {
type: "finished",
subType: "finished
}
},
{
matchId: "32152513",
market: "BOTH_TEAMS_SCORE",
result: true,
matchModel: MatchBasicModel,
matchStatus: {
type: "finished",
subType: "finished
}
},
{
matchId: "32152513",
market: "PLAYER_SCORE",
result: ["player-id-1", "player-id-2", "player-id-3"],
matchModel: MatchBasicModel,
playerModels: PlayerMarketResultModel[],
matchStatus: {
type: "finished",
subType: "finished
}
},
],
tiebreakers: null
}
Get current game results
Method: getCurrentGameResults(disableCache?)
Alias of getGameResults but returns the active game results. Has pagination.
If no value is passed to disableCache (undefined) it will be set to false.
sdk.matchQuiz.getCurrentGameResults().then((responseObject) => {
// do something with responseObject
});
Example result
// See response for getGameResults(gameId)
Get game winners
Method: getGameWinners(gameId)
Method returns winners for the specific game.
sdk.matchQuiz.getGameWinners("gameId").then((responseObject) => {
// do something with responseObject
});
Example result
{
contestId: "gameId",
contestType: "GAME",
contestModel: GamesListModel
description: "description",
userList: [
{
position: "winner",
profileId: "profileId",
profileModel: ProfileModel,
note: "Winner note",
tags: [
"big_prizezzzzz",
"winner"
]
}
]
}
User related operations
The following methods are relating to the user and their interaction with the game instances.
Get user's own game participations
Method: getMyGameEditions(filters?, disableCache?)
Returns a list of Match Quiz editions I have participated in.
If no value is passed to disableCache (undefined) it will be set to false.
Filters object:
- limit: number. The number of games to be returned.
- startAfter: string. The ID after which the games should be listed. To be used in the context of infinite scroll/pagination.
- status: string. Options include: "OPEN", "LIVE", "PENDING", "CANCELED", "CLOSED", "SETTLED"
- gameIds: array. An array of Game IDs
sdk.matchQuiz.getMyGameEditions().then((responseObject) => {
// do something with responseObject
});
Example result
{
meta: {
pagination: {
nextPageStartsAfter: "prediction-id-example_g_2fVRGja1B3O0HSo0xc9Z1k,
itemsPerPage: 1
}
},
data: [
{
id: "2fVRGja1B3O0HSo0xc9Z1k",
title: "Title Example",
description: "Description Example",
type: "MATCH_QUIZ",
status: "SETTLED",
outcome: "WON",
predictionsCutoff: "2022-08-14T15:15:00Z",
scheduleOpenAt: "2022-08-13T15:15:00Z",
fixtures: [
{
matchId: "fb:m:46912",
matchType: "FOOTBALL",
market: "OVER_GOALS_2_5",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
},
prediction: {
value: true,
target: null,
playerId: null,
playerModel: null,
result: {
settledAt: "2022-08-15T12:24:01Z",
resettledAt: null,
status: "SETTLED",
outcome: "CORRECT",
points: 10
}
}
}
],
predictionId: "prediction-id-example",
participantsCount: 222,
tiebreaker: {
timeTiebreaker: true
},
rules: "Some custom rules",
flags: ["Some", "custom", "flags"],
excludedProfileIds: ["profile-id-1", "profile-id-2"],
related: [
{
entityId: "game-id",
entityType: "game"
}
],
points: 10,
createdAt: "2022-08-08T15:17:51Z",
updatedAt: "2022-08-15T12:24:11Z",
predictionsMadeAt: "2022-08-12T11:35:00Z",
images: {
main: null,
cover: null,
mobile: null
}
}
]
}
Get user's own predictions for a game
Method: getMyGamePrediction(gameId)
Returns my own predictions for a specific Match Quiz instance.
sdk.matchQuiz.getMyGamePrediction('game-instance-id').then((responseObject) => {
// do something with responseObject
});
Example result
{
id: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2_g_3xtM4jU7jaXe82KnxrTKaJ",
gameInstanceId: "3xtM4jU7jaXe82KnxrTKaJ",
gameType: "MATCH_QUIZ",
wager: null,
totalFixtures: 6,
settledFixtures: 0,
userId: "GSGUDDW5xVNSo7I0ujVbsNBoeMz2",
fixtures: [
{
market: "HT_1X2",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: {},
prediction: {
value: "1",
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "CORRECT_SCORE",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: {},
prediction: {
value: "3:1",
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "PLAYER_SCORE_FIRST_GOAL",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: {},
prediction: {
value: true,
playerId: "fb:p:41754",
playerModel: {}
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "CORNERS_MATCH",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: {},
prediction: {
value: 11,
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "RED_CARD_MATCH",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: {},
prediction: {
value: false,
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
},
{
market: "PENALTY_MATCH",
matchId: "fb:m:425669548",
matchType: "FOOTBALL",
matchModel: {},
prediction: {
value: true,
playerId: null,
playerModel: null
},
result: {
settledAt: null,
resettledAt: null,
status: "NOT_SETTLED",
outcome: "NOT_VERIFIED",
points: 0
}
}
],
status: "ACTIVE",
tiebreaker: null,
points: 0,
createdAt: "2022-03-04T08:20:09Z",
updatedAt: "2022-03-04T08:20:09Z"
}
Get user's predictions for a game
Method: getUserGamePrediction(userId, gameId, disableCache?)
Returns user’s predictions for a specific Match Quiz instance.
If no value is passed to disableCache (undefined) it will be set to false.
sdk.matchQuiz.getMyGamePrediction('user-id', 'game-instance-id').then((responseObject) => {
// do something with responseObject
});
Example result
// See result for getMyGamePrediction(gameId)
Get user's game participations
Method: getUserGameEditions(userId, filters?, disableCache?)
Returns the edition the user has participated in.
If no value is passed to disableCache (undefined) it will be set to false.
sdk.matchQuiz.getUserGameEditions('user-id').then((responseObject) => {
// do something with responseObject
});
Example result
{
meta: {
pagination: {
nextPageStartsAfter: "prediction-id-example_g_2fVRGja1B3O0HSo0xc9Z1k",
itemsPerPage: 1
}
},
data: [
{
id: "2fVRGja1B3O0HSo0xc9Z1k",
title: "Title Example",
description: "Description Example",
type: "MATCH_QUIZ",
status: "SETTLED",
outcome: "WON",
predictionsCutoff: "2022-08-14T15:15:00Z",
scheduleOpenAt: "2022-08-13T15:15:00Z",
fixtures: [
{
matchId: "fb:m:46912",
matchType: "FOOTBALL",
market: "OVER_GOALS",
matchModel: MatchBasicModel,
matchStatus: {
type: "notstarted",
subType: "not_started"
},
prediction: {
value: true,
target: 2.5,
playerId: null,
playerModel: null,
result: {
settledAt: "2022-08-15T12:24:01Z",
resettledAt: null,
status: "SETTLED",
outcome: "CORRECT",
points: 10
}
}
}
],
tiebreaker: {
timeTiebreaker: false
},
predictionId: "prediction-id-example",
participantsCount: 123,
rules: "Some custom rules",
flags: ["Some", "custom", "flags"],
excludedProfileIds: ["profile-id-1", "profile-id-2"],
points: 10,
images: {
main: "https://bla.bla/bla.jpg",
cover: "https://bla.bla/bla.jpg",
mobile: "https://bla.bla/bla.jpg"
},
related: [
{
entityId: "game-id",
entityType: "game"
}
],
predictionTiebreaker: {
goldenGoal: 10
},
createdAt: "2022-08-08T15:17:51Z",
updatedAt: "2022-08-15T12:24:11Z",
predictionsMadeAt: "2022-08-13T19:45:00Z"
}
]
}
Helpers operations
The helpers operations are designed to provide streamlined, efficient methods to facilitate common UI integrations. These helpers simplify the process of building and managing features by offering reusable utilities for specific tasks. All operations are synchronous.
Below is an example usage and the methods included:
Find last game
Method: findLastGame(games)
Identifies the last game from the provided games list.
N.B The games parameter is required and it needs to be GamesListModel (returned from getGames) or MatchQuizListModel (returned from getMyGameEditions or getUserGameEditions).
Example call:
const gamesListModel: GamesListModel[];
// Returns GameListModel with the last game from the provided games
// Returns null when no SETTLED game was found
const lastGame = sdk.matchQuiz.helpers.findLastGame(gamesListModel);
Find current game
Method: findCurrentGame(games)
Identifies the current game from the provided games list.
N.B The games parameter is required and it needs to be GamesListModel (returned from getGames) or MatchQuizListModel (returned from getMyGameEditions or getUserGameEditions).
Example call:
const gamesListModel: MatchQuizListModel[];
// Returns GameListModel with the last game from the provided games
// Returns null when no SETTLED game was found
const currentGame = sdk.matchQuiz.helpers.findCurrentGame(gamesListModel);
Find next game
Method: findNextGame(games)
Identifies the next game from the provided games list.
N.B The games parameter is required and it needs to be GamesListModel (returned from getGames) or MatchQuizListModel (returned from getMyGameEditions or getUserGameEditions).
Example call:
const gamesListModel: MatchQuizListModel[];
// Returns GameListModel with the last game from the provided games
// Returns null when no SETTLED game was found
const nextGame = sdk.matchQuiz.helpers.findNextGame(gamesListModel);
Other operations
Get config
Method: getConfig()
Returns the configuration for the Match Quiz feature. Match Quiz games can be created only with matches who are part of competitions who are listed in competitionsWhitelist.
The config will be cached in LocalStorage for 4 hours.
sdk.matchQuiz.getConfig().then((responseObject) => {
// do something with responseObject
});
Example result
{
enabled: true,
defaultMarkets: [
"CORRECT_SCORE",
"HT_1X2",
"PLAYER_SCORE_FIRST_GOAL",
"CORNERS_MATCH",
"PENALTY_MATCH",
"RED_CARD_MATCH",
"FT_1X2"
],
competitionsWhitelist: [
"fb:c:1",
"fb:c:11",
"fb:c:119",
"fb:c:12",
"fb:c:13",
"fb:c:14",
"fb:c:15",
"fb:c:16",
"fb:c:17",
"fb:c:18",
"fb:c:19",
"fb:c:20",
"fb:c:21",
"fb:c:22",
"fb:c:27",
"fb:c:28",
"fb:c:3",
"fb:c:30",
"fb:c:34",
"fb:c:37",
"fb:c:4",
"fb:c:5",
"fb:c:6",
"fb:c:7",
"fb:c:9",
"fb:c:8"
]
}
Updated 23 days ago