public async Task <Dictionary <string, List <Team> > > RetrieveTeams() { Url url = UrlConstants.UrlBuilder(region, UrlConstants.teamAPIVersion, UrlConstants.teamPart) .AppendPathSegments(UrlConstants.bySummonerPart, id.ToString()); url.SetQueryParams(new { 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(HelperMethods.LoadTeams(responseString)); }
public async Task <RecentGames> RetrieveRecentGames() { Url url = UrlConstants.UrlBuilder(region, UrlConstants.gameAPIVersion, UrlConstants.gamePart) .AppendPathSegments(UrlConstants.bySummonerPart, id.ToString(), UrlConstants.recentPart); url.SetQueryParams(new { 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(LoadRecentGames(JObject.Parse(responseString))); }
public async Task <Dictionary <string, RunePages> > RetrieveRunePages() { Url url = UrlConstants.UrlBuilder(region, UrlConstants.summonerAPIVersion, UrlConstants.summonerPart) .AppendPathSegments(id.ToString(), UrlConstants.runesPart); url.SetQueryParams(new { 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(LoadRunePages(responseString)); }
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)); }
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."); } }
public async Task <CurrentGameInfoLive> RetrieveCurrentGameInfo() { Url url = new Url(UrlConstants.GetBaseUrl(region)).AppendPathSegments(UrlConstants.observerModeRestpart, "/consumer/getSpectatorGameInfo/", UrlConstants.GetPlatformId(region), id.ToString()); url.SetQueryParams(new { 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(HelperMethods.LoadCurrentGameInfo(JObject.Parse(responseString))); }
public async Task <MatchListAdvanced> RetrieveMatchList(List <int> championIds = null, List <GameConstants.Queue> rankedQueues = null, List <AdvancedMatchHistoryConstants.SeasonAdvanced> seasons = null, long?beginTime = null, long?endTime = null, int?beginIndex = null, int?endIndex = null) { string url = UrlConstants.GetBaseUrl(region) + UrlConstants.apiLolPart + "/" + UrlConstants.GetRegion(region) + UrlConstants.matchListAPIVersion + UrlConstants.matchListPart + UrlConstants.bySummonerPart + "/" + id.ToString() + "?"; if (championIds != null) { if (championIds.Count != 0) { url += "championIds="; for (int i = 0; i < championIds.Count; i++) { if (i + 1 == championIds.Count) { url += championIds[i].ToString() + "&"; } else { url += championIds[i].ToString() + ","; } } } } if (rankedQueues != null) { if (rankedQueues.Count != 0) { string tmpRankedQueues = ""; for (int i = 0; i < rankedQueues.Count; i++) { if (rankedQueues[i] == GameConstants.Queue.None) { continue; } else { if (i + 1 == rankedQueues.Count) { tmpRankedQueues += GameConstants.GetQueue(rankedQueues[i]); } else { tmpRankedQueues += GameConstants.GetQueue(rankedQueues[i]) + ","; } } } if (tmpRankedQueues != "") { url += "rankedQueues=" + tmpRankedQueues + "&"; } } } if (seasons != null) { if (seasons.Count != 0) { string tmpSeasons = ""; for (int i = 0; i < seasons.Count; i++) { if (seasons[i] == AdvancedMatchHistoryConstants.SeasonAdvanced.Other) { continue; } else { if (i + 1 == seasons.Count) { tmpSeasons += AdvancedMatchHistoryConstants.GetSeason(seasons[i]); } else { tmpSeasons += AdvancedMatchHistoryConstants.GetSeason(seasons[i]) + ","; } } } if (tmpSeasons != "") { url += "seasons=" + tmpSeasons + "&"; } } } if (beginTime != null) { url += "beginTime=" + beginTime.Value.ToString() + "&"; } if (endTime != null) { url += "endTime=" + endTime.Value.ToString() + "&"; } if (beginIndex != null) { url += "beginIndex=" + beginIndex.Value.ToString() + "&"; } if (endIndex != null) { url += "endIndex=" + endIndex.Value.ToString() + "&"; } url += "api_key=" + CreepScore.apiKey; Uri uri = new Uri(url); await CreepScore.GetPermission(region); string responseString; try { responseString = await CreepScore.GetWebData(uri); } catch (CreepScoreException) { throw; } return(HelperMethods.LoadMatchListAdvanced(JObject.Parse(responseString))); }