[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
continuous-integration/drone/pr Build is passing Details
d344d140b8
fix test & setDefaults & saveSetDefaults
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
continuous-integration/drone/pr Build is failing Details
4160adeedd
Merge branch 'master' into add_Next-to-response
6543 added 1 commit 2021-01-29 21:20:16 +00:00
continuous-integration/drone/pr Build is failing Details
33418ef511
fix & more func
6543 added 7 commits 2021-01-29 22:43:56 +00:00
continuous-integration/drone/pr Build is passing Details
b89f8f2eb9
Update Test Data
continuous-integration/drone/pr Build is passing Details
6b3ae41b72
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
continuous-integration/drone/pr Build is passing Details
0cb4e36105
add Next up to ListReleases()
6543 added 3 commits 2021-01-30 01:51:23 +00:00
6543 added 1 commit 2021-01-30 01:53:33 +00:00
continuous-integration/drone/pr Build is passing Details
87587ab592
out comment for now
6543 added 2 commits 2021-01-30 02:05:21 +00:00
6543 added 2 commits 2021-01-30 02:14:42 +00:00
continuous-integration/drone/pr Build is passing Details
b8e97bd24a
parse links once
6543 added 1 commit 2021-01-30 13:27:02 +00:00
continuous-integration/drone/pr Build is passing Details
f5101c32f1
Merge branch 'master' into add_Next-to-response
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?
All checks were successful
continuous-integration/drone/pr Build is passing
Required
Details
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
Sign in to join this conversation.
No description provided.