[WIP] Add Next() pagination helper to Response #473

Draft
6543 wants to merge 23 commits from 6543/go-sdk:add_Next-to-response into main
Owner

add Next function to Response, for easy pagination

example:

func getIssueWithSoon(c *gitea.Client) (issues []*gitea.Issue, _ error) {
  for {
    il, resp, err := c.ListIssues(ListIssueOption{KeyWord: "soon"})
    if err != nil {
        return nil, err
    }
    issues = append(issues, il)
    if !resp.Next() {
    	break
    }
  }
  return
}

close #396

TODO:

  • use saveSetDefaults on all List functions
  • process preparePaginatedResponse on all List functions respecting pagination
  • gitea >= 1.12
add Next function to Response, for easy pagination example: ```go func getIssueWithSoon(c *gitea.Client) (issues []*gitea.Issue, _ error) { for { il, resp, err := c.ListIssues(ListIssueOption{KeyWord: "soon"}) if err != nil { return nil, err } issues = append(issues, il) if !resp.Next() { break } } return } ``` close #396 TODO: * [ ] use saveSetDefaults on all List functions * [ ] process preparePaginatedResponse on all List functions respecting pagination * [ ] gitea >= 1.12
6543 added 4 commits 2020-12-21 21:31:45 +00:00
6543 added the
kind/feature
status/needs-feedback
labels 2020-12-21 21:32:16 +00:00
6543 added 1 commit 2020-12-21 21:53:00 +00:00
fix test & setDefaults & saveSetDefaults
All checks were successful
continuous-integration/drone/pr Build is passing
d344d140b8
6543 reviewed 2020-12-21 21:54:26 +00:00
Dismissed
gitea/client.go Outdated
@ -47,0 +50,4 @@
// pagination values, need to be initialized by preparePaginatedResponse
currentItem int // number of current returned objects
maxItems int // number of current returned objects
Author
Owner

number of max items returned per page

number of max items returned per page
6543 marked this conversation as resolved
Contributor

Nice!

Nice!
6543 added this to the v0.14.0 milestone 2021-01-29 18:49:34 +00:00
6543 added 1 commit 2021-01-29 20:43:26 +00:00
Merge branch 'master' into add_Next-to-response
Some checks failed
continuous-integration/drone/pr Build is failing
4160adeedd
6543 added 1 commit 2021-01-29 21:20:16 +00:00
fix & more func
Some checks failed
continuous-integration/drone/pr Build is failing
33418ef511
6543 added 7 commits 2021-01-29 22:43:56 +00:00
Update Test Data
All checks were successful
continuous-integration/drone/pr Build is passing
b89f8f2eb9
make tests repetable
now you dont have to "make test-instance" for each test just bring up a test instance and run the tests as often as you like
All checks were successful
continuous-integration/drone/pr Build is passing
6b3ae41b72
add Next up to ListReleases()
All checks were successful
continuous-integration/drone/pr Build is passing
0cb4e36105
6543 added 3 commits 2021-01-30 01:51:23 +00:00
upstream: ListRepoBranches do not paginate
Some checks failed
continuous-integration/drone/pr Build is failing
564382dd70
6543 added 1 commit 2021-01-30 01:53:33 +00:00
out comment for now
All checks were successful
continuous-integration/drone/pr Build is passing
87587ab592
6543 added 2 commits 2021-01-30 02:05:21 +00:00
migrate ListCronTasks
All checks were successful
continuous-integration/drone/pr Build is passing
520c69f19a
6543 added 2 commits 2021-01-30 02:14:42 +00:00
parse links once
All checks were successful
continuous-integration/drone/pr Build is passing
b8e97bd24a
6543 added 1 commit 2021-01-30 13:27:02 +00:00
Merge branch 'master' into add_Next-to-response
All checks were successful
continuous-integration/drone/pr Build is passing
f5101c32f1
6543 modified the milestone from v0.14.0 to v0.15.0 2021-02-02 22:59:24 +00:00
Author
Owner

moved to v1.15.0 as it needs gitea >= 1.12 (List option must respect pagination)

moved to v1.15.0 as it needs `gitea >= 1.12` (List option **must** respect pagination)
6543 removed the
status/needs-feedback
label 2021-02-02 23:01:07 +00:00
6543 added a new dependency 2021-03-23 19:33:21 +00:00
6543 removed a dependency 2021-03-29 23:20:03 +00:00
Author
Owner

because https://github.com/go-gitea/gitea/pull/16551 will land in v1.16.0 I'll move it

because https://github.com/go-gitea/gitea/pull/16551 will land in v1.16.0 I'll move it
6543 modified the milestone from v0.15.0 to v0.16.0 2021-08-10 14:53:40 +00:00
Contributor

1.16 has been released, can this be merged now?

1.16 has been released, can this be merged now?
appleboy modified the milestone from v0.16.0 to v0.18.0 2023-12-17 04:57:49 +00:00
Some checks are pending
continuous-integration/drone/pr Build is passing
testing / testing*
Required
This pull request has changes conflicting with the target branch.
  • gitea/Issue_label_test.go
  • gitea/admin_test.go
  • gitea/attachment.go
  • gitea/client.go
  • gitea/fork.go
  • gitea/git_hook.go
  • gitea/hook.go
  • gitea/issue.go
  • gitea/issue_comment.go
  • gitea/issue_label.go

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u add_Next-to-response:6543-add_Next-to-response
git checkout 6543-add_Next-to-response
Sign in to join this conversation.
No description provided.