aboutsummaryrefslogtreecommitdiff
path: root/sx-tag.el
diff options
context:
space:
mode:
Diffstat (limited to 'sx-tag.el')
-rw-r--r--sx-tag.el21
1 files changed, 16 insertions, 5 deletions
diff --git a/sx-tag.el b/sx-tag.el
index 82f7ddb..07b7a77 100644
--- a/sx-tag.el
+++ b/sx-tag.el
@@ -26,9 +26,21 @@
;;; Getting the list from a site
-(defvar sx-tag-filter '((tag.name))
+(defvar sx-tag-filter
+ (sx-filter-from-nil
+ (tag.name))
"Filter used when querying tags.")
+(defun sx-tag--get-all (site)
+ "Retrieve all tags for SITE."
+ (mapcar
+ (lambda (tag)
+ (cdr (assoc 'name tag)))
+ (sx-method-call 'tags
+ :get-all t
+ :filter sx-tag-filter
+ :site site)))
+
(defun sx-tag--get-some-tags-containing (site string)
"Return at most 100 tags for SITE containing STRING.
Returns an array."
@@ -36,7 +48,7 @@ Returns an array."
:auth nil
:filter sx-tag-filter
:site site
- :keywords `((page . 1) (pagesize . 100) (inname . ,string))))
+ :keywords `((inname . ,string))))
(defun sx-tag--get-some-tag-names-containing (site string)
"Return at most 100 tag names for SITE containing STRING.
@@ -52,7 +64,7 @@ TAGS can be a string (the tag name) or a list of strings.
Fails if TAGS is a list with more than 100 items.
Return the list of invalid tags in TAGS."
(and (listp tags) (> (length tags) 100)
- (error "Invalid argument. TAG has more than 100 items"))
+ (error "Invalid argument. TAG has more than 100 items"))
(let ((result
(mapcar
(lambda (x) (cdr (assoc 'name x)))
@@ -61,8 +73,7 @@ Return the list of invalid tags in TAGS."
:submethod 'info
:auth nil
:filter sx-tag-filter
- :site site
- :keywords '((page . 1) (pagesize . 100))))))
+ :site site))))
(cl-remove-if (lambda (x) (member x result)) tags)))
(provide 'sx-tag)