github.com/jxgolibs/go-oauth2-server@v1.0.1/util/response/list.go (about) 1 package response 2 3 import ( 4 "github.com/RichardKnop/jsonhal" 5 ) 6 7 // ListResponse ... 8 type ListResponse struct { 9 jsonhal.Hal 10 Count uint `json:"count"` 11 Page uint `json:"page"` 12 } 13 14 // NewListResponse creates new ListResponse instance 15 func NewListResponse(count, page int, self, first, last, previous, next, embedName string, items interface{}) *ListResponse { 16 response := &ListResponse{ 17 Count: uint(count), 18 Page: uint(page), 19 } 20 21 response.SetLink("self", self, "") 22 response.SetLink("first", first, "") 23 response.SetLink("last", last, "") 24 response.SetLink("prev", previous, "") 25 response.SetLink("next", next, "") 26 27 response.SetEmbedded(embedName, jsonhal.Embedded(items)) 28 29 return response 30 }