Пример #1
0
        /// <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);
        }
Пример #2
0
        private OpenDotaApi(string apiKey, WebProxy proxy)
        {
            _request = new Request(apiKey, proxy);

            Matches         = new MatchEndpoint(_request);
            Player          = new PlayerEndpoint(_request);
            ProPlayers      = new ProPlayerEndpoint(_request);
            ProMatches      = new ProMatchesEndpoint(_request);
            PublicMatches   = new PublicMatchEndpoint(_request);
            Metadata        = new MetadataEndpoint(_request);
            MmrDistribution = new MmrDistributionEndpoint(_request);
            Search          = new SearchEndpoint(_request);
            Ranking         = new RankingEndpoint(_request);
            Benchmarks      = new BenchmarksEndpoint(_request);
            Status          = new StatusEndpoint(_request);
            Health          = new HealthEndpoint(_request);
            Request         = new RequestEndpoint(_request);
            FindMatch       = new FindMatchEndpoint(_request);
            Hero            = new HeroEndpoint(_request);
            HeroStats       = new HeroStatsEndpoint(_request);
            League          = new LeagueEndpoint(_request);
            Team            = new TeamEndpoint(_request);
            Replay          = new ReplayEndpoint(_request);
            Record          = new RecordEndpoint(_request);
            Live            = new LiveEndpoint(_request);
            Scenarios       = new ScenariosEndpoint(_request);
            Schema          = new SchemaEndpoint(_request);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        /// <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);
        }