From cf814e11bdb9c3f7a8b4aeed61d429a28a4d66cb Mon Sep 17 00:00:00 2001 From: Johnson Denen Date: Sun, 23 Apr 2017 09:28:14 -0400 Subject: Group API endpoint function with mastodon-http --- lisp/mastodon-client.el | 2 +- lisp/mastodon-http.el | 2 +- lisp/mastodon-tl.el | 6 +++--- lisp/mastodon-toot.el | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lisp') 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 -- cgit v1.2.3