Beispiel #1
0
        public string GetServer(EServer server)
        {
            if (HasServer(server))
            {
                return(Servers[Credentials.environment][server]);
            }

            throw new ArgumentException($"Server ({server.ToString()}) is not supported.");
        }
Beispiel #2
0
        public async Task <IEnumerable <League> > GetLeagueDetailsAsync(string encryptedSummonerId, EServer summonerServer)
        {
            Client.BaseAddress = new Uri(string.Format(RiotApiConstants.BaseUrl, summonerServer.ToString()));
            var response = await Client.GetAsync(string.Format(RiotApiConstants.LeagueBySummonerId, encryptedSummonerId));

            response.EnsureSuccessStatusCode();

            var responseStream = await response.Content.ReadAsStringAsync();

            var leagues = JsonConvert.DeserializeObject <IEnumerable <League> >(responseStream);

            return(leagues);
        }
Beispiel #3
0
        public async Task <Summoner> GetSummonerDetailsAsync(string summonerName, EServer summonerServer)
        {
            Client.BaseAddress = new Uri(string.Format(RiotApiConstants.BaseUrl, summonerServer.ToString()));
            var response = await Client.GetAsync(string.Format(RiotApiConstants.SummonerByName, summonerName));

            response.EnsureSuccessStatusCode();

            var responseStream = await response.Content.ReadAsStringAsync();

            var summoner = JsonConvert.DeserializeObject <Summoner>(responseStream);

            summoner.Server = summonerServer;

            return(summoner);
        }