using RiotGamesApi.AspNetCore
using RiotGamesApi;
using RiotGamesApi.AspNetCore;
using RiotGamesApi.Enums;
using RiotGamesApi.Libraries.Lol.Enums;
using RiotGamesApi.RateLimit;
-
lol/platform/v3/champions
- platform is called LolApiName
- champions is called LolApiMethodName
-
also you can find the RiotGames api Rules in here: https://developer.riotgames.com/api-methods/#champion-v3
services.AddLeagueOfLegendsApi("RGAPI-440fcd4b-a43f-4d80-92b5-bd50c0df1893",
(cache) =>
{
//overrides default values
cache.EnableStaticApiCaching = true;
cache.StaticApiCacheExpiry = new TimeSpan(1, 0, 0);
//custom caching is activated
//working for any api except static-api
cache.EnableCustomApiCaching = true;
//summoner-profiles are cached for 5sec
cache.AddCacheRule(LolUrlType.NonStatic, LolApiName.Summoner, new TimeSpan(0, 0, 5));
return cache;
},
(limits) =>
{
limits.AddRateLimitFor(LolUrlType.Static, LolApiName.StaticData,
new List<ApiLimit>()
{
new ApiLimit(new TimeSpan(1, 0, 0), 10, RateLimitType.MethodRate)
}, LolApiMethodName.Champions,
LolApiMethodName.Items,
LolApiMethodName.LanguageStrings,
LolApiMethodName.LanguageStrings,
LolApiMethodName.Maps,
LolApiMethodName.Masteries,
LolApiMethodName.ProfileIcons,
LolApiMethodName.Realms,
LolApiMethodName.Runes,
LolApiMethodName.SummonerSpells,
LolApiMethodName.Versions);
limits.AddRateLimitFor(LolUrlType.NonStatic, LolApiName.Match,
new List<ApiLimit>()
{
new ApiLimit(new TimeSpan(0, 0, 10),500, RateLimitType.MethodRate)
}, LolApiMethodName.Matches, LolApiMethodName.Timelines);
limits.AddRateLimitFor(LolUrlType.NonStatic, LolApiName.Match,
new List<ApiLimit>()
{
new ApiLimit(new TimeSpan(0, 0, 10),1000, RateLimitType.MethodRate)
}, LolApiMethodName.MatchLists);
limits.AddRateLimitFor(LolUrlType.Status, LolApiName.Status, new List<ApiLimit>()
{
new ApiLimit(new TimeSpan(0, 0, 10), 20000, RateLimitType.MethodRate),
new ApiLimit(new TimeSpan(0, 2, 0), 100, RateLimitType.AppRate),
new ApiLimit(new TimeSpan(0, 0, 1), 20, RateLimitType.AppRate)
}, LolApiMethodName.ShardData);
limits.AddRateLimitFor(LolUrlType.Tournament, new List<LolApiName>()
{
LolApiName.Tournament,
LolApiName.TournamentStub
}, new List<ApiLimit>()
{
new ApiLimit(new TimeSpan(0, 0, 10), 20000, RateLimitType.MethodRate),
new ApiLimit(new TimeSpan(0, 2, 0), 100, RateLimitType.AppRate),
new ApiLimit(new TimeSpan(0, 0, 1), 20, RateLimitType.AppRate)
},
LolApiMethodName.Codes,
LolApiMethodName.LobbyEvents,
LolApiMethodName.Providers,
LolApiMethodName.Tournaments);
limits.AddRateLimitFor(LolUrlType.NonStatic, new List<LolApiName>()
{
LolApiName.ChampionMastery,
LolApiName.Spectator,
//LolApiName.Summoner, //<== disabled
LolApiName.Platform,
}, new List<ApiLimit>()
{
new ApiLimit(new TimeSpan(0, 0, 10), 20000, RateLimitType.MethodRate),
new ApiLimit(new TimeSpan(0, 2, 0), 100, RateLimitType.AppRate),
new ApiLimit(new TimeSpan(0, 0, 1), 20, RateLimitType.AppRate)
},
LolApiMethodName.ChampionMasteries,
LolApiMethodName.Scores,
LolApiMethodName.ActiveGames,
LolApiMethodName.FeaturedGames,
LolApiMethodName.Summoners
);
//lol/platform/v3/champions
//lol/platform/v3/masteries/by-summoner/{summonerId}
//lol/platform/v3/runes/by-summoner/{summonerId}
limits.AddRateLimitFor(LolUrlType.NonStatic, new List<LolApiName>()
{
LolApiName.Platform
}, new List<ApiLimit>()
{
new ApiLimit(new TimeSpan(0,1,0),400, RateLimitType.MethodRate),
new ApiLimit(new TimeSpan(0, 2, 0), 100, RateLimitType.AppRate),
new ApiLimit(new TimeSpan(0, 0, 1), 20, RateLimitType.AppRate)
}, LolApiMethodName.Champions,
LolApiMethodName.Masteries,
LolApiMethodName.Runes);
limits.LeaguesApiLimitsInMinute();//<==special league v3 method-rate-limiting
limits.SummonerIdAndByNameLimitsInMinute();//<==special summoner v3 method-rate-limiting
limits.SummonerAccountNameLimitsInMinute();//<==special summoner v3 method-rate-limiting
return limits;
});
app.UseRiotGamesApi();
Updated almost 7 years ago