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 <Dictionary <string, List <Team> > > RetrieveTeams(CreepScore.Region region, List <long> summonerIds) { string ids = ""; if (summonerIds.Count > 10) { throw new CreepScoreException("Cannot retrieve more than 10 summoners at once."); } for (int i = 0; i < summonerIds.Count; i++) { if (i != summonerIds.Count - 1) { ids += summonerIds[i].ToString() + ","; } else { ids += summonerIds[i].ToString(); } } Uri uri; if (ids != "") { Url url = UrlConstants.UrlBuilder(region, UrlConstants.teamAPIVersion, UrlConstants.teamPart) .AppendPathSegments(UrlConstants.bySummonerPart, ids); url.SetQueryParams(new { api_key = apiKey }); uri = new Uri(url.ToString()); } else { throw new CreepScoreException("Cannot have an empty list of summoner IDs."); } await GetPermission(region); string responseString; try { responseString = await GetWebData(uri); } catch (CreepScoreException) { throw; } return(HelperMethods.LoadTeams(responseString)); }