Esempio n. 1
0
        public virtual IPagedList <Question> Search(QuestionSearchOptions options)
        {
            string taggedString = null;

            if (options.Tagged != null)
            {
                taggedString = String.Join(" ", options.Tagged.ToArray());
            }

            string notTaggedString = null;

            if (options.NotTagged != null)
            {
                notTaggedString = String.Join(" ", options.NotTagged.ToArray());
            }

            var response = MakeRequest <QuestionResponse>("search", null, new
            {
                key       = apiKey,
                intitle   = options.InTitle,
                tagged    = taggedString,
                nottagged = notTaggedString,
                sort      = options.SortBy.ToString(),
                order     = GetSortDirection(options.SortDirection),
                page      = options.Page ?? null,
                pagesize  = options.PageSize ?? null,
                min       = options.Min ?? null,
                max       = options.Max ?? null
            });

            return(new PagedList <Question>(response.Questions, response));
        }
Esempio n. 2
0
        public virtual IPagedList<Question> Search(QuestionSearchOptions options)
        {
            string taggedString = null;
            if (options.Tagged != null)
                taggedString = String.Join(" ", options.Tagged.ToArray());

            string notTaggedString = null;
            if (options.NotTagged != null)
                notTaggedString = String.Join(" ", options.NotTagged.ToArray());

            var response = MakeRequest<QuestionResponse>("search", null, new
            {
                key = apiKey,
                intitle = options.InTitle,
                tagged = taggedString,
                nottagged = notTaggedString,
                sort = options.SortBy.ToString(),
                order = GetSortDirection(options.SortDirection),
                page = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                min = options.Min ?? null,
                max = options.Max ?? null
            });
            return new PagedList<Question>(response.Questions, response);
        }
Esempio n. 3
0
        public virtual void Search(Action <IEnumerable <Question> > onSuccess, Action <ApiException> onError, QuestionSearchOptions options)
        {
            string taggedString = null;

            if (options.Tagged != null)
            {
                taggedString = String.Join(" ", options.Tagged.ToArray());
            }

            string notTaggedString = null;

            if (options.NotTagged != null)
            {
                notTaggedString = String.Join(" ", options.NotTagged.ToArray());
            }

            MakeRequest <QuestionResponse>("search", null, new
            {
                key       = apiKey,
                intitle   = options.InTitle,
                tagged    = taggedString,
                nottagged = notTaggedString,
                sort      = options.SortBy.ToString(),
                order     = GetSortDirection(options.SortDirection),
                page      = options.Page ?? null,
                pagesize  = options.PageSize ?? null,
                min       = options.Min ?? null,
                max       = options.Max ?? null
            }, (items) => onSuccess(new PagedList <Question>(items.Questions, items)), onError);
        }
Esempio n. 4
0
        public virtual void Search(Action<IEnumerable<Question>> onSuccess, Action<ApiException> onError, QuestionSearchOptions options)
        {
            string taggedString = null;
            if (options.Tagged != null)
                taggedString = String.Join(" ", options.Tagged.ToArray());

            string notTaggedString = null;
            if (options.NotTagged != null)
                notTaggedString = String.Join(" ", options.NotTagged.ToArray());

            MakeRequest<QuestionResponse>("search", null, new
            {
                key = apiKey,
                intitle = options.InTitle,
                tagged = taggedString,
                nottagged = notTaggedString,
                sort = options.SortBy.ToString(),
                order = GetSortDirection(options.SortDirection),
                page = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                min = options.Min ?? null,
                max = options.Max ?? null
            }, (items) => onSuccess(new PagedList<Question>(items.Questions, items)), onError);
        }