Параметры метода friends.getRequests
Ejemplo n.º 1
0
        /// <summary>
        /// Привести к типу VkParameters.
        /// </summary>
        /// <param name="p">Параметры.</param>
        /// <returns></returns>
        public static VkParameters ToVkParameters(FriendsGetRequestsParams p)
        {
            var parameters = new VkParameters
            {
                { "offset", p.Offset },
                { "count", p.Count },
                { "extended", p.Extended },
                { "need_mutual", p.NeedMutual },
                { "out", p.Out },
                { "sort", p.Sort },
                { "suggested", p.Suggested }
            };

            return(parameters);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Привести к типу VkParameters.
		/// </summary>
		/// <param name="p">Параметры.</param>
		/// <returns></returns>
		internal static VkParameters ToVkParameters(FriendsGetRequestsParams p)
		{
			var parameters = new VkParameters
			{
				{ "offset", p.Offset },
				{ "count", p.Count },
				{ "extended", p.Extended },
				{ "need_mutual", p.NeedMutual },
				{ "out", p.Out },
				{ "sort", p.Sort },
				{ "suggested", p.Suggested }
			};

			return parameters;
		}
Ejemplo n.º 3
0
		public ReadOnlyCollection<long> GetRequests(int? count = null, int? offset = null, bool extended = false, bool needMutual = false, bool @out = false, bool sort = false, bool suggested = false)
		{
			VkErrors.ThrowIfNumberIsNegative(() => count);
			VkErrors.ThrowIfNumberIsNegative(() => offset);

			var parameters = new FriendsGetRequestsParams
			{
				Offset = offset,
				Count = count,
				Extended = extended,
				NeedMutual = needMutual,
				Out = @out,
				Sort = sort,
				Suggested = suggested
			};

			return GetRequests(parameters).Select(x => x.Key).ToReadOnlyCollection();
		}
Ejemplo n.º 4
0
        public IDictionary<long, ReadOnlyCollection<long>> GetRequests(FriendsGetRequestsParams @params)
        {
            VkResponseArray response = _vk.Call("friends.getRequests", @params);

            // Проверка возвращается ли список объектов или идентификаторы пользователя
            if (response.Count > 0 && response[0].ContainsKey("user_id"))
            {
                var dicResult = new Dictionary<long, ReadOnlyCollection<long>>();
                foreach (var item in response)
                {
                    VkResponseArray mutual = item["mutual"];
                    dicResult.Add(item["user_id"], mutual.ToReadOnlyCollectionOf(x => (long)x));
                }
                return dicResult;
            }

            return response.ToDictionary(x => (long)x, x => new ReadOnlyCollection<long>(new List<long>()));
        }