From caf9fe0a330b093cb9426fb1d4530548ddf6ee6e Mon Sep 17 00:00:00 2001 From: dpparekh Date: Wed, 18 Sep 2013 13:23:05 -0500 Subject: [PATCH 1/2] Added ability to retrieve timeline with since_id parameter I updated the code to allow to pull timeline from a specific unqiue tweet id. --- oAuthTwitterWrapper/App.config | 3 ++- oAuthTwitterWrapper/ITimeLineSettings.cs | 1 + oAuthTwitterWrapper/OAuthTwitterWrapper.cs | 6 ++++-- oAuthTwitterWrapper/TimeLineSettings.cs | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/oAuthTwitterWrapper/App.config b/oAuthTwitterWrapper/App.config index 043986b..e2a99d1 100644 --- a/oAuthTwitterWrapper/App.config +++ b/oAuthTwitterWrapper/App.config @@ -4,7 +4,8 @@ - + + diff --git a/oAuthTwitterWrapper/ITimeLineSettings.cs b/oAuthTwitterWrapper/ITimeLineSettings.cs index 434b55e..5c9d2e2 100644 --- a/oAuthTwitterWrapper/ITimeLineSettings.cs +++ b/oAuthTwitterWrapper/ITimeLineSettings.cs @@ -8,5 +8,6 @@ public interface ITimeLineSettings string ScreenName { get; set; } string TimelineFormat { get; set; } string TimelineUrl { get; } + string Since_ID { get; set; } } } diff --git a/oAuthTwitterWrapper/OAuthTwitterWrapper.cs b/oAuthTwitterWrapper/OAuthTwitterWrapper.cs index 0fbceb7..46eafe5 100644 --- a/oAuthTwitterWrapper/OAuthTwitterWrapper.cs +++ b/oAuthTwitterWrapper/OAuthTwitterWrapper.cs @@ -31,14 +31,16 @@ public OAuthTwitterWrapper() string include_rts = ConfigurationManager.AppSettings["include_rts"]; string exclude_replies = ConfigurationManager.AppSettings["exclude_replies"]; int count = Convert.ToInt16(ConfigurationManager.AppSettings["count"]); - string timelineFormat = ConfigurationManager.AppSettings["timelineFormat"]; + string timelineFormat = ConfigurationManager.AppSettings["timelineFormat"]; + string since_id = ConfigurationManager.AppSettings["timeline_since_id"]; TimeLineSettings = new TimeLineSettings { ScreenName = screenname, IncludeRts = include_rts, ExcludeReplies = exclude_replies, Count = count, - TimelineFormat = timelineFormat + TimelineFormat = timelineFormat, + Since_ID = since_id }; string searchFormat = ConfigurationManager.AppSettings["searchFormat"]; string searchQuery = ConfigurationManager.AppSettings["searchQuery"]; diff --git a/oAuthTwitterWrapper/TimeLineSettings.cs b/oAuthTwitterWrapper/TimeLineSettings.cs index 35722fa..18ebaad 100644 --- a/oAuthTwitterWrapper/TimeLineSettings.cs +++ b/oAuthTwitterWrapper/TimeLineSettings.cs @@ -12,11 +12,12 @@ public class TimeLineSettings : ITimeLineSettings public string ExcludeReplies { get; set; } public int Count { get; set; } public string TimelineFormat { get; set; } + public string Since_ID { get; set; } public string TimelineUrl { get { - return string.Format(TimelineFormat, ScreenName, IncludeRts, ExcludeReplies, Count); + return string.Format(TimelineFormat, ScreenName, IncludeRts, ExcludeReplies, Count,Since_ID); } } } From 35041588ca26a2e78501c54e545514328789ad67 Mon Sep 17 00:00:00 2001 From: dpparekh Date: Wed, 18 Sep 2013 14:32:08 -0500 Subject: [PATCH 2/2] updated TimeLineSettings.cs Updated timelinesettings to use since_id only if it is available. --- oAuthTwitterWrapper/App.config | 2 +- oAuthTwitterWrapper/TimeLineSettings.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/oAuthTwitterWrapper/App.config b/oAuthTwitterWrapper/App.config index e2a99d1..50b7a6c 100644 --- a/oAuthTwitterWrapper/App.config +++ b/oAuthTwitterWrapper/App.config @@ -4,7 +4,7 @@ - + diff --git a/oAuthTwitterWrapper/TimeLineSettings.cs b/oAuthTwitterWrapper/TimeLineSettings.cs index 18ebaad..79e7266 100644 --- a/oAuthTwitterWrapper/TimeLineSettings.cs +++ b/oAuthTwitterWrapper/TimeLineSettings.cs @@ -17,7 +17,15 @@ public string TimelineUrl { get { - return string.Format(TimelineFormat, ScreenName, IncludeRts, ExcludeReplies, Count,Since_ID); + if (Since_ID != "0") + { + return string.Format(TimelineFormat, ScreenName, IncludeRts, ExcludeReplies, Count); + } + else + { + return string.Format(TimelineFormat + "&since_id={4}", ScreenName, IncludeRts, ExcludeReplies, Count, Since_ID); + } + } } }