Ejemplo n.º 1
0
        public virtual IPagedList <Answer> GetAnswers(IEnumerable <int> answerIds, AnswerOptions options)
        {
            var response = MakeRequest <AnswerResponse>("answers", new string[] { answerIds.Vectorize() }, new
            {
                key      = apiKey,
                page     = options.Page ?? null,
                pagesize = options.PageSize ?? null,
                body     = options.IncludeBody ? (bool?)true : null,
                sort     = options.SortBy.ToString().ToLower(),
                order    = GetSortDirection(options.SortDirection),
                min      = options.Min ?? null,
                max      = options.Max ?? null,
                fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
                todate   = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null
            });

            return(new PagedList <Answer>(response.Answers, response));
        }
Ejemplo n.º 2
0
 public virtual Answer GetAnswer(int answerId, AnswerOptions options)
 {
     return(GetAnswers(answerId.ToArray(), options).FirstOrDefault());
 }
Ejemplo n.º 3
0
 public virtual IPagedList <Answer> GetQuestionAnswers(int questionId, AnswerOptions options)
 {
     return(GetQuestionAnswers(questionId.ToArray(), options));
 }
Ejemplo n.º 4
0
 public virtual IPagedList <Answer> GetUsersAnswers(int userId, AnswerOptions options)
 {
     return(GetUsersAnswers(userId.ToArray(), options));
 }
Ejemplo n.º 5
0
 private void GetAnswers(string method, string[] urlParameters, Action <IPagedList <Answer> > onSuccess, Action <ApiException> onError, AnswerOptions options)
 {
     MakeRequest <AnswerResponse>(method, urlParameters, new
     {
         key      = apiKey,
         page     = options.Page ?? null,
         pagesize = options.PageSize ?? null,
         body     = options.IncludeBody ? (bool?)true : null,
         comments = options.IncludeComments ? (bool?)true : null,
         sort     = options.SortBy.ToString().ToLower(),
         order    = GetSortDirection(options.SortDirection),
         min      = options.Min ?? null,
         max      = options.Max ?? null,
         fromdate = options.FromDate.HasValue ? (long?)options.FromDate.Value.ToUnixTime() : null,
         todate   = options.ToDate.HasValue ? (long?)options.ToDate.Value.ToUnixTime() : null
     }, (items) => onSuccess(new PagedList <Answer>(items.Answers, items)), onError);
 }
Ejemplo n.º 6
0
 public virtual void GetQuestionAnswers(IEnumerable <int> questionIds, Action <IPagedList <Answer> > onSuccess, Action <ApiException> onError, AnswerOptions options)
 {
     GetAnswers("questions", new string[] { questionIds.Vectorize(), "answers" }, onSuccess, onError, options);
 }
Ejemplo n.º 7
0
 public virtual void GetQuestionAnswers(int questionId, Action <IPagedList <Answer> > onSuccess, Action <ApiException> onError, AnswerOptions options)
 {
     GetUsersAnswers(questionId.ToArray(), onSuccess, onError, options);
 }