Exemple #1
0
        public async Task <PlayerStatsSummaryList> RetrievePlayerStatsSummaries(CreepScore.Season season)
        {
            Url url = UrlConstants.UrlBuilder(region, UrlConstants.statsAPIVersion, UrlConstants.statsPart)
                      .AppendPathSegments(UrlConstants.bySummonerPart, id.ToString(), UrlConstants.summaryPart);

            url.SetQueryParams(new
            {
                season  = CreepScore.GetSeason(season),
                api_key = CreepScore.apiKey
            });
            Uri uri = new Uri(url.ToString());
            await CreepScore.GetPermission(region);

            string responseString;

            try
            {
                responseString = await CreepScore.GetWebData(uri);
            }
            catch (CreepScoreException)
            {
                throw;
            }
            return(LoadPlayerStatSummariesList(JObject.Parse(responseString), season));
        }
Exemple #2
0
        public async Task <RankedStats> RetrieveRankedStats(CreepScore.Season season)
        {
            if (summonerLevel == 30)
            {
                Url url = UrlConstants.UrlBuilder(region, UrlConstants.statsAPIVersion, UrlConstants.statsPart)
                          .AppendPathSegments(UrlConstants.bySummonerPart, id.ToString(), UrlConstants.rankedPart);
                url.SetQueryParams(new
                {
                    season  = CreepScore.GetSeason(season),
                    api_key = CreepScore.apiKey
                });
                Uri uri = new Uri(url.ToString());
                await CreepScore.GetPermission(region);

                string responseString;
                try
                {
                    responseString = await CreepScore.GetWebData(uri);
                }
                catch (CreepScoreException)
                {
                    throw;
                }
                return(LoadRankedStats(JObject.Parse(responseString), season));
            }
            else
            {
                throw new CreepScoreException("The summoner is not level 30. They do not have ranked stats.");
            }
        }