(request *cloudcontroller.Request, obj interface{}, appendToExternalList func(interface{}) error)
| 36 | } |
| 37 | |
| 38 | func (requester RealRequester) wrapFirstPage(request *cloudcontroller.Request, obj interface{}, appendToExternalList func(interface{}) error) (*PaginatedResources, Warnings, error) { |
| 39 | warnings := Warnings{} |
| 40 | wrapper := NewPaginatedResources(obj) |
| 41 | response := cloudcontroller.Response{ |
| 42 | DecodeJSONResponseInto: &wrapper, |
| 43 | } |
| 44 | |
| 45 | err := requester.connection.Make(request, &response) |
| 46 | warnings = append(warnings, response.Warnings...) |
| 47 | if err != nil { |
| 48 | return nil, warnings, err |
| 49 | } |
| 50 | |
| 51 | list, err := wrapper.Resources() |
| 52 | if err != nil { |
| 53 | return nil, warnings, err |
| 54 | } |
| 55 | |
| 56 | for _, item := range list { |
| 57 | err = appendToExternalList(item) |
| 58 | if err != nil { |
| 59 | return nil, warnings, err |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | return wrapper, warnings, nil |
| 64 | } |
no test coverage detected