示例#1
0
        public static ChampionDto RetrieveChampionById(ChampionRegion _region, int _id)
        {
            if (_region == ChampionRegion.None)
            {
                return(null);
            }

            string  url      = string.Format(@"https://global.api.pvp.net/api/lol/{0}/v1.2/champion/{1}?api_key={2}", _region, _id, Helpers.apiKey);
            dynamic champion = Helpers.GetJSONObject(url);

            return(new ChampionDto(champion));
        }
示例#2
0
        public static List <ChampionDto> RetrieveAllChampions(ChampionRegion _region, bool _freeToPlay)
        {
            if (_region == ChampionRegion.None)
            {
                return(null);
            }

            string url = string.Format(@"https://global.api.pvp.net/api/lol/{0}/v1.2/champion?freeToPlay={1}&api_key={2}", _region, _freeToPlay, Helpers.apiKey);

            dynamic champions = Helpers.GetJSONObject(url);

            List <ChampionDto> returnMe = new List <ChampionDto>();

            foreach (dynamic champion in champions["champions"])
            {
                returnMe.Add(new ChampionDto(champion));
            }

            return(returnMe);
        }