Use a Concat method to aggregate Collection pages.
diff --git a/openstack/identity/v3/services/results.go b/openstack/identity/v3/services/results.go
index c6ce1b9..88510b4 100644
--- a/openstack/identity/v3/services/results.go
+++ b/openstack/identity/v3/services/results.go
@@ -19,8 +19,8 @@
type ServiceList struct {
gophercloud.PaginationLinks `json:"links"`
- client *gophercloud.ServiceClient
- Page []Service `json:"services"`
+ client *gophercloud.ServiceClient
+ Services []Service `json:"services"`
}
// Pager indicates that the ServiceList is paginated by next and previous links.
@@ -28,6 +28,14 @@
return gophercloud.NewLinkPager(list)
}
+// Concat returns a new collection that's the result of appending a new collection at the end of this one.
+func (list ServiceList) Concat(other gophercloud.Collection) gophercloud.Collection {
+ return ServiceList{
+ client: list.client,
+ Services: append(list.Services, AsServices(other)...),
+ }
+}
+
// Service returns the ServiceClient used to acquire this list.
func (list ServiceList) Service() *gophercloud.ServiceClient {
return list.client
@@ -56,5 +64,5 @@
// AsServices extracts a slice of Services from a Collection acquired from List.
// It panics if the Collection does not actually contain Services.
func AsServices(results gophercloud.Collection) []Service {
- return results.(*ServiceList).Page
+ return results.(*ServiceList).Services
}