refactor(services): share the SDK list-page wrapper

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 20:49:33 +02:00
1 parent 9df6cb7dd3
commit dbe2d376fe
12 files changed
+98 -142

No files matched your search

+3 -7
View File
@@ -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