Example #1
0
        /// <summary>
        /// Retrieve third party code by summoner id
        /// </summary>
        /// <param name="encryptedSummonerId">Encrypted summoner id</param>
        /// <returns>Third party code</returns>
        public async Task <string> GetThirdPartyCodeBySummonerId(string encryptedSummonerId)
        {
            if (base.ServiceConfigured)
            {
                var pathParams = new Dictionary <string, object>()
                {
                    { nameof(encryptedSummonerId), encryptedSummonerId }
                };

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

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