Example #1
0
func fetchQuestionAnswers(ids []int) ([]bson.M, error) {
	var answers []bson.M
	_, err := Client.Do(stackexchange.PathQuestionAnswers, &answers, &stackexchange.Params{
		Site:   Site,
		Args:   []string{stackexchange.JoinIDs(ids)},
		Filter: QuestionAnswersFilter,
	})
	return answers, err
}
Example #2
0
func fetchQuestion(id int) (bson.M, error) {
	var questions []bson.M
	_, err := Client.Do(stackexchange.PathQuestions, &questions, &stackexchange.Params{
		Site:   Site,
		Args:   []string{stackexchange.JoinIDs([]int{id})},
		Filter: AllQuestionsFilter,
	})
	if len(questions) == 0 {
		return nil, errors.New("no questions found")
	}
	return questions[0], err
}