示例#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
 public ReportViewModel(IEventAggregator events, ICommentEndpoint commentEndpoint,
                        IStatusEndpoint statusEndpoint, IBugEndpoint bugEndpoint,
                        ILoggedInUserModel loggedUser)
 {
     _events          = events;
     _commentEndpoint = commentEndpoint;
     _statusEndpoint  = statusEndpoint;
     _bugEndpoint     = bugEndpoint;
     _loggedUser      = loggedUser;
     _events.Subscribe(this);
 }
示例#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);
            Status     = new StatusEndpoint(Requesters.StaticApiRequester);
        }