Exemplo n.º 1
0
        static public List <TwitterItem> getRetweets(TwitterService service, AccountTwitter account, DoWorkEventArgs e, decimal minimumId)
        {
            IEnumerable <TwitterStatus> retweets;
            List <TwitterItem>          allTweets = new List <TwitterItem>();

            try
            {
                ListRetweetsOfMyTweetsOptions options = new TweetSharp.ListRetweetsOfMyTweetsOptions();
                options.Count = Properties.Settings.Default.TwitterItemsFetchInPast;
                if (minimumId >= 0)
                {
                    options.SinceId = Convert.ToInt64(minimumId);
                }

                IAsyncResult result = service.BeginListRetweetsOfMyTweets(options);
                retweets = service.EndListRetweetsOfMyTweets(result);

                foreach (TwitterStatus status in retweets)
                {
                    if (e != null)
                    {
                        if (e.Cancel)
                        {
                            AppController.Current.Logger.writeToLogfile("Cancel received for retweets");
                            break;
                        }
                    }
                    allTweets.Add(API.TweetSharpConverter.getItemFromStatus(status, account));
                    foreach (TwitterItem item in allTweets)
                    {
                        item.isRetweetedToMe = true;
                    }
                }
            }
            catch
            {
                // xxx
            }
            return(allTweets);
        }
		public virtual void ListRetweetsOfMyTweets(ListRetweetsOfMyTweetsOptions options, Action<IEnumerable<TwitterStatus>, TwitterResponse> action)
		{
			var count = options.Count;
			var since_id = options.SinceId;
			var max_id = options.MaxId;
			var trim_user = options.TrimUser;
			var include_entities = options.IncludeEntities;
			var include_user_entities = options.IncludeUserEntities;
			
			WithHammock(action, "statuses/retweets_of_me", FormatAsString, "?count=", count, "&since_id=", since_id, "&max_id=", max_id, "&trim_user="******"&include_entities=", include_entities, "&include_user_entities=", include_user_entities);
		}
		public virtual IAsyncResult BeginListRetweetsOfMyTweets(ListRetweetsOfMyTweetsOptions options)
		{
			var count = options.Count;
			var since_id = options.SinceId;
			var max_id = options.MaxId;
			var trim_user = options.TrimUser;
			var include_entities = options.IncludeEntities;
			var include_user_entities = options.IncludeUserEntities;
				

			return BeginWithHammock<IEnumerable<TwitterStatus>>(WebMethod.Get, "statuses/retweets_of_me", FormatAsString, "?count=", count, "&since_id=", since_id, "&max_id=", max_id, "&trim_user="******"&include_entities=", include_entities, "&include_user_entities=", include_user_entities);
		}
		public virtual Task<TwitterResponse<IEnumerable<TwitterStatus>>> ListRetweetsOfMyTweetsAsync(ListRetweetsOfMyTweetsOptions options)
		{
			var count = options.Count;
			var since_id = options.SinceId;
			var max_id = options.MaxId;
			var trim_user = options.TrimUser;
			var include_entities = options.IncludeEntities;
			var include_user_entities = options.IncludeUserEntities;
				
			
			return ExecuteRequest<IEnumerable<TwitterStatus>>("statuses/retweets_of_me", FormatAsString, "?count=", count, "&since_id=", since_id, "&max_id=", max_id, "&trim_user="******"&include_entities=", include_entities, "&include_user_entities=", include_user_entities);
		}