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

API Generalize Header for get XY list endpoints #11114

Closed
2 tasks
6543 opened this issue Apr 17, 2020 · 3 comments · Fixed by #16551
Closed
2 tasks

API Generalize Header for get XY list endpoints #11114

6543 opened this issue Apr 17, 2020 · 3 comments · Fixed by #16551
Assignees
Labels
modifies/api This PR adds API routes or modifies them type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@6543
Copy link
Member

6543 commented Apr 17, 2020

as title, if an api endpoint returns a list of objects it should:
A: support paggination (optional)
B: add max-obj-count to header

  • add this to API programming guidelinge

  • create header for all get list endpints

  • ctx.Header().Set("X-Total-Count", fmt.Sprintf("%d", maxResults))

@guillep2k guillep2k added modifies/api This PR adds API routes or modifies them type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Apr 18, 2020
@zeripath
Copy link
Contributor

I would be cautious about assuming that we should always provide a full count - that can be very expensive in certain circumstances - (mostly circumstances that we've already committed to providing a count.)

@6543
Copy link
Member Author

6543 commented May 16, 2020

good point ...

sebastian-sauer added a commit to sebastian-sauer/gitea that referenced this issue Jun 30, 2021
as proposed in go-gitea#11114

Co-authored-by: 6543 <6543@obermui.de>
@6543 6543 self-assigned this Jun 30, 2021
@6543 6543 added this to the 1.16.0 milestone Jun 30, 2021
@6543
Copy link
Member Author

6543 commented Jul 2, 2021

... maybe it's better to add a help function named as ctx.SetResultHeader(...) to do it.

Originally posted by @a1012112796 in #16300 (comment)

@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants