public virtual void GetQuestionAnswers(IEnumerable<int> questionIds, Action<IPagedList<Answer>> onSuccess, Action<ApiException> onError = null, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null) { MakeRequest<AnswerResponse>("questions", new string[] { questionIds.Vectorize(), "answers" }, new { key = apiKey, page = page ?? null, pagesize = pageSize ?? null, body = includeBody ? (bool?)true : null, sort = sortBy.ToString().ToLower(), order = GetSortDirection(sortDirection), min = min ?? null, max = max ?? null, fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null, todate = toDate.HasValue ? (long?)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, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int?page = null, int?pageSize = null, bool includeBody = false, bool includeComments = false, int?min = null, int?max = null, DateTime?fromDate = null, DateTime?toDate = null) { MakeRequest <AnswerResponse>("questions", new string[] { questionIds.Vectorize(), "answers" }, new { key = apiKey, page = page ?? null, pagesize = pageSize ?? null, body = includeBody ? (bool?)true : null, sort = sortBy.ToString().ToLower(), order = GetSortDirection(sortDirection), min = min ?? null, max = max ?? null, fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null, todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null }, (items) => onSuccess(new PagedList <Answer>(items.Answers, items)), onError); }
/// <summary> /// Gets the question answers. /// </summary> /// <param name="questionIds">The question ids.</param> /// <param name="sortBy">The sort by.</param> /// <param name="sortDirection">The sort direction.</param> /// <param name="page">The page.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="includeBody">if set to <c>true</c> [include body].</param> /// <param name="includeComments">if set to <c>true</c> [include comments].</param> /// <param name="min">The min.</param> /// <param name="max">The max.</param> /// <param name="fromDate">From date.</param> /// <param name="toDate">To date.</param> /// <returns></returns> public virtual IPagedList<Answer> GetQuestionAnswers(IEnumerable<int> questionIds, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, int? min = null, int? max = null, DateTime? fromDate = null, DateTime? toDate = null) { var response = MakeRequest<AnswerResponse>("questions", new string[] { questionIds.Vectorize(), "answers" }, new { key = apiKey, page = page ?? null, pagesize = pageSize ?? null, body = includeBody ? (bool?)true : null, sort = sortBy.ToString().ToLower(), order = GetSortDirection(sortDirection), min = min ?? null, max = max ?? null, fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null, todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null }); return new PagedList<Answer>(response.Answers, response); }
/// <summary> /// Gets the question answers. /// </summary> /// <param name="questionIds">The question ids.</param> /// <param name="sortBy">The sort by.</param> /// <param name="sortDirection">The sort direction.</param> /// <param name="page">The page.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="includeBody">if set to <c>true</c> [include body].</param> /// <param name="includeComments">if set to <c>true</c> [include comments].</param> /// <param name="min">The min.</param> /// <param name="max">The max.</param> /// <param name="fromDate">From date.</param> /// <param name="toDate">To date.</param> /// <returns></returns> public virtual IPagedList <Answer> GetQuestionAnswers(IEnumerable <int> questionIds, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int?page = null, int?pageSize = null, bool includeBody = false, bool includeComments = false, int?min = null, int?max = null, DateTime?fromDate = null, DateTime?toDate = null) { var response = MakeRequest <AnswerResponse>("questions", new string[] { questionIds.Vectorize(), "answers" }, new { key = apiKey, page = page ?? null, pagesize = pageSize ?? null, body = includeBody ? (bool?)true : null, sort = sortBy.ToString().ToLower(), order = GetSortDirection(sortDirection), min = min ?? null, max = max ?? null, fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null, todate = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null }); return(new PagedList <Answer>(response.Answers, response)); }
public virtual IPagedList <Question> GetQuestionsByUser(int userId, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int?page = null, int?pageSize = null, bool includeBody = false, bool includeComments = false, bool includeAnswers = false, DateTime?fromDate = null, DateTime?toDate = null, int?min = null, int?max = null, string[] tags = null) { return(GetQuestions("users", new string[] { userId.ToString(), "questions" }, sortBy.ToString().ToLower(), GetSortDirection(sortDirection), page, pageSize, includeBody, includeComments, includeAnswers, fromDate, toDate, min, max, tags)); }
public virtual IPagedList<Question> GetQuestionsByUser(int userId, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, bool includeAnswers = false, DateTime? fromDate = null, DateTime? toDate = null, int? min = null, int? max = null, string[] tags = null) { return GetQuestions("users", new string[] { userId.ToString(), "questions" }, sortBy.ToString().ToLower(), GetSortDirection(sortDirection), page, pageSize, includeBody, includeComments, includeAnswers, fromDate, toDate, min, max, tags); }
public virtual void GetQuestionsByUser(int userId, Action<IPagedList<Question>> onSuccess, Action<ApiException> onError = null, QuestionsByUserSort sortBy = QuestionsByUserSort.Activity, SortDirection sortDirection = SortDirection.Descending, int? page = null, int? pageSize = null, bool includeBody = false, bool includeComments = false, bool includeAnswers = false, DateTime? fromDate = null, DateTime? toDate = null, string[] tags = null) { GetQuestions(onSuccess, onError, "users", new string[] { userId.ToString(), "questions" }, sortBy.ToString().ToLower(), GetSortDirection(sortDirection), page, pageSize, includeBody, includeComments, includeAnswers, fromDate, toDate, tags); }