hydrus
hydrus copied to clipboard
Client API: /get_files/search_files - Return quantity instead of list of files
Add an argument to the /get_files/search_files
endpoint, which is named something to the effect of return_only_quantity
When this argument is set to true
, instead of returning a big list of file IDs, it instead returns the length of the list it would have returned.
For example, instead of sending
[1,2,42,132,1000]
it sends
5
Motivation
I can use this in my 3rd party app to optimize cases where I just want to show how many pending files there are. Querying 10k files and sending them in a big JSON dump just to call len()
and abandon it all to the garbage collector isn't ideal
In that case a route named /get_files/count_files
could make sense?
It would take the same arguments, and would result in the same database filters, but could instead do a SELECT count(*) ...
on it instead SELECT * ...
(or similar)