Documentation ¶
Index ¶
Constants ¶
const ( PageSizeParam = "pageSize" PageTokenParam = "pageToken" )
Variables ¶
This section is empty.
Functions ¶
func MaybeSetNextPageToken ¶
func MaybeSetNextPageToken(c *gin.Context, serviceNextPageToken string, respNextPageToken *string) bool
MaybeSetNextPageToken encodes the serviceNextPageToken and the URL query params into a base64url string. The encoded string is assigned to what respNextPageToken is pointing to. respNextPageToken cannot be nil. Any error during the execution is responded to using the passed in gin.Context. The return value corresponds to whether there was an error within the function.
func ParsePaginationParams ¶
func ParsePaginationParams(c *gin.Context, pageRequest *PageRequest) bool
ParsePaginationParams reads the PageSizeParam and PageTokenParam from the URL parameters and populates the passed in pageRequest. The value encoded in PageTokenParam is assumed to be the base64url encoding of a PageToken. It is an error for the query params to be different from the query params encoded in the PageToken. Any error during the execution is responded to using the passed in gin.Context. The return value corresponds to whether there was an error within the function.
Types ¶
type PageRequest ¶
type PageRequest struct { // PageSize is the value associated with PageSizeParam. A nil value means it was not present in the query. When the parameter // is absent, all items in the collection are included in the response. PageSize *int `json:"pageSize,omitempty"` // PageToken is the value associated with PageTokenParam. A nil value means it was not present in the query. PageToken *string `json:"pageToken,omitempty"` }
PageRequest contains the parameters sent in the request.
func (*PageRequest) ToServicePage ¶
func (r *PageRequest) ToServicePage() *common.Page