Predictor Operations
Core Data Models
Prediction Model (PredictionResponseModel
)
PredictionResponseModel
)prediction.id: String // Unique prediction identifier
prediction.matchId: String // Associated match ID
prediction.market: Market // Prediction market
prediction.value: Any // Prediction value
prediction.status: PredictionStatus? // Prediction status
prediction.points: Int32? // Points earned
prediction.createdAt: Kotlinx_datetimeInstant? // Creation timestamp
Market Model (Market
)
Market
)market.id: String // Market identifier
market.name: String // Market name
market.type: String // Market type
Predictor Operations
Make Football Prediction
do {
let prediction = try await sdk.predictor().makeFootballPrediction(
matchId: "fb:m:123",
market: Market(id: "1x2", name: "Match Result", type: "1x2"),
value: "1", // Home win
playerId: nil
)
print("Prediction made: \(prediction.id)")
} catch {
print("Error making prediction: \(error)")
}
Get My Predictions
do {
let filters = PredictionsFilters(
limit: 20,
startAfter: nil,
status: nil,
type: nil,
matchIds: nil,
gameIds: nil
)
let predictions = try await sdk.predictor().getMyPredictions(filters: filters, disableCache: false)
if let predictionArray = predictions.data {
print("Found \(predictionArray.count) predictions")
}
} catch {
print("Error fetching predictions: \(error)")
}
Get Predictions for Specific Matches
do {
let matchIds = ["match1", "match2", "match3"]
let predictions = try await sdk.predictor().getMyPredictionsForMatches(
matchIds: matchIds,
filters: nil,
disableCache: false
)
print("Predictions for matches: \(predictions.data?.count ?? 0)")
} catch {
print("Error fetching match predictions: \(error)")
}
Delete Prediction
do {
let success = try await sdk.predictor().deleteFootballPrediction(predictionId: "prediction123")
print("Prediction deleted: \(success)")
} catch {
print("Error deleting prediction: \(error)")
}
Get Predictor Configuration
do {
let config = try await sdk.predictor().getConfig(disableCache: false)
print("Predictor config loaded")
} catch {
print("Error fetching predictor config: \(error)")
}
Get My Current Predictions
do {
let filters = PredictionsFilters(
limit: 20,
startAfter: nil,
status: [PredictionStatus.pending],
type: nil,
matchIds: nil,
gameIds: nil
)
let predictions = try await sdk.predictor().getMyCurrentPredictions(filters: filters, disableCache: false)
print("Current predictions: \(predictions.data?.count ?? 0)")
} catch {
print("Error fetching current predictions: \(error)")
}
Get My Past Predictions
do {
let filters = PredictionsFilters(
limit: 20,
startAfter: nil,
status: [PredictionStatus.settled],
type: nil,
matchIds: nil,
gameIds: nil
)
let predictions = try await sdk.predictor().getMyPastPredictions(filters: filters, disableCache: false)
print("Past predictions: \(predictions.data?.count ?? 0)")
} catch {
print("Error fetching past predictions: \(error)")
}
Get Prediction by ID
do {
let prediction = try await sdk.predictor().getPredictionById(predictionId: "prediction123")
print("Prediction: \(prediction.market.name) - \(prediction.value)")
} catch {
print("Error fetching prediction: \(error)")
}
Get Predictions by IDs
do {
let predictionIds = ["pred1", "pred2", "pred3"]
let predictions = try await sdk.predictor().getPredictionsByIds(predictionIds: predictionIds)
if let predictionArray = predictions?.data {
print("Found \(predictionArray.count) predictions")
}
} catch {
print("Error fetching predictions: \(error)")
}
Get User Predictions
do {
let filters = PredictionsFilters(
limit: 20,
startAfter: nil,
status: nil,
type: nil,
matchIds: nil,
gameIds: nil
)
let predictions = try await sdk.predictor().getUserPredictions(
userId: "user123",
filters: filters,
disableCache: false
)
print("User predictions: \(predictions.data?.count ?? 0)")
} catch {
print("Error fetching user predictions: \(error)")
}
Get User Current Predictions
do {
let predictions = try await sdk.predictor().getUserCurrentPredictions(
userId: "user123",
filters: nil,
disableCache: false
)
print("User current predictions: \(predictions.data?.count ?? 0)")
} catch {
print("Error fetching user current predictions: \(error)")
}
Get User Past Predictions
do {
let predictions = try await sdk.predictor().getUserPastPredictions(
userId: "user123",
filters: nil,
disableCache: false
)
print("User past predictions: \(predictions.data?.count ?? 0)")
} catch {
print("Error fetching user past predictions: \(error)")
}
Get User Predictions for Matches
do {
let matchIds = ["match1", "match2", "match3"]
let predictions = try await sdk.predictor().getUserPredictionsForMatches(
userId: "user123",
matchIds: matchIds,
filters: nil,
disableCache: false
)
print("User match predictions: \(predictions.data?.count ?? 0)")
} catch {
print("Error fetching user match predictions: \(error)")
}
Get Match Summary
do {
let summary = try await sdk.predictor().getMatchSummary(matchId: "fb:m:123", disableCache: false)
print("Match summary: \(summary.totalPredictions) total predictions")
} catch {
print("Error fetching match summary: \(error)")
}
Get Market Summary
do {
let market = Market(id: "1x2", name: "Match Result", type: "1x2")
let summary = try await sdk.predictor().getMarketSummary(
matchId: "fb:m:123",
market: market,
playerId: nil,
disableCache: false
)
print("Market summary loaded")
} catch {
print("Error fetching market summary: \(error)")
}
Get Match Markets Results
do {
let results = try await sdk.predictor().getMatchMarketsResults(matchId: "fb:m:123")
print("Match markets results loaded")
} catch {
print("Error fetching match markets results: \(error)")
}
Match Quiz Operations
Core Data Models
Match Quiz Game Model (GameMatchQuizListModel
)
GameMatchQuizListModel
)game.id: String // Game identifier
game.name: String // Game name
game.status: GameStatus? // Game status
game.startDate: Kotlinx_datetimeInstant? // Game start date
game.endDate: Kotlinx_datetimeInstant? // Game end date
game.fixtures: [FixturesMatchQuizModel]? // Game fixtures
Match Quiz Request Model (MatchQuizRequestModel
)
MatchQuizRequestModel
)request.gameId: String // Game identifier
request.predictions: [Any] // Quiz predictions
Match Quiz Operations
Get My Game Editions
do {
let filters = MainCursorFilters(
limit: 20,
startAfter: nil
)
let games = try await sdk.matchQuiz().getMyGameEditions(filters: filters, disableCache: false)
if let gameArray = games.data {
print("Found \(gameArray.count) match quiz games")
}
} catch {
print("Error fetching match quiz games: \(error)")
}
Get User Game Editions
do {
let games = try await sdk.matchQuiz().getUserGameEditions(
userId: "user123",
filters: nil,
disableCache: false
)
print("User's match quiz games: \(games.data?.count ?? 0)")
} catch {
print("Error fetching user's match quiz games: \(error)")
}
Play Match Quiz
do {
let request = MatchQuizRequestModel(
gameId: "game123",
predictions: [/* quiz answers */]
)
let response = try await sdk.matchQuiz().play(request: request)
print("Match quiz played: \(response.id)")
} catch {
print("Error playing match quiz: \(error)")
}
Updated about 22 hours ago