mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 03:32:24 -06:00
[chore] much improved paging package (#2182)
This commit is contained in:
parent
14ef098099
commit
b093947d84
15 changed files with 1154 additions and 445 deletions
|
|
@ -103,8 +103,12 @@ func (m *Module) BlocksGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
limit, errWithCode := apiutil.ParseLimit(c.Query(LimitKey), 20, 100, 2)
|
||||
if err != nil {
|
||||
page, errWithCode := paging.ParseIDPage(c,
|
||||
1, // min limit
|
||||
100, // max limit
|
||||
20, // default limit
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
|
@ -112,11 +116,7 @@ func (m *Module) BlocksGETHandler(c *gin.Context) {
|
|||
resp, errWithCode := m.processor.BlocksGet(
|
||||
c.Request.Context(),
|
||||
authed.Account,
|
||||
paging.Pager{
|
||||
SinceID: c.Query(SinceIDKey),
|
||||
MaxID: c.Query(MaxIDKey),
|
||||
Limit: limit,
|
||||
},
|
||||
page,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue