예제 #1
0
        public static IIServiceBus Queue(QueueEnum QueueName)
        {
            string Q = QueueName.ToString().Replace("_", "-");
            string ConnectionString_ServiceBus = Niffler.Constants.ServiceBusConnectionString;

            return(new ServiceBus(ConnectionString_ServiceBus, Q));
        }
예제 #2
0
        /// <summary>
        /// Retrieves all the league entries
        /// </summary>
        /// <param name="queue">Queue type</param>
        /// <param name="tier">Tier value</param>
        /// <param name="division">Division value</param>
        /// <param name="queryParams">League request parameters value</param>
        /// <returns></returns>
        public async Task <HashSet <LeagueEntry> > GetAllLeagueEntries(QueueEnum queue, TierEnum tier, DivisionEnum division, LeagueRequestParameters queryParams = null)
        {
            if (base.ServiceConfigured)
            {
                HttpRequestMessage requestMessage;
                var pathParams = new Dictionary <string, object>
                {
                    { nameof(queue), queue.ToString() },
                    { nameof(tier), tier.ToString() },
                    { nameof(division), division.ToString() }
                };

                if (queryParams == null)
                {
                    requestMessage = new HttpRequestMessage(HttpMethod.Get, ApiService.BuildUri(RiotGames.Properties.Resources.LEAGUE_QUEUE_TIER_DIVISION, pathParams));
                }
                else
                {
                    requestMessage = new HttpRequestMessage(HttpMethod.Get, ApiService.BuildUri(RiotGames.Properties.Resources.LEAGUE_QUEUE_TIER_DIVISION, pathParams, queryParams));
                }

                var response = await base.Client.SendAsync(requestMessage);

                if (response.IsSuccessStatusCode)
                {
                    return(await response.Content.ReadAsAsync <HashSet <LeagueEntry> >());
                }
                else
                {
                    throw new HttpRequestException($"Code: {(int)response.StatusCode}-{response.StatusCode}, Location: {GetType().FullName}, Description: {response.ReasonPhrase}");
                }
            }
            throw new HttpServiceNotConfiguredException(base.Client);
        }
예제 #3
0
        /// <summary>
        /// Retrieve the grand master league based on queue
        /// </summary>
        /// <param name="queue">Queue type</param>
        /// <returns>Content of the league</returns>
        public async Task <LeagueList> GetGrandMasterLeagueByQueue(QueueEnum queue)
        {
            if (base.ServiceConfigured)
            {
                var pathParams = new Dictionary <string, object>
                {
                    { nameof(queue), queue.ToString() }
                };

                var response = await base.Client.SendAsync(new HttpRequestMessage(HttpMethod.Get, ApiService.BuildUri(RiotGames.Properties.Resources.LEAGUE_GRANDMASTER_QUEUE, pathParams)));

                if (response.IsSuccessStatusCode)
                {
                    return(await response.Content.ReadAsAsync <LeagueList>());
                }
                else
                {
                    throw new HttpRequestException($"Code: {(int)response.StatusCode}-{response.StatusCode}, Location: {GetType().FullName}, Description: {response.ReasonPhrase}");
                }
            }
            throw new HttpServiceNotConfiguredException(base.Client);
        }