Пример #1
0
        /// <summary>
        /// Search using specific terms from a specified time to now
        /// </summary>
        /// <param name="terms">Terms you want to search for</param>
        /// <param name="sortE">Sort the way you want to, see <see cref="Sorting"/></param>
        /// <param name="timeE">Time sorting you want to see</param>
        /// <param name="max">Number of records to return.  -1 for unliminted.</param>
        /// <returns>A list of posts</returns>
        public Listing <Post> Search(string terms, Sorting sortE = Sorting.Relevance, TimeSorting timeE = TimeSorting.All, int max = -1)
        {
            string sort = sortE.ToString().ToLower();
            string time = timeE.ToString().ToLower();

            return(Listing <Post> .Create(WebAgent, SearchUrl(Uri.EscapeUriString(terms), sort, time), max, 100));
        }
Пример #2
0
        /// <summary>
        /// Search for a list of posts from a specific time to another time
        /// </summary>
        /// <param name="from">Time to begin search</param>
        /// <param name="to">Time to end search at</param>
        /// <param name="sortE">Sort of the objects you want to have it in</param>
        /// <param name="max">Number of records to return.  -1 for unliminted.</param>
        /// <returns>A list of posts in the range of time/dates in a specific order</returns>
        public Listing <Post> Search(DateTime from, DateTime to, Sorting sortE = Sorting.New, int max = -1)
        {
            string sort = sortE.ToString().ToLower();

            return(Listing <Post> .Create(WebAgent,
                                          SearchUrlDate(from.DateTimeToUnixTimestamp(),
                                                        to.DateTimeToUnixTimestamp(), sort), max, 100));
        }
Пример #3
0
        /// <summary>
        /// All posts on a subreddit.
        /// </summary>
        /// /// <param name="max">Maximum number of records to return. -1 for unlimited.</param>
        public Listing <Post> GetPosts(int max = -1)
        {
            if (Name == "/")
            {
                return(Listing <Post> .Create(WebAgent, "/.json", max, 100));
            }

            return(Listing <Post> .Create(WebAgent, SubredditPostUrl, max, 100));
        }
Пример #4
0
        /// <summary>
        /// List of Controversial posts
        /// </summary>
        /// <param name="max">Maximum number of records to return.</param>
        private Listing <Post> GetControversial(int max = -1)
        {
            if (Name == "/")
            {
                return(Listing <Post> .Create(WebAgent, "/.json", max, 100));
            }

            return(Listing <Post> .Create(WebAgent, SubredditControversialUrl, max, 100));
        }
Пример #5
0
        /// <summary>
        /// List of rising posts
        /// </summary>
        /// <param name="max">Maximum number of records to return.</param>
        private Listing <Post> GetRising(int max = -1)
        {
            if (Name == "/")
            {
                return(Listing <Post> .Create(WebAgent, "/.json", max, 100));
            }

            return(Listing <Post> .Create(WebAgent, SubredditRisingUrl, max, 100));
        }
Пример #6
0
        /// <summary>
        /// Comments for a subreddit, all of them, irrespective of replies and what it is replying to
        /// </summary>
        public Listing <Comment> GetComments(int max = -1, int limitPerRequest = 25)
        {
            if (Name == "/")
            {
                return(Listing <Comment> .Create(WebAgent, "/comments.json", max, limitPerRequest));
            }

            return(Listing <Comment> .Create(WebAgent, CommentsUrl, max, limitPerRequest));
        }
Пример #7
0
        /// <summary>
        /// List of gilded things
        /// </summary>
        /// <param name="max">Maximum number of records to return.  -1 for unlimited.</param>
        public Listing <VotableThing> GetGilded(int max = -1)
        {
            if (Name == "/")
            {
                return(Listing <VotableThing> .Create(WebAgent, "/.json", max, 100));
            }

            return(Listing <VotableThing> .Create(WebAgent, SubredditGildedUrl, max, 100));
        }
Пример #8
0
        /// <summary>
        /// Posts on the front page of the subreddits
        /// </summary>
        /// <param name="max">Maximum number of records to return.</param>
        private Listing <Post> GetHot(int limit = 100, int max = -1)
        {
            if (Name == "/")
            {
                return(Listing <Post> .Create(WebAgent, "/.json", max, limit));
            }

            return(Listing <Post> .Create(WebAgent, SubredditHotUrl, max, limit));
        }
Пример #9
0
        /// <summary>
        /// All posts on a subreddit.
        /// </summary>
        /// /// <param name="max">Maximum number of records to return. -1 for unlimited.</param>
        public Listing <Post> GetPosts(int limit = 100, int max = -1)
        {
            if (Name == "/")
            {
                return(Listing <Post> .Create(WebAgent, "/.json?raw_json=1", max, limit));
            }

            return(Listing <Post> .Create(WebAgent, SubredditPostUrl, max, limit));
        }
Пример #10
0
        /// <summary>
        /// Top of the subreddit from a particular time.
        /// </summary>
        /// <param name="timePeriod">Timeperiod you want to start at <seealso cref="FromTime"/></param>
        /// <param name="max">Maximum number of records to return.</param>
        /// <returns>The top of the subreddit from a specific time</returns>
        public Listing <Post> GetTop(FromTime timePeriod, int max = -1)
        {
            var period = timePeriod.ToString("g").ToLower();

            if (Name == "/")
            {
                return(Listing <Post> .Create(WebAgent, "/top.json?t=" + period, max, 100));
            }

            return(Listing <Post> .Create(WebAgent, $"{SubredditTopUrl}?t={period}", max, 100));
        }
Пример #11
0
 /// <summary>
 /// Return a <see cref="Listing{T}"/> of posts disliked by the logged in user.
 /// </summary>
 public Listing <Post> GetDislikedPosts(int max = -1) => Listing <Post> .Create(WebAgent, DislikedUrl, max, 100);
Пример #12
0
 /// <summary>
 /// Return the users overview.
 /// </summary>
 public Listing <VotableThing> GetOverview(int max = -1) => Listing <VotableThing> .Create(WebAgent, OverviewUrl, max, 100);
Пример #13
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of sent messages.
 /// </summary>
 public Listing <PrivateMessage> GetSent(int max = -1) => Listing <PrivateMessage> .Create(WebAgent, SentUrl, max, 100);
Пример #14
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of private messages.
 /// </summary>
 public Listing <PrivateMessage> GetPrivateMessages(int max = -1) => Listing <PrivateMessage> .Create(WebAgent, MessagesUrl, max, 100);
Пример #15
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of unmoderated Posts.
 /// </summary>
 public Listing <Post> GetUnmoderatedLinks(int max = -1) => Listing <Post> .Create(WebAgent, UnmoderatedUrl, max, 100);
Пример #16
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of unread messages.
 /// </summary>
 public Listing <Thing> GetUnreadMessages(int max = -1) => Listing <Thing> .Create(WebAgent, UnreadMessagesUrl, max, 100);
Пример #17
0
 /// <summary>
 /// Return a list of subscribed subreddits for the logged in user.
 /// </summary>
 public Listing <Subreddit> GetSubscribedSubreddits(int max = -1) => Listing <Subreddit> .Create(WebAgent, SubscribedSubredditsUrl, max, 100);
Пример #18
0
 /// <summary>
 /// Return a <see cref="Listing{T}"/> of comments made by the user.
 /// </summary>
 public Listing <Comment> GetComments(int max = -1) => Listing <Comment> .Create(WebAgent, CommentsUrl, max, 100);
Пример #19
0
 /// <summary>
 /// Return a <see cref="Listing{T}"/> of posts made by the user.
 /// </summary>
 public Listing <Post> GetPosts(int max = -1) => Listing <Post> .Create(WebAgent, LinksUrl, max, 100);
Пример #20
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of banned users.
 /// </summary>
 public Listing <BannedUser> GetBannedUsers(int max = -1) => Listing <BannedUser> .Create(WebAgent, BannedUsersUrl, max, 100);
Пример #21
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of subreddits moderated by the logged in user.
 /// </summary>
 public Listing <Subreddit> GetModeratorSubreddits(int max = -1) => Listing <Subreddit> .Create(WebAgent, ModeratorUrl, max, 100);
Пример #22
0
 /// <summary>
 /// Get the flair text of a user.
 /// </summary>
 /// <param name="max">Maximum number of records to return.</param>
 public Listing <RedditUser> GetUserFlairList(int max = -1) => Listing <RedditUser> .Create(WebAgent, FlairListUrl, max, 1000);
Пример #23
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of items in the Moderation Queue.
 /// </summary>
 public Listing <VotableThing> GetModerationQueue(int max = -1) => Listing <VotableThing> .Create(WebAgent, ModQueueUrl, max, 100);
Пример #24
0
 /// <summary>
 /// Gets the moderation log of the current subreddit
 /// </summary>
 public Listing <ModAction> GetModerationLog(int max = -1) => Listing <ModAction> .Create(WebAgent, ModLogUrl, max, 500);
Пример #25
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of (old style) modmail.
 /// </summary>
 public Listing <PrivateMessage> GetModMail(int max = -1) => Listing <PrivateMessage> .Create(WebAgent, ModMailUrl, max, 100);
Пример #26
0
        /// <summary>
        /// Gets the moderation log of the current subreddit filtered by the action taken
        /// </summary>
        /// <param name="action">ModActionType of action performed</param>
        /// <param name="max">Maximum number of records to return.</param>
        public Listing <ModAction> GetModerationLog(ModActionType action, int max = -1)
        {
            var url = $"{ModLogUrl}?type={action.ToString("g").ToLower()}";

            return(Listing <ModAction> .Create(WebAgent, url, max, 500));
        }
Пример #27
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of messages in the inbox.
 /// </summary>
 public Listing <PrivateMessage> GetInbox(int max = -1) => Listing <PrivateMessage> .Create(WebAgent, InboxUrl, max, 100);
Пример #28
0
        /// <summary>
        /// Gets the moderation log of the current subreddit filtered by moderator(s) who performed the action
        /// </summary>
        /// <param name="mods">String array of mods to filter by</param>
        /// <param name="max">Maximum number of records to return.</param>
        public Listing <ModAction> GetModerationLog(IEnumerable <string> mods, int max = -1)
        {
            var url = $"{ModLogUrl}?mod={string.Join(",", mods)}";

            return(Listing <ModAction> .Create(WebAgent, url, max, 500));
        }
Пример #29
0
 /// <summary>
 /// Get a <see cref="Listing{T}"/> of username mentions.
 /// </summary>
 public Listing <Comment> GetUsernameMentions(int max = -1) => Listing <Comment> .Create(WebAgent, MentionsUrl, max, 100);
Пример #30
0
        /// <summary>
        /// Gets the moderation log of the current subreddit filtered by the action taken and moderator(s) who performed the action
        /// </summary>
        /// <param name="action">ModActionType of action performed.</param>
        /// <param name="mods">String array of mods to filter by.</param>
        /// <param name="max">Maximum number of records to return.</param>
        /// <returns></returns>
        public Listing <ModAction> GetModerationLog(ModActionType action, IEnumerable <string> mods, int max = -1)
        {
            var url = $"{ModLogUrl}?type={action}";

            return(Listing <ModAction> .Create(WebAgent, url, max, 500));
        }