public IEnumerable <PostDetail> GetSubredditPosts(string name, Enums.PostsCategory category = Enums.PostsCategory.TOP, string after = "") { // Get the named subreddit var subReddit = this.RedditClient.Subreddit(name); IEnumerable <PostDetail> posts; // Get the requested category of posts, 'after' is the id of the last post we saw, for pagination purposes. switch (category) { case Enums.PostsCategory.HOT: posts = subReddit.Posts .GetHot(after: after, limit: 20) .ToPostDetailList(); break; case Enums.PostsCategory.NEW: posts = subReddit.Posts .GetNew(after: after, limit: 20) .ToPostDetailList(); break; case Enums.PostsCategory.RISING: posts = subReddit.Posts .GetRising(after: after, limit: 20) .ToPostDetailList(); break; case Enums.PostsCategory.CONTROVERSIAL: posts = subReddit.Posts .GetControversial(after: after, limit: 20) .ToPostDetailList(); break; case Enums.PostsCategory.TOP: default: posts = subReddit.Posts .GetTop(after: after, limit: 20) .ToPostDetailList(); break; } return(posts); }
public IEnumerable <PostDetail> GetSubredditPosts(string name = "funny", Enums.PostsCategory category = Enums.PostsCategory.HOT, string after = "") { return(this.subredditService.GetSubredditPosts(name, category, after)); }