Список параметров для метода Messages.GetDialogs
Example #1
0
 /// <summary>
 /// Привести к типу VkParameters.
 /// </summary>
 /// <param name="p">Параметры.</param>
 /// <returns></returns>
 internal static VkParameters ToVkParameters(MessagesDialogsGetParams p)
 {
     return(new VkParameters
     {
         { "start_message_id", p.StartMessageId },
         { "offset", p.Offset },
         { "count", p.Count },
         { "unread", p.Unread },
         { "preview_length", p.PreviewLength }
     });
 }
Example #2
0
		/// <summary>
		/// Привести к типу VkParameters.
		/// </summary>
		/// <param name="p">Параметры.</param>
		/// <returns></returns>
		internal static VkParameters ToVkParameters(MessagesDialogsGetParams p)
        {
            return new VkParameters
            {
                { "start_message_id", p.StartMessageId },
                { "offset", p.Offset },
                { "count", p.Count },
                { "unread", p.Unread },
                { "preview_length", p.PreviewLength }
            };
        }
Example #3
0
 /// <summary>
 /// Привести к типу VkParameters.
 /// </summary>
 /// <param name="p">Параметры.</param>
 /// <returns></returns>
 public static VkParameters ToVkParameters(MessagesDialogsGetParams p)
 {
     return(new VkParameters
     {
         { "start_message_id", p.StartMessageId },
         { "offset", p.Offset },
         { "count", p.Count },
         { "unread", p.Unread },
         { "preview_length", p.PreviewLength },
         { "important", p.Important },
         { "unanswered", p.Unanswered }
     });
 }
Example #4
0
        public ReadOnlyCollection<Message> GetDialogs(out int totalCount, out int unreadCount, uint count = 20, int? offset = null, bool unread = false, long? startMessageId = null, uint? previewLength = null)
        {
            var parameters = new MessagesDialogsGetParams
            {
                StartMessageId = startMessageId,
                Offset = offset.Value,
                PreviewLength = previewLength,
                Count = count,
                Unread = unread
            };
            var response = _vk.Call("messages.getDialogs", parameters);

            // При загрузке списка непрочитанных диалогов в параметре count передается значение unreadCount,
            // а значение totalCount не возвращаеться
            totalCount = response["count"];
            if (unread)
            {
                unreadCount = totalCount;
            }
            else
            {
                unreadCount = response.ContainsKey("unread_dialogs") ? response["unread_dialogs"] : 0;
            }
            return GetDialogs(parameters).Messages;
        }