diff options
author | Teddy Wing | 2022-05-08 01:38:56 +0200 |
---|---|---|
committer | Teddy Wing | 2022-05-08 01:38:56 +0200 |
commit | 325c79d91fb39bbe4e153e22131239fb1123c735 (patch) | |
tree | 5732c1a2dd25d6c35c7de09c8b5255f215b64340 | |
parent | 6afdaa4730c143d21031a51b0cb78ecbc5bd9e32 (diff) | |
download | wajir-325c79d91fb39bbe4e153e22131239fb1123c735.tar.bz2 |
run: Loop over all pages of issues
For each page of issues, watch those issues. Watcher code needs to be
implemented.
-rw-r--r-- | src/main.lisp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/main.lisp b/src/main.lisp index ecf0ed3..0706a33 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -22,10 +22,22 @@ (login config) (token config))))) - (fetch-issues - (endpoint config) - (jql config) - :basic-auth-token basic-auth-token))) + (loop + (let* ((response (fetch-issues + (endpoint config) + (jql config) + :basic-auth-token basic-auth-token)) + + (start-at (gethash "startAt" response)) + (max-results (gethash "maxResults" response)) + (total (gethash "total" response))) + + (watch-issues (gethash "issues" response)) + + ;; Stop looping if we're on the last page of results. + (when (> start-at + (- total max-results)) + (return)))))) (defun fetch-issues (endpoint jql &key basic-auth-token) (jzon:parse @@ -37,3 +49,7 @@ :headers `((:content-type . "application/json") (:authorization . ,(format nil "Basic ~A" basic-auth-token)))))) + +(defun watch-issues (issues) + (loop for issue across issues do + (format t "Watching issue ~A~%" (gethash "key" issue)))) |