/
utils.go
36 lines (29 loc) · 839 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package restclient
import (
"net/url"
"github.com/callummance/nazuna/messages"
)
type pagination struct {
Before string `json:"before,omitempty"`
After string `json:"after,omitempty"`
}
func (p pagination) insertToValues(initialValues *url.Values) {
if p.After != "" {
(*initialValues)["after"] = []string{p.After}
} else if p.Before != "" {
(*initialValues)["before"] = []string{p.Before}
}
}
type paginationCursor struct {
Cursor string `json:"cursor"`
}
type subscriptionsPage struct {
Total int `json:"total"`
Data []messages.Subscription `json:"data"`
Limit int `json:"limit"`
Pagination paginationCursor `json:"pagination"`
}
type streamsPage struct {
Data []TwitchStream `json:"data"`
Pagination paginationCursor `json:"pagination"`
}