lfoust avatar lfoust committed c1920f7

Added more user methods

Comments (0)

Files changed (9)

Add a comment to this file

trunk/data/V2.0 Upgrade Checklist.xlsx

Binary file modified.

trunk/source/Stacky.Net35/Stacky.Net35.csproj

     <Compile Include="..\Stacky\Enums\UserType.cs">
       <Link>Enums\UserType.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\VoteType.cs">
+      <Link>Enums\VoteType.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\ErrorResponse.cs">
       <Link>ErrorResponse.cs</Link>
     </Compile>

trunk/source/Stacky.Silverlight/Stacky.Silverlight.csproj

     <Compile Include="..\Stacky\Enums\UserType.cs">
       <Link>Enums\UserType.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\VoteType.cs">
+      <Link>Enums\VoteType.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\ErrorResponse.cs">
       <Link>ErrorResponse.cs</Link>
     </Compile>

trunk/source/Stacky.WindowsPhone/Stacky.WindowsPhone.csproj

     <Compile Include="..\Stacky\Enums\UserType.cs">
       <Link>Enums\UserType.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\VoteType.cs">
+      <Link>Enums\VoteType.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\ErrorResponse.cs">
       <Link>ErrorResponse.cs</Link>
     </Compile>

trunk/source/Stacky/Entities/Privilege.cs

-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
 
 namespace Stacky
 {

trunk/source/Stacky/Entities/Reputation.cs

     /// </summary>
     public class Reputation : Entity
     {
+        private int userId;
+        [JsonProperty("user_id")]
+        public int UserId
+        {
+            get { return userId; }
+            set { userId = value; NotifyOfPropertyChange(() => UserId); }
+        }
+
         private int postId;
-        private PostType postType;
-        private string title;
-        private int positiveReputation;
-        private int negativeReputation;
-        private DateTime onDate;
-
-        /// <summary>
-        /// Gets or sets the post id.
-        /// </summary>
-        /// <value>The post id.</value>
         [JsonProperty("post_id")]
         public int PostId
         {
             set { postId = value; NotifyOfPropertyChange(() => PostId); }
         }
 
-        /// <summary>
-        /// Gets or sets the <see cref="PostType">.
-        /// </summary>
-        /// <value>The type of the post.</value>
+        private PostType postType;
         [JsonProperty("post_type")]
         public PostType PostType
         {
             set { postType = value; NotifyOfPropertyChange(() => PostType); }
         }
 
-        /// <summary>
-        /// Gets or sets the title.
-        /// </summary>
-        /// <value>The title.</value>
+        private VoteType voteType;
+        [JsonProperty("vote_type")]
+        public VoteType VoteType
+        {
+            get { return voteType; }
+            set { voteType = value; NotifyOfPropertyChange(() => VoteType); }
+        }
+
+        private string title;
         [JsonProperty("title")]
         public string Title
         {
             set { title = value; NotifyOfPropertyChange(() => Title); }
         }
 
-        /// <summary>
-        /// Gets or sets the positive reputation.
-        /// </summary>
-        /// <value>The positive reputation.</value>
-        [JsonProperty("positive_rep")]
-        public int PositiveReputation
+        private string link;
+        [JsonProperty("link")]
+        public string Link
         {
-            get { return positiveReputation; }
-            set { positiveReputation = value; NotifyOfPropertyChange(() => PositiveReputation); }
+            get { return link; }
+            set { link = value; NotifyOfPropertyChange(() => Link); }
         }
 
-        /// <summary>
-        /// Gets or sets the negative reputation.
-        /// </summary>
-        /// <value>The negative reputation.</value>
-        [JsonProperty("negative_rep")]
-        public int NegativeReputation
+        private int reputationChange;
+        [JsonProperty("reputation_change")]
+        public int ReputationChange
         {
-            get { return negativeReputation; }
-            set { negativeReputation = value; NotifyOfPropertyChange(() => NegativeReputation); }
+            get { return reputationChange; }
+            set { reputationChange = value; NotifyOfPropertyChange(() => ReputationChange); }
         }
 
-        /// <summary>
-        /// Gets or sets the on date.
-        /// </summary>
-        /// <value>The on date.</value>
+        private DateTime onDate;
         [JsonProperty("on_date"), JsonConverter(typeof(UnixDateTimeConverter))]
         public DateTime OnDate
         {

trunk/source/Stacky/Enums/VoteType.cs

+namespace Stacky
+{
+    using System.Runtime.Serialization;
+
+    public enum VoteType
+    {
+        Accepts,
+        [EnumMember(Value = "up_votes")]
+        UpVotes,
+        [EnumMember(Value = "down_votes")]
+        DownVotes,
+        [EnumMember(Value = "bounties_offered")]
+        BountiesOffered,
+        [EnumMember(Value = "bounties_won")]
+        BountiesWon,
+        Spam,
+        [EnumMember(Value = "suggested_edits")]
+        SuggestedEdits
+    }
+}

trunk/source/Stacky/Stacky.csproj

     <Compile Include="Enums\UserMentionSort.cs" />
     <Compile Include="Enums\UserSort.cs" />
     <Compile Include="Enums\UserType.cs" />
+    <Compile Include="Enums\VoteType.cs" />
     <Compile Include="ErrorResponse.cs" />
     <Compile Include="Helpers\DateHelper.cs" />
     <Compile Include="Helpers\EnumHelper.cs" />

trunk/source/Stacky/StackyClient/UserMethods.cs

         /// <summary>
         /// See: http://api.stackexchange.com/docs/comments-by-users-to-user
         /// </summary>
+        /// TODO: Fix Sort
         public IPagedList<Comment> GetUserCommentsTo(IEnumerable<int> fromIds, IEnumerable<int> toIds, UserSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
         {
             return Execute<Comment>("users", new string[] { fromIds.Vectorize(), "comments", toIds.Vectorize() },
                 sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/favorites-on-users
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserFavoriteQuestions(IEnumerable<int> userIds, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<Question>("users", new string[] { userIds.Vectorize(), "favorites" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/favorites-on-users
+        /// </summary>
+        public IPagedList<Question> GetUserFavoriteQuestions(int userId, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserFavoriteQuestions(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/mentions-on-users
+        /// </summary>
+        public IPagedList<Comment> GetUserMentions(IEnumerable<int> userIds, CommentSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<Comment>("users", new string[] { userIds.Vectorize(), "mentioned" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/mentions-on-users
+        /// </summary>
+        public IPagedList<Comment> GetUserMentions(int userId, CommentSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserMentions(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/privileges-on-users
+        /// </summary>
+        public IPagedList<Privilege> GetUserPrivileges(IEnumerable<int> userIds, int? page = null, int? pageSize = null, string filter = null)
+        {
+            return Execute<Privilege>("users", new string[] { userIds.Vectorize(), "privileges" },
+                null, null, page, pageSize, null, null, null, null, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/privileges-on-users
+        /// </summary>
+        public IPagedList<Privilege> GetUserPrivileges(int userId, CommentSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserPrivileges(userId.ToArray(), page, pageSize, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/questions-on-users
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserQuestions(IEnumerable<int> userIds, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<Question>("users", new string[] { userIds.Vectorize(), "questions" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/questions-on-users
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserQuestions(int userId, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserQuestions(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/no-answer-questions-on-users
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserQuestionsWithNoAnswers(IEnumerable<int> userIds, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<Question>("users", new string[] { userIds.Vectorize(), "questions", "no-answers" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/no-answer-questions-on-users    
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserQuestionsWithNoAnswers(int userId, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserQuestionsWithNoAnswers(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/unaccepted-questions-on-users
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserUnacceptedQuestions(IEnumerable<int> userIds, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<Question>("users", new string[] { userIds.Vectorize(), "questions", "unaccepted" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/unaccepted-questions-on-users    
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserUnacceptedQuestions(int userId, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserUnacceptedQuestions(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/unanswered-questions-on-users
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserUnansweredQuestions(IEnumerable<int> userIds, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<Question>("users", new string[] { userIds.Vectorize(), "questions", "unanswered" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/unanswered-questions-on-users  
+        /// </summary>
+        /// TODO: Fix Sort
+        public IPagedList<Question> GetUserUnansweredQuestions(int userId, QuestionSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserUnansweredQuestions(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/reputation-on-users
+        /// </summary>
+        public IPagedList<Reputation> GetUserReputation(IEnumerable<int> userIds, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, string filter = null)
+        {
+            return Execute<Reputation>("users", new string[] { userIds.Vectorize(), "reputation" },
+                null, null, page, pageSize, fromDate, toDate, null, null, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/reputation-on-users 
+        /// </summary>
+        public IPagedList<Reputation> GetUserReputation(int userId, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, string filter = null)
+        {
+            return GetUserReputation(userId.ToArray(), page, pageSize, fromDate, toDate, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/suggested-edits-on-users
+        /// </summary>
+        public IPagedList<SuggestedEdit> GetUserSuggestedEdits(IEnumerable<int> userIds, SuggestedEditSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<SuggestedEdit>("users", new string[] { userIds.Vectorize(), "suggested-edits" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/suggested-edits-on-users 
+        /// </summary>
+        public IPagedList<SuggestedEdit> GetUserUnansweredQuestions(int userId, SuggestedEditSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserSuggestedEdits(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/tags-on-users
+        /// </summary>
+        public IPagedList<Tag> GetUserTags(IEnumerable<int> userIds, TagSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return Execute<Tag>("users", new string[] { userIds.Vectorize(), "tags" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: https://api.stackexchange.com/docs/tags-on-users
+        /// </summary>
+        public IPagedList<Tag> GetUserTags(int userId, TagSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, DateTime? min = null, DateTime? max = null, string filter = null)
+        {
+            return GetUserTags(userId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
     }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.