/// <summary> /// Dependency injection constructor /// </summary> /// <param name="rateLimitedRequester">Rate limited requester for all endpoints except the static endpoint.</param> /// <param name="staticEndpointProvider">The static endpoint provider.</param> /// <param name="cache">The cache.</param> /// <exception cref="ArgumentNullException"> /// rateLimitedRequester /// or /// staticEndpointProvider /// </exception> public RiotApi(IRateLimitedRequester rateLimitedRequester, IRequester requester, IStaticEndpointProvider staticEndpointProvider, ICache cache = null) { if (rateLimitedRequester == null) { throw new ArgumentNullException(nameof(rateLimitedRequester)); } if (staticEndpointProvider == null) { throw new ArgumentNullException(nameof(staticEndpointProvider)); } _cache = cache ?? new PassThroughCache(); Summoner = new SummonerEndpoint(rateLimitedRequester, _cache); Champion = new ChampionEndpoint(rateLimitedRequester); League = new LeagueEndpoint(rateLimitedRequester); Match = new MatchEndpoint(rateLimitedRequester, _cache); Spectator = new SpectatorEndpoint(rateLimitedRequester); ChampionMastery = new ChampionMasteryEndpoint(rateLimitedRequester); ThirdParty = new ThirdPartyEndpoint(rateLimitedRequester); DataDragon = new DataDragonEndpoints(staticEndpointProvider); Status = new StatusEndpoint(requester); Clash = new ClashEndpoint(rateLimitedRequester, _cache); }
private RiotApi(string apiKey, IDictionary <TimeSpan, int> rateLimits, ICache cache) { _cache = cache ?? throw new ArgumentNullException(nameof(cache)); Requesters.RiotApiRequester = new RateLimitedRequester(apiKey, rateLimits); Requesters.StaticApiRequester = new Requester(apiKey); var requester = Requesters.RiotApiRequester; Summoner = new SummonerEndpoint(requester, _cache); Champion = new ChampionEndpoint(requester); League = new LeagueEndpoint(requester); Match = new MatchEndpoint(requester, _cache); Spectator = new SpectatorEndpoint(requester); ChampionMastery = new ChampionMasteryEndpoint(requester); ThirdParty = new ThirdPartyEndpoint(requester); StaticData = new StaticDataEndpoints(Requesters.StaticApiRequester, cache); }
private RiotApi(string apiKey, IDictionary <TimeSpan, int> rateLimits) { Requesters.RiotApiRequester = new RateLimitedRequester(apiKey, rateLimits); var requester = Requesters.RiotApiRequester; Summoner = new SummonerEndpoint(requester, _cache); Champion = new ChampionEndpoint(requester); Masteries = new MasteriesEndpoint(requester); Runes = new RunesEndpoint(requester); League = new LeagueEndpoint(requester); Match = new MatchEndpoint(requester, _cache); Spectator = new SpectatorEndpoint(requester); ChampionMastery = new ChampionMasteryEndpoint(requester); ThirdParty = new ThirdPartyEndpoint(requester); Static = StaticDataEndpoints.GetInstance(apiKey, true); }
/// <summary> /// Dependency injection constructor /// </summary> /// <param name="rateLimitedRequester"></param> /// <param name="staticEndpointProvider"></param> public RiotApi(IRateLimitedRequester rateLimitedRequester, IStaticEndpointProvider staticEndpointProvider) { if (rateLimitedRequester == null) { throw new ArgumentNullException(nameof(rateLimitedRequester)); } if (staticEndpointProvider == null) { throw new ArgumentNullException(nameof(staticEndpointProvider)); } Summoner = new SummonerEndpoint(rateLimitedRequester, _cache); Champion = new ChampionEndpoint(rateLimitedRequester); Masteries = new MasteriesEndpoint(rateLimitedRequester); Runes = new RunesEndpoint(rateLimitedRequester); League = new LeagueEndpoint(rateLimitedRequester); Match = new MatchEndpoint(rateLimitedRequester, _cache); Spectator = new SpectatorEndpoint(rateLimitedRequester); ChampionMastery = new ChampionMasteryEndpoint(rateLimitedRequester); ThirdParty = new ThirdPartyEndpoint(rateLimitedRequester); Static = new StaticDataEndpoints(staticEndpointProvider); }