Exemple #1
0
        /// <summary>
        /// Report that a reward for the milestone corresponding to milestoneId for the quest corresponding to questId has been claimed by the currently authorized user.
        /// Documentation https://developers.google.com/games/v1/reference/questMilestones/claim
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Games service.</param>
        /// <param name="questId">The ID of the quest.</param>
        /// <param name="milestoneId">The ID of the milestone.</param>
        /// <param name="requestId">A numeric ID to ensure that the request is handled correctly across retries. Your client application must generate this ID randomly.</param>
        /// <param name="optional">Optional paramaters.</param>
        public static void Claim(GamesService service, string questId, string milestoneId, string requestId, QuestMilestonesClaimOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (questId == null)
                {
                    throw new ArgumentNullException(questId);
                }
                if (milestoneId == null)
                {
                    throw new ArgumentNullException(milestoneId);
                }
                if (requestId == null)
                {
                    throw new ArgumentNullException(requestId);
                }

                // Building the initial request.
                var request = service.QuestMilestones.Claim(questId, milestoneId, requestId);

                // Applying optional parameters to the request.
                request = (QuestMilestonesResource.ClaimRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                request.Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request QuestMilestones.Claim failed.", ex);
            }
        }
        /// <summary>
        /// Lists all the leaderboard metadata for your application.
        /// Documentation https://developers.google.com/games/v1/reference/leaderboards/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Games service.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>LeaderboardListResponseResponse</returns>
        public static LeaderboardListResponse List(GamesService service, LeaderboardsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.Leaderboards.List();

                // Applying optional parameters to the request.
                request = (LeaderboardsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Leaderboards.List failed.", ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// Indicate that the the currently authenticated user is playing your application.
        /// Documentation https://developers.google.com/games/v1/reference/applications/played
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Games service.</param>
        /// <param name="optional">Optional paramaters.</param>
        public static void Played(GamesService service, ApplicationsPlayedOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.Applications.Played();

                // Applying optional parameters to the request.
                request = (ApplicationsResource.PlayedRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                request.Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Applications.Played failed.", ex);
            }
        }
        /// Documentation https://developers.google.com/games/v1/reference/scores/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Games service.</param>
        /// <param name="playerId">A player ID. A value of me may be used in place of the authenticated player's ID.</param>
        /// <param name="leaderboardId">The ID of the leaderboard. Can be set to 'ALL' to retrieve data for all leaderboards for this application.</param>
        /// <param name="timeSpan">The time span for the scores and ranks you're requesting.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>PlayerLeaderboardScoreListResponseResponse</returns>
        public static PlayerLeaderboardScoreListResponse Get(GamesService service, string playerId, string leaderboardId, string timeSpan, ScoresGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (playerId == null)
                {
                    throw new ArgumentNullException(playerId);
                }
                if (leaderboardId == null)
                {
                    throw new ArgumentNullException(leaderboardId);
                }
                if (timeSpan == null)
                {
                    throw new ArgumentNullException(timeSpan);
                }

                // Building the initial request.
                var request = service.Scores.Get(playerId, leaderboardId, timeSpan);

                // Applying optional parameters to the request.
                request = (ScoresResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Scores.Get failed.", ex);
            }
        }
        /// <summary>
        /// Lists the scores in a leaderboard around (and including) a player's score.
        /// Documentation https://developers.google.com/games/v1/reference/scores/listWindow
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Games service.</param>
        /// <param name="leaderboardId">The ID of the leaderboard.</param>
        /// <param name="collection">The collection of scores you're requesting.</param>
        /// <param name="timeSpan">The time span for the scores and ranks you're requesting.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>LeaderboardScoresResponse</returns>
        public static LeaderboardScores ListWindow(GamesService service, string leaderboardId, string collection, string timeSpan, ScoresListWindowOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (leaderboardId == null)
                {
                    throw new ArgumentNullException(leaderboardId);
                }
                if (collection == null)
                {
                    throw new ArgumentNullException(collection);
                }
                if (timeSpan == null)
                {
                    throw new ArgumentNullException(timeSpan);
                }

                // Building the initial request.
                var request = service.Scores.ListWindow(leaderboardId, collection, timeSpan);

                // Applying optional parameters to the request.
                request = (ScoresResource.ListWindowRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Scores.ListWindow failed.", ex);
            }
        }
        /// <summary>
        /// Returns turn-based matches the player is or was involved in that changed since the last sync call, with the least recent changes coming first. Matches that should be removed from the local cache will have a status of MATCH_DELETED.
        /// Documentation https://developers.google.com/games/v1/reference/turnBasedMatches/sync
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Games service.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>TurnBasedMatchSyncResponse</returns>
        public static TurnBasedMatchSync Sync(GamesService service, TurnBasedMatchesSyncOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.TurnBasedMatches.Sync();

                // Applying optional parameters to the request.
                request = (TurnBasedMatchesResource.SyncRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TurnBasedMatches.Sync failed.", ex);
            }
        }
        /// <summary>
        /// Return the metagame configuration data for the calling application.
        /// Documentation https://developers.google.com/games/v1/reference/metagame/getMetagameConfig
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Games service.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>MetagameConfigResponse</returns>
        public static MetagameConfig GetMetagameConfig(GamesService service, MetagameGetMetagameConfigOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.Metagame.GetMetagameConfig();

                // Applying optional parameters to the request.
                request = (MetagameResource.GetMetagameConfigRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Metagame.GetMetagameConfig failed.", ex);
            }
        }