mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor(services): share the SDK list-page wrapper
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
12 files changed
+98
-142
No files matched your search
@@ -5,7 +5,6 @@ package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -122,12 +121,9 @@ func (s Issues) ListPage(ctx context.Context, opts ListOptions) (Page[Issue], er
|
||||
if opts.Before != nil {
|
||||
query.Before = *opts.Before
|
||||
}
|
||||
issues, err := listPage(opts.Limit, opts.Page, func(limit, page int) ([]*gitea.Issue, http.Header, error) {
|
||||
query.ListOptions = listOptions(limit, page)
|
||||
issues, resp, err := call(ctx, s.Client, func(ctx context.Context, c *gitea.Client) ([]*gitea.Issue, *gitea.Response, error) {
|
||||
return c.Issues.ListRepoIssues(ctx, owner, repo, query)
|
||||
})
|
||||
return issues, headerOf(resp), err
|
||||
issues, err := callPage(ctx, s.Client, opts.Limit, opts.Page, func(ctx context.Context, c *gitea.Client, list gitea.ListOptions) ([]*gitea.Issue, *gitea.Response, error) {
|
||||
query.ListOptions = list
|
||||
return c.Issues.ListRepoIssues(ctx, owner, repo, query)
|
||||
})
|
||||
if err != nil {
|
||||
return Page[Issue]{}, err
|
||||
|
||||
Reference in new issue
Block a user