From d6d114189eaf90f6ae4a0257b92555b257c056f2 Mon Sep 17 00:00:00 2001 From: mousebot Date: Sun, 30 May 2021 13:32:55 +0200 Subject: http: docstrings and move delete fun --- lisp/mastodon-http.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 3b31668..462b5c6 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -101,7 +101,7 @@ Authorization header is included by default unless UNAUTHENTICED-P is non-nil." (url-retrieve-synchronously url nil nil mastodon-http--timeout))))) (defun mastodon-http--get (url) - "Make GET request to URL. + "Make synchronous GET request to URL. Pass response buffer to CALLBACK function." (let ((url-request-method "GET") @@ -112,17 +112,8 @@ Pass response buffer to CALLBACK function." (url-retrieve-synchronously url) (url-retrieve-synchronously url nil nil mastodon-http--timeout)))) -(defun mastodon-http--delete (url) - "Make DELETE request to URL." - (let ((url-request-method "DELETE") - (url-request-extra-headers - `(("Authorization" . ,(concat "Bearer " - (mastodon-auth--access-token)))))) - (with-temp-buffer - (url-retrieve-synchronously url)))) - (defun mastodon-http--get-json (url) - "Make GET request to URL. Return JSON response." + "Make synchronous GET request to URL. Return JSON response." (with-current-buffer (mastodon-http--get url) (mastodon-http--process-json))) @@ -137,6 +128,15 @@ Pass response buffer to CALLBACK function." (kill-buffer) (json-read-from-string json-string))) +(defun mastodon-http--delete (url) + "Make DELETE request to URL." + (let ((url-request-method "DELETE") + (url-request-extra-headers + `(("Authorization" . ,(concat "Bearer " + (mastodon-auth--access-token)))))) + (with-temp-buffer + (url-retrieve-synchronously url)))) + ;; http functions for search: (defun mastodon-http--process-json-search () "Process JSON returned by a search query to the server." -- cgit v1.2.3