summaryrefslogtreecommitdiff
path: root/internal/paging/response.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-09-12 14:00:35 +0100
committerLibravatar GitHub <noreply@github.com>2023-09-12 14:00:35 +0100
commit7293d6029b43db693fd170c0c087394339da0677 (patch)
tree09063243faf1b178fde35973486e311f66b1ca33 /internal/paging/response.go
parent[feature] Allow admins to expire remote public keys; refetch expired keys on ... (diff)
downloadgotosocial-7293d6029b43db693fd170c0c087394339da0677.tar.xz
[feature] add paging to account follows, followers and follow requests endpoints (#2186)
Diffstat (limited to 'internal/paging/response.go')
-rw-r--r--internal/paging/response.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/internal/paging/response.go b/internal/paging/response.go
index 498b42d34..71b0cf213 100644
--- a/internal/paging/response.go
+++ b/internal/paging/response.go
@@ -18,6 +18,7 @@
package paging
import (
+ "net/url"
"strings"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
@@ -35,18 +36,13 @@ type ResponseParams struct {
Path string // path to use for next/prev queries in the link header
Next *Page // page details for the next page
Prev *Page // page details for the previous page
- Query []string // any extra query parameters to provide in the link header, should be in the format 'example=value'
+ Query url.Values // any extra query parameters to provide in the link header, should be in the format 'example=value'
}
// PackageResponse is a convenience function for returning
// a bunch of pageable items (notifications, statuses, etc), as well
// as a Link header to inform callers of where to find next/prev items.
func PackageResponse(params ResponseParams) *apimodel.PageableResponse {
- if len(params.Items) == 0 {
- // No items to page through.
- return EmptyResponse()
- }
-
var (
// Extract paging params.
nextPg = params.Next