aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-12-17 15:35:26 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-12-17 15:35:26 -0200
commit925b4ef8b503b22481e624905fa6e3af8d6d4077 (patch)
tree55ac2c611e1c265dcaa82bce2d7c66a1339fc09b
parenta5cb69f2937500e5c035ff6588c1f25a5a611833 (diff)
Implent getting question given answer id
-rw-r--r--sx-question.el14
1 files changed, 14 insertions, 0 deletions
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