Esempio n. 1
0
        public IEnumerable <Leaderboard> GetRecords(
            string gameId,
            int?top = null,
            LeaderboardScope scope = LeaderboardScope.All,
            bool includeMiscellaneousCategories = true,
            bool skipEmptyLeaderboards          = false,
            int?elementsPerPage      = null,
            LeaderboardEmbeds embeds = default)
        {
            var parameters = new List <string>()
            {
                embeds.ToString()
            };

            if (top.HasValue)
            {
                parameters.Add(string.Format("top={0}", top.Value));
            }

            if (scope != LeaderboardScope.All)
            {
                parameters.Add(scope.ToParameter());
            }

            if (!includeMiscellaneousCategories)
            {
                parameters.Add("miscellaneous=false");
            }

            if (skipEmptyLeaderboards)
            {
                parameters.Add("skip-empty=true");
            }

            if (elementsPerPage.HasValue)
            {
                parameters.Add(string.Format("max={0}", elementsPerPage.Value));
            }

            var uri = GetGamesUri(string.Format("/{0}/records{1}",
                                                Uri.EscapeDataString(gameId),
                                                parameters.ToParameters()));

            return(baseClient.DoPaginatedRequest <Leaderboard>(uri,
                                                               x => Leaderboard.Parse(baseClient, x)));
        }
Esempio n. 2
0
        public IEnumerable<Leaderboard> GetRecords(string gameId,
            int? top = null, LeaderboardScope scope = LeaderboardScope.All,
            bool includeMiscellaneousCategories = true, bool skipEmptyLeaderboards = false,
            int? elementsPerPage = null,
            LeaderboardEmbeds embeds = default(LeaderboardEmbeds))
        {
            var parameters = new List<string>() { embeds.ToString() };

            if (top.HasValue)
                parameters.Add(string.Format("top={0}", top.Value));
            if (scope != LeaderboardScope.All)
                parameters.Add(scope.ToParameter());
            if (!includeMiscellaneousCategories)
                parameters.Add("miscellaneous=false");
            if (skipEmptyLeaderboards)
                parameters.Add("skip-empty=true");
            if (elementsPerPage.HasValue)
                parameters.Add(string.Format("max={0}", elementsPerPage.Value));

            var uri = GetGamesUri(string.Format("/{0}/records{1}",
                Uri.EscapeDataString(gameId),
                parameters.ToParameters()));

            return baseClient.DoPaginatedRequest<Leaderboard>(uri,
                x => Leaderboard.Parse(baseClient, x));
        }