Exemple #1
0
        /// <summary>
        /// http://vk.com/developers.php?oid=-1&p=friends.get
        /// </summary>
        public static async Task<string> GetFriendListAsync(string token, int count, int offset, FriendOrderType order)
        {
            string orderValue;
            switch (order)
            {
                case FriendOrderType.FirstName:
                    orderValue = "name";
                    break;
                case FriendOrderType.Rate:
                    orderValue = "hints";
                    break;
                default:
                    throw new ArgumentOutOfRangeException("order");
            }

            string uri = BuildVkApiUri(
                "friends.get",
                new[]
                    {
                        "fields",
                        "count",
                        "offset",
                        "order"
                    },
                new[]
                    {
                        "uid,first_name,last_name,photo,photo_medium,photo_big",
                        count.ToString(),
                        offset.ToString(),
                        orderValue
                    },
                token);
            return await DownloadStringTaskAsync(uri);
        }
Exemple #2
0
 public async Task<List<Friend>> GetFriendListAsync(string token, int count, int offset, FriendOrderType order)
 {
     try
     {
         return JsonHelper.DeserializeList<Friend>(await VkApi.GetFriendListAsync(token, count, offset, order),
                                                   "response");
     }
     catch (WebException e)
     {
         throw new VkException("GetFriendListAsync WebException", e);
     }
 }
 public Task<List<Friend>> GetFriendListAsync(string token, int count, int offset, FriendOrderType order)
 {
     return TaskEx.Run(() => Enumerable.Empty<Friend>().ToList());
 }