summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rt-liberation-rest.el28
-rw-r--r--rt-liberation.el2
2 files changed, 29 insertions, 1 deletions
diff --git a/rt-liberation-rest.el b/rt-liberation-rest.el
index aa06caf..85cabf4 100644
--- a/rt-liberation-rest.el
+++ b/rt-liberation-rest.el
@@ -91,6 +91,19 @@
"user=" user "&"
"pass=" pass "&")))
+(defun rt-liber-rest-history-string (scheme url ticket-id username password)
+ "Return the ticket show string."
+ (let ((user (url-encode-url username))
+ (pass (url-encode-url password)))
+ (concat scheme
+ "://"
+ url
+ "/REST/1.0/ticket/" ticket-id
+ "/history" "?"
+ "format=l" "&"
+ "user=" user "&"
+ "pass=" pass)))
+
(defun rt-liber-rest-call (url)
"Perform a REST call with URL."
(let ((url-request-method "POST"))
@@ -126,6 +139,13 @@
rt-liber-rest-username
rt-liber-rest-password
query-string)))
+ ((string= op "history")
+ (rt-liber-rest-call
+ (rt-liber-rest-history-string rt-liber-rest-scheme
+ rt-liber-rest-url
+ query-string
+ rt-liber-rest-username
+ rt-liber-rest-password)))
(t (error "unknown op [%s]" op))))
(defun rt-liber-rest-parse-http-header ()
@@ -196,6 +216,14 @@
(rt-liber-rest-show-query-runner idsublist)
#'rt-liber-ticket-base-retriever-parser-f))
+(defun rt-liber-rest-run-ticket-history-base-query (ticket-id)
+ "Run history query against server for TICKET-ID."
+ (rt-liber-parse-answer
+ (rt-liber-rest-query-runner "history" ticket-id)
+ #'(lambda ()
+ (rt-liber-rest-parse-http-header)
+ (buffer-substring (point) (point-max)))))
+
(provide 'rt-liberation-rest)
diff --git a/rt-liberation.el b/rt-liberation.el
index c7a3a33..1997adc 100644
--- a/rt-liberation.el
+++ b/rt-liberation.el
@@ -625,7 +625,7 @@ AFTER date after predicate."
TICKET-ALIST alist of ticket data.
ASSOC-BROWSER if non-nil should be a ticket browser."
(let* ((ticket-id (rt-liber-ticket-id-only ticket-alist))
- (contents (rt-liber-run-ticket-history-base-query ticket-id))
+ (contents (rt-liber-rest-run-ticket-history-base-query ticket-id))
(new-ticket-buffer (get-buffer-create
(concat "*RT Ticket #" ticket-id "*"))))
(with-current-buffer new-ticket-buffer