Source

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

#if !SILVERLIGHT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Stacky
{
    public partial class StackyClient : StackyClientBase
    {
        protected IPagedList<TEntity> Execute<TEntity>(string methodName, string[] urlArguments, Options options)
            where TEntity : Entity, new()
        {
            var response = MakeRequest<TEntity>(methodName, urlArguments, new
            {
                site = this.SiteUrlName,
                page = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                filter = options.Filter
            });
            return new PagedList<TEntity>(response);
        }

        protected IPagedList<TEntity> Execute<TEntity>(string methodName, string[] urlArguments, OptionsWithDates options)
            where TEntity : Entity, new()
        {
            var response = MakeRequest<TEntity>(methodName, urlArguments, new
            {
                site = this.SiteUrlName,
                page = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                fromdate = GetDateValue(options.FromDate),
                todate = GetDateValue(options.ToDate),
                filter = options.Filter
            });
            return new PagedList<TEntity>(response);
        }

        protected IPagedList<TEntity> Execute<TEntity, TSort, TMinMax>(string methodName, string[] urlArguments, Options<TSort, TMinMax> options)
            where TEntity : Entity, new()
            where TSort : struct
            where TMinMax : struct
        {
            var response = MakeRequest<TEntity>(methodName, urlArguments, new
            {
                site = this.SiteUrlName,
                page = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                fromdate = GetDateValue(options.FromDate),
                todate = GetDateValue(options.ToDate),
                sort = GetEnumValue(options.SortBy),
                order = GetSortDirection(options.SortDirection),
                min = options.Min,
                max = options.Max,
                filter = options.Filter
            });
            return new PagedList<TEntity>(response);
        }

        protected IPagedList<TEntity> Execute<TEntity, TSort>(string methodName, string[] urlArguments, Options<TSort> options)
            where TEntity : Entity, new()
            where TSort : struct
        {
            var response = MakeRequest<TEntity>(methodName, urlArguments, new
            {
                site = this.SiteUrlName,
                page = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                fromdate = GetDateValue(options.FromDate),
                todate = GetDateValue(options.ToDate),
                sort = GetEnumValue(options.SortBy),
                order = GetSortDirection(options.SortDirection),
                min = GetDateValue(options.Min),
                max = GetDateValue(options.Max),
                filter = options.Filter
            });
            return new PagedList<TEntity>(response);
        }
    }
}
#endif
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.