Standing Game operations
Get the configuration for all platform interactions
Standing Game operations are responsible for communicating with Prediction API and specially with custom standing game functionalities.
The namespace is of course called standingGame. All methods return promises. The general design of the namespace follows this pattern unless stated otherwise:
General call:
sdk.standingGame .someMethod() .then((response) => { // Handle response }) .catch((error) => { // Handle error });
The responses are comprised of different objects you can find here.
Game related operations
Get standing games
Method: getGames(filters?, disableCache?)
Model:
The method returns list of standing games.
No authentication required.
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"
- sortOrder: string. Options are: desc and asc. Games will be returned sorted by created at.
- gameIds: string[]. The IDs of standing games.
The response from API is cached for 10 minutes. With disableCache
argument you can avoid cached response.
Example call:
const filters = { status: GameStatusEnum.PENDING, sortOrder: "asc", limit: 10, startAfter: "gameId" } sdk.standingGame .getGames(filters) .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
meta: {
pagination: {
itemsPerPage: 10,
nextPageStartsAfter: null
}
},
data: [
{
id: "iccchampionstrophy",
title: "ICC Champions Trophy",
description:
"Welcome to the ICC Champions Trophy Bracket game. Predict the outcome of each match and win great prizes.",
rules: "<h2>Rules of the game</h2><p>The rules of the game are...</p>",
customFields: {
field_1: "value_1",
field_2: "value_2",
},
images: {
main: null,
cover: null,
mobile: null,
},
type: "BRACKET",
status: "OPEN",
points: 20,
related: [
{
entityId: "1",
entityType: "classic_quiz",
entityRelationship: "bonusPointsGame",
}
],
predictionsCutoff: "2025-02-19T00:00:00+00:00",
meta: {
participants: [
{
id: "1",
name: "Bangladesh",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Flag_of_Bangladesh.svg/23px-Flag_of_Bangladesh.svg.png",
undecided: false,
},
{
id: "2",
name: "India",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/en/thumb/4/41/Flag_of_India.svg/23px-Flag_of_India.svg.png",
undecided: false,
},
{
id: "3",
name: "New Zealand",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Flag_of_New_Zealand.svg/23px-Flag_of_New_Zealand.svg.png",
undecided: false,
},
{
id: "4",
name: "Pakistan",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/32/Flag_of_Pakistan.svg/23px-Flag_of_Pakistan.svg.png",
undecided: false,
},
{
id: "5",
name: "Afghanistan",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Flag_of_Afghanistan_%282013%E2%80%932021%29.svg/23px-Flag_of_Afghanistan_%282013%E2%80%932021%29.svg.png",
undecided: false,
},
{
id: "6",
name: "Australia",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Flag_of_Australia_%28converted%29.svg/23px-Flag_of_Australia_%28converted%29.svg.png",
undecided: false,
},
{
id: "7",
name: "England",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/en/thumb/b/be/Flag_of_England.svg/23px-Flag_of_England.svg.png",
undecided: false,
},
{
id: "8",
name: "South Africa",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Flag_of_South_Africa.svg/23px-Flag_of_South_Africa.svg.png",
undecided: false,
},
{
id: "9",
name: "A1",
group: null,
image: null,
undecided: true,
},
{
id: "10",
name: "A2",
group: null,
image: null,
undecided: true,
},
{
id: "11",
name: "B1",
group: null,
image: null,
undecided: true,
},
{
id: "12",
name: "B2",
group: null,
image: null,
undecided: true,
},
{
id: "13",
name: "SF1W",
group: null,
image: null,
undecided: true,
},
{
id: "14",
name: "SF2W",
group: null,
image: null,
undecided: true,
},
],
},
outcome: ["1", "2", "3", "4"],
outcomeCount: 2
}
]
}
Get bracket game by ID
Method: getGameById(gameId, disableCache?)
Model:
The method returns the Standing Game information.
No authentication required.
The response from API is cached for 10 minutes. With disableCache
argument you can avoid cached response.
Example call:
sdk.standingGame .getGameById("gameId") .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: "iccchampionstrophy",
title: "ICC Champions Trophy",
description:
"Welcome to the ICC Champions Trophy Bracket game. Predict the outcome of each match and win great prizes.",
rules: "<h2>Rules of the game</h2><p>The rules of the game are...</p>",
customFields: {
field_1: "value_1",
field_2: "value_2",
},
images: {
main: null,
cover: null,
mobile: null,
},
type: "BRACKET",
status: "OPEN",
points: 20,
related: [
{
entityId: "1",
entityType: "classic_quiz",
entityRelationship: "bonusPointsGame",
}
],
predictionsCutoff: "2025-02-19T00:00:00+00:00",
meta: {
participants: [
{
id: "1",
name: "Bangladesh",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Flag_of_Bangladesh.svg/23px-Flag_of_Bangladesh.svg.png",
undecided: false,
},
{
id: "2",
name: "India",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/en/thumb/4/41/Flag_of_India.svg/23px-Flag_of_India.svg.png",
undecided: false,
},
{
id: "3",
name: "New Zealand",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Flag_of_New_Zealand.svg/23px-Flag_of_New_Zealand.svg.png",
undecided: false,
},
{
id: "4",
name: "Pakistan",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/32/Flag_of_Pakistan.svg/23px-Flag_of_Pakistan.svg.png",
undecided: false,
},
{
id: "5",
name: "Afghanistan",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Flag_of_Afghanistan_%282013%E2%80%932021%29.svg/23px-Flag_of_Afghanistan_%282013%E2%80%932021%29.svg.png",
undecided: false,
},
{
id: "6",
name: "Australia",
group: "A",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Flag_of_Australia_%28converted%29.svg/23px-Flag_of_Australia_%28converted%29.svg.png",
undecided: false,
},
{
id: "7",
name: "England",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/en/thumb/b/be/Flag_of_England.svg/23px-Flag_of_England.svg.png",
undecided: false,
},
{
id: "8",
name: "South Africa",
group: "B",
image:
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Flag_of_South_Africa.svg/23px-Flag_of_South_Africa.svg.png",
undecided: false,
},
{
id: "9",
name: "A1",
group: null,
image: null,
undecided: true,
},
{
id: "10",
name: "A2",
group: null,
image: null,
undecided: true,
},
{
id: "11",
name: "B1",
group: null,
image: null,
undecided: true,
},
{
id: "12",
name: "B2",
group: null,
image: null,
undecided: true,
},
{
id: "13",
name: "SF1W",
group: null,
image: null,
undecided: true,
},
{
id: "14",
name: "SF2W",
group: null,
image: null,
undecided: true,
},
],
},
outcome: ["1", "2", "3", "4"],
outcomeCount: 2
}
Get rankings for a standing game
Method: getRankings(gameId, filters?, disableCache?)
Models:
The method returns leaderboard for specific game.
No authentication required.
The response from API is cached for 10 minutes. With disableCache
argument you can avoid cached response.
Example call:
const filters = { limit: 10, startAfter: "id" }; sdk.standingGame .getRankings("gameId", filters) .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
meta: {
pagination: {
itemsPerPage: 1,
nextPageStartsAfter: null
}
},
data: [
{
id: "profileId_g_gameId",
profileId: "profileId",
profileModel: ProfileModel,
totalPoints: 100,
gamePoints: 80,
bonusPoints: 20,
position: 1,
status: "ACTIVE",
gameId: "gameId",
total: 4,
standing: ["1", "3", "4", "2"],
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
]
}
User related operations
Make prediction for a Standing Game
Method: makePrediction(gameId, prediction)
Models:
The method creates user prediction for the game.
Authentication required.
Example call:
const prediction = ["1", "3", "4", "2"]; sdk.standingGame .makePrediction("gameId", prediction) .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: "profileId_g_gameId",
profileId: "profileId",
profileModel: null,
totalPoints: null,
gamePoints: null,
bonusPoints: null,
position: null,
status: "ACTIVE",
gameId: "gameId",
total: 4,
standing: ["1", "3", "4", "2"],
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
Update prediction for a Standing Game
Method: updatePrediction(gameId, predictionId, prediction)
Models:
The method updates user prediction for the game.
Authentication required.
Example call:
const prediction = ["1", "3", "4", "2"]; sdk.standingGame .updatePrediction("gameId", "profileId_g_gameId", prediction) .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
id: "profileId_g_gameId",
profileId: "profileId",
profileModel: null,
totalPoints: null,
gamePoints: null,
bonusPoints: null,
position: null,
status: "ACTIVE",
gameId: "gameId",
total: 4,
standing: ["1", "3", "4", "2"],
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
Get standing game predictions for user
Method: getGamePredictionsForUser(gameId, profileId, disableCache?)
Models:
The method returns all predictions for specific game for specific user.
No authentication required.
Example call:
sdk.standingGame .getGamePredictionsForUser("gameId", "profileId") .then((response) => { // Handle response }) .catch((error) => { // Handle error });
Example result
{
meta: {
pagination: {
itemsPerPage: 1,
nextPageStartsAfter: "profileId_g_gameId"
}
},
data: [
{
id: "profileId_g_gameId",
profileId: "profileId",
totalPoints: null,
gamePoints: null,
bonusPoints: null,
position: null,
status: "ACTIVE",
gameId: "gameId",
standing: ["1", "3", "4", "2"],
total: 4,
createdAt: "2025-01-08T15:02:15Z",
updatedAt: "2025-01-08T15:02:15Z"
}
]
}
Updated 3 days ago