added AdminListOrgsOptions #202
No reviewers
Labels
No Label
has/backport
has/pull
in progress
invalid
kind/breaking
kind/bug
kind/build
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/refactor
kind/security
kind/testing
kind/translation
kind/ui
need/backport
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/go-sdk#202
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "spawn2kill/go-sdk:master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Since
AdminListOrgs
function is limited to 10 results, it is currently impossible to get all admin's organizations.This PR creates a
AdminListOrgsOptions
struct which allows to use Gitea's API URL query parameters in order to increase the limit of results or by getting another page of results.@ -12,2 +12,4 @@
)
// AdminListOrgsOptions options for listing admin's organizations
type AdminListOrgsOptions struct {
this look like a struct whitch could be used in general
is there already a struct named like paginationOptions or so?
Honestly I don't know the Gitea API so that well, just ran into that issue, fixed it and created a PR for it.
For what I could see rn, there are some structs defining the same URL params for different requests like this
Anyway, that implementation is not right since the slice is being created with a fixed size of 10... If I change the limit of the options to let's say 30, it will still be limited by the slice length.
There are some other implementations like this which by the way are not used by the Gitea API
I suggest a refactor in all SDK requests with the correct implementation of the Gitea API... but for now I guess this PR fixes the problem for this request.
I might work on that refactor as soon as I have some free time for that
I think we can follow some rules of https://github.com/google/go-github.
We can have
type ListOptions
for a common parameters.And then we can create a
OrgListOptions
which includeListOptions
. It could be used by all function to retrieve organization list.I do agree with you @lunny but that change only makes sense if Gitea's API is also refactored in order to support pagination in all GET /list requests... The API itself needs to be uniformed before uniforming the SDK. I mean, why does this request takes pagination, but this and this doesn't?
Right. We need more work to do on APIs. :(
I can see there are some open issues regarding the pagination problem on the API like:
https://github.com/go-gitea/gitea/issues/8131
https://github.com/go-gitea/gitea/issues/8127
https://github.com/go-gitea/gitea/issues/5632
Maybe we can define that all routes that returns a list of anything will support pagination in the future with
page
andlimit
URL parameters,limit
field being limited to 50. If something like that gets defined, I can improve this PR in order to add that future support for pagination.There is some work done about this uniformity like here. That logic will only have to be replicated across all APIs.
@spawn2kill I like lunny's idear: #202 (comment) can you change your PR in this direction
and sure API need some refactor - to ad a new query is not that hard because it is backwards compatible :D
Pull request closed