示例#1
0
        public static Ranked GetStatsRanked(this Summoner sum, season?season = null)
        {
            RiotApiCaller <Ranked> caller = new RiotApiCaller <Ranked>(suffix.statsRanked);

            caller.AddParam(param.summonerId, sum.Id);
            caller.AddParam(param.region, sum.Region);
            if (season != null)
            {
                caller.AddParam(param.season, season.Value);
            }
            else
            {
                caller.RemoveParam(param.season);
            }

            caller.CreateRequest();
            return(caller.Result.FirstOrDefault());
        }
示例#2
0
        public static MatchList GetMatchList(this Summoner sum, List <long> _championIds = null,
                                             List <queue> _queue = null, List <season> _seasons = null, DateTime?_beginTime = null, DateTime?_endTime = null,
                                             int?_beginIndex     = null, int?_endIndex = null)
        {
            RiotApiCaller <MatchList> u = new RiotApiCaller <MatchList>(suffix.matchlist);

            u.AddParam(param.summonerId, new List <long>()
            {
                sum.Id
            });
            u.AddParam(param.region, sum.Region);

            if (_championIds != null)
            {
                u.AddParam(param.championIds, _championIds);
            }
            else
            {
                u.RemoveParam(param.championIds);
            }

            if (_queue != null)
            {
                u.AddParam(param.rankedQueues, _queue);
            }
            else
            {
                u.RemoveParam(param.rankedQueues);
            }

            if (_seasons != null)
            {
                u.AddParam(param.seasons, _seasons);
            }
            else
            {
                u.RemoveParam(param.seasons);
            }

            if (_beginTime != null)
            {
                u.AddParam(param.beginTime, _beginTime.Value);
            }
            else
            {
                u.RemoveParam(param.beginTime);
            }

            if (_endTime != null)
            {
                u.AddParam(param.endTime, _endTime.Value);
            }
            else
            {
                u.RemoveParam(param.endTime);
            }

            if (_beginIndex != null)
            {
                u.AddParam(param.beginIndex, _beginIndex.Value);
            }
            else
            {
                u.RemoveParam(param.beginIndex);
            }

            if (_endIndex != null)
            {
                u.AddParam(param.endIndex, _endIndex.Value);
            }
            else
            {
                u.RemoveParam(param.endIndex);
            }

            u.CreateRequest();
            return(u.Result.FirstOrDefault());
        }