mirror of
https://github.com/gfleury/go-bitbucket-v1.git
synced 2025-04-18 06:38:06 -05:00
Better checks on HasNextPage
This commit is contained in:
parent
d6c940c167
commit
defacfd94c
@ -555,9 +555,12 @@ func NewRawAPIResponse(r *http.Response) (*APIResponse, error) {
|
|||||||
|
|
||||||
// HasNextPage returns if response is paged and has next page and where it does start
|
// HasNextPage returns if response is paged and has next page and where it does start
|
||||||
func HasNextPage(response *APIResponse) (isLastPage bool, nextPageStart int) {
|
func HasNextPage(response *APIResponse) (isLastPage bool, nextPageStart int) {
|
||||||
isLastPage = response.Values["isLastPage"].(bool)
|
isLastPage, ok := response.Values["isLastPage"].(bool)
|
||||||
if !isLastPage {
|
if ok && !isLastPage {
|
||||||
nextPageStart = int(response.Values["nextPageStart"].(float64))
|
floatStart, ok := response.Values["nextPageStart"].(float64)
|
||||||
|
if ok {
|
||||||
|
nextPageStart = int(floatStart)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return !isLastPage, nextPageStart
|
return !isLastPage, nextPageStart
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user