diff --git a/RedditSharp/Things/Post.cs b/RedditSharp/Things/Post.cs index 20593c4..9ab67d6 100644 --- a/RedditSharp/Things/Post.cs +++ b/RedditSharp/Things/Post.cs @@ -108,9 +108,6 @@ public Comment[] Comments [JsonConverter(typeof(UrlParser))] public Uri Permalink { get; set; } - [JsonProperty("score")] - public int Score { get; set; } - [JsonProperty("selftext")] public string SelfText { get; set; } diff --git a/RedditSharp/Things/RedditUser.cs b/RedditSharp/Things/RedditUser.cs index 74a2c53..c706b46 100644 --- a/RedditSharp/Things/RedditUser.cs +++ b/RedditSharp/Things/RedditUser.cs @@ -13,6 +13,7 @@ public class RedditUser : Thing private const string SubscribedSubredditsUrl = "/subreddits/mine.json"; private const string LikedUrl = "/user/{0}/liked.json"; private const string DislikedUrl = "/user/{0}/disliked.json"; + private const string SavedUrl = "/user/{0}/saved.json"; private const int MAX_LIMIT = 100; @@ -165,6 +166,24 @@ public Listing GetPosts(Sort sorting = Sort.New, int limit = 25, FromTime return new Listing(Reddit, linksUrl, WebAgent); } + /// + /// Get a listing of comments and posts saved by the user sorted by , from time + /// and limited to . + /// + /// How to sort the comments (hot, new, top, controversial). + /// How many comments to fetch per request. Max is 100. + /// What time frame of comments to show (hour, day, week, month, year, all). + /// The listing of posts and/or comments requested that the user saved. + public Listing GetSaved(Sort sorting = Sort.New, int limit = 25, FromTime fromTime = FromTime.All) + { + if ((limit < 1) || (limit > MAX_LIMIT)) + throw new ArgumentOutOfRangeException("limit", "Valid range: [1," + MAX_LIMIT + "]"); + string savedUrl = string.Format(SavedUrl, Name); + savedUrl += string.Format("?sort={0}&limit={1}&t={2}", Enum.GetName(typeof(Sort), sorting), limit, Enum.GetName(typeof(FromTime), fromTime)); + + return new Listing(Reddit, savedUrl, WebAgent); + } + public override string ToString() { return Name;