const player = await apiClient.initializeNewPlayer({
gameApiKey: process.env.GAMEON_KEY, // Your Public API Key you receive when you register your game with GameOn.
appBuildType: 'development' // GameOn API requires either 'development' or 'release', but it's only used for their metrics.
});
let tournament = await apiClient.getTournamentsByTitle("Weekly Tournament", player)
tournament = tournament[0];
Enter the player into a tournament
const {matchId} = await apiClient.enterTournamentForPlayer({
tournamentId: tournament.tournamentId,
player: player
});
Submit a score
let {matches} = await apiClient.getMatchListForPlayer({
player,
tournament: tournament.tournamentId,
filter: "live"
});
// await apiClient.enterMatchForPlayer({
// matchId: matches[0].matchId, // The Match Id that is associated with your tournament.
// player: player
// });
let result = await apiClient.submitScoreForPlayer({
matchId: matches[0].matchId,
submitScoreRequest: { score: 8, stats: [{name: "Reshoots", value: 1}] },
player: player,
ensureMatchEntered: true
});
Get leaderboard standings
const leaderboard = await apiClient.getMatchLeaderboardForPlayer({
matchId: matches[0].matchId,
player: player
});