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)); }
public virtual Answer GetAnswer(int answerId, AnswerOptions options) { return(GetAnswers(answerId.ToArray(), options).FirstOrDefault()); }
public virtual IPagedList <Answer> GetQuestionAnswers(int questionId, AnswerOptions options) { return(GetQuestionAnswers(questionId.ToArray(), options)); }
public virtual IPagedList <Answer> GetUsersAnswers(int userId, AnswerOptions options) { return(GetUsersAnswers(userId.ToArray(), options)); }
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); }
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); }
public virtual void GetQuestionAnswers(int questionId, Action <IPagedList <Answer> > onSuccess, Action <ApiException> onError, AnswerOptions options) { GetUsersAnswers(questionId.ToArray(), onSuccess, onError, options); }