aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-http.el11
-rw-r--r--lisp/mastodon-tl.el11
2 files changed, 22 insertions, 0 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 7be4467..b590bf0 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -98,6 +98,17 @@ Pass response buffer to CALLBACK function."
(mastodon-auth--access-token))))))
(url-retrieve-synchronously url)))
+(defun mastodon-http--delete (url)
+ "Make GET request to URL.
+
+Pass response buffer to CALLBACK function."
+ (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 vector."
(let ((json-vector
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 0b918df..ae21041 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -782,6 +782,17 @@ webapp"
(cdr (assoc 'descendants context))))))
(message "No Thread!"))))
+(defun mastodon-tl--delete-toot ()
+ "Delete user's toot at point synchronously."
+ (interactive)
+ (let* ((id (mastodon-tl--as-string (mastodon-tl--toot-id
+ (mastodon-tl--property 'toot-json))))
+ (url (mastodon-http--api (format "statuses/%s" id))))
+ (let ((response (mastodon-http--delete url)))
+ (mastodon-http--triage response
+ (lambda ()
+ (message "Toot deleted! There may be a delay before it disappears from your profile."))))))
+
(defun mastodon-tl--more ()
"Append older toots to timeline."
(interactive)