BuildIdsString() публичный статический Метод

public static BuildIdsString ( List ids ) : string
ids List
Результат string
Пример #1
0
        /// <summary>
        /// Get the mach history of a specific summoner asynchronously.
        /// </summary>
        /// <param name="region">Region in which the summoner is.</param>
        /// <param name="summonerId">Summoner ID for which you want to retrieve the match history.</param>
        /// <param name="beginIndex">The begin index to use for fetching games.
        /// endIndex - beginIndex has to be inferior to 15.</param>
        /// <param name="endIndex">The end index to use for fetching games.
        /// endIndex - beginIndex has to be inferior to 15.</param>
        /// <param name="championIds">List of champion IDs to use for fetching games.</param>
        /// <param name="rankedQueues">List of ranked queue types to use for fetching games. Non-ranked queue types
        /// will be ignored.</param>
        /// <returns>A list of match summaries object.</returns>
        public async Task <List <MatchSummary> > GetMatchHistoryAsync(Region region, long summonerId,
                                                                      int beginIndex         = 0, int endIndex = 14,
                                                                      List <int> championIds = null, List <Queue> rankedQueues = null)
        {
            var addedArguments = new List <string> {
                string.Format("beginIndex={0}", beginIndex),
                string.Format("endIndex={0}", endIndex),
            };

            if (championIds != null)
            {
                addedArguments.Add(string.Format("championIds={0}", Util.BuildIdsString(championIds)));
            }
            if (rankedQueues != null)
            {
                addedArguments.Add(string.Format("rankedQueues={0}", Util.BuildQueuesString(rankedQueues)));
            }

            var json = await requester.CreateRequestAsync(
                string.Format(MatchHistoryRootUrl, region.ToString()) + string.Format(IdUrl, summonerId),
                region,
                addedArguments);

            return(await Task.Factory.StartNew(() =>
                                               JsonConvert.DeserializeObject <PlayerHistory>(json).Matches));
        }
Пример #2
0
        /// <summary>
        /// Get the teams for the specified ids synchronously.
        /// </summary>
        /// <param name="region">Region in which the teams are located.</param>
        /// <param name="summonerIds">List of summoner ids</param>
        /// <returns>A map of teams indexed by the summoner's id.</returns>
        public Dictionary <long, List <TeamEndpoint.Team> > GetTeams(Region region, List <int> summonerIds)
        {
            var json = requester.CreateRequest(
                string.Format(TeamRootUrl, region.ToString()) +
                string.Format(TeamBySummonerURL, Util.BuildIdsString(summonerIds)),
                region);

            return(JsonConvert.DeserializeObject <Dictionary <long, List <TeamEndpoint.Team> > >(json));
        }
Пример #3
0
        /// <summary>
        /// Get rune pages for a list summoners' ids synchronously.
        /// </summary>
        /// <param name="region">Region in which you wish to look for mastery pages for a list of summoners.</param>
        /// <param name="summonerIds">A list of summoners' ids for which you wish to retrieve the masteries.</param>
        /// <returns>A dictionary where the keys are the summoners' ids and the values are lists of rune pages.
        /// </returns>
        public Dictionary <long, List <RunePage> > GetRunePages(Region region, List <int> summonerIds)
        {
            var json = requester.CreateRequest(
                string.Format(SummonerRootUrl, region.ToString()) +
                string.Format(RunesUrl, Util.BuildIdsString(summonerIds)),
                region);

            return(ConstructRuneDict(JsonConvert.DeserializeObject <Dictionary <string, RunePages> >(json)));
        }
Пример #4
0
        /// <summary>
        /// Retrieves the entire leagues for the specified summoners.
        /// </summary>
        /// <param name="region">Region in which you wish to look for the leagues of summoners.</param>
        /// <param name="summonerIds">The summoner ids.</param>
        /// <returns>A map of list of leagues indexed by the summoner id.</returns>
        public Dictionary <long, List <League> > GetEntireLeagues(Region region, List <int> summonerIds)
        {
            var json = requester.CreateRequest(
                string.Format(LeagueRootUrl, region.ToString()) +
                string.Format(LeagueBySummonerUrl, Util.BuildIdsString(summonerIds)),
                region);

            return(JsonConvert.DeserializeObject <Dictionary <long, List <League> > >(json));
        }
Пример #5
0
        /// <summary>
        /// Get the teams for the specified ids asynchronously.
        /// </summary>
        /// <param name="region">Region in which the teams are located.</param>
        /// <param name="summonerIds">List of summoner ids.</param>
        /// <returns>A map of teams indexed by their id.</returns>
        public async Task <Dictionary <long, List <TeamEndpoint.Team> > > GetTeamsAsync(Region region, List <int> summonerIds)
        {
            var json = await requester.CreateRequestAsync(
                string.Format(TeamRootUrl, region.ToString()) +
                string.Format(TeamBySummonerURL, Util.BuildIdsString(summonerIds)),
                region);

            return(await Task.Factory.StartNew(() =>
                                               JsonConvert.DeserializeObject <Dictionary <long, List <TeamEndpoint.Team> > >(json)));
        }
Пример #6
0
        /// <summary>
        /// Retrieves the league entries for the specified summoners asynchronously.
        /// </summary>
        /// <param name="region">Region in which you wish to look for the leagues of summoners.</param>
        /// <param name="summonerIds">The summoner ids.</param>
        /// <returns>A map of list of league entries indexed by the summoner id.</returns>
        public async Task <Dictionary <long, List <League> > > GetLeaguesAsync(Region region, List <int> summonerIds)
        {
            var json = await requester.CreateRequestAsync(
                string.Format(LeagueRootUrl, region.ToString()) +
                string.Format(LeagueBySummonerUrl, Util.BuildIdsString(summonerIds)) + LeagueEntryUrl,
                region);

            return(await Task.Factory.StartNew(() =>
                                               JsonConvert.DeserializeObject <Dictionary <long, List <League> > >(json)));
        }
Пример #7
0
        /// <summary>
        /// Get rune pages for a list summoners' ids asynchronously.
        /// </summary>
        /// <param name="region">Region in which you wish to look for mastery pages for a list of summoners.</param>
        /// <param name="summonerIds">A list of summoners' ids for which you wish to retrieve the masteries.</param>
        /// <returns>A dictionary where the keys are the summoners' ids and the values are lists of rune pages.
        /// </returns>
        public async Task <Dictionary <long, List <RunePage> > > GetRunePagesAsync(Region region, List <int> summonerIds)
        {
            var json = await requester.CreateRequestAsync(
                string.Format(SummonerRootUrl, region.ToString()) +
                string.Format(RunesUrl, Util.BuildIdsString(summonerIds)),
                region);

            return(ConstructRuneDict(await Task.Factory.StartNew(() =>
                                                                 JsonConvert.DeserializeObject <Dictionary <string, RunePages> >(json))));
        }
Пример #8
0
        /// <summary>
        /// Get summoners by ids synchronously.
        /// </summary>
        /// <param name="region">Region in which you wish to look for summoners.</param>
        /// <param name="summonerIds">List of ids of the summoners you're looking for.</param>
        /// <returns>A list of summoners.</returns>
        public List <Summoner> GetSummoners(Region region, List <int> summonerIds)
        {
            var json = requester.CreateRequest(
                string.Format(SummonerRootUrl, region.ToString()) + string.Format(IdUrl,
                                                                                  Util.BuildIdsString(summonerIds)),
                region);
            var list = JsonConvert.DeserializeObject <Dictionary <long, Summoner> >(json).Values.ToList();

            foreach (var summ in list)
            {
                summ.Region = region;
            }
            return(list);
        }
Пример #9
0
        /// <summary>
        /// Get a list of summoner's names and ids synchronously.
        /// </summary>
        /// <param name="region">Region in which you wish to look for summoners.</param>
        /// <param name="summonerIds">List of ids of the summoners you're looking for.</param>
        /// <returns>A list of ids and names of summoners.</returns>
        public List <SummonerBase> GetSummonersNames(Region region, List <int> summonerIds)
        {
            var json = requester.CreateRequest(
                string.Format(SummonerRootUrl, region.ToString()) +
                string.Format(NamesUrl, Util.BuildIdsString(summonerIds)),
                region);
            var summoners = new List <SummonerBase>();
            var children  = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);

            foreach (var child in children)
            {
                summoners.Add(new SummonerBase(child.Key, child.Value, requester, region));
            }
            return(summoners);
        }
Пример #10
0
        /// <summary>
        /// Get summoners by ids asynchronously.
        /// </summary>
        /// <param name="region">Region in which you wish to look for summoners.</param>
        /// <param name="summonerIds">List of ids of the summoners you're looking for.</param>
        /// <returns>A list of summoners.</returns>
        public async Task <List <Summoner> > GetSummonersAsync(Region region, List <int> summonerIds)
        {
            var json = await requester.CreateRequestAsync(
                string.Format(SummonerRootUrl, region.ToString()) + string.Format(IdUrl,
                                                                                  Util.BuildIdsString(summonerIds)),
                region);

            var list = (await Task.Factory.StartNew(() =>
                                                    JsonConvert.DeserializeObject <Dictionary <long, Summoner> >(json))).Values.ToList();

            foreach (var summ in list)
            {
                summ.Region = region;
            }
            return(list);
        }
Пример #11
0
        /// <summary>
        /// Get the list of matches of a specific summoner synchronously.
        /// </summary>
        /// <param name="region">Region in which the summoner is.</param>
        /// <param name="summonerId">Summoner ID for which you want to retrieve the match list.</param>
        /// <param name="championIds">List of champion IDS to use for fetching games.</param>
        /// <param name="rankedQueues">List of ranked queue types to use for fetching games. Non-ranked queue types
        ///  will be ignored.</param>
        /// <param name="seasons">List of seasons for which to filter the match list by.</param>
        /// <param name="beginTime">The earliest date you wish to get matches from.</param>
        /// <param name="endTime">The latest date you wish to get matches from.</param>
        /// <param name="beginIndex">The begin index to use for fetching matches.</param>
        /// <param name="endIndex">The end index to use for fetching matches.</param>
        /// <returns>A list of Match references object.</returns>
        public MatchlistDto GetMacthAllByAccountId(Region region, long accountId, List <long> championIds = null, List <string> rankedQueues = null,
                                                   List <Season> seasons = null, DateTime?beginTime = null, DateTime?endTime = null,
                                                   int?beginIndex        = null, int?endIndex = null)
        {
            var addedArguments = new List <string> {
                string.Format("beginIndex={0}", beginIndex),
                string.Format("endIndex={0}", endIndex),
            };

            if (beginTime != null)
            {
                addedArguments.Add(string.Format("beginTime={0}", beginTime.Value.ToLong()));
            }
            if (endTime != null)
            {
                addedArguments.Add(string.Format("endTime={0}", endTime.Value.ToLong()));
            }
            if (championIds != null)
            {
                addedArguments.Add(string.Format("championIds={0}", Util.BuildIdsString(championIds)));
            }
            if (rankedQueues != null)
            {
                addedArguments.Add(string.Format("rankedQueues={0}", Util.BuildQueuesString(rankedQueues)));
            }
            if (seasons != null)
            {
                addedArguments.Add(string.Format("seasons={0}", Util.BuildSeasonString(seasons)));
            }

            var json = requester.CreateGetRequest(
                string.Format(Match_V3_RootUrl + MatchAllList_V3_ByAccountIdUrl, accountId),
                region,
                addedArguments,
                usePlatforms: true);

            return(JsonConvert.DeserializeObject <MatchlistDto>(json));

            //var json = requester.CreateGetRequest(
            //    string.Format(Match_V3_RootUrl + MatchAllList_V3_ByAccountIdUrl, accountId),
            //    region, usePlatforms: true);

            //return JsonConvert.DeserializeObject<MatchlistDto>(json);
        }
Пример #12
0
        /// <summary>
        /// Retrieves the league entries for the specified summoners.
        /// </summary>
        /// <param name="region">Region in which you wish to look for the leagues of summoners.</param>
        /// <param name="summonerIds">The summoner ids.</param>
        /// <returns>A map of list of league entries indexed by the summoner id.</returns>
        public Dictionary <long, List <League> > GetLeagues(Region region, List <long> summonerIds)
        {
            string json = null;

            if (ApiCache.CacheEnabled && (json = ApiCache.GetCache(summonerIds[0], region, "LS")) != null)
            {
                return(JsonConvert.DeserializeObject <Dictionary <long, List <League> > >(json));
            }


            json = requester.CreateRequest(
                string.Format(LeagueRootUrl, region.ToString()) +
                string.Format(LeagueBySummonerUrl, Util.BuildIdsString(summonerIds)) + LeagueEntryUrl,
                region);

            if (ApiCache.CacheEnabled)
            {
                ApiCache.AddCache(summonerIds[0], region.ToString(), json, "LS");
            }

            return(JsonConvert.DeserializeObject <Dictionary <long, List <League> > >(json));
        }