Predictor Operations
The Predictor namespace provides comprehensive functionality for managing sports predictions through the sdk.predictor()
. Below is the detailed documentation of available operations.
Core Methods
Prediction Operations
Create Prediction
suspend fun makeFootballPrediction(
matchId: String,
market: Market,
value: Any,
playerId: String? = null
): PredictionResponseModel?
Creates a new football prediction with:
- Match identifier
- Market type (FT_1X2, HT_1X2, CORRECT_SCORE, etc.)
- Prediction value based on market type
- Optional player ID for player-specific markets
Delete Prediction
suspend fun deleteFootballPrediction(predictionId: String): Boolean
Removes an existing prediction.
Prediction Retrieval
Own Predictions
// Get all predictions
suspend fun getMyPredictions(
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
// Get active predictions
suspend fun getMyCurrentPredictions(
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
// Get past predictions
suspend fun getMyPastPredictions(
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
PredictionsFilters
Query Model
PredictionsFilters
Query ModelA class used to filter predictions in game-related queries.
Properties
-
limit:
Int?
- Maximum number of results to return
-
startAfter:
String?
- Pagination cursor for results
-
status:
List<PredictionStatus>?
- List of prediction statuses to filter by
-
type:
GameType?
- Type of game to filter predictions
-
matchIds:
List<String>?
- Filter by specific match identifiers
-
gameIds:
List<String>?
- Filter by specific game identifiers
User Predictions
// Get user's predictions
suspend fun getUserPredictions(
userId: String,
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
// Get user's active predictions
suspend fun getUserCurrentPredictions(
userId: String,
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
// Get user's past predictions
suspend fun getUserPastPredictions(
userId: String,
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
Match Operations
Match Summary
suspend fun getMatchSummary(
matchId: String,
disableCache: Boolean? = null
): MatchSummaryModel?
Retrieves prediction summary for a match.
Market Summary
suspend fun getMarketSummary(
matchId: String,
market: Market,
playerId: String? = null,
disableCache: Boolean? = null
): MarketSummary?
Gets summary for specific market in a match.
Market Results
// Get match market results
suspend fun getMatchMarketsResults(matchId: String): MatchMarketsResults?
// Get game market results
suspend fun getMarketsResultsForGame(
gameId: String,
disableCache: Boolean? = null
): CursorResponse<GameMatchOutcome>?
Specific Prediction Queries
By IDs
// Get single prediction
suspend fun getPredictionById(predictionId: String): PredictionResponseModel?
// Get multiple predictions
suspend fun getPredictionsByIds(
predictionIds: List<String>
): CursorResponse<List<PredictionResponseModel>>
By Matches
// Get own predictions for matches
suspend fun getMyPredictionsForMatches(
matchIds: List<String>,
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
// Get user predictions for matches
suspend fun getUserPredictionsForMatches(
userId: String,
matchIds: List<String>,
filters: PredictionsFilters? = null,
disableCache: Boolean? = null
): CursorResponse<List<PredictionResponseModel>>?
Example Usage
// Create prediction
val prediction = sdk.predictor().makeFootballPrediction(
matchId = "match:123",
market = Market.FT_1X2,
value = Value1X2.HOME
)
// Get match summary
val summary = sdk.predictor().getMatchSummary("match:123")
// Get own predictions
val myPredictions = sdk.predictor().getMyCurrentPredictions(
filters = PredictionsFilters(
limit = 10,
status = PredictionStatus.ACTIVE
)
)
// Delete prediction
val deleted = sdk.predictor().deleteFootballPrediction("pred:456")
Configuration
suspend fun getConfig(): PredictorConfig?
Retrieves current predictor system configuration.
Helper Functions
suspend fun helpers(): IPredictorHelpers
Provides access to prediction helper utilities.
Calculate 1X2 from Scores
suspend fun calculateOneXTwoFromScores(
matchSummary: MatchSummaryModel
): CalculatedOneXTwoFromScores
Calculates 1X2 (Home/Draw/Away) prediction results based on match summary data:
- Takes
MatchSummaryModel
containing prediction statistics - Returns
CalculatedOneXTwoFromScores
with calculated percentages for each outcome
Top Correct Scores
suspend fun getTopCorrectScores(
matchSummary: MatchSummaryModel
): List<TopCorrectScores>
Analyzes match predictions to find most popular correct score predictions:
- Takes
MatchSummaryModel
with prediction data - Returns list of top 3 predicted scores sorted by percentage
- Each
TopCorrectScores
contains the score and its prediction percentage
Example Usage
// Get predictor helpers
val helpers = sdk.predictor().helpers()
// Calculate 1X2 percentages
val oneXTwo = helpers.calculateOneXTwoFromScores(matchSummary)
println("Home win: ${oneXTwo.home}%")
println("Draw: ${oneXTwo.draw}%")
println("Away win: ${oneXTwo.away}%")
// Get top predicted scores
val topScores = helpers.getTopCorrectScores(matchSummary)
topScores.forEach { score ->
println("Score ${score.score}: ${score.percentage}%")
}
Note: All predictor operations are suspending functions and must be called from a coroutine scope.
Updated 3 days ago