Total count of repos #948

Closed
opened 2025-11-02 03:42:50 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @Morlinest on GitHub (Aug 8, 2017).

I need total count of repos to fix dashboard UI. Gitea returns (api/v1/repos/search) only array of repos but I do not know if there are more. I think we should add "Total" (or something like this) to api.SearchResults (code.gitea.io/sdk/gitea).

Originally created by @Morlinest on GitHub (Aug 8, 2017). I need total count of repos to fix dashboard UI. Gitea returns (api/v1/repos/search) only array of repos but I do not know if there are more. I think we should add "Total" (or something like this) to api.SearchResults (code.gitea.io/sdk/gitea).
GiteaMirror added the type/featureissue/stale labels 2025-11-02 03:42:50 -06:00
Author
Owner

@Morlinest commented on GitHub (Aug 8, 2017):

Another option is to set header like "X-Total-Count".

@Morlinest commented on GitHub (Aug 8, 2017): Another option is to set header like "X-Total-Count".
Author
Owner

@sapk commented on GitHub (Aug 8, 2017):

This would help if we paginate results later.

@sapk commented on GitHub (Aug 8, 2017): This would help if we paginate results later.
Author
Owner

@Morlinest commented on GitHub (Aug 8, 2017):

I've implemented it in header in my fix for now (very simple - ctx.Header().Set("X-Total-Count", fmt.Sprintf("%d", count))), but I want to resolve #2278 first.

@Morlinest commented on GitHub (Aug 8, 2017): I've implemented it in header in my fix for now (very simple - `ctx.Header().Set("X-Total-Count", fmt.Sprintf("%d", count))`), but I want to resolve #2278 first.
Author
Owner

@bkcsoft commented on GitHub (Aug 24, 2017):

@Morlinest Please don't prefix with X- (rather use Gitea-) since that has been depricated from the HTTP specs: https://tools.ietf.org/html/rfc6648

@bkcsoft commented on GitHub (Aug 24, 2017): @Morlinest Please don't prefix with `X-` (rather use `Gitea-`) since that has been depricated from the HTTP specs: https://tools.ietf.org/html/rfc6648
Author
Owner

@bkcsoft commented on GitHub (Aug 24, 2017):

And actually, there's the Link-header for pagination, so please use that...

@bkcsoft commented on GitHub (Aug 24, 2017): And actually, there's the `Link`-header for pagination, so please use that... - https://developer.github.com/v3/guides/traversing-with-pagination/ - https://tools.ietf.org/html/rfc5988#section-5.5
Author
Owner

@Morlinest commented on GitHub (Aug 24, 2017):

@bkcsoft Thanks for your opinion. I can use Gitea-Total-Count too, real question is about right way to pass information from server to client (I know there is some deprecation, but it's often being ignored). I think, including TotalCount in response body is better way (also don't know, why gitea responds with ok field, response status code should be used instead). Example of response:

{
    data: [],
    total_count: 0
}

Link header is for pagination links, not for total count. It doesn't contain exact number, only pages. Also this header should be present there (it is in code), but right now it is not working.

@Morlinest commented on GitHub (Aug 24, 2017): @bkcsoft Thanks for your opinion. I can use `Gitea-Total-Count` too, real question is about right way to pass information from server to client (I know there is some deprecation, but it's often being ignored). I think, including `TotalCount` in response body is better way (also don't know, why gitea responds with `ok` field, response status code should be used instead). Example of response: ``` { data: [], total_count: 0 } ``` `Link` header is for pagination links, not for `total count`. It doesn't contain exact number, only pages. Also this header should be present there (it is in code), but right now it is not working.
Author
Owner

@bkcsoft commented on GitHub (Aug 27, 2017):

@Morlinest The API exposes this, but code.gitea.io/sdk does not unfortunately. I've yet to find a good way to support it either without breaking compatability 🙁

@bkcsoft commented on GitHub (Aug 27, 2017): @Morlinest The API exposes this, but `code.gitea.io/sdk` does not unfortunately. I've yet to find a good way to support it either without breaking compatability 🙁
Author
Owner

@stale[bot] commented on GitHub (Feb 13, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Feb 13, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@lunny commented on GitHub (Feb 27, 2019):

should be fixed by #2285

@lunny commented on GitHub (Feb 27, 2019): should be fixed by #2285
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#948