Exemplo n.º 1
0
        private List <Comment> GetComments(Group group, Topic topic, DateTime dateStart, DateTime dateFinish)
        {
            List <Comment>         resultComments = new List <Comment>();
            List <Comment>         newComments;
            BoardGetCommentsParams commentsParams = new BoardGetCommentsParams
            {
                TopicId = topic.Id,
                GroupId = group.Id,
                Count   = 100,
                Offset  = 0
            };

            do
            {
                try
                {
                    newComments = Vk.Board.GetComments(commentsParams).Items.ToList();
                }
                catch
                {
                    System.Threading.Thread.Sleep(1000);
                    newComments = Vk.Board.GetComments(commentsParams).Items.ToList();
                }
                commentsParams.Offset += commentsParams.Count;
                if (newComments.Count > 0)
                {
                    newComments = SelectionOnTime(newComments, dateStart, dateFinish);
                    resultComments.AddRange(newComments);
                }
            }while (newComments.Count != 0);
            return(resultComments);
        }
Exemplo n.º 2
0
 public TopicsFeed GetComments(BoardGetCommentsParams @params, bool skipAuthorization = true)
 {
     var response = _vk.Call("board.getComments", @params, skipAuthorization);
     var result = new TopicsFeed
     {
         Count = response["count"],
         Items = response["items"].ToReadOnlyCollectionOf<Comment>(x => x),
         Profiles = response["profiles"].ToReadOnlyCollectionOf<User>(x => x),
         Groups = response["groups"].ToReadOnlyCollectionOf<Group>(x => x)
     };
     return result;
 }
Exemplo n.º 3
0
        public TopicsFeed GetComments(BoardGetCommentsParams @params, bool skipAuthorization = false)
        {
            var response = _vk.Call("board.getComments", @params, skipAuthorization);
            var result   = new TopicsFeed
            {
                Count    = response["count"],
                Items    = response["items"].ToReadOnlyCollectionOf <Comment>(x => x),
                Profiles = response["profiles"].ToReadOnlyCollectionOf <User>(x => x),
                Groups   = response["groups"].ToReadOnlyCollectionOf <Group>(x => x)
            };

            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Возвращает список сообщений в указанной теме.
        /// </summary>
        /// <param name="params"> Входные параметры выборки. </param>
        /// <param name="skipAuthorization"> Если <c> true </c> то пропустить авторизацию. </param>
        /// <returns>
        /// </returns>
        /// <remarks>
        /// Страница документации ВКонтакте
        /// <see href="https://new.vk.com/dev/board.getComments" />.
        /// </remarks>
        public TopicsFeed GetComments(BoardGetCommentsParams @params, bool skipAuthorization = false)
        {
            var response = _vk.Call(methodName: "board.getComments", parameters: @params, skipAuthorization: skipAuthorization);

            var result = new TopicsFeed
            {
                Count      = response[key : "count"]
                , Items    = response[key : "items"].ToReadOnlyCollectionOf <CommentBoard>(selector : x => x)
                , Profiles = response[key : "profiles"].ToReadOnlyCollectionOf <User>(selector : x => x)
                , Groups   = response[key : "groups"].ToReadOnlyCollectionOf <Group>(selector : x => x)
            };

            return(result);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Возвращает список сообщений в указанной теме.
 /// </summary>
 /// <param name="params"> Входные параметры выборки. </param>
 /// <param name="skipAuthorization"> Если <c> true </c> то пропустить авторизацию. </param>
 /// <returns>
 /// </returns>
 /// <remarks>
 /// Страница документации ВКонтакте
 /// <see href="https://new.vk.com/dev/board.getComments" />.
 /// </remarks>
 public Task <TopicsFeed> GetCommentsAsync(BoardGetCommentsParams @params, bool skipAuthorization = false)
 {
     return(TypeHelper.TryInvokeMethodAsync(func: () =>
                                            _vk.Board.GetComments(@params: @params, skipAuthorization: skipAuthorization)));
 }