diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2017-11-12 23:23:08 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2017-11-12 23:23:08 +0100 |
commit | 61f44917ab3c7023f6f6ab242ce657b784e455d8 (patch) | |
tree | ba515de62d811247917dd1cce8d925657b93e458 | |
parent | cbe35b1061b8cfb4f9e1d54325f7c94ad068e41c (diff) |
debbugs: Add get-bugs RPC.
* README.org: Remove list of implemented RPCs.
* debbugs/operations.scm (get-bugs): New procedure.
-rw-r--r-- | README.org | 3 | ||||
-rw-r--r-- | debbugs/operations.scm | 24 |
2 files changed, 24 insertions, 3 deletions
@@ -1,6 +1,5 @@ This is an attempt to provide Guile bindings for the debbugs bug -tracker. Currently, only few RPCs are implemented: =get-status=, -=newest-bugs=, and =get-bug-log=. +tracker. #+BEGIN_SRC scheme (set! %load-path (cons "/home/rekado/dev/guile/guile-debbugs/" %load-path)) diff --git a/debbugs/operations.scm b/debbugs/operations.scm index 3eb0812..4bef624 100644 --- a/debbugs/operations.scm +++ b/debbugs/operations.scm @@ -20,7 +20,8 @@ #:use-module (debbugs soap) #:use-module (debbugs bug) #:use-module (sxml xpath) - #:use-module (srfi srfi-1)) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match)) (define-public (newest-bugs amount) "Return a list of bug numbers corresponding to the newest AMOUNT @@ -52,6 +53,27 @@ by BUG-IDS, a list of bug numbers." urn:Debbugs/SOAP:item)) response-body))) (map soap-bug->bug bugs))))) +(define-public (get-bugs args) + "Returns bug numbers for bugs that match the conditions given by +ARGS, an alist of key-value pairs. Possible keys: package, submitter, +maint, src, severity, status (which can be 'done', 'forwarded', +'open'), tag, owner, bugs, affects, archive (which can be 'both', or a +Boolean value)." + (soap-request + `(ns1:get_bugs + (@ (xmlns:ns1 . "urn:Debbugs/SOAP") + (soapenc:encodingStyle . "http://schemas.xmlsoap.org/soap/encoding/")) + (ns1:query + (@ (xsi:type "soapenc:Array") + (soapenc:arrayType ,(string-append "xsd:anyType[" (number->string (* 2 (length args))) "]"))) + ,@(map (match-lambda + ((key . value) + `((ns1:query (@ (xsi:type "xsd:string")) ,key) + (ns1:query (@ (xsi:type "xsd:string")) ,value)))) + args))) + (lambda (response-body) + (map string->number ((sxpath '(// urn:Debbugs/SOAP:item *text*)) response-body))))) + (define-public (get-bug-log bug-id) "Return emails associated with the bug identified by BUG-ID." (soap-request |