mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 00:02:25 -05:00
[feature] add paging to account follows, followers and follow requests endpoints (#2186)
This commit is contained in:
parent
4b594516ec
commit
7293d6029b
51 changed files with 2281 additions and 641 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue