Example #1
0
        public Mastery GetMastery(int masteryId, region region, language lang, masteryListData?masteryData = null, bool useCaching = false)
        {
            Mastery val = Cache.Get <Mastery>(masteryId.ToString(), region.ToString(), lang.ToString(), masteryData.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <Mastery> caller = new RiotApiCaller <Mastery>(suffix.masteryById);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);
            caller.AddParam(param.id, masteryId);
            if (masteryData != null)
            {
                caller.AddParam(param.masteryData, masteryData);
            }
            else
            {
                caller.AddParam(param.masteryData, "");                                   //important for basic information
            }
            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
Example #2
0
        public ChampionStatus GetChampionRotationById(region region, long championId, bool useCaching = false)
        {
            ChampionStatus val = Cache.Get <ChampionStatus>(championId.ToString(), region.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <ChampionStatus> caller = new RiotApiCaller <ChampionStatus>(suffix.championRotationId);

            caller.AddParam(param.region, region);
            caller.AddParam(param.id, championId);

            if (useCaching)
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(0, 22, 0)));
            }
            else
            {
                caller.CreateRequest();
            }

            return(caller.Result.FirstOrDefault());
        }
Example #3
0
        public Champions GetChampions(region region, language lang, champData?chamData = null, bool useCaching = false)
        {
            Champions val = Cache.Get <Champions>(region.ToString(), lang.ToString(), chamData.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <Champions> caller = new RiotApiCaller <Champions>(suffix.champions);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);
            if (chamData != null)
            {
                caller.AddParam(param.champData, chamData.Value);
            }
            else
            {
                caller.AddParam(param.champData, "");                                     //important for basic information
            }
            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
Example #4
0
        public MatchDetail GetMatchDetail(long matchId, region region, bool includeTimeline = false, bool useCaching = false)
        {
            MatchDetail val = Cache.Get <MatchDetail>(matchId.ToString(), region.ToString(), includeTimeline.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <MatchDetail> caller = new RiotApiCaller <MatchDetail>(suffix.matchdetail);

            caller.AddParam(param.matchId, matchId);
            caller.AddParam(param.region, region);
            caller.AddParam(param.includeTimeline, includeTimeline);

            if (useCaching)
            {
                Cache.AddOrUpdate(caller.CreateRequest(new TimeSpan(0, 22, 0)));
            }
            else
            {
                caller.CreateRequest();
            }

            return(caller.Result.FirstOrDefault());
        }
Example #5
0
        public ItemData GetItem(long itemId, region region, language lang, itemListData?itemData = null, bool useCaching = false)
        {
            ItemData val = Cache.Get <ItemData>(itemId.ToString(), region.ToString(), lang.ToString(), itemData.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <ItemData> caller = new RiotApiCaller <ItemData>(suffix.item);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);
            caller.AddParam(param.id, itemId);
            if (itemData != null)
            {
                caller.AddParam(param.itemData, itemData.Value);
            }
            else
            {
                caller.AddParam(param.itemData, "");                                      //important for basic information
            }
            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
Example #6
0
        public ChampionRotation GetChampionRotation(region region, bool onlyFreeToPlay = true, bool useCaching = false)
        {
            ChampionRotation val = Cache.Get <ChampionRotation>(region.ToString(), onlyFreeToPlay.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <ChampionRotation> caller = new RiotApiCaller <ChampionRotation>(suffix.championRotation);

            caller.AddParam(param.region, region);
            caller.AddParam(param.freeToPlay, onlyFreeToPlay);

            if (useCaching)
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(0, 22, 0)));
            }
            else
            {
                caller.CreateRequest();
            }

            return(caller.Result.FirstOrDefault());
        }
Example #7
0
        public SummonerSpellList GetSummonerSpells(region region, language lang, spellData?spellData = null, bool useCaching = false)
        {
            SummonerSpellList val = Cache.Get <SummonerSpellList>(region.ToString(), lang.ToString(), spellData.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <SummonerSpellList> caller = new RiotApiCaller <SummonerSpellList>(suffix.summonerSpells);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);
            if (spellData != null)
            {
                caller.AddParam(param.spellData, spellData);
            }
            else
            {
                caller.AddParam(param.spellData, "");                                     //important for basic information
            }
            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
Example #8
0
        public RuneList GetRunes(region region, language lang, runeListData runeData = runeListData.basic, bool useCaching = false)
        {
            RuneList val = Cache.Get <RuneList>(region.ToString(), lang.ToString(), runeData.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <RuneList> caller = new RiotApiCaller <RuneList>(suffix.runes);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);
            caller.AddParam(param.runeListData, runeData);

            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
Example #9
0
        public CurrentGame GetCurrentGame(long summonerId, region region, bool useCaching = false)
        {
            CurrentGame val = Cache.GetWithMultipleKey <CurrentGame>(summonerId.ToString(), region.ToString(), region.ToPlatform().ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <CurrentGame> caller = new RiotApiCaller <CurrentGame>(suffix.CurrentGameInfo);

            caller.AddParam(param.summonerId, summonerId);
            caller.AddParam(param.region, region);
            caller.AddParam(param.platformId, region.ToPlatform());

            if (useCaching)
            {
                cacheObject <CurrentGame> cache = caller.CreateRequest(new TimeSpan(0, 22, 0));
                if (caller.Result.Count > 0)
                {
                    Cache.AddOrUpdate(cache);
                    List <RiotCaller.ApiEndPoints.Summoner> summoner = GetSummoners(caller.Result.FirstOrDefault().Participants.Select(p => p.SummonerName).ToList(), region);
                    for (int i = 0; i < summoner.Count; i++)
                    {
                        Cache.AddWithMultipleKey(new cacheParam <CurrentGame>(
                                                     summoner[i].Name,
                                                     caller.Result.FirstOrDefault().PlatformId.ToRegion(),
                                                     caller.Result.FirstOrDefault().PlatformId.ToString()
                                                     ).ToString(), cache.PKey);

                        Cache.AddWithMultipleKey(new cacheParam <CurrentGame>(
                                                     summoner[i].Id,
                                                     caller.Result.FirstOrDefault().PlatformId.ToRegion(),
                                                     caller.Result.FirstOrDefault().PlatformId.ToString()
                                                     ).ToString(), cache.PKey);
                    }
                }
            }
            else
            {
                caller.CreateRequest();
            }
            if (caller.Result.Count > 0)
            {
                return(caller.Result.FirstOrDefault());
            }
            else
            {
                return(null);
            }
        }
Example #10
0
        public void matchlist()
        {
            RiotApiCaller <MatchList> caller = new RiotApiCaller <MatchList>(suffix.matchlist);

            caller.AddParam(param.summonerId, new List <long>()
            {
                summonerId1
            });
            caller.AddParam(param.championIds, new List <long>()
            {
                45, 25
            });
            caller.AddParam(param.rankedQueues, new List <queue>()
            {
                queue.RANKED_SOLO_5x5, queue.TEAM_BUILDER_DRAFT_RANKED_5x5
            });
            caller.AddParam(param.seasons, new List <season>()
            {
                season.SEASON2016
            });
            caller.AddParam(param.region, Region);
            caller.AddParam(param.beginTime, DateTime.Now.AddMonths(-1));
            caller.AddParam(param.endTime, DateTime.Now);
            caller.AddParam(param.beginIndex, 0);
            caller.AddParam(param.endIndex, 2);
            caller.CreateRequest();
            Assert.IsTrue(caller.Result.Count > 0);
        }
Example #11
0
        public List <Shards> GetShards()
        {
            RiotApiCaller <List <Shards> > caller = new RiotApiCaller <List <Shards> >(suffix.status);

            caller.CreateRequest();
            return(caller.Result.FirstOrDefault());
        }
Example #12
0
        public FuturedGames GetFuturedGames(region region)
        {
            RiotApiCaller <FuturedGames> caller = new RiotApiCaller <FuturedGames>(suffix.featuredGames);

            caller.AddParam(param.region, region);
            caller.CreateRequest();
            return(caller.Result.FirstOrDefault());
        }
Example #13
0
        public static RecentGames GetRecentGames(this Summoner sum)
        {
            RiotApiCaller <RecentGames> caller = new RiotApiCaller <RecentGames>(suffix.recentgames);

            caller.AddParam(param.summonerId, sum.Id);
            caller.AddParam(param.region, sum.Region);
            caller.CreateRequest();
            return(caller.Result.FirstOrDefault());
        }
Example #14
0
        public List <Team> GetTeams(List <string> teamNames, region region)
        {
            RiotApiCaller <Team> caller = new RiotApiCaller <Team>(suffix.teamByIds);

            caller.AddParam(param.teamIds, teamNames);
            caller.AddParam(param.region, region);
            caller.CreateRequest();
            return(caller.Result.ToList());
        }
Example #15
0
        public static int GetChampionScore(this Summoner sum)
        {
            RiotApiCaller <ChampionMastery> caller = new RiotApiCaller <ChampionMastery>(suffix.championMasteryScore);

            caller.AddParam(param.region, sum.Region);
            caller.AddParam(param.platformId, sum.Region.ToPlatform());
            caller.AddParam(param.playerId, sum.Id);
            caller.CreateRequest();
            return(caller.ResultStruct);
        }
Example #16
0
        public static List <ChampionMastery> GetChampionMasteries(this Summoner sum)
        {
            RiotApiCaller <List <ChampionMastery> > caller = new RiotApiCaller <List <ChampionMastery> >(suffix.championMasteries);

            caller.AddParam(param.region, sum.Region);
            caller.AddParam(param.platformId, sum.Region.ToPlatform());
            caller.AddParam(param.playerId, sum.Id);
            caller.CreateRequest();
            return(caller.Result.FirstOrDefault());
        }
Example #17
0
        public void statsSummary()
        {
            RiotApiCaller <Summary> caller = new RiotApiCaller <Summary>(suffix.statsSummary);

            caller.AddParam(param.summonerId, 466244);
            caller.AddParam(param.region, Region);
            caller.AddParam(param.seasons, season.SEASON2016);
            caller.CreateRequest();
            Assert.IsTrue(caller.Result.Count > 0);
        }
Example #18
0
        public void matchdetail()
        {
            RiotApiCaller <MatchDetail> caller = new RiotApiCaller <MatchDetail>(suffix.matchdetail);

            caller.AddParam(param.matchId, gameId1);
            caller.AddParam(param.region, Region);
            caller.AddParam(param.includeTimeline, false);
            caller.CreateRequest();
            Assert.IsTrue(caller.Result.Count > 0);
        }
Example #19
0
        public List <List <League> > GetLeagues(List <long> summonerIds, region region)
        {
            //<=obligate
            RiotApiCaller <List <League> > caller = new RiotApiCaller <List <League> >(suffix.leagueByIds);

            caller.AddParam(param.summonerIds, summonerIds);
            caller.AddParam(param.region, region);
            caller.CreateRequest();
            return(caller.Result);
        }
Example #20
0
        public static ChampionMastery GetChampionMastery(this Summoner sum, long championId)
        {
            RiotApiCaller <ChampionMastery> caller = new RiotApiCaller <ChampionMastery>(suffix.championMastery);

            caller.AddParam(param.region, sum.Region);
            caller.AddParam(param.platformId, sum.Region.ToPlatform());
            caller.AddParam(param.playerId, sum.Id);
            caller.AddParam(param.championId, championId);
            caller.CreateRequest();
            return(caller.Result.FirstOrDefault());
        }
Example #21
0
        public void teamByIds()
        {
            RiotApiCaller <Team> caller = new RiotApiCaller <Team>(suffix.teamByIds);

            caller.AddParam(param.teamIds, new List <string>()
            {
                teamName1
            });
            caller.AddParam(param.region, Region);
            caller.CreateRequest();
            Assert.IsTrue(caller.Result.Count > 0);
        }
Example #22
0
        public void leagueByIdsEntry()
        {
            RiotApiCaller <List <League> > caller = new RiotApiCaller <List <League> >(suffix.leagueByIdsEntry);

            caller.AddParam(param.summonerIds, new List <long>()
            {
                summonerId1, summonerId1
            });
            caller.AddParam(param.region, Region);
            caller.CreateRequest();
            Assert.IsTrue(caller.Result.Count > 0);
        }
Example #23
0
        public void teamteamIds()
        {
            RiotApiCaller <List <Team> > caller = new RiotApiCaller <List <Team> >(suffix.teamIds);

            caller.AddParam(param.summonerIds, new List <long>()
            {
                summonerId1, summonerId1
            });
            caller.AddParam(param.region, Region);
            caller.CreateRequest();
            Assert.IsTrue(caller.Result.Count > 0);
        }
Example #24
0
        public List <Summoner> GetSummoners(List <long> summonerIds, region region)
        {
            RiotApiCaller <Summoner> caller = new RiotApiCaller <Summoner>(suffix.summonerIds);

            caller.AddParam(param.summonerIds, summonerIds);
            caller.AddParam(param.region, region);
            caller.CreateRequest();
            foreach (var item in caller.Result)
            {
                item.Region = region;
            }
            return(caller.Result);
        }
Example #25
0
        public void summonerByname()
        {
            RiotApiCaller <Summoner> caller = new RiotApiCaller <Summoner>(suffix.summonerByname);

            caller.AddParam(param.summonerNames, new List <string>()
            {
                summonerName1, summonerName1
            });
            caller.AddParam(param.region, Region);
            caller.CreateRequest();

            Assert.IsTrue(caller.Result.Count > 0);
        }
Example #26
0
        public List <string> GetVersions(region region, bool useCaching = false)
        {
            List <string> val = Cache.Get <List <string> >(region.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <List <string> > caller = new RiotApiCaller <List <string> >(suffix.versionList);

            caller.AddParam(param.region, region);

            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
Example #27
0
        public MapData GetMaps(region region, language lang, bool useCaching = false)
        {
            MapData val = Cache.Get <MapData>(region.ToString(), lang.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <MapData> caller = new RiotApiCaller <MapData>(suffix.map);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);

            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
Example #28
0
        public static League GetLeague(this Summoner sum)
        {
            RiotApiCaller <List <League> > caller = new RiotApiCaller <List <League> >(suffix.leagueByIds);

            caller.AddParam(param.summonerIds, sum.Id);
            caller.AddParam(param.region, sum.Region);
            caller.CreateRequest();
            if (caller.Result.Count > 0)
            {
                return(caller.Result.FirstOrDefault().FirstOrDefault());
            }
            else
            {
                return(null);
            }
        }
Example #29
0
        public List <Team> GetTeams(List <long> teamIds, region region)
        {
            RiotApiCaller <List <Team> > caller = new RiotApiCaller <List <Team> >(suffix.teamIds);

            caller.AddParam(param.summonerIds, teamIds);
            caller.AddParam(param.region, region);
            caller.CreateRequest();
            //return caller.Result;//<== orginal
            if (caller.Result.Count > 0)
            {
                return(caller.Result.Select(p => p.FirstOrDefault()).ToList());//[CONFLICT] summoners' teams grouped but i combined to one list ( [A][1,2] + [B][1,2] = [C][1,2,3,4] )
            }
            else
            {
                return(null);
            }
        }
Example #30
0
        public static Summary GetStatsSummary(this Summoner sum, season?season = null)
        {
            RiotApiCaller <Summary> caller = new RiotApiCaller <Summary>(suffix.statsSummary);

            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());
        }