stacky / trunk / source / Stacky.Net35 / StackyClient / CommentMethods.cs

Diff from to

trunk/source/Stacky.Net35/StackyClient/CommentMethods.cs

 {
     public partial class StackyClient
     {
-        public virtual IPagedList<Comment> GetComments(IEnumerable<int> fromUserIds)
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments
+        /// </summary>
+        public IPagedList<Comment> GetComments()
         {
-            return GetComments(fromUserIds, new CommentOptions());
+            return GetComments(null);
         }
 
-        public virtual IPagedList<Comment> GetComments(IEnumerable<int> fromUserIds, CommentOptions options)
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments
+        /// </summary>
+        public IPagedList<Comment> GetComments(Options<CommentSort> options)
         {
-            string[] urlParameters = null;
-            if (options.ToUserId.HasValue)
-            {
-                urlParameters = new string[] { fromUserIds.Vectorize(), "comments", options.ToUserId.ToString() };
-            }
-            else
-            {
-                urlParameters = new string[] { fromUserIds.Vectorize(), "comments" };
-            }
-
-            var response = MakeRequest<Comment>("users", urlParameters, new
-            {
-                site = this.SiteUrlName,
-                page = options.Page ?? null,
-                pagesize = options.PageSize ?? null,
-                fromdate = GetDateValue(options.FromDate),
-                todate = GetDateValue(options.ToDate),
-                sort = options.SortBy.ToString().ToLower(),
-                order = GetSortDirection(options.SortDirection),
-                min = options.Min ?? null,
-                max = options.Max ?? null
-            });
-            return new PagedList<Comment>(response);
+            return Execute<Comment>("comments", null, options);
         }
 
-        public virtual IPagedList<Comment> GetComments(int fromUserId)
+        public IPagedList<Comment> GetComments(int id, Options<CommentSort> options)
         {
-            return GetComments(fromUserId.ToArray(), new CommentOptions());
+            return GetComments(id.ToArray(), options);
         }
 
-        public virtual IPagedList<Comment> GetComments(int fromUserId, CommentOptions options)
+        public IPagedList<Comment> GetComments(IEnumerable<int> ids, Options<CommentSort> options)
         {
-            return GetComments(fromUserId.ToArray(), options);
-        }
-
-        public virtual IPagedList<Comment> GetCommentsByPost(int postId)
-        {
-            return GetCommentsByPost(postId, new CommentsByPostOptions());
-        }
-
-        public virtual IPagedList<Comment> GetCommentsByPost(int postId, CommentsByPostOptions options)
-        {
-            return GetCommentsByPost(postId.ToArray(), options);
-        }
-
-        public virtual IPagedList<Comment> GetCommentsByPost(IEnumerable<int> postIds)
-        {
-            return GetCommentsByPost(postIds, new CommentsByPostOptions());
-        }
-
-        public virtual IPagedList<Comment> GetCommentsByPost(IEnumerable<int> postIds, CommentsByPostOptions options)
-        {
-            var response = MakeRequest<Comment>("posts", new string[] { postIds.Vectorize(), "comments" }, new
-            {
-                site = this.SiteUrlName,
-                page = options.Page ?? null,
-                pagesize = options.PageSize ?? null,
-                fromdate = GetDateValue(options.FromDate),
-                todate = GetDateValue(options.ToDate),
-                sort = options.SortBy.ToString().ToLower(),
-                order = GetSortDirection(options.SortDirection),
-            });
-            return new PagedList<Comment>(response);
-        }
-
-        public virtual IPagedList<Comment> GetAnswerComments(int answerId)
-        {
-            return GetAnswerComments(answerId, new CommentsByPostOptions());
-        }
-
-        public virtual IPagedList<Comment> GetAnswerComments(int answerId, CommentsByPostOptions options)
-        {
-            return GetAnswerComments(answerId.ToArray(), options);
-        }
-
-        public virtual IPagedList<Comment> GetAnswerComments(IEnumerable<int> answerIds)
-        {
-            return GetAnswerComments(answerIds, new CommentsByPostOptions());
-        }
-
-        public virtual IPagedList<Comment> GetAnswerComments(IEnumerable<int> answerIds, CommentsByPostOptions options)
-        {
-            var response = MakeRequest<Comment>("answers", new string[] { answerIds.Vectorize(), "comments" }, new
-            {
-                site = this.SiteUrlName,
-                page = options.Page ?? null,
-                pagesize = options.PageSize ?? null,
-                fromdate = GetDateValue(options.FromDate),
-                todate = GetDateValue(options.ToDate),
-                sort = options.SortBy.ToString().ToLower(),
-                order = GetSortDirection(options.SortDirection),
-                min = options.Min ?? null,
-                max = options.Max ?? null
-            });
-            return new PagedList<Comment>(response);
+            return Execute<Comment>("comments", new string[] { ids.Vectorize() }, options);
         }
     }
 }
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.