diff options
author | Teddy Wing | 2022-05-07 02:21:19 +0200 |
---|---|---|
committer | Teddy Wing | 2022-05-07 17:46:00 +0200 |
commit | 21bef67ff67f67b8bd2e6a351d75e4e9cf94e786 (patch) | |
tree | 5f109d096d149127c0073d0eda743b0d5cacbc89 /src | |
parent | 53035fa4aa5f3a471d4093e70269ae992b12feef (diff) | |
download | wajir-21bef67ff67f67b8bd2e6a351d75e4e9cf94e786.tar.bz2 |
Move issues fetch to a function
Diffstat (limited to 'src')
-rw-r--r-- | src/main.lisp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/main.lisp b/src/main.lisp index 4c1c498..7f6973f 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -7,11 +7,21 @@ ;; Send email to ^maildir^program^ containing message with issue metadata ;; Continue to next page - (dex:post "https://example.atlassian.net/rest/api/3/search" - :content - "{ - \"jql\": \"project = \\\"FAKE\\\" AND watcher != currentUser() AND key > \\\"FAKE-100\\\" ORDER BY created DESC\", - \"fields\": [\"id\", \"key\", \"self\"] - }" - :headers '((:content-type . "application/json") - (:authorization . "Basic TOKEN")))) + (fetch-issues + "project = \\\"FAKE\\\" AND watcher != currentUser() AND key > \\\"FAKE-100\\\" ORDER BY created DESC" + :basic-auth-token "TOKEN")) + +(defun fetch-issues (jql &key basic-auth-token) + (multiple-value-bind (body code) + (dex:post "https://example.atlassian.net/rest/api/3/search" + :content + (format nil "{ + \"jql\": \"~A\", + \"fields\": [\"id\", \"key\", \"self\"] + }" + jql) + :headers `((:content-type . "application/json") + (:authorization + . ,(format nil "Basic ~A" basic-auth-token)))) + + body)) |