MatchQuiz operations
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 general design of the namespace follows this pattern:
val response = sdk.matchQuiz().someMethod(...)
// do something with response object
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
.
sdk.matchQuiz().play(List<PredictionFixture>, gameInstanceId, Tiebreaker)
Delete game participations
Method: delete(predictionId)
Deletes the user's participation (all game predictions) in a specific game.
sdk.matchQuiz().delete('GSGUDDW5xVNSo7I0ujVbsNBoeMz2_g_3xtM4jU7jaXe82KnxrTKaJ')
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({})
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')
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: Int?. 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')
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')
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()
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()
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')
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().getUserGamePrediction('user-id', 'game-instance-id')
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')
Updated about 1 year ago