stacky / trunk / source / Stacky.Net35 / StackyClientAsync / PostMethods.cs

using System;
using System.Collections.Generic;
using System.Linq;

namespace Stacky
{
#if SILVERLIGHT
    public partial class StackyClient
#else
    public partial class StackyClientAsync
#endif
    {
        public void GetPosts(Action<IPagedList<Post>> onSuccess, Action<ApiException> onError, Options<PostSort> options)
        {
            Execute<Post>("posts", null, onSuccess, onError, options);
        }

        public void GetPosts(IEnumerable<int> ids, Action<IPagedList<Post>> onSuccess, Action<ApiException> onError, Options<PostSort> options)
        {
            Execute<Post>("posts", new string[] { ids.Vectorize() }, onSuccess, onError, options);
        }

        public void GetPosts(int id, Action<Post> onSuccess, Action<ApiException> onError, Options<PostSort> options)
        {
            GetPosts(id.ToArray(), items => onSuccess(items.FirstOrDefault()), onError, options);
        }

        public void GetPostComments(IEnumerable<int> ids, Action<IPagedList<Comment>> onSuccess, Action<ApiException> onError, Options<CommentSort> options)
        {
            Execute<Comment>("posts", new string[] { ids.Vectorize(), "comments" }, onSuccess, onError, options);
        }

        public void GetPostRevisions(int id, Action<IPagedList<Revision>> onSuccess, Action<ApiException> onError, OptionsWithDates options)
        {
            GetPostRevisions(id.ToArray(), onSuccess, onError, options);
        }

        public void GetPostRevisions(IEnumerable<int> ids, Action<IPagedList<Revision>> onSuccess, Action<ApiException> onError, OptionsWithDates options)
        {
            Execute<Revision>("posts", new string[] { ids.Vectorize(), "revisions" }, onSuccess, onError, options);
        }

        public void GetPostSuggestedEdits(int id, Action<IPagedList<SuggestedEdit>> onSuccess, Action<ApiException> onError, Options<SuggestedEditSort> options)
        {
            GetPostSuggestedEdits(id.ToArray(), onSuccess, onError, options);
        }

        public void GetPostSuggestedEdits(IEnumerable<int> ids, Action<IPagedList<SuggestedEdit>> onSuccess, Action<ApiException> onError, Options<SuggestedEditSort> options)
        {
            Execute<SuggestedEdit>("posts", new string[] { ids.Vectorize(), "suggested-edits" }, onSuccess, onError, 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.