aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-search.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-13 16:01:28 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-13 16:01:28 +0200
commitbeb877d523383d0adf2314e67c3655c6fbe87a7d (patch)
treef458f1b6f6646d4e1eaafea630131caf24e53809 /lisp/mastodon-search.el
parente0b2f1a5eb1dab3b99f974b030bdbb866bd48dae (diff)
add basic limit/offset search params
Diffstat (limited to 'lisp/mastodon-search.el')
-rw-r--r--lisp/mastodon-search.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el
index 602df8d..bf0f948 100644
--- a/lisp/mastodon-search.el
+++ b/lisp/mastodon-search.el
@@ -146,9 +146,11 @@ PRINT-FUN is the function used to print the data from the response."
'("statuses" "accounts" "hashtags"))
(defun mastodon-search--search-query (query
- &optional type following account-id)
+ &optional type limit
+ following account-id offset)
"Prompt for a search QUERY and return accounts, statuses, and hashtags.
TYPE is a member of `mastodon-search-types'.
+LIMIT is a number as string, up to 40, with 40 the default.
FOLLOWING means limit to accounts followed, for \"accounts\" type only.
A single prefix arg also sets FOLLOWING to true.
ACCOUNT-ID means limit search to that account, for \"statuses\" type only."
@@ -164,10 +166,14 @@ ACCOUNT-ID means limit search to that account, for \"statuses\" type only."
(completing-read "Search type: "
mastodon-search-types
nil t))))
+ (limit (or limit "40"))
+ (offset (or offset "0"))
(buffer (format "*mastodon-search-%s-%s*" type query))
(params (cl-remove nil
`(("q" . ,query)
,(when type `("type" . ,type))
+ ,(when limit `("limit" . ,limit))
+ ,(when offset `("offset" . ,offset))
,(when following `("following" . ,following))
,(when account-id `("account_id" . ,account-id)))))
(response (mastodon-http--get-json url params))