v2 icon indicating copy to clipboard operation
v2 copied to clipboard

Get Categories API: Add count of read/unread items

Open jcollas opened this issue 3 years ago • 2 comments

  • [X ] I have read this document: https://miniflux.app/opinionated.html#feature-request

when calling /v1/categories, it would simplify client development to return the available items for a category.

now:

[{"id":13,"title":"All","user_id":2}]

proposed:

[{"id":13,"title":"All","unread":232,"read":"41","total":273,"user_id":2}]

It could also just be the unread count.

This is a great application, thanks for writing it.

jcollas avatar Mar 03 '21 14:03 jcollas

I commented on a similar issue: https://github.com/miniflux/v2/issues/512#issuecomment-797868878

fguillot avatar Mar 13 '21 05:03 fguillot

Hi,

Counting at category level might be a performance concern because it require join and count on a lot of data in the server.

You might be interested in my PR #1431 to fetch the feed count. It is based on fetchFeedCounter() which is quite efficent and straighforward.

It does not "simplify client development" but it make it possible for your frontend to infer the category count if you map the feed categories with this feed count client side.

Regards, Pascal

PascalNoisette avatar May 14 '22 11:05 PascalNoisette