public IEnumerable<Status> FetchTweetsForFavorites(TwitterPart part) { var screenName = part.Parameter1.Trim(); var count = part.Count; var context = CreateContext(); return context.Favorites.Where(x => x.ScreenName == screenName && x.Count == count); }
public IEnumerable<Status> FetchTweetsForList(TwitterPart part) { var listId = (ulong)XmlHelper.Parse<long>(part.Parameter2.Trim()); var count = part.Count; var context = CreateContext(); return context.List.Where(x => x.ListID == listId && x.Count == count) .SelectMany(x => x.Statuses); }
public IEnumerable<Status> FetchTweetsForPart(TwitterPart part) { var cacheKey = CacheKeyPrefix + part.Id; return _cacheManager.Get(cacheKey, ctx => { ctx.Monitor(_signals.When(WellKnownSignals.TwitterPartChanged)); ctx.Monitor(_clock.When(TimeSpan.FromMinutes(part.CacheMinutes))); return FetchTweets(part).ToList(); }); }
protected IEnumerable<Status> FetchTweets(TwitterPart part) { IEnumerable<Status> tweets; switch (part.FeedType) { case (int)FeedType.Profile: tweets = FetchTweetsForScreenName(part); break; case (int)FeedType.List: tweets = FetchTweetsForList(part); break; case (int)FeedType.Favorites: tweets = FetchTweetsForFavorites(part); break; default: tweets = FetchTweetsForSearch(part); break; } return tweets; }
public IEnumerable<Status> FetchTweetsForSearch(TwitterPart part) { return FetchTweetsForSearch(part.Parameter1, part.Count); }