aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnson Denen <johnson.denen@gmail.com>2017-04-23 09:28:14 -0400
committerJohnson Denen <johnson.denen@gmail.com>2017-04-23 11:09:06 -0400
commitcf814e11bdb9c3f7a8b4aeed61d429a28a4d66cb (patch)
tree459183e386e4136efa476d20e82f9f89351d6d71
parent993fbec64edf128ba9e5a1aa61f93c385fe3be31 (diff)
Group API endpoint function with mastodon-http
-rw-r--r--lisp/mastodon-client.el2
-rw-r--r--lisp/mastodon-http.el2
-rw-r--r--lisp/mastodon-tl.el6
-rw-r--r--lisp/mastodon-toot.el4
-rw-r--r--test/mastodon-client-tests.el2
5 files changed, 8 insertions, 8 deletions
diff --git a/lisp/mastodon-client.el b/lisp/mastodon-client.el
index 25f303f..d422e78 100644
--- a/lisp/mastodon-client.el
+++ b/lisp/mastodon-client.el
@@ -41,7 +41,7 @@
(defun mastodon-client--register ()
"POST client to Mastodon."
(mastodon-http--post
- (mastodon--api-for "apps")
+ (mastodon-http--api "apps")
'(("client_name" . "mastodon.el")
("redirect_uris" . "urn:ietf:wg:oauth:2.0:oob")
("scopes" . "read write follow")
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index e6e5549..3727e45 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -34,7 +34,7 @@
:prefix "mastodon-http-"
:group 'mastodon)
-(defun mastodon--api-for (endpoint)
+(defun mastodon-http--api (endpoint)
"Return Mastondon API URL for ENDPOINT."
(concat mastodon-instance-url "/api/" mastodon--api-version "/" endpoint))
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 3944084..a7ab9da 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -157,7 +157,7 @@ Return value from boosted content if available."
;; Look into the JSON returned here by Local
(defun mastodon-tl--updated-json (timeline id)
"Return JSON for TIMELINE since ID."
- (let ((url (mastodon--api-for (concat "timelines/"
+ (let ((url (mastodon-http--api (concat "timelines/"
timeline
"?since_id="
(number-to-string id)))))
@@ -179,7 +179,7 @@ Return value from boosted content if available."
"Open thread buffer for toot under `point'."
(interactive)
(let* ((id (number-to-string (mastodon-tl--property 'toot-id)))
- (url (mastodon--api-for (format "statuses/%s/context" id)))
+ (url (mastodon-http--api (format "statuses/%s/context" id)))
(buffer (format "*mastodon-thread-%s*" id))
(toot (mastodon-tl--property 'toot-json))
(context (mastodon-http--get-json url)))
@@ -205,7 +205,7 @@ Return value from boosted content if available."
(defun mastodon-tl--get (timeline)
"Display TIMELINE in buffer."
- (let* ((url (mastodon--api-for (concat "timelines/" timeline)))
+ (let* ((url (mastodon-http--api (concat "timelines/" timeline)))
(buffer (concat "*mastodon-" timeline "*"))
(json (mastodon-http--get-json url)))
(with-output-to-temp-buffer buffer
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 9096a47..1277a9c 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -46,7 +46,7 @@
(defun mastodon-toot--action (action callback)
"Take ACTION on toot at point, then execute CALLBACK."
(let* ((id (mastodon-tl--property 'toot-id))
- (url (mastodon--api-for (concat "statuses/"
+ (url (mastodon-http--api (concat "statuses/"
(number-to-string id)
"/"
action))))
@@ -63,7 +63,7 @@
"Kill new-toot buffer/window and POST contents to the Mastodon instance."
(interactive)
(let* ((toot (buffer-string))
- (endpoint (mastodon--api-for "statuses"))
+ (endpoint (mastodon-http--api "statuses"))
(args `(("status" . ,toot)
("in_reply_to_id" . ,mastodon-toot--reply-to-id))))
(progn
diff --git a/test/mastodon-client-tests.el b/test/mastodon-client-tests.el
index 73a3d7e..e1f92f8 100644
--- a/test/mastodon-client-tests.el
+++ b/test/mastodon-client-tests.el
@@ -3,7 +3,7 @@
(ert-deftest register ()
"Should POST to /apps."
(with-mock
- (mock (mastodon--api-for "apps") => "https://instance.url/api/v1/apps")
+ (mock (mastodon-http--api "apps") => "https://instance.url/api/v1/apps")
(mock (mastodon-http--post "https://instance.url/api/v1/apps"
'(("client_name" . "mastodon.el")
("redirect_uris" . "urn:ietf:wg:oauth:2.0:oob")