lfoust avatar lfoust committed d218c21

Started adding async methods

Comments (0)

Files changed (12)

Add a comment to this file

trunk/data/V2.0 Upgrade Checklist.xlsx

Binary file modified.

trunk/source/Stacky/Stacky.csproj

     <Compile Include="StackyClientAsync\AnswerMethods.cs" />
     <Compile Include="StackyClientAsync\BadgeMethods.cs" />
     <Compile Include="StackyClientAsync\CommentMethods.cs" />
+    <Compile Include="StackyClientAsync\NetworkMethods.cs" />
     <Compile Include="StackyClientAsync\PrivilegeMethods.cs" />
     <Compile Include="StackyClientAsync\QuestionMethods.cs" />
     <Compile Include="StackyClientAsync\RevisionMethods.cs" />

trunk/source/Stacky/StackyClient/AnswerMethods.cs

 namespace Stacky
 {
     public partial class StackyClient
-    {   
-        public virtual IPagedList<Answer> GetUsersAnswers(int userId, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
+    {
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/answers
+        /// </summary>
+        public IPagedList<Answer> GetAnswers(AnswerSort? 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 GetUsersAnswers(userId.ToArray(), sortBy, sortDirection, page, pageSize, includeBody, includeComments, min, max, fromDate, toDate);
-        }
-
-        public virtual IPagedList<Answer> GetUsersAnswers(IEnumerable<int> userIds, QuestionsByUserSort sortBy = QuestionsByUserSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
-        {
-            var response = MakeRequest<Answer>("users", new string[] { userIds.Vectorize(), "answers" }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                comments = includeComments ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            });
-            return new PagedList<Answer>(response);
+            return Execute<Answer>("answers", null,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
         /// <summary>
-        /// Gets the question answers.
+        /// See: http://api.stackexchange.com/docs/answers-by-ids
         /// </summary>
-        /// <param name="questionIds">The question ids.</param>
-        /// <param name="sortBy">The sort by.</param>
-        /// <param name="sortDirection">The sort direction.</param>
-        /// <param name="page">The page.</param>
-        /// <param name="pageSize">Size of the page.</param>
-        /// <param name="includeBody">if set to <c>true</c> [include body].</param>
-        /// <param name="includeComments">if set to <c>true</c> [include comments].</param>
-        /// <param name="min">The min.</param>
-        /// <param name="max">The max.</param>
-        /// <param name="fromDate">From date.</param>
-        /// <param name="toDate">To date.</param>
-        /// <returns></returns>
-        public virtual IPagedList<Answer> GetQuestionAnswers(IEnumerable<int> questionIds, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
+        public IPagedList<Answer> GetAnswers(IEnumerable<int> ids, AnswerSort? 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)
         {
-            var response = MakeRequest<Answer>("questions", new string[] { questionIds.Vectorize(), "answers" }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            });
-            return new PagedList<Answer>(response);
-        }
-
-        public virtual Answer GetAnswer(int answerId, bool includeBody = true, bool includeComments = true)
-        {
-            return GetAnswers(answerId.ToArray(), includeBody: includeBody, includeComments : includeComments).FirstOrDefault();
-        }
-
-        public virtual IPagedList<Answer> GetAnswers(IEnumerable<int> answerIds, AnswerSort sortBy = AnswerSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
-        {
-            var response = MakeRequest<Answer>("answers", new string[] { answerIds.Vectorize() }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            });
-            return new PagedList<Answer>(response);
+            return Execute<Answer>("answers", new string[] { ids.Vectorize() },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
         /// <summary>
-        /// Returns all the answers in the system
+        /// See: http://api.stackexchange.com/docs/answers-by-ids
         /// </summary>
-        /// <param name="sortBy">How a collection should be sorted.</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="includeBody">When "true", a post's body will be included in the response.</param>
-        /// <param name="includeComments">When "true", any comments on a post will be included in the response.</param>
-        /// <param name="includeAnswers"> When "true", the answers to a question will be returned</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>
-        /// <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>
-        /// <returns></returns>
-        public virtual IPagedList<Answer> GetAnswers(AnswerSort sortBy = AnswerSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, bool includeAnswers = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
+        public Answer GetAnswer(int id, AnswerSort? 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)
         {
-            var response = MakeRequest<Answer>("answers", null, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                comments = includeComments ? (bool?)true : null,
-                answers = includeAnswers ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            });
-            return new PagedList<Answer>(response);
+            return GetAnswers(id.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter).FirstOrDefault();
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments-on-answers
+        /// </summary>
+        public IPagedList<Comment> GetAnswerComments(IEnumerable<int> ids, AnswerSort? 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>("answers", new string[] { ids.Vectorize(), "comments" },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments-on-answers
+        /// </summary>
+        public IPagedList<Comment> GetAnswerComments(int id, AnswerSort? 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 GetAnswerComments(id.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
     }
 }

trunk/source/Stacky/StackyClient/BadgeMethods.cs

 			return Execute<Badge, BadgeMinMax>("badges", new string[] { "tags" },
 				sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
 		}
-        
     }
 }

trunk/source/Stacky/StackyClient/CommentMethods.cs

 {
     public partial class StackyClient
     {
-        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)
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments
+        /// </summary>
+        public 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)
         {
-            var response = MakeRequest<Comment>("comments", null, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                fromdate = GetDateValue(fromDate),
-                todate = GetDateValue(toDate),
-                sort = GetEnumValue(sortBy),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                filter = filter
-            });
-            return new PagedList<Comment>(response);
+            return Execute<Comment>("comments", null,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        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)
+        public 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(id.ToArray(), sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        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)
+        public 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)
         {
-            var response = MakeRequest<Comment>("comments", new string[] { ids.Vectorize() }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                fromdate = GetDateValue(fromDate),
-                todate = GetDateValue(toDate),
-                sort = GetEnumValue(sortBy),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                filter = filter
-            });
-            return new PagedList<Comment>(response);
+            return Execute<Comment>("comments", new string[] { ids.Vectorize() },
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
     }
 }

trunk/source/Stacky/StackyClient/NetworkMethods.cs

             return new PagedList<NetworkUser>(response);
         }
 
-        public NetworkUser GetAssociatedUsers(int id, string filter = null)
+        public IPagedList<NetworkUser> GetAssociatedUsers(int id, string filter = null)
         {
-            return GetAssociatedUsers(id.ToArray(), filter: filter).FirstOrDefault();
+            return GetAssociatedUsers(id.ToArray(), filter: filter);
         }
     }
 }

trunk/source/Stacky/StackyClientAsync/AnswerMethods.cs

     public partial class StackyClientAsync
 #endif
     {
-        public virtual void GetUsersAnswers(int userId, Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError, QuestionsByUserSort sortBy = QuestionsByUserSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false)
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/answers
+        /// </summary>
+        public void GetAnswers(Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError = null,
+            AnswerSort? 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)
         {
-            GetUsersAnswers(userId.ToArray(), onSuccess, onError, sortBy, sortDirection, page, pageSize, includeBody, includeComments);
-        }
-
-        public virtual void GetUsersAnswers(IEnumerable<int> userIds, Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
-        {
-            MakeRequest<Answer>("users", new string[] { userIds.Vectorize(), "answers" }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            }, (items) => onSuccess(new PagedList<Answer>(items)), onError);
-        }
-
-        public virtual void GetQuestionAnswers(int questionId, Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError, QuestionsByUserSort sortBy = QuestionsByUserSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false)
-        {
-            GetQuestionAnswers(questionId.ToArray(), onSuccess, onError, sortBy, sortDirection, page, pageSize, includeBody);
-        }
-
-        public virtual void GetQuestionAnswers(IEnumerable<int> questionIds, Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
-        {
-            MakeRequest<Answer>("questions", new string[] { questionIds.Vectorize(), "answers" }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            }, (items) => onSuccess(new PagedList<Answer>(items)), onError);
-        }
-
-        public virtual void GetAnswer(int answerId, Action<Answer> onSuccess, Action<ApiException> onError, bool includeBody = true, bool includeComments = true)
-        {
-            GetAnswers(answerId.ToArray(), answers => onSuccess(answers.FirstOrDefault()), onError, includeBody: includeBody, includeComments: includeComments);
-        }
-
-        public virtual void GetAnswers(IEnumerable<int> answerIds, Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError, AnswerSort sortBy = AnswerSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
-        {
-            MakeRequest<Answer>("answers", new string[] { answerIds.Vectorize() }, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            }, (items) => onSuccess(new PagedList<Answer>(items)), onError);
+            Execute<Answer>("answers", null, onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
         /// <summary>
-        /// Returns all the answers in the system
+        /// See: http://api.stackexchange.com/docs/answers-by-ids
         /// </summary>
-        /// <param name="onSuccess">The callback on successful execution</param>
-        /// <param name="onError">The callback if an error occurs</param>
-        /// <param name="sortBy">How a collection should be sorted.</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="includeBody">When "true", a post's body will be included in the response.</param>
-        /// <param name="includeComments">When "true", any comments on a post will be included in the response.</param>
-        /// <param name="includeAnswers"> When "true", the answers to a question will be returned</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>
-        /// <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>
-        /// <returns></returns>
-        public virtual void GetAnswers(Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError, AnswerSort sortBy = AnswerSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, bool includeAnswers = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null)
+        public void GetAnswers(IEnumerable<int> ids, Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError = null, 
+            AnswerSort? 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)
         {
-            MakeRequest<Answer>("answers", null, new
-            {
-                site = this.SiteUrlName,
-                page = page ?? null,
-                pagesize = pageSize ?? null,
-                body = includeBody ? (bool?)true : null,
-                comments = includeComments ? (bool?)true : null,
-                answers = includeAnswers ? (bool?)true : null,
-                sort = sortBy.ToString().ToLower(),
-                order = GetSortDirection(sortDirection),
-                min = min ?? null,
-                max = max ?? null,
-                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
-                todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null
-            }, (items) => onSuccess(new PagedList<Answer>(items)), onError);
+            Execute<Answer>("answers", new string[] { ids.Vectorize() }, onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/answers-by-ids
+        /// </summary>
+        public void GetAnswer(int id, Action<Answer> onSuccess, Action<ApiException> onError = null,
+            AnswerSort? 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)
+        {
+            GetAnswers(id.ToArray(), items => onSuccess(items.FirstOrDefault()), onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments-on-answers
+        /// </summary>
+        public void GetAnswerComments(IEnumerable<int> ids, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError = null, 
+            AnswerSort? 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)
+        {
+            Execute<Comment>("answers", new string[] { ids.Vectorize(), "comments" }, onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments-on-answers
+        /// </summary>
+        public void GetAnswerComments(int id, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError = null, 
+            AnswerSort? 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)
+        {
+            GetAnswerComments(id.ToArray(), onSuccess, onError, sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
     }
 }

trunk/source/Stacky/StackyClientAsync/BadgeMethods.cs

 using System;
+using System.Linq;
 using System.Collections.Generic;
 
 namespace Stacky
     public partial class StackyClientAsync
 #endif
     {
-        public virtual void GetBadges(Action<IEnumerable<Badge>> onSuccess, Action<ApiException> onError = null)
+        public void GetBadges(Action<IPagedList<Badge>> onSuccess, Action<ApiException> onError = null, 
+            BadgeSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, BadgeMinMax? min = null, BadgeMinMax? max = null, string filter = null)
         {
-            GetBadges(onSuccess, onError, "badges", null);
+            Execute<Badge, BadgeMinMax>("badges", null,
+                onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        private void GetBadges(Action<IEnumerable<Badge>> onSuccess, Action<ApiException> onError, string method, string[] urlArguments)
+        public void GetBadge(int id, Action<Badge> onSuccess, Action<ApiException> onError = null, string filter = null)
         {
-            MakeRequest<Badge>(method, urlArguments, new
-            {
-                site = this.SiteUrlName,
-            }, (items) => onSuccess(items.Items), onError);
+            GetBadges(id.ToArray(), items => onSuccess(items.FirstOrDefault()), onError, filter: filter);
         }
 
-        public virtual void GetUsersByBadge(int badgeId, Action<IPagedList<User>> onSuccess, Action<ApiException> onError, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
+        public void GetBadges(IEnumerable<int> ids, Action<IPagedList<Badge>> onSuccess, Action<ApiException> onError = null, BadgeSort? 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)
         {
-            GetUsersByBadge(badgeId.ToArray(), onSuccess, onError, page, pageSize, fromDate, toDate);
+            Execute<Badge>("badges", new string[] { ids.Vectorize() },
+                onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        public virtual void GetUsersByBadge(IEnumerable<int> badgeId, Action<IPagedList<User>> onSuccess, Action<ApiException> onError, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
+        public void GetNamedBadges(Action<IPagedList<Badge>> onSuccess, Action<ApiException> onError = null,
+            BadgeSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, BadgeMinMax? min = null, BadgeMinMax? max = null, string filter = null)
         {
-            MakeRequest<User>("badges", new string[] { badgeId.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
-            }, (items) => onSuccess(new PagedList<User>(items)), onError);
+            Execute<Badge, BadgeMinMax>("badges", new string[] { "name" },
+                onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        public virtual void GetTagBasedBadges(Action<IEnumerable<Badge>> onSuccess, Action<ApiException> onError = null)
+        public void GetRecentlyAwardedBadges(Action<IPagedList<Badge>> onSuccess, Action<ApiException> onError = null, 
+            int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, string filter = null)
         {
-            GetBadges(onSuccess, onError, "badges", new string[] { "tags" });
+            Execute<Badge, BadgeMinMax>("badges", new string[] { "recipients" },
+                onSuccess, onError,
+                null, null, page, pageSize, fromDate, toDate, null, null, filter);
+        }
+
+        public void GetRecentlyAwardedBadges(int id, Action<IPagedList<Badge>> onSuccess, Action<ApiException> onError = null, 
+            int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, string filter = null)
+        {
+            GetRecentlyAwardedBadges(id.ToArray(), onSuccess, onError, page, pageSize, fromDate, toDate, filter);
+        }
+
+        public void GetRecentlyAwardedBadges(IEnumerable<int> ids, Action<IPagedList<Badge>> onSuccess, Action<ApiException> onError = null, 
+            int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, string filter = null)
+        {
+            Execute<Badge, BadgeMinMax>("badges", new string[] { ids.Vectorize(), "recipients" },
+                onSuccess, onError,
+                null, null, page, pageSize, fromDate, toDate, null, null, filter);
+        }
+
+        public void GetTagBasedBadges(Action<IPagedList<Badge>> onSuccess, Action<ApiException> onError = null, 
+            BadgeSort? sortBy = null, SortDirection? sortDirection = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null, BadgeMinMax? min = null, BadgeMinMax? max = null, string filter = null)
+        {
+            Execute<Badge, BadgeMinMax>("badges", new string[] { "tags" },
+                onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
     }
 }

trunk/source/Stacky/StackyClientAsync/CommentMethods.cs

     public partial class StackyClientAsync
 #endif
     {
-        public virtual void GetComments(IEnumerable<int> fromUserIds, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? toUserId = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/comments
+        /// </summary>
+        public void GetComments(Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError = null, 
+            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" };
-            }
-
-            MakeRequest<Comment>("users", urlParameters, 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)
-            }, (items) => onSuccess(new PagedList<Comment>(items)), onError);
+            Execute<Comment>("comments", null,
+                onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        public virtual void GetComments(int fromUserId, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? toUserId = null, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
+        public void GetComments(int id, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError = null,
+            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)
         {
-            GetComments(fromUserId.ToArray(), onSuccess, onError, sortBy, sortDirection, toUserId, page, pageSize, fromDate, toDate);
+            GetComments(id.ToArray(), onSuccess, onError, sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
 
-        public virtual void GetCommentsByPost(int postId, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
+        public void GetComments(IEnumerable<int> ids, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError = null,
+            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)
         {
-            GetCommentsByPost(postId.ToArray(), onSuccess, onError, sortBy, sortDirection, page, pageSize, fromDate, toDate);
-        }
-
-        public virtual void GetCommentsByPost(IEnumerable<int> postIds, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, CommentSort sortBy = CommentSort.Creation, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, DateTime? fromDate = null, DateTime? toDate = null)
-        {
-            MakeRequest<Comment>("posts", new string[] { postIds.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),
-            }, (items) => onSuccess(new PagedList<Comment>(items)), onError);
-        }
-
-        public virtual void GetAnswerComments(int answerId, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, 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)
-        {
-            GetAnswerComments(answerId.ToArray(), onSuccess, onError, sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max);
-        }
-
-        public virtual void GetAnswerComments(IEnumerable<int> answerIds, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, 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)
-        {
-            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
-            }, response => onSuccess(new PagedList<Comment>(response)), onError);
-        }
-
-        /// <summary>
-        /// Gets all the comments in the site
-        /// </summary>
-        /// <param name="onSuccess"></param>
-        /// <param name="onError"></param>
-        /// <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 void GetComments(Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, 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)
-        {
-            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
-            }, response => onSuccess(new PagedList<Comment>(response)), onError);
+            Execute<Comment>("comments", new string[] { ids.Vectorize() },
+                onSuccess, onError,
+                sortBy, sortDirection, page, pageSize, fromDate, toDate, min, max, filter);
         }
     }
 }

trunk/source/Stacky/StackyClientAsync/NetworkMethods.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Stacky
+{
+#if SILVERLIGHT
+    public partial class StackyClient
+#else
+    public partial class StackyClientAsync
+#endif
+    {
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/invalidate-access-tokens
+        /// </summary>
+        public void InvalidateAccessTokens(IEnumerable<string> tokens, Action<IPagedList<AccessToken>> onSuccess, Action<ApiException> onError = null,
+            int? page = null, int? pageSize = null, string filter = null)
+        {
+            MakeRequest<AccessToken>("access-tokens", new string[] { tokens.Vectorize(), "invalidate" }, new
+            {
+                page = page,
+                pagesize = pageSize,
+                filter = filter
+            }, response => onSuccess(new PagedList<AccessToken>(response)), onError);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/invalidate-access-tokens
+        /// </summary>
+        public void InvalidateAccessToken(string token, Action<AccessToken> onSuccess, Action<ApiException> onError = null, 
+            int? page = null, int? pageSize = null, string filter = null)
+        {
+            InvalidateAccessTokens(new string[] { token }, items => onSuccess(items.FirstOrDefault()), onError, page, pageSize, filter);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/read-access-tokens
+        /// </summary>
+        public void ReadAccessTokens(IEnumerable<string> tokens, Action<IPagedList<AccessToken>> onSuccess, Action<ApiException> onError = null, 
+            int? page = null, int? pageSize = null, string filter = null)
+        {
+            MakeRequest<AccessToken>("access-tokens", new string[] { tokens.Vectorize(), "read" }, new
+            {
+                page = page,
+                pagesize = pageSize,
+                filter = filter
+            }, response => onSuccess(new PagedList<AccessToken>(response)), onError);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/read-access-tokens
+        /// </summary>
+        public void ReadAccessToken(string token, Action<AccessToken> onSuccess, Action<ApiException> onError = null, 
+            int? page = null, int? pageSize = null, string filter = null)
+        {
+            ReadAccessTokens(new string[] { token }, items => onSuccess(items.FirstOrDefault()), onError, page, pageSize, filter);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/create-filter
+        /// </summary>
+        public void CreateFilter(IEnumerable<string> include, IEnumerable<string> exclude, Action<Filter> onSuccess, Action<ApiException> onError = null,
+            string baseFilter = null, bool? isUnsafe = null)
+        {
+            MakeRequest<Filter>("similar", null, new
+            {
+                include = TryVectorize(include),
+                exclude = TryVectorize(exclude),
+                @base = baseFilter,
+                @unsafe = isUnsafe
+            }, response => onSuccess(response.Items.FirstOrDefault()), onError);
+        }
+
+        private string TryVectorize(IEnumerable<string> items)
+        {
+            if (items == null || items.Count() == 0)
+                return null;
+            return items.Vectorize();
+        }
+
+        /// <summary>
+        /// http://api.stackexchange.com/docs/read-filter
+        /// </summary>
+        public void GetFilters(IEnumerable<string> filters, Action<IEnumerable<Filter>> onSuccess, Action<ApiException> onError = null, string filter = null)
+        {
+            MakeRequest<Filter>("similar", new string[] { filters.Vectorize() }, new
+            {
+                filter = filter
+            }, response => onSuccess(response.Items), onError);
+        }
+
+        /// <summary>
+        /// http://api.stackexchange.com/docs/read-filter
+        /// </summary>
+        public void GetFilters(string filter, Action<Filter> onSuccess, Action<ApiException> onError = null)
+        {
+            GetFilters(new string[] { filter }, items => onSuccess(items.FirstOrDefault()), onError);
+        }
+
+        /// <summary>
+        /// See: http://api.stackexchange.com/docs/sites
+        /// </summary>
+        public void GetSites(Action<IPagedList<Site>> onSuccess, Action<ApiException> onError = null, int? page = null, int? pageSize = null, string filter = null)
+        {
+            MakeRequest<Site>("sites", null, new
+            {
+                page = page,
+                pagesize = pageSize,
+                filter = filter
+            }, response => onSuccess(new PagedList<Site>(response)), onError);
+        }
+
+        public void GetAssociatedUsers(IEnumerable<int> ids, Action<IPagedList<NetworkUser>> onSuccess, Action<ApiException> onError = null,
+            int? page = null, int? pageSize = null, string filter = null)
+        {
+            MakeRequest<NetworkUser>("users", new string[] { ids.Vectorize(), "associated" }, new
+            {
+                page = page,
+                pagesize = pageSize,
+                filter = filter
+            }, response => onSuccess(new PagedList<NetworkUser>(response)), onError);
+        }
+
+        public void GetAssociatedUsers(int id, Action<IPagedList<NetworkUser>> onSuccess, Action<ApiException> onError = null, string filter = null)
+        {
+            GetAssociatedUsers(id.ToArray(), onSuccess, onError, null, null, filter);
+        }
+    }
+}

trunk/source/Stacky/StackyClientAsync/StackyClientAsync.cs

             WebClient.MakeRequest(url, onSuccess, onError);
         }
 
+        protected void Execute<TEntity, TMinMax>(string methodName, string[] urlArguments,
+            Action<IPagedList<TEntity>> onSuccess,
+            Action<ApiException> onError,
+            object 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 TMinMax : struct
+        {
+            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
+            }, (response) => onSuccess(new PagedList<TEntity>(response)), onError);
+        }
+
+        protected void Execute<TEntity>(string methodName, string[] urlArguments,
+            Action<IPagedList<TEntity>> onSuccess,
+            Action<ApiException> onError,
+            object 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()
+        {
+            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
+            }, (response) => onSuccess(new PagedList<TEntity>(response)), onError);
+        }
+
         #endregion
     }
 }

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

         }
 
         [TestMethod]
-        public void Answer_GetUsersAnswers_ContainsPagingInformation()
-        {
-            var answers = Client.GetUsersAnswers(1464);
-            Assert.IsNotNull(answers);
-            Assert.IsTrue(answers.PageSize > 0);
-            Assert.IsTrue(answers.CurrentPage > 0);
-            Assert.IsTrue(answers.TotalItems > 0);
-        }
-
-        [TestMethod]
-        public void ContainsOwnerAsObject()
-        {
-            var answer = Client.GetUsersAnswers(1464).FirstOrDefault();
-
-            Assert.IsNotNull(answer);
-            Assert.IsNotNull(answer.Owner);
-            Assert.IsNotNull(answer.Owner.DisplayName);
-        }
-
-        [TestMethod]
         public void Answer_GetAnswer()
         {
             var answer = Client.GetAnswer(11738);
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.