Predictor operations

Predictor operations are responsible for communicating with the Prediction API.
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.predictor().someMethod(...)
// do something with response object

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

Match related operations

Some match related operations require authentication, some do not. This will be stated in each method.
In addition, some API calls are HTTP cached. This, again, will be state in each method.

Another thing to keep in mind is that not all markets are available for all matches. Depending on the coverage from
the data provider some matches will accept all markets, while the rest will accept only some. You can see the list of full coverage competitions
by calling the method getConfig().

Make football prediction

Method: makeFootballPrediction(matchId, market, value, playerId?)

Makes a prediction for a selected match and market.

Requires authentication. Not cached.

Accepted options:

  • matchId: string. ID of the match.
  • market: string. Options include: "FT_1X2", "HT_1X2", "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", "HT_FT", "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"
  • value: object. the prediction. The value depends on the market. Some markets require booleans, some strings, other numbers. For example when market is "FT_1X2", value can be "1", "x" or "2".

More information about value param can be found here

  • playerId: string. Optional. The ID of the player. Only applicable to the player related markets.

How the method works:

val prediction: Prediction? = sdk.predictor().makeFootballPrediction(PredictionFixture)

Delete football prediction

Method: deleteFootballPrediction("predictionId")

Allows user to delete their own prediction.

Requires authentication. Not cached.

Parameters:

  • predictionId: string. ID of the prediction.
val prediction: Prediction? = sdk.predictor().deleteFootballPrediction('prediction-id')

Get match summary

Method: getMatchSummary(matchId, disableCache?)

Returns the summary of all predictions for all users in all markets.

Cached by API for 1 hour.

Parameters:

  • matchId: string. ID of a football match.
  • disableCache: boolean. Optional. Option to disable cache from API.
val predictionSummary: PredictionSummary? = sdk.predictor().getMatchSummary('fb:m:887608794')

User related operations

Get user's own predictions

Method: getOwnPredictions({})

Gets the currently logged-in user's predictions.

Requires authentication. Not cached.

Options object:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
  • status: string. The status of prediction. Options include: "ACTIVE", "WON", "LOST", "PARTIALLY_WON", "CANCELED".
  • type: string. Type of game for predictions. Options are: "MATCH_QUIZ", "TOP_X" and "SINGLE".

N.B status and type filters can NOT be used together. If they are used together JS SDK will throw an excpetion.

val response = sdk.predictor().getOwnPredictions({})
val list: List<Prediction> = response.data

Get user's own current predictions

Method: getOwnCurrentPredictions(filters?)

Gets the logged-in user's currently active predictions.

Requires authentication. Not cached.

Optional filters options:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
val response = sdk.predictor().getOwnCurrentPredictions(...)
val list: List<Prediction> = response.data

Get user's own past predictions

Method: getMyPastPredictions(filters?)

Gets the logged-in user's past predictions.

Requires authentication. Not cached.

Options filters options:

  • limit: number. Number of records to be returned.
  • startAfter: string. The ID of the prediction you want to start the count after.
val response = sdk.predictor().getOwnPastPredictions(...)
val list: List<Prediction> = response.data

Get user's predictions

Method: getUserPredictions("ID", filters?, disableCache?)

Gets the predictions for a particular user.

  • userId: string. The ID of the user you want to fetch the predictions for
  • filters: object. Optional.
    • limit: number. Number of records to be returned.
    • startAfter: string. The ID of the prediction you want to start the count after.
    • status: string. The status of prediction. Options include: "ACTIVE", "WON", "LOST", "PARTIALLY_WON", "CANCELED".
    • type: string. Type of game for predictions. Options are: "MATCH_QUIZ", "TOP_X" and "SINGLE".
  • disableCache: boolean. Default: false. Disables cached response
val response = sdk.predictor().getUserPredictions('user-id-here', {}, true)
val list: List<Prediction> = response.data

Get user's current predictions

Method: getUserCurrentPredictions("ID", filters)

Gets the current (active/live and future) predictions of a user.

  • userId: string. The ID of the user you want to fetch the predictions for
  • options: object. Optional.
    • limit: number. Number of records to be returned.
    • startAfter: string. The ID of the prediction you want to start the count after.
val response = sdk.predictor().getUserCurrentPredictions('user-id-here', {})
val list: List<Prediction> = response.data

Get user's past predictions

Method: getUserPastPredictions("ID", filters?)

Gets the past predictions for a particular user.

  • userId: string. The ID of the user you want to fetch the predictions for
  • filters: object. Optional.
    • limit: number. Number of records to be returned.
    • startAfter: string. The ID of the prediction you want to start the count after.
val response = sdk.predictor.getUserPastPredictions('user-id-here', {})
val list: List<Prediction> = response.data

Other operations

Get config

Method: getConfig()

Returns the configuration for the Predictor feature. The matches from competitions listed in fullCoverageCompetitions accept all markets.
The matches in all other competitions accept only the main markets.

We recommend calling this method and caching the data locally. Then you can use it to prevent unnecessary requests to the API which will affect your quota.

val config: PredictorConfig? = sdk.predictor().getConfig()