aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-09-02 13:16:11 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-09-02 13:16:11 +0200
commitf8ea1b346fef0c91ab558657eced6bce0a83e14b (patch)
treef883ffdacfd8f5d16e872d22ec9d0324062cd653 /lisp/mastodon-http.el
parent3642927d8c60faee3cc7aea1136d33bce7e1a381 (diff)
parent3ec2f7814aa11f860658e4e995ea4f8accc9499a (diff)
Merge branch 'develop'
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el19
1 files changed, 8 insertions, 11 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 49b2375..9904232 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -168,7 +168,7 @@ Pass response buffer to CALLBACK function."
(defun mastodon-http--append-query-string (url params)
"Append PARAMS to URL as query strings and return it.
-PARAMS should be an alist as required `url-build-query-string'."
+PARAMS should be an alist as required by `url-build-query-string'."
(let ((query-string (url-build-query-string params)))
(concat url "?" query-string)))
@@ -204,21 +204,18 @@ PARAM is a formatted request parameter, eg 'following=true'."
;; profile update functions
-(defun mastodon-http--patch-json (url)
- "Make synchronous PATCH request to URL. Return JSON response."
- (with-current-buffer (mastodon-http--patch url)
+(defun mastodon-http--patch-json (url &optional params)
+ "Make synchronous PATCH request to URL. Return JSON response.
+Optionally specify the PARAMS to send."
+ (with-current-buffer (mastodon-http--patch url params)
(mastodon-http--process-json)))
-;; hard coded just for bio note for now:
-(defun mastodon-http--patch (base-url &optional note)
+(defun mastodon-http--patch (base-url &optional params)
"Make synchronous PATCH request to BASE-URL.
-Optionally specify the NOTE to edit.
-Pass response buffer to CALLBACK function."
+Optionally specify the PARAMS to send."
(mastodon-http--authorized-request
"PATCH"
- (let ((url (if note
- (concat base-url "?note=" (url-hexify-string note))
- base-url)))
+ (let ((url (mastodon-http--append-query-string base-url params)))
(mastodon-http--url-retrieve-synchronously url))))
;; Asynchronous functions