-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathresponse.go
35 lines (29 loc) · 954 Bytes
/
response.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
package solus
// ResponseLinks represent useful links which is returned with paginated response.
type ResponseLinks struct {
First string `json:"first"`
Last string `json:"last"`
Prev string `json:"prev"`
Next string `json:"next"`
}
// ResponseMeta represent response metadata which is returned with paginated response.
type ResponseMeta struct {
CurrentPage int `json:"current_page"`
From int `json:"from"`
LastPage int `json:"last_page"`
Path string `json:"path"`
PerPage int `json:"per_page"`
To int `json:"to"`
Total int `json:"total"`
}
type paginatedResponse struct {
Links ResponseLinks `json:"links"`
Meta ResponseMeta `json:"meta"`
err error
service *service
}
// Run `go generate` to add `Next()` method to all required structs.
// Err return an error which is occurred during fetching next page data.
func (r *paginatedResponse) Err() error {
return r.err
}