Commits

lfoust committed 361006a

Added some post methods

Comments (0)

Files changed (15)

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

     <Compile Include="..\Stacky\Enums\PostEventType.cs">
       <Link>Enums\PostEventType.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\PostSort.cs">
+      <Link>Enums\PostSort.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\Enums\PostType.cs">
       <Link>Enums\PostType.cs</Link>
     </Compile>
     <Compile Include="..\Stacky\Enums\QuestionSort.cs">
       <Link>Enums\QuestionSort.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\RevisionType.cs">
+      <Link>Enums\RevisionType.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\Enums\SearchSort.cs">
       <Link>Enums\SearchSort.cs</Link>
     </Compile>

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

     <Compile Include="..\Stacky\Enums\PostEventType.cs">
       <Link>Enums\PostEventType.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\PostSort.cs">
+      <Link>Enums\PostSort.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\Enums\PostType.cs">
       <Link>Enums\PostType.cs</Link>
     </Compile>
     <Compile Include="..\Stacky\Enums\QuestionSort.cs">
       <Link>Enums\QuestionSort.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\RevisionType.cs">
+      <Link>Enums\RevisionType.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\Enums\SearchSort.cs">
       <Link>Enums\SearchSort.cs</Link>
     </Compile>

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

     <Compile Include="..\Stacky\Enums\PostEventType.cs">
       <Link>Enums\PostEventType.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\PostSort.cs">
+      <Link>Enums\PostSort.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\Enums\PostType.cs">
       <Link>Enums\PostType.cs</Link>
     </Compile>
     <Compile Include="..\Stacky\Enums\QuestionSort.cs">
       <Link>Enums\QuestionSort.cs</Link>
     </Compile>
+    <Compile Include="..\Stacky\Enums\RevisionType.cs">
+      <Link>Enums\RevisionType.cs</Link>
+    </Compile>
     <Compile Include="..\Stacky\Enums\SearchSort.cs">
       <Link>Enums\SearchSort.cs</Link>
     </Compile>

trunk/source/Stacky/Entities/Comment.cs

 
 namespace Stacky
 {
-    /// <summary>
-    /// Represents a comment.
-    /// </summary>
     public class Comment : Entity
     {
         private int id;
-        private string body;
-        private DateTime creationDate;
-        private PostType postType;
-        private int postId;
-        private int score;
-        private int editCount;
-        private User owner;
-        private User replyTo;
-
-        /// <summary>
-        /// Gets or sets the <see cref="Comment"/> id.
-        /// </summary>
-        /// <value>The <see cref="Comment"/> id.</value>
         [JsonProperty("comment_id")]
         public int Id
         {
             set { id = value; NotifyOfPropertyChange(() => Id); }
         }
 
-        /// <summary>
-        /// Gets or sets the <see cref="Comment"/> body.
-        /// </summary>
-        /// <value>The <see cref="Comment"/> body.</value>
+        private string body;
         [JsonProperty("body")]
         public string Body
         {
             set { body = value; NotifyOfPropertyChange(() => Body); }
         }
 
-        /// <summary>
-        /// Gets or sets the <see cref="Comment"/> creation date.
-        /// </summary>
-        /// <value>The <see cref="Comment"/> creation date.</value>
+        private DateTime creationDate;
         [JsonProperty("creation_date"), JsonConverter(typeof(UnixDateTimeConverter))]
         public DateTime CreationDate
         {
             set { creationDate = value; NotifyOfPropertyChange(() => CreationDate); }
         }
 
-        /// <summary>
-        /// Gets or sets the <see cref="PostType">post type</see>.
-        /// </summary>
-        /// <value>The type of the post.</value>
+        private PostType postType;
         [JsonProperty("post_type"), JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
         public PostType PostType
         {
             set { postType = value; NotifyOfPropertyChange(() => PostType); }
         }
 
-        /// <summary>
-        /// Gets or sets the Id of the post this comment is on
-        /// </summary>
+        private int postId;
         [JsonProperty("post_id")]
         public int PostId
         {
             set { postId = value; NotifyOfPropertyChange(() => PostId); }
         }
 
-        /// <summary>
-        /// Gets or sets the score.
-        /// </summary>
-        /// <value>The score.</value>
+        private int score;
         [JsonProperty("score")]
         public int Score
         {
             set { score = value; NotifyOfPropertyChange(() => Score); }
         }
 
-        /// <summary>
-        /// Gets or sets the edit count.
-        /// </summary>
-        /// <value>The edit count.</value>
-        [JsonProperty("edit_count")]
-        public int EditCount
+        private bool edited;
+        [JsonProperty("edited")]
+        public bool Edited
         {
-            get { return editCount; }
-            set { editCount = value; NotifyOfPropertyChange(() => EditCount); }
+            get { return edited; }
+            set { edited = value; NotifyOfPropertyChange(() => Edited); }
         }
 
-        /// <summary>
-        /// Gets or sets the <see cref="User"/> associated with this <see cref="Comment"/>.
-        /// </summary>
+        private ShallowUser owner;
         [JsonProperty("owner")]
-        public User Owner
+        public ShallowUser Owner
         {
             get { return owner; }
             set { owner = value; NotifyOfPropertyChange(() => Owner); }
         }
 
-        /// <summary>
-        /// Gets or sets the <see cref="User"/> which this <see cref="Comment"/> was in reply to.
-        /// </summary>
+        private ShallowUser replyTo;
         [JsonProperty("reply_to_user")]
-        public User ReplyTo
+        public ShallowUser ReplyTo
         {
             get { return replyTo; }
             set { replyTo = value; NotifyOfPropertyChange(() => ReplyTo); }

trunk/source/Stacky/Entities/Post.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Newtonsoft.Json;
+
+namespace Stacky
+{
+    public class Post : Entity
+    {
+        private string body;
+        [JsonProperty("body")]
+        public string Body
+        {
+            get { return body; }
+            set { body = value; NotifyOfPropertyChange(() => Body); }
+        }
+
+        private DateTime creationDate;
+        [JsonProperty("creation_date"), JsonConverter(typeof(UnixDateTimeConverter))]
+        public DateTime CreationDate
+        {
+            get { return creationDate; }
+            set { creationDate = value; NotifyOfPropertyChange(() => CreationDate); }
+        }
+
+        private DateTime lastActivityDate;
+        [JsonProperty("last_activity_date"), JsonConverter(typeof(UnixDateTimeConverter))]
+        public DateTime LastActivityDate
+        {
+            get { return lastActivityDate; }
+            set { lastActivityDate = value; NotifyOfPropertyChange(() => LastActivityDate); }
+        }
+
+        private DateTime lastEditDate;
+        [JsonProperty("last_edit_date"), JsonConverter(typeof(UnixDateTimeConverter))]
+        public DateTime LastEditDate
+        {
+            get { return lastEditDate; }
+            set { lastEditDate = value; NotifyOfPropertyChange(() => LastEditDate); }
+        }
+        
+        private PostType postType;
+        [JsonProperty("post_type"), JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+        public PostType PostType
+        {
+            get { return postType; }
+            set { postType = value; NotifyOfPropertyChange(() => PostType); }
+        }
+
+        private int postId;
+        [JsonProperty("post_id")]
+        public int PostId
+        {
+            get { return postId; }
+            set { postId = value; NotifyOfPropertyChange(() => PostId); }
+        }
+
+        private ShallowUser owner;
+        [JsonProperty("owner")]
+        public ShallowUser Owner
+        {
+            get { return owner; }
+            set { owner = value; NotifyOfPropertyChange(() => Owner); }
+        }
+
+        private ShallowUser replyTo;
+        [JsonProperty("reply_to_user")]
+        public ShallowUser ReplyTo
+        {
+            get { return replyTo; }
+            set { replyTo = value; NotifyOfPropertyChange(() => ReplyTo); }
+        }
+
+        private int score;
+        [JsonProperty("score")]
+        public int Score
+        {
+            get { return score; }
+            set { score = value; NotifyOfPropertyChange(() => Score); }
+        }
+
+        private int upVoteCount;
+        [JsonProperty("up_vote_count")]
+        public int UpVoteCount
+        {
+            get { return upVoteCount; }
+            set { upVoteCount = value; NotifyOfPropertyChange(() => UpVoteCount); }
+        }
+
+        private int downVoteCount;
+        [JsonProperty("down_count_vote")]
+        public int DownVoteCount
+        {
+            get { return downVoteCount; }
+            set { downVoteCount = value; NotifyOfPropertyChange(() => DownVoteCount); }
+        }
+
+        private List<Comment> comments = new List<Comment>();
+        [JsonProperty("comments")]
+        public List<Comment> Comments
+        {
+            get { return comments; }
+            set { comments = value; NotifyOfPropertyChange(() => Comments); }
+        }
+    }
+}

trunk/source/Stacky/Entities/Revision.cs

     /// </summary>
     public class Revision : Entity
     {
+                private Guid revisionGuid;
+        [JsonProperty("revision_guid")]
+        public Guid RevisionGuid
+        {
+            get { return revisionGuid; }
+            set { revisionGuid = value; NotifyOfPropertyChange(() => RevisionGuid); }
+        }
+
+        private int revisionNumber;
+        [JsonProperty("revision_number")]
+        public int RevisionNumber
+        {
+            get { return revisionNumber; }
+            set { revisionNumber = value; NotifyOfPropertyChange(() => RevisionNumber); }
+        }
+
+        private RevisionType revisionType;
+        [JsonProperty("revision_type"), JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+        public RevisionType RevisionType
+        {
+            get { return revisionType; }
+            set { revisionType = value; NotifyOfPropertyChange(() => RevisionType); }
+        }
+
+        private PostType postType;
+        [JsonProperty("post_type"), JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+        public PostType PostType
+        {
+            get { return postType; }
+            set { postType = value; NotifyOfPropertyChange(() => PostType); }
+        }
+
+        private int postId;
+        [JsonProperty("post_id")]
+        public int PostId
+        {
+            get { return postId; }
+            set { postId = value; NotifyOfPropertyChange(() => PostId); }
+        }
+
+        private string comment;
+        [JsonProperty("comment")]
+        public string Comment
+        {
+            get { return comment; }
+            set { comment = value; NotifyOfPropertyChange(() => Comment); }
+        }
+
+        private DateTime creationDate;
+        [JsonProperty("creation_date"), JsonConverter(typeof(UnixDateTimeConverter))]
+        public DateTime CreationDate
+        {
+            get { return creationDate; }
+            set { creationDate = value; NotifyOfPropertyChange(() => CreationDate); }
+        }
+
+        private bool isRollback;
+        [JsonProperty("is_rollback")]
+        public bool IsRollback
+        {
+            get { return isRollback; }
+            set { isRollback = value; NotifyOfPropertyChange(() => IsRollback); }
+        }
+
+        private string lastBody;
+        [JsonProperty("last_body")]
+        public string LastBody
+        {
+            get { return lastBody; }
+            set { lastBody = value; NotifyOfPropertyChange(() => LastBody); }
+        }
+
+        private string body;
+        [JsonProperty("body")]
+        public string Body
+        {
+            get { return body; }
+            set { body = value; NotifyOfPropertyChange(() => Body); }
+        }
+
+        private bool setCommunityWiki;
+        [JsonProperty("set_community_wiki")]
+        public bool SetCommunityWiki
+        {
+            get { return setCommunityWiki; }
+            set { setCommunityWiki = value; NotifyOfPropertyChange(() => SetCommunityWiki); }
+        }
+
+        private ShallowUser user;
+        [JsonProperty("user")]
+        public ShallowUser User
+        {
+            get { return user; }
+            set { user = value; NotifyOfPropertyChange(() => User); }
+        }
+
         private List<string> lastTags = new List<string>();
+        [JsonProperty("last_tags")]
+        public List<string> LastTags
+        {
+            get { return lastTags; }
+            set { lastTags = value; NotifyOfPropertyChange(() => LastTags); }
+        }
+
         private List<string> tags = new List<string>();
+        [JsonProperty("tags")]
+        public List<string> Tags
+        {
+            get { return tags; }
+            set { tags = value; NotifyOfPropertyChange(() => Tags); }
+        }
+
         private string title;
-        private string lastTitle;
-        private string comment;
-        private string body;
-        private string lastBody;
-        private DateTime creationDate;
-        private bool isQuestion;
-        private bool isRollback;
-        private Guid revisionGuid;
-        private int revisionNumber;
-        private string revisionType;
-        private bool setCommunityWiki;
-        private int userId;
-
-
-        /// <summary>
-        /// Gets or sets the title.
-        /// </summary>
-        /// <value>The title.</value>
         [JsonProperty("title")]
         public string Title
         {
             set { title = value; NotifyOfPropertyChange(() => Title); }
         }
 
-        /// <summary>
-        /// Gets or sets the last title.
-        /// </summary>
-        /// <value>The last title.</value>
+        private string lastTitle;
         [JsonProperty("last_title")]
         public string LastTitle
         {
             get { return lastTitle; }
             set { lastTitle = value; NotifyOfPropertyChange(() => LastTitle); }
         }
-
-        /// <summary>
-        /// Gets or sets the comment.
-        /// </summary>
-        /// <value>The comment.</value>
-        [JsonProperty("comment")]
-        public string Comment
-        {
-            get { return comment; }
-            set { comment = value; NotifyOfPropertyChange(() => Comment); }
-        }
-
-        /// <summary>
-        /// Gets or sets the body.
-        /// </summary>
-        /// <value>The body.</value>
-        [JsonProperty("body")]
-        public string Body
-        {
-            get { return body; }
-            set { body = value; NotifyOfPropertyChange(() => Body); }
-        }
-
-        /// <summary>
-        /// Gets or sets the last body.
-        /// </summary>
-        /// <value>The last body.</value>
-        [JsonProperty("last_body")]
-        public string LastBody
-        {
-            get { return lastBody; }
-            set { lastBody = value; NotifyOfPropertyChange(() => LastBody); }
-        }
-
-        /// <summary>
-        /// Gets or sets the list of <see cref="Tag">tags</see>.
-        /// </summary>
-        /// <value>The list of <see cref="Tag">tags</see>.</value>
-        [JsonProperty("tags")]
-        public List<string> Tags
-        {
-            get { return tags; }
-            set { tags = value; NotifyOfPropertyChange(() => Tags); }
-        }
-
-        /// <summary>
-        /// Gets or sets the last list of <see cref="Tag">tags</see>.
-        /// </summary>
-        /// <value>The last list of <see cref="Tag">tags</see>.</value>
-        [JsonProperty("last_tags")]
-        public List<string> LastTags
-        {
-            get { return lastTags; }
-            set { lastTags = value; NotifyOfPropertyChange(() => LastTags); }
-        }
-
-        /// <summary>
-        /// Gets or sets the creation date.
-        /// </summary>
-        /// <value>The creation date.</value>
-        [JsonProperty("creation_date"), JsonConverter(typeof(UnixDateTimeConverter))]
-        public DateTime CreationDate
-        {
-            get { return creationDate; }
-            set { creationDate = value; NotifyOfPropertyChange(() => CreationDate); }
-        }
-
-        /// <summary>
-        /// Gets or sets a value indicating whether this instance is question.
-        /// </summary>
-        /// <value>
-        /// 	<c>true</c> if this instance is question; otherwise, <c>false</c>.
-        /// </value>
-        [JsonProperty("is_question")]
-        public bool IsQuestion
-        {
-            get { return isQuestion; }
-            set { isQuestion = value; NotifyOfPropertyChange(() => IsQuestion); }
-        }
-
-        /// <summary>
-        /// Gets or sets a value indicating whether this instance is rollback.
-        /// </summary>
-        /// <value>
-        /// 	<c>true</c> if this instance is rollback; otherwise, <c>false</c>.
-        /// </value>
-        [JsonProperty("is_rollback")]
-        public bool IsRollback
-        {
-            get { return isRollback; }
-            set { isRollback = value; NotifyOfPropertyChange(() => IsRollback); }
-        }
-
-        /// <summary>
-        /// Gets or sets the revision GUID.
-        /// </summary>
-        /// <value>The revision GUID.</value>
-        [JsonProperty("revision_guid")]
-        public Guid RevisionGuid
-        {
-            get { return revisionGuid; }
-            set { revisionGuid = value; NotifyOfPropertyChange(() => RevisionGuid); }
-        }
-
-        /// <summary>
-        /// Gets or sets the revision number.
-        /// </summary>
-        /// <value>The revision number.</value>
-        [JsonProperty("revision_number")]
-        public int RevisionNumber
-        {
-            get { return revisionNumber; }
-            set { revisionNumber = value; NotifyOfPropertyChange(() => RevisionNumber); }
-        }
-
-        /// <summary>
-        /// Gets or sets the type of the revision.
-        /// </summary>
-        /// <value>The type of the revision.</value>
-        [JsonProperty("revision_type")]
-        public string RevisionType
-        {
-            get { return revisionType; }
-            set { revisionType = value; NotifyOfPropertyChange(() => RevisionType); }
-        }
-
-        /// <summary>
-        /// Gets or sets a value indicating whether [set community wiki].
-        /// </summary>
-        /// <value><c>true</c> if [set community wiki]; otherwise, <c>false</c>.</value>
-        [JsonProperty("set_community_wiki")]
-        public bool SetCommunityWiki
-        {
-            get { return setCommunityWiki; }
-            set { setCommunityWiki = value; NotifyOfPropertyChange(() => SetCommunityWiki); }
-        }
-
-        /// <summary>
-        /// Gets or sets the user id.
-        /// </summary>
-        /// <value>The user id.</value>
-        [JsonProperty("user_id")]
-        public int UserId
-        {
-            get { return userId; }
-            set { userId = value; NotifyOfPropertyChange(() => UserId); }
-        }
     }
 }

trunk/source/Stacky/Enums/PostSort.cs

+namespace Stacky
+{
+    public enum PostSort
+    {
+        Activity,
+        Creation,
+        Votes
+    }
+}

trunk/source/Stacky/Enums/RevisionType.cs

+namespace Stacky
+{
+    public enum RevisionType
+    {
+        //[EnumMember(Value = "single_user")]
+        SingleUser,
+        //[EnumMember(Value = "vote_based")]        
+        VoteBased
+    }
+}

trunk/source/Stacky/Stacky.csproj

     <Compile Include="Entities\Entity.cs" />
     <Compile Include="Entities\MigrationInfo.cs" />
     <Compile Include="Entities\NetworkUser.cs" />
+    <Compile Include="Entities\Post.cs" />
     <Compile Include="Entities\PostEvent.cs" />
     <Compile Include="Entities\Privilege.cs" />
     <Compile Include="Entities\Question.cs" />
     <Compile Include="Enums\ErrorCode.cs" />
     <Compile Include="Enums\FavoriteQuestionsSort.cs" />
     <Compile Include="Enums\PostEventType.cs" />
+    <Compile Include="Enums\PostSort.cs" />
     <Compile Include="Enums\PostType.cs" />
     <Compile Include="Enums\QuestionsByUserSort.cs" />
     <Compile Include="Enums\QuestionSort.cs" />
+    <Compile Include="Enums\RevisionType.cs" />
     <Compile Include="Enums\SearchSort.cs" />
     <Compile Include="Enums\SiteState.cs" />
     <Compile Include="Enums\SortDirection.cs" />
     <Compile Include="StackyClient\AnswerMethods.cs" />
     <Compile Include="StackyClient\BadgeMethods.cs" />
     <Compile Include="StackyClient\CommentMethods.cs" />
+    <Compile Include="StackyClient\PostMethods.cs" />
     <Compile Include="StackyClient\PrivilegeMethods.cs" />
     <Compile Include="StackyClient\QuestionMethods.cs" />
     <Compile Include="StackyClient\RevisionMethods.cs" />

trunk/source/Stacky/StackyClient/CommentMethods.cs

 {
     public partial class StackyClient
     {
-        public virtual IPagedList<Comment> GetComments(IEnumerable<int> fromUserIds, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? toUserId = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null)
+        public virtual IPagedList<Comment> GetComments(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)
         {
-            string[] urlParameters = null;
-            if (toUserId.HasValue)
-            {
-                urlParameters = new string[] { fromUserIds.Vectorize(), "comments", toUserId.ToString() };
-            }
-            else
-            {
-                urlParameters = new string[] { fromUserIds.Vectorize(), "comments" };
-            }
-
-            var response = MakeRequest<Comment>("users", urlParameters, new
+            var response = MakeRequest<Comment>("comments", null, new
             {
                 site = this.SiteUrlName,
                 page = page ?? null,
                 pagesize = pageSize ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
-                sort = sortBy.ToString().ToLower(),
+                fromdate = GetDateValue(fromDate),
+                todate = GetDateValue(toDate),
+                sort = GetEnumValue(sortBy),
                 order = GetSortDirection(sortDirection),
                 min = min ?? null,
-                max = max ?? null
+                max = max ?? null,
+                filter = filter
             });
             return new PagedList<Comment>(response);
         }
 
-        public virtual IPagedList<Comment> GetComments(int fromUserId, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? toUserId = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null)
+        public virtual IPagedList<Comment> GetComments(int id, 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 GetComments(fromUserId.ToArray(), sortBy, sortDirection, toUserId, page, pageSize, fromDate, toDate, min, max);
+            return GetComments(id.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        public virtual IPagedList<Comment> GetCommentsByPost(int postId, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null)
+        public virtual IPagedList<Comment> GetComments(IEnumerable<int> ids, 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 GetCommentsByPost(postId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max);
-        }
-
-        public virtual IPagedList<Comment> GetCommentsByPost(IEnumerable<int> postIds, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null)
-        {
-            var response = MakeRequest<Comment>("posts", new string[] { postIds.Vectorize(), "comments" }, new
+            var response = MakeRequest<Comment>("comments", new string[] { ids.Vectorize() }, new
             {
                 site = this.SiteUrlName,
                 page = page ?? null,
                 pagesize = pageSize ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
-                sort = sortBy.ToString().ToLower(),
+                fromdate = GetDateValue(fromDate),
+                todate = GetDateValue(toDate),
+                sort = GetEnumValue(sortBy),
                 order = GetSortDirection(sortDirection),
                 min = min ?? null,
-                max = max ?? null
-            });
-            return new PagedList<Comment>(response);
-        }
-
-        public virtual IPagedList<Comment> GetAnswerComments(int answerId, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null)
-        {
-            return GetAnswerComments(answerId.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max);
-        }
-
-        public virtual IPagedList<Comment> GetAnswerComments(IEnumerable<int> answerIds, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null)
-        {
-            var response = MakeRequest<Comment>("answers", new string[] { answerIds.Vectorize(), "comments" }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null
-            });
-            return new PagedList<Comment>(response);
-        }
-
-        /// <summary>
-        /// Gets all the comments in the site
-        /// </summary>
-        /// <param name="sortBy">How the current sort should be ordered.</param>
-        /// <param name="sortDirection"></param>
-        /// <param name="page">The pagination offset for the current collection. Affected by the specified pagesize.</param>
-        /// <param name="pageSize">The number of collection results to display during pagination. Should be between 0 and 100 inclusive.</param>
-        /// <param name="fromDate"> Unix timestamp of the minimum creation date on a returned item.</param>
-        /// <param name="toDate">Unix timestamp of the maximum creation date on a returned item.</param>
-        /// <param name="min">Minimum of the range to include in the response according to the current sort.</param>
-        /// <param name="max">Maximum of the range to include in the response according to the current sort.</param>
-        /// <returns></returns>
-        public virtual IPagedList<Comment> GetComments(CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null)
-        {
-            var response = MakeRequest<Comment>("answers", null, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null
+                max = max ?? null,
+                filter = filter
             });
             return new PagedList<Comment>(response);
         }

trunk/source/Stacky/StackyClient/PostMethods.cs

+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace Stacky
+{
+    public partial class StackyClient
+    {
+        public IPagedList<Post> GetPosts(PostSort? 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<Post, PostSort>("posts", null,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        public IPagedList<Post> GetPosts(IEnumerable<int> ids, PostSort? 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<Post, PostSort>("posts", new string[] { ids.Vectorize() },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        public Post GetPosts(int id, PostSort? 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 GetPosts(id.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter).FirstOrDefault();
+        }
+
+        public IPagedList<Comment> GetPostComments(IEnumerable<int> ids, 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, CommentSort>("posts", new string[] { ids.Vectorize(), "comments" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        public Revision GetPostRevision(int id, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, string filter = null)
+        {
+            return GetPostRevision(id.ToArray(), page, pageSize, fromDate, toDate, filter).FirstOrDefault();
+        }
+
+        public IPagedList<Revision> GetPostRevision(IEnumerable<int> ids, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, string filter = null)
+        {
+            return Execute<Revision, CommentSort>("posts", new string[] { ids.Vectorize(), "revisions" },
+                null, null, page, pageSize, fromDate, toDate, null, null, filter);
+        }
+    }
+}

trunk/source/Stacky/StackyClient/StackyClient.cs

             return WebClient.MakeRequest(url);
         }
 
+        protected IPagedList<TEntity> Execute<TEntity, TSort, TMinMax>(string methodName, string[] urlArguments, TSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, TMinMax? min = null, TMinMax? max = null, string filter = null)
+            where TEntity : Entity, new()
+            where TSort : struct
+            where TMinMax : struct
+        {
+            var response = MakeRequest<TEntity>(methodName, urlArguments, new
+            {
+                site = this.SiteUrlName,
+                page = page ?? null,
+                pagesize = pageSize ?? null,
+                fromdate = GetDateValue(fromDate),
+                todate = GetDateValue(toDate),
+                sort = GetEnumValue(sortBy),
+                order = GetSortDirection(sortDirection),
+                min = min.HasValue ? min : null,
+                max = max.HasValue ? max : null,
+                filter = filter
+            });
+            return new PagedList<TEntity>(response);
+        }
+
+        protected IPagedList<TEntity> Execute<TEntity, TSort>(string methodName, string[] urlArguments, TSort? 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)
+            where TEntity : Entity, new()
+            where TSort : struct
+        {
+            var response = MakeRequest<TEntity>(methodName, urlArguments, new
+            {
+                site = this.SiteUrlName,
+                page = page ?? null,
+                pagesize = pageSize ?? null,
+                fromdate = GetDateValue(fromDate),
+                todate = GetDateValue(toDate),
+                sort = GetEnumValue(sortBy),
+                order = GetSortDirection(sortDirection),
+                min = GetDateValue(min),
+                max = GetDateValue(max),
+                filter = filter
+            });
+            return new PagedList<TEntity>(response);
+        }
+
         #endregion
 
         #region Properties

trunk/source/Tests/Stacky.IntegrationTests/CommentTests.cs

             Assert.IsNotNull(comment.Owner.DisplayName);
         }
 
-        [TestMethod]
-        public void GetCommentsByPost_ByQuestionId()
-        {
-            var comments = Client.GetCommentsByPost(9033);
-            Assert.IsNotNull(comments);
-            Assert.AreEqual(PostType.Question, comments.FirstOrDefault().PostType);
-        }
+        //[TestMethod]
+        //public void GetCommentsByPost_ByQuestionId()
+        //{
+        //    var comments = Client.GetCommentsByPost(9033);
+        //    Assert.IsNotNull(comments);
+        //    Assert.AreEqual(PostType.Question, comments.FirstOrDefault().PostType);
+        //}
 
-        [TestMethod]
-        public void GetCommentsByPost_ByAnswerId()
-        {
-            var comments = Client.GetCommentsByPost(11738);
-            Assert.IsNotNull(comments);
-            Assert.AreEqual(PostType.Answer, comments.FirstOrDefault().PostType);
-        }
+        //[TestMethod]
+        //public void GetCommentsByPost_ByAnswerId()
+        //{
+        //    var comments = Client.GetCommentsByPost(11738);
+        //    Assert.IsNotNull(comments);
+        //    Assert.AreEqual(PostType.Answer, comments.FirstOrDefault().PostType);
+        //}
 
-        [TestMethod]
-        public void GetAnswerComments()
-        {
-            var answers = Client.GetAnswerComments(1330865);
-            Assert.IsNotNull(answers);
-        }
+        //[TestMethod]
+        //public void GetAnswerComments()
+        //{
+        //    var answers = Client.GetAnswerComments(1330865);
+        //    Assert.IsNotNull(answers);
+        //}
     }
 }

trunk/source/Tests/Stacky.IntegrationTests/PostTests.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace Stacky.IntegrationTests
+{
+    [TestClass]
+    public class PostTests : IntegrationTest
+    {
+        [TestMethod]
+        public void GetPosts()
+        {
+            var posts = Client.GetPosts();
+            Assert.IsNotNull(posts);
+        }
+
+        [TestMethod]
+        public void GetPostsWithId()
+        {
+            int id = 8429231;
+            var post = Client.GetPosts(id);
+            Assert.IsNotNull(post);
+            Assert.AreEqual(id, post.PostId);
+        }
+    }
+}

trunk/source/Tests/Stacky.IntegrationTests/Stacky.IntegrationTests.csproj

     <Compile Include="HostSiteTests.cs" />
     <Compile Include="IntegrationTest.cs" />
     <Compile Include="PagerTests.cs" />
+    <Compile Include="PostTests.cs" />
     <Compile Include="PrivilegeTests.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="QuestionTests.cs" />