Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total count of repos #2277

Closed
Morlinest opened this issue Aug 8, 2017 · 9 comments
Closed

Total count of repos #2277

Morlinest opened this issue Aug 8, 2017 · 9 comments
Labels
issue/stale type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Comments

@Morlinest
Copy link
Member

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).

@lafriks lafriks added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Aug 8, 2017
@lafriks lafriks added this to the 1.x.x milestone Aug 8, 2017
@Morlinest
Copy link
Member Author

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

@sapk
Copy link
Member

sapk commented Aug 8, 2017

This would help if we paginate results later.

@Morlinest
Copy link
Member Author

Morlinest commented 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.

@bkcsoft
Copy link
Member

bkcsoft commented 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
Copy link
Member

bkcsoft commented Aug 24, 2017

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

@Morlinest
Copy link
Member Author

@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.

@bkcsoft
Copy link
Member

bkcsoft commented 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 🙁

@stale
Copy link

stale bot commented 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 stale bot added the issue/stale label Feb 13, 2019
@lunny
Copy link
Member

lunny commented Feb 27, 2019

should be fixed by #2285

@lunny lunny closed this as completed Feb 27, 2019
@lafriks lafriks removed this from the 1.x.x milestone Feb 27, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/stale type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

No branches or pull requests

5 participants