aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-19 17:58:01 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-19 18:01:47 +0100
commit25f7e47beddb8fcf789a7e06a03fce5339f8500d (patch)
treea58c35ece1d10fd120391fd633b49465c3a42818 /lisp
parent38b6075e5ce35f512321f05cd5f9f9d622703845 (diff)
http--post - make args + headers optional args
also update all calls to it, no need for nil nil everywhere.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-http.el4
-rw-r--r--lisp/mastodon-notifications.el9
-rw-r--r--lisp/mastodon-tl.el14
-rw-r--r--lisp/mastodon-toot.el4
4 files changed, 13 insertions, 18 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index e67cf2d..6e7bfb3 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -130,8 +130,8 @@ Used for API form data parameters that take an array."
(cl-loop for x in array
collect (cons param-str x)))
-(defun mastodon-http--post (url args headers &optional unauthenticated-p)
- "POST synchronously to URL with ARGS and HEADERS.
+(defun mastodon-http--post (url &optional args headers unauthenticated-p)
+ "POST synchronously to URL, optionally with ARGS and HEADERS.
Authorization header is included by default unless UNAUTHENTICATED-P is non-nil."
(mastodon-http--authorized-request
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index b23e3c5..127a9e2 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -117,8 +117,7 @@ follow-requests view."
(mastodon-http--api "follow_requests")
(format "/%s/%s" id (if reject
"reject"
- "authorize")))
- nil nil)))
+ "authorize"))))))
(mastodon-http--triage response
(lambda ()
(if f-reqs-view-p
@@ -326,8 +325,7 @@ Status notifications are created when you call
(interactive)
(when (y-or-n-p "Clear all notifications?")
(let ((response
- (mastodon-http--post (mastodon-http--api "notifications/clear")
- nil nil)))
+ (mastodon-http--post (mastodon-http--api "notifications/clear"))))
(mastodon-http--triage
response (lambda ()
(when mastodon-tl--buffer-spec
@@ -342,8 +340,7 @@ Status notifications are created when you call
(mastodon-tl--property 'toot-json))))
(response
(mastodon-http--post (mastodon-http--api
- (format "notifications/%s/dismiss" id))
- nil nil)))
+ (format "notifications/%s/dismiss" id)))))
(mastodon-http--triage
response (lambda ()
(when mastodon-tl--buffer-spec
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index b8486cc..6618c48 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1145,7 +1145,7 @@ this just means displaying toot client."
;; need to zero-index our option:
(option-as-arg (number-to-string (1- (string-to-number (car option)))))
(arg `(("choices[]" . ,option-as-arg)))
- (response (mastodon-http--post url arg nil)))
+ (response (mastodon-http--post url arg)))
(mastodon-http--triage response
(lambda ()
(message "You voted for option %s: %s!"
@@ -1604,8 +1604,7 @@ If ID is provided, use that list."
(account-id (alist-get account handles nil nil 'equal))
(url (mastodon-http--api (format "lists/%s/accounts" list-id)))
(response (mastodon-http--post url
- `(("account_ids[]" . ,account-id))
- nil)))
+ `(("account_ids[]" . ,account-id)))))
(mastodon-tl--list-action-triage
response
(message "%s added to list %s!" account list-name))))
@@ -1685,8 +1684,7 @@ Prompt for a context, must be a list containting at least one of \"home\",
contexts)))
(response (mastodon-http--post url (push
`("phrase" . ,word)
- contexts-processed)
- nil)))
+ contexts-processed))))
(mastodon-http--triage response
(lambda ()
(message "Filter created for %s!" word)
@@ -2117,7 +2115,7 @@ NOTIFY is only non-nil when called by `mastodon-tl--follow-user'."
"Post ACTION on user NAME/USER-HANDLE to URL.
NOTIFY is either \"true\" or \"false\", and used when we have been called
by `mastodon-tl--follow-user' to enable or disable notifications."
- (let ((response (mastodon-http--post url nil nil)))
+ (let ((response (mastodon-http--post url)))
(mastodon-http--triage response
(lambda ()
(cond ((string-equal notify "true")
@@ -2145,7 +2143,7 @@ If TAG provided, follow it."
(interactive)
(let* ((tag (or tag (read-string "Tag to follow: ")))
(url (mastodon-http--api (format "tags/%s/follow" tag)))
- (response (mastodon-http--post url nil nil)))
+ (response (mastodon-http--post url)))
(mastodon-http--triage response
(lambda ()
(message "tag #%s followed!" tag)))))
@@ -2166,7 +2164,7 @@ If TAG if provided, unfollow it."
(tag (or tag (completing-read "Unfollow tag: "
tags)))
(url (mastodon-http--api (format "tags/%s/unfollow" tag)))
- (response (mastodon-http--post url nil nil)))
+ (response (mastodon-http--post url)))
(mastodon-http--triage response
(lambda ()
(message "tag #%s unfollowed!" tag)))))
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 53e60bd..d0eb143 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -268,7 +268,7 @@ boosting, or bookmarking toots."
(mastodon-tl--as-string id)
"/"
action))))
- (let ((response (mastodon-http--post url nil nil)))
+ (let ((response (mastodon-http--post url)))
(mastodon-http--triage response callback))))
(defun mastodon-toot--toggle-boost-or-favourite (type)
@@ -666,7 +666,7 @@ If media items have been attached and uploaded with
((mastodon-toot--empty-p)
(message "Empty toot. Cowardly refusing to post this."))
(t
- (let ((response (mastodon-http--post endpoint args nil)))
+ (let ((response (mastodon-http--post endpoint args)))
(mastodon-http--triage response
(lambda ()
(mastodon-toot--kill)