Created
August 4, 2024 20:33
-
-
Save erickgnavar/d4c132f300cdbf26d27d7f0e4c59a6dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let ((url-request-method "POST") | |
(url-request-extra-headers `(("Content-Type" . "application/json") ("User-Agent" . "gist.el") ("Authorization" . ,(concat "Bearer " oauth-token)))) | |
(url-request-data (json-encode payload))) | |
(url-retrieve "https://api.github.com/gists" 'my/gist-handle-response)))) | |
(defun my/gist-handle-response (response) | |
"Process content of RESPONSE and extract link." | |
(let* ((status-line (buffer-substring-no-properties (line-beginning-position) (line-end-position))) | |
(status-code (nth 1 (split-string status-line " ")))) | |
(message status-code) | |
(unless (not (string-equal status-code "201")) | |
(user-error "There was a problem with GitHub API, try again later")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment