Esempio n. 1
0
 /// <summary>
 /// Retrieve the user's post history.
 /// </summary>
 /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
 /// <param name="where">One of (overview, submitted, upvotes, downvoted, hidden, saved, gilded)</param>
 /// <returns>A list of posts.</returns>
 public List <Post> PostHistory(UsersHistoryInput usersHistoryInput, string where = "overview")
 {
     return(usersHistoryInput.sort.Equals("newForced", StringComparison.OrdinalIgnoreCase)
         ? SanitizePosts(Lists.ForceNewSort(Lists.GetPosts(Validate(Dispatch.Users.PostHistory(Name, where, usersHistoryInput)),
                                                           Dispatch)))
         : SanitizePosts(Lists.GetPosts(Validate(Dispatch.Users.PostHistory(Name, where, usersHistoryInput)), Dispatch)));
 }
Esempio n. 2
0
        /// <summary>
        /// This endpoint is a listing.
        /// </summary>
        /// <param name="username">the name of an existing user</param>
        /// <param name="where">One of (overview, submitted, upvotes, downvoted, hidden, saved, gilded, moderated_subreddits)</param>
        /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
        /// <returns>A list of objects containing the requested data.</returns>
        public T GetUser <T>(string username, string where, UsersHistoryInput usersHistoryInput)
        {
            RestRequest restRequest = PrepareRequest("user/" + username + "/" + where);

            restRequest.AddObject(usersHistoryInput);

            return(JsonConvert.DeserializeObject <T>(ExecuteRequest(restRequest)));
        }
Esempio n. 3
0
        /// <summary>
        /// This endpoint is a listing.
        /// </summary>
        /// <param name="username">the name of an existing user</param>
        /// <param name="where">One of (comments, saved, gilded)</param>
        /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
        /// <returns>A list of objects containing the requested data.</returns>
        public CommentContainer CommentHistory(string username, string where, UsersHistoryInput usersHistoryInput)
        {
            RestRequest restRequest = PrepareRequest("user/" + username + "/" + where);

            restRequest.AddObject(usersHistoryInput);

            return(JsonConvert.DeserializeObject <CommentContainer>(ExecuteRequest(restRequest)));
        }
Esempio n. 4
0
        // TODO - The Reddit API sometimes includes a comment with the post history when "links" is specified as the type.  Probably an API bug.  --Kris
        /// <summary>
        /// This endpoint is a listing.
        /// </summary>
        /// <param name="username">the name of an existing user</param>
        /// <param name="where">One of (overview, submitted, upvotes, downvoted, hidden, saved, gilded)</param>
        /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
        /// <returns>A list of objects containing the requested data.</returns>
        public PostContainer PostHistory(string username, string where, UsersHistoryInput usersHistoryInput)
        {
            RestRequest restRequest = PrepareRequest("user/" + username + "/" + where);

            usersHistoryInput.sort = (usersHistoryInput.sort.Equals("newForced", StringComparison.OrdinalIgnoreCase) ? "new" : usersHistoryInput.sort);

            restRequest.AddObject(usersHistoryInput);

            return(JsonConvert.DeserializeObject <PostContainer>(ExecuteRequest(restRequest)));
        }
Esempio n. 5
0
 /// <summary>
 /// Retrieve the user's comment history.
 /// </summary>
 /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
 /// <returns>A list of comments.</returns>
 public List <Comment> CommentHistory(UsersHistoryInput usersHistoryInput)
 {
     return(Lists.GetComments(Validate(Dispatch.Users.CommentHistory(Name, "comments", usersHistoryInput)), Dispatch));
 }
Esempio n. 6
0
 /// <summary>
 /// Get a user's comment history.
 /// This endpoint is a listing.
 /// </summary>
 /// <param name="username">the name of an existing user</param>
 /// <param name="where">One of (comments, saved, gilded)</param>
 /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
 /// <returns>A list of objects containing the requested data.</returns>
 public CommentContainer CommentHistory(string username, string where, UsersHistoryInput usersHistoryInput)
 {
     return(GetUser <CommentContainer>(username, where, usersHistoryInput));
 }
Esempio n. 7
0
 /// <summary>
 /// Get a user's post history.
 /// This endpoint is a listing.
 /// </summary>
 /// <param name="username">the name of an existing user</param>
 /// <param name="where">One of (submitted, upvotes, downvoted, hidden, saved, gilded)</param>
 /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
 /// <returns>A list of objects containing the requested data.</returns>
 public PostContainer PostHistory(string username, string where, UsersHistoryInput usersHistoryInput)
 {
     usersHistoryInput.sort = (usersHistoryInput.sort.Equals("newForced", StringComparison.OrdinalIgnoreCase) ? "new" : usersHistoryInput.sort);
     return(GetUser <PostContainer>(username, where, usersHistoryInput));
 }
Esempio n. 8
0
 /// <summary>
 /// Get a user's post and comment history.
 /// This endpoint is a listing.
 /// </summary>
 /// <param name="username">the name of an existing user</param>
 /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
 /// <returns>A list of objects containing the requested data.</returns>
 public OverviewContainer Overview(string username, UsersHistoryInput usersHistoryInput)
 {
     usersHistoryInput.sort = (usersHistoryInput.sort.Equals("newForced", StringComparison.OrdinalIgnoreCase) ? "new" : usersHistoryInput.sort);
     return(GetUser <OverviewContainer>(username, "overview", usersHistoryInput));
 }
Esempio n. 9
0
 /// <summary>
 /// Retrieve a list of subreddits that the user moderates.
 /// This endpoint is a listing.
 /// </summary>
 /// <param name="username">the name of an existing user</param>
 /// <param name="usersHistoryInput">A valid UsersHistoryInput instance</param>
 /// <returns>A list of objects containing the requested data.</returns>
 public ModeratedListContainer ModeratedSubreddits(string username, UsersHistoryInput usersHistoryInput)
 {
     return(GetUser <ModeratedListContainer>(username, "moderated_subreddits", usersHistoryInput));
 }