示例#1
0
文件: VkCountry.cs 项目: aw3s0me/W8VK
        public static VkCountry FromJson(JToken json)
        {
            var vkCountry = new VkCountry();

            vkCountry.Cid = json["cid"].Value <long>();

            if (json["name"] != null)
            {
                vkCountry.Name = json["name"].Value <string>();
            }

            return(vkCountry);
        }
示例#2
0
        public async Task <IEnumerable <VkCountry> > Get(IEnumerable <string> cids)
        {
            var dictionary = new Dictionary <string, string>();

            if (cids != null)
            {
                dictionary.Add("cids", string.Join(",", cids));
            }
            JObject jObject = await new VkRequest(new Uri("https://api.vk.com/method/places.getCountryById"), dictionary, "GET").Execute();

            VkErrorProcessor.ProcessError(jObject);
            IEnumerable <VkCountry> result;

            if (jObject["response"].HasValues)
            {
                result = Enumerable.Select <JToken, VkCountry>(jObject["response"], (JToken u) => VkCountry.FromJson(u));
            }
            else
            {
                result = null;
            }
            return(result);
        }