Exemplo n.º 1
0
        public NewsFeed GetNewsFeed(string _userToken, DateTime _start, DateTime _end, string _sourceIds)
        {
            try
            {
                var request = RequestBuilder.BuildNewsFeedRequest(_userToken, m_currentVkVersion,
                                                                  _start, _end, _sourceIds);

                var responseData = m_requestExecutor.Execute(request);

                var getVideoFunc = new Func <VideoInfo, string>((_arg) =>
                {
                    try
                    {
                        var getVideoRequest = RequestBuilder.BuildGetVideoRequest(_userToken, m_currentVkVersion, _arg.OwnerId, _arg.VideoId);

                        var videoResponseData = m_requestExecutor.Execute(getVideoRequest);

                        return(videoResponseData);
                    }
                    catch (Exception ex)
                    {
                        throw new VkException("Failed to get video", ex);
                    }
                });

                var newsFeed = m_newsFeedDeserializer.Deserialize(responseData, getVideoFunc);

                return(newsFeed);
            }
            catch (Exception ex)
            {
                throw new VkException("Failed to get newsfeed", ex);
            }
        }