Source

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

using System;
using System.Collections.Generic;

namespace Stacky
{
#if SILVERLIGHT
    public partial class StackyClient : StackyClientBase
#else
    public partial class StackyClientAsync : StackyClientBase
#endif
    {
        private void GetTags(Action<IPagedList<Tag>> onSuccess, Action<ApiException> onError, string method, string[] urlParameters, string filter, string sort, string order, int? page, int? pageSize, DateTime? fromDate, DateTime? toDate, int? min, int? max)
        {
            MakeRequest<Tag>(method, urlParameters, new
            {
                site = this.SiteUrlName,
                page = page ?? null,
                pagesize = pageSize ?? null,
                sort = sort,
                order = order,
                fromdate = GetDateValue(fromDate),
                todate = GetDateValue(toDate),
                min = min ?? null,
                max = max ?? null
            }, (items) => onSuccess(new PagedList<Tag>(items)), onError);
        }

        public virtual void GetTags(Action<IPagedList<Tag>> onSuccess, Action<ApiException> onError)
        {
            GetTags(onSuccess, onError, new TagOptions());
        }

        public virtual void GetTags(Action<IPagedList<Tag>> onSuccess, Action<ApiException> onError, TagOptions options)
        {
            GetTags(onSuccess, onError, "tags", null, options.Filter, options.SortBy.ToString().ToLower(), GetSortDirection(options.SortDirection), options.Page, options.PageSize, options.FromDate, options.ToDate, options.Min, options.Max);
        }

        public virtual void GetTagsByUser(int userId, Action<IPagedList<Tag>> onSuccess, Action<ApiException> onError)
        {
            GetTagsByUser(userId, onSuccess, onError, new TagOptions());
        }

        public virtual void GetTagsByUser(int userId, Action<IPagedList<Tag>> onSuccess, Action<ApiException> onError, TagOptions options)
        {
            GetTagsByUser(userId.ToArray(), onSuccess, onError, options);
        }

        public virtual void GetTagsByUser(IEnumerable<int> userIds, Action<IPagedList<Tag>> onSuccess, Action<ApiException> onError)
        {
            GetTagsByUser(userIds, onSuccess, onError, new TagOptions());
        }

        public virtual void GetTagsByUser(IEnumerable<int> userIds, Action<IPagedList<Tag>> onSuccess, Action<ApiException> onError, TagOptions options)
        {
            GetTags(onSuccess, onError, "users", new string[] { userIds.Vectorize(), "tags" }, options.Filter, options.SortBy.ToString(), GetSortDirection(options.SortDirection), options.Page, options.PageSize, options.FromDate, options.ToDate, options.Min, options.Max);
        }
    }
}
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.