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()); }
public void GetSummonerSpells() { ApiService.ApiKey = APIKEY;//you must add your project, if you dont use ninject StaticApi staticapi = new StaticApi(new ApiCache()); SummonerSpellList data = staticapi.GetSummonerSpells(region.tr, language.tr_TR, spellData.all); Assert.IsNotNull(data); }
public StaticService( ILeagueApiConfiguration config) : base(config, VersionEnum.V1Rev2, "static-data", false) { ChampionList.CreateMap(AutoMapperService); ItemList.CreateMap(AutoMapperService); MasteryList.CreateMap(AutoMapperService); Realm.CreateMap(AutoMapperService); RuneList.CreateMap(AutoMapperService); SummonerSpellList.CreateMap(AutoMapperService); #if DEBUG AutoMapperService.AssertConfigurationIsValid(); #endif }