feat: add ghpr-review-mode
This commit is contained in:
parent
30cfe3b7f3
commit
e8b876075f
2 changed files with 90 additions and 0 deletions
20
ghpr-api.el
20
ghpr-api.el
|
@ -75,6 +75,26 @@ Returns a list of pull request objects on success, nil on failure."
|
|||
(message "Error fetching pull requests: %s" error-thrown)))))
|
||||
result))
|
||||
|
||||
(defun ghpr--get-patch-content (repo-name pr-number)
|
||||
"Retrieve the diff contents for PR-NUMBER in REPO-NAME."
|
||||
(let ((token (ghpr--get-token))
|
||||
(url (format "https://api.github.com/repos/%s/pulls/%s" repo-name pr-number))
|
||||
(result nil))
|
||||
(when token
|
||||
(request url
|
||||
:type "GET"
|
||||
:headers `(("Accept" . "application/vnd.github.diff")
|
||||
("Authorization" . ,(format "Bearer %s" token))
|
||||
("X-GitHub-Api-Version" . "2022-11-28"))
|
||||
:sync t
|
||||
:success (cl-function
|
||||
(lambda (&key data &allow-other-keys)
|
||||
(setq result data)))
|
||||
:error (cl-function
|
||||
(lambda (&key error-thrown &allow-other-keys)
|
||||
(message "Error fetching diff: %s" error-thrown)))))
|
||||
result))
|
||||
|
||||
(provide 'ghpr-api)
|
||||
|
||||
;;; ghpr-api.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue