diff options
| author | Yoni Rabkin <yrk@gnu.org> | 2015-03-06 13:35:56 -0500 | 
|---|---|---|
| committer | Yoni Rabkin <yrk@gnu.org> | 2015-03-06 13:35:56 -0500 | 
| commit | 0e6c7ca0c5f3baa7c4e3ffb7019ee4e9a7203200 (patch) | |
| tree | 924f1e27c27331b74fb96d6dc4b82830e3740a69 /rt-liberation-rest.el | |
| parent | 1aa3ed01bbdabce77885f0c22226b36c574ae052 (diff) | |
Implement ticket history via REST.
Also, replace the cli version in the code with the rest version.
Diffstat (limited to 'rt-liberation-rest.el')
| -rw-r--r-- | rt-liberation-rest.el | 28 | 
1 files changed, 28 insertions, 0 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) | 
