From 925b4ef8b503b22481e624905fa6e3af8d6d4077 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 17 Dec 2014 15:35:26 -0200 Subject: Implent getting question given answer id --- sx-question.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sx-question.el') diff --git a/sx-question.el b/sx-question.el index 9fb31fc..801384a 100644 --- a/sx-question.el +++ b/sx-question.el @@ -54,6 +54,20 @@ If QUESTION-ID doesn't exist on SITE, raise an error." (error "Couldn't find question %S in %S" question-id site)))) +(defun sx-question-get-from-answer (site answer-id) + "Get question from SITE to which ANSWER-ID belongs. +If ANSWER-ID doesn't exist on SITE, raise an error." + (let ((res (sx-method-call 'answers + :id answer-id + :site site + :submethod 'questions + :auth t + :filter sx-browse-filter))) + (if (vectorp res) + (elt res 0) + (error "Couldn't find answer %S in %S" + answer-id site)))) + ;;; Question Properties -- cgit v1.2.3