Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
Ejemplo n.º 12
0
 /// <summary>
 /// Return the users overview.
 /// </summary>
 public Listing <VotableThing> GetOverview(int max = -1) => Listing <VotableThing> .Create(WebAgent, OverviewUrl, max, 100);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
Ejemplo n.º 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));
        }