GetPlayerSuperCoachPointsPredictions API¶
Overview¶
The GetPlayerSuperCoachPointsPredictions API returns SuperCoach points predictions for the players in a single match. Predictions are keyed by player and returned as a flat map of player to predicted points.
Query: PlayerSuperCoachPointsPredictionsQuery
Handler: PlayerSuperCoachPointsPredictionsQueryHandler
Response: PlayerSuperCoachPointsPredictionContract
File: src/Integration/LBS.Sport.Integration/Queries/PlayerSuperCoachPointsPredictionsQuery.cs
Endpoint¶
POST /api/readmodel
Authentication¶
This query is secured with [RequiresRoles(RoleDefinition.Member)]. The caller must be authenticated and hold the Member role.
Request Format¶
The query carries a single required field, MatchId. There are no filter, ordering, or pagination inputs.
Query Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
queryType |
string | Yes | Must be "GetPlayerSuperCoachPointsPredictions" |
matchId |
string | Yes | The fixture/match ID to get predictions for |
Response Format¶
The handler returns a single PlayerSuperCoachPointsPredictionContract (DataContract name PlayerSuperCoachPointsPrediction). Its only field, predictions, is a map of player identifier to predicted SuperCoach points.
Response Fields¶
| Field | Type | Description |
|---|---|---|
predictions |
object (map of string to double) | Predicted SuperCoach points keyed by player identifier. Empty if no predictions are available for the match. |
Example Usage¶
curl -X POST "https://api.ballr.live/api/readmodel" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"query": {
"queryType": "GetPlayerSuperCoachPointsPredictions",
"matchId": "match-123"
}
}'
TypeScript SDK¶
The query is exposed from the core module of @luckboxstudios/foundry-sdk.
| Import | Type | Purpose |
|---|---|---|
@luckboxstudios/foundry-sdk |
GetPlayerSuperCoachPointsPredictions |
Query input interface |
@luckboxstudios/foundry-sdk |
PlayerSuperCoachPointsPrediction |
Response interface (predictions: Record<string, number>) |
@luckboxstudios/foundry-sdk/core |
coreQueries.getPlayerSuperCoachPointsPredictions(...) |
Builder function (sets queryType automatically) |
import type {
GetPlayerSuperCoachPointsPredictions,
PlayerSuperCoachPointsPrediction
} from '@luckboxstudios/foundry-sdk';
import { coreQueries } from '@luckboxstudios/foundry-sdk/core';
const query = coreQueries.getPlayerSuperCoachPointsPredictions({
matchId: 'match-123'
});
const response = await client.query<
GetPlayerSuperCoachPointsPredictions,
PlayerSuperCoachPointsPrediction
>(query);
How It Works¶
- The handler validates that
MatchIdis present; if it is missing or blank it returns an empty result. - The fixture mapping (
MappedFixture) is loaded and the suppliedMatchId(matched againstFoxMatchId) is resolved to aFixtureId. - If a
FixtureIdis found, predictions are fetched from the SuperCoach model API (FixturePredictions.GetPlayerSuperCoachPointsPredictions). The model API base URL comes from configuration keyModelling:SupercoachModelApi, defaulting tohttps://api.supercoach.com.au/. - The resulting
Dictionary<string, double>is wrapped in a singlePlayerSuperCoachPointsPredictionContractand returned. If no fixture mapping or predictions are found, an empty result is returned.
Caching¶
The query implements ISecureCacheableQuery, so results are cached automatically by the query infrastructure:
- Cache key:
nrlPredictions_{matchId} - Duration: 1 minute
- Tags:
supercoach,predictions,match-{matchId}
Module¶
The handler requires the SuperCoach module ([RequiresModule(ModuleDefinition.SuperCoach)]).