Esempio n. 1
0
 private static IObservable <T> GetPolling <T>(this TwitterClient client, Func <TwitterClient, string, IObservable <T> > selector) where T : ITweetItem
 {
     return(Observable.Create <T>(obs =>
     {
         string sinceId = null;
         return CreateTimerObservable()
         .SelectMany(_ => selector(client, sinceId))
         .Do(tweet => sinceId = tweet.Id)
         .Subscribe(obs.OnNext);
     }));
 }
Esempio n. 2
0
 public static IObservable <Tweet> GetConversation(this TwitterClient client, Tweet sourceTweet)
 {
     return(Observable.Create <Tweet>(obs =>
     {
         Tweet t = sourceTweet;
         obs.OnNext(t);
         while (!string.IsNullOrEmpty(t.InReplyToStatusId))
         {
             t = client.GetTweet(t.InReplyToStatusId).First();
             obs.OnNext(t);
         }
         obs.OnCompleted();
         return Disposable.Empty;
     }));
 }
Esempio n. 3
0
 public static IObservable <Tweet> GetPollingListStatuses(this TwitterClient client, string id)
 {
     Enforce.NotNullOrEmpty(id);
     return(client.GetPolling((x, sinceId) => x.GetListStatuses(id)));
 }
Esempio n. 4
0
 public static IObservable <SearchResult> GetPollingSearch(this TwitterClient client, string query)
 {
     Enforce.NotNullOrEmpty(query);
     return(client.GetPolling((x, sinceId) => x.GetSearch(query, sinceId)));
 }
Esempio n. 5
0
 public static IObservable <Tweet> GetPollingUserTimeline(this TwitterClient client, string screenName)
 {
     Enforce.NotNullOrEmpty(screenName);
     return(client.GetPolling((x, sinceId) => x.GetUserTimeline(screenName, sinceId)));
 }
Esempio n. 6
0
 public static IObservable <DirectMessage> GetPollingDirectMessages(this TwitterClient client)
 {
     return(client.GetPolling((x, sinceId) => x.GetDirectMessages(sinceId)));
 }
Esempio n. 7
0
 public static IObservable <RateLimitStatus> GetPollingRateLimitStatus(this TwitterClient client)
 {
     return(CreateTimerObservable().SelectMany(_ => client.GetRateLimitStatus()));
 }
Esempio n. 8
0
 public static IObservable <Tweet> GetStreamingStatuses(this TwitterClient client)
 {
     return(client.GetHomeTimeline()
            .Merge(client.GetMentions())
            .Concat(client.GetStreamingHomeline()));
 }