MCPcopy Index your code
hub / github.com/cloudfoundry/cli / paginate

Method paginate

api/cloudcontroller/ccv3/paginate.go:9–36  ·  view source on GitHub ↗
(request *cloudcontroller.Request, obj interface{}, appendToExternalList func(interface{}) error, specificPage bool)

Source from the content-addressed store, hash-verified

7)
8
9func (requester RealRequester) paginate(request *cloudcontroller.Request, obj interface{}, appendToExternalList func(interface{}) error, specificPage bool) (IncludedResources, Warnings, error) {
10 fullWarningsList := Warnings{}
11 var includes IncludedResources
12
13 for {
14 wrapper, warnings, err := requester.wrapFirstPage(request, obj, appendToExternalList)
15 fullWarningsList = append(fullWarningsList, warnings...)
16 if err != nil {
17 return IncludedResources{}, fullWarningsList, err
18 }
19
20 includes.Merge(wrapper.IncludedResources)
21
22 if specificPage || wrapper.NextPage() == "" {
23 break
24 }
25
26 request, err = requester.newHTTPRequest(requestOptions{
27 URL: wrapper.NextPage(),
28 Method: http.MethodGet,
29 })
30 if err != nil {
31 return IncludedResources{}, fullWarningsList, err
32 }
33 }
34
35 return includes, fullWarningsList, nil
36}
37
38func (requester RealRequester) wrapFirstPage(request *cloudcontroller.Request, obj interface{}, appendToExternalList func(interface{}) error) (*PaginatedResources, Warnings, error) {
39 warnings := Warnings{}

Callers 1

MakeListRequestMethod · 0.95

Calls 4

wrapFirstPageMethod · 0.95
MergeMethod · 0.95
newHTTPRequestMethod · 0.95
NextPageMethod · 0.80

Tested by

no test coverage detected