Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

GameOn Experiments

node v10.24.1
version: 1.0.0
endpointsharetweet
# References - https://developer.amazon.com/blogs/alexa/post/671de3de-0635-4626-9371-e926d7d655d6/skills-gameon-sdk - https://skills-gameon-sdk.github.io/
const sdk = require("@alexa-games/skills-gameon-sdk"); const apiClient = new sdk.SkillsGameOnApiClient();
console.info(process.env); // const generator = sdk.PlayerProfileGeneratorBuilder.getGenerator({ // locale: "en-US", // avatarBaseUrl: process.env.AVATAR_URL, // numberOfUniqueAvatars: 500 // }); // const uniqueProfile = generator.getPlayerProfileFromId("ddf56dcd-30c5-485f-a656-9cd78e0fad6b"); // console.info(uniqueProfile);
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 });
Loading…

no comments

    sign in to comment