Exemplo n.º 1
0
 /// <summary>
 /// Gets the questions asked by the users in id which the site consideres unanswered, while still having at least one answer posted.
 /// These rules are subject to change, but currently any question without at least one upvoted or accepted answer is considered unanswered.
 /// </summary>
 public virtual void GetUnansweredQuestions(Action <IPagedList <Question> > onSuccess, Action <ApiException> onError, IEnumerable <int> userIds, int?page = null, int?pageSize = null, QuestionSort sortBy = QuestionSort.Activity, SortDirection sortDirection = SortDirection.Descending, DateTime?fromDate = null, DateTime?toDate = null, int?min = null, int?max = null, bool?includeBody = null, bool?includeAnswers = null, bool?includeComments = null)
 {
     MakeRequest <QuestionResponse>("users", new string[] { userIds.Vectorize(), "questions", "unanswered" }, new
     {
         key      = apiKey,
         page     = page ?? null,
         pagesize = pageSize ?? null,
         sort     = sortBy.ToString().ToLower(),
         order    = GetSortDirection(sortDirection),
         fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
         todate   = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
         min      = min ?? null,
         max      = max ?? null,
         body     = includeBody,
         comments = includeComments,
         answers  = includeAnswers
     }, (response) => onSuccess(new PagedList <Question>(response.Questions, response)), onError);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the questions asked by the users in userIds which have no answers.
        /// Questions returns by this method actually have zero undeleted answers.
        /// </summary>
        public virtual IPagedList <Question> GetNoAnswerQuestions(IEnumerable <int> userIds, int?page = null, int?pageSize = null, QuestionSort sortBy = QuestionSort.Activity, SortDirection sortDirection = SortDirection.Descending, DateTime?fromDate = null, DateTime?toDate = null, int?min = null, int?max = null, bool?includeBody = null, bool?includeAnswers = null, bool?includeComments = null)
        {
            var response = MakeRequest <QuestionResponse>("users", new string[] { userIds.Vectorize(), "questions", "no-answers" }, new
            {
                key      = apiKey,
                page     = page ?? null,
                pagesize = pageSize ?? null,
                sort     = sortBy.ToString().ToLower(),
                order    = GetSortDirection(sortDirection),
                fromdate = fromDate.HasValue ? (long?)fromDate.Value.ToUnixTime() : null,
                todate   = toDate.HasValue ? (long?)toDate.Value.ToUnixTime() : null,
                min      = min ?? null,
                max      = max ?? null,
                body     = includeBody,
                comments = includeComments,
                answers  = includeAnswers
            });

            return(new PagedList <Question>(response.Questions, response));
        }
Exemplo n.º 3
0
 public virtual IPagedList <Question> GetNoAnswerQuestions(QuestionSort sortBy = QuestionSort.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)
 {
     return(GetQuestions("questions", new string[] { "no-answers" }, sortBy.ToString(), GetSortDirection(sortDirection), page, pageSize, includeBody, includeComments, includeAnswers, fromDate, toDate, min, max, null));
 }
Exemplo n.º 4
0
 public virtual IPagedList <Question> GetRelatedQuestions(IEnumerable <int> questionIds, QuestionSort sortBy = QuestionSort.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)
 {
     return(GetQuestions("questions", new string[] { questionIds.Vectorize(), "related" }, sortBy.ToString(), GetSortDirection(sortDirection), page, pageSize, includeBody, includeComments, includeAnswers, fromDate, toDate, min, max, null));
 }
Exemplo n.º 5
0
 public virtual void GetNoAnswerQuestions(Action <IPagedList <Question> > onSuccess, Action <ApiException> onError, QuestionSort sortBy = QuestionSort.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)
 {
     GetQuestions(onSuccess, onError, "questions", new string[] { "no-answers" }, sortBy.ToString(), GetSortDirection(sortDirection), page, pageSize, includeBody, includeComments, includeAnswers, fromDate, toDate, min, max, null);
 }