diff options
author | Abhiseck Paira <abhiseckpaira@disroot.org> | 2021-12-28 14:46:46 +0530 |
---|---|---|
committer | Abhiseck Paira <abhiseckpaira@disroot.org> | 2022-01-13 19:22:45 +0530 |
commit | 89add914c9e10979c271cdbb5f4af076ecbe41db (patch) | |
tree | 5d851d2ca3c4cab5e393e51a8490ac726039addc | |
parent | 2349750b607388a1a665c5e68b5708d9563ecaff (diff) |
add helper function `mastodon-http-append-query-string'
Add helper function `mastodon-http-append-query-string' which create
URLs with query strings appended to its end. (see doc string for
details.)
-rw-r--r-- | lisp/mastodon-http.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index f988e39..8e96b39 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -32,6 +32,7 @@ (require 'json) (require 'request) ; for attachments upload +(require 'url) (defvar mastodon-instance-url) (defvar mastodon-toot--media-attachment-ids) @@ -156,6 +157,13 @@ Pass response buffer to CALLBACK function." (with-temp-buffer (mastodon-http--url-retrieve-synchronously url)))) +(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'." + (let ((query-string (url-build-query-string params))) + (concat url "?" query-string))) + ;; search functions: (defun mastodon-http--process-json-search () "Process JSON returned by a search query to the server." |