Skip to content

Commit

Permalink
Adding jiralib-get-labels
Browse files Browse the repository at this point in the history
This functions gets all available labels. So we can later use them to
assign to during our jira create issue workflow.
  • Loading branch information
djgoku committed Sep 27, 2024
1 parent bd57358 commit 9f842a7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion jiralib.el
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ request.el, so if at all possible, it should be avoided."
('updateIssue (jiralib--rest-call-it
(format "/rest/api/2/issue/%s" (first params))
:type "PUT"
:data (json-encode `((fields . ,(second params)))))))))
:data (json-encode `((fields . ,(second params))))))
('getLabels (jiralib--rest-call-it (format "/rest/api/2/label?startAt=%s" (first params)))))))

(defun jiralib--soap-call-it (&rest args)
"Deprecated SOAP call endpoint. Will be removed soon.
Expand Down Expand Up @@ -1202,6 +1203,20 @@ Auxiliary Notes:
(apply 'jiralib-call "getIssuesFromBoard"
(cl-getf params :callback) board-id params))

(defvar jiralib-labels-cache nil)
(defun jiralib-get-labels ()
"Return assignable labels that can be added to an issue."
(unless jiralib-labels-cache
(setq jiralib-labels-start-at 0)
(while (progn
(let* ((labels (jiralib-call "getLabels" nil jiralib-labels-start-at))
(max-results (alist-get 'maxResults labels))
(is-last (alist-get 'isLast labels))
(values (alist-get 'values labels)))
(setq jiralib-labels-start-at (+ max-results jiralib-labels-start-at)
jiralib-labels-cache (append values jiralib-labels-cache))
(not (eq is-last t)))))))

(defun jiralib--agile-not-last-entry (num-entries total start-at limit)
"Return true if need to retrieve next page from agile api"
(and (> num-entries 0)
Expand Down

0 comments on commit 9f842a7

Please sign in to comment.