コード例 #1
0
ファイル: SeriesClient.cs プロジェクト: mysidia/LiveSplit-Sid
        public IEnumerable <Game> GetGames(
            string seriesId,
            string name           = null, int?yearOfRelease   = null,
            string platformId     = null, string regionId     = null,
            string moderatorId    = null, int?elementsPerPage = null,
            GameEmbeds embeds     = default(GameEmbeds),
            GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List <string>()
            {
                embeds.ToString()
            };

            parameters.AddRange(orderBy.ToParameters());

            if (!string.IsNullOrEmpty(name))
            {
                parameters.Add(string.Format("name={0}", Uri.EscapeDataString(name)));
            }

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

            if (!string.IsNullOrEmpty(platformId))
            {
                parameters.Add(string.Format("platform={0}", Uri.EscapeDataString(platformId)));
            }

            if (!string.IsNullOrEmpty(regionId))
            {
                parameters.Add(string.Format("region={0}", Uri.EscapeDataString(regionId)));
            }

            if (!string.IsNullOrEmpty(moderatorId))
            {
                parameters.Add(string.Format("moderator={0}", Uri.EscapeDataString(moderatorId)));
            }

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

            var uri = GetSeriesUri(string.Format("/{0}/games{1}",
                                                 Uri.EscapeDataString(seriesId),
                                                 parameters.ToParameters()));

            return(baseClient.DoPaginatedRequest(uri,
                                                 x => Game.Parse(baseClient, x) as Game));
        }
コード例 #2
0
        public IEnumerable<GameHeader> GetGameHeaders(int elementsPerPage = 1000,
            GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List<string>() { "_bulk=yes" };

            parameters.AddRange(orderBy.ToParameters());
            parameters.Add(string.Format("max={0}", elementsPerPage));

            var uri = GetGamesUri(parameters.ToParameters());

            return baseClient.DoPaginatedRequest(uri,
                x => GameHeader.Parse(baseClient, x) as GameHeader);
        }
コード例 #3
0
        public IEnumerable <GameHeader> GetGameHeaders(int elementsPerPage = 1000, GamesOrdering orderBy = default)
        {
            var parameters = new List <string>()
            {
                "_bulk=yes"
            };

            parameters.AddRange(orderBy.ToParameters());
            parameters.Add(string.Format("max={0}", elementsPerPage));

            var uri = GetGamesUri(parameters.ToParameters());

            return(baseClient.DoPaginatedRequest(uri, x => GameHeader.Parse(baseClient, x) as GameHeader));
        }
コード例 #4
0
        public ReadOnlyCollection <Game> GetRomHacks(string gameId,
                                                     GameEmbeds embeds     = default(GameEmbeds),
                                                     GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List <string>()
            {
                embeds.ToString()
            };

            parameters.AddRange(orderBy.ToParameters());

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

            return(baseClient.DoDataCollectionRequest(uri,
                                                      x => Game.Parse(baseClient, x) as Game));
        }
コード例 #5
0
        public IEnumerable<Game> GetGames(
            string seriesId,
            string name = null, int? yearOfRelease = null,
            string platformId = null, string regionId = null,
            string moderatorId = null, int? elementsPerPage = null,
            GameEmbeds embeds = default(GameEmbeds),
            GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List<string>() { embeds.ToString() };

            parameters.AddRange(orderBy.ToParameters());

            if (!string.IsNullOrEmpty(name))
                parameters.Add(string.Format("name={0}", Uri.EscapeDataString(name)));

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

            if (!string.IsNullOrEmpty(platformId))
                parameters.Add(string.Format("platform={0}", Uri.EscapeDataString(platformId)));

            if (!string.IsNullOrEmpty(regionId))
                parameters.Add(string.Format("region={0}", Uri.EscapeDataString(regionId)));

            if (!string.IsNullOrEmpty(moderatorId))
                parameters.Add(string.Format("moderator={0}", Uri.EscapeDataString(moderatorId)));

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

            var uri = GetSeriesUri(string.Format("/{0}/games{1}",
                Uri.EscapeDataString(seriesId),
                parameters.ToParameters()));

            return baseClient.DoPaginatedRequest(uri,
                x => Game.Parse(baseClient, x) as Game);
        }
コード例 #6
0
        public ReadOnlyCollection<Game> GetRomHacks(string gameId,
            GameEmbeds embeds = default(GameEmbeds),
            GamesOrdering orderBy = default(GamesOrdering))
        {
            var parameters = new List<string>() { embeds.ToString() };

            parameters.AddRange(orderBy.ToParameters());

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

            return baseClient.DoDataCollectionRequest(uri,
                x => Game.Parse(baseClient, x) as Game);
        }