/// <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);
            }
        }
Пример #2
0
        /// <summary>
        /// Get high scores, and optionally ranks, in leaderboards for the currently authenticated player. For a specific time span, leaderboardId can be set to ALL to retrieve data for all leaderboards in a given time span.NOTE: You cannot ask for 'ALL' leaderboards and 'ALL' timeSpans in the same request; only one parameter may be set to 'ALL'.
        /// 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);
            }
        }
Пример #3
0
        /// <summary>
        /// Lists all the achievement definitions for your application.
        /// Documentation https://developers.google.com/games/v1/reference/achievementDefinitions/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>AchievementDefinitionsListResponseResponse</returns>
        public static AchievementDefinitionsListResponse List(GamesService service, AchievementDefinitionsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request AchievementDefinitions.List failed.", ex);
            }
        }
Пример #4
0
        /// <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);
            }
        }