コード例 #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));
        }
コード例 #2
0
 public virtual Answer GetAnswer(int answerId, AnswerOptions options)
 {
     return(GetAnswers(answerId.ToArray(), options).FirstOrDefault());
 }
コード例 #3
0
 public virtual IPagedList <Answer> GetQuestionAnswers(int questionId, AnswerOptions options)
 {
     return(GetQuestionAnswers(questionId.ToArray(), options));
 }
コード例 #4
0
 public virtual IPagedList <Answer> GetUsersAnswers(int userId, AnswerOptions options)
 {
     return(GetUsersAnswers(userId.ToArray(), options));
 }
コード例 #5
0
ファイル: AnswerMethods.cs プロジェクト: lfoust/stacky
 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);
 }
コード例 #6
0
ファイル: AnswerMethods.cs プロジェクト: lfoust/stacky
 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);
 }
コード例 #7
0
ファイル: AnswerMethods.cs プロジェクト: lfoust/stacky
 public virtual void GetQuestionAnswers(int questionId, Action <IPagedList <Answer> > onSuccess, Action <ApiException> onError, AnswerOptions options)
 {
     GetUsersAnswers(questionId.ToArray(), onSuccess, onError, options);
 }