equinix-labs / metal-go

[Deprecated] Golang client for Equinix Metal
https://deploy.equinix.com/labs/equinix-sdk-go/
MIT License
3 stars 2 forks source link

Missing Meta filed in IPReservationList to iterate the pages #139

Closed codinja1188 closed 1 year ago

codinja1188 commented 1 year ago

https://github.com/equinix-labs/metal-go/blob/main/docs/IPReservationList.md

for {
        ipReservationsPage, _, err := s.FindIPReservations(context.Background(), projectId).Types(types).Include(inc).Exclude(exc).PerPage(perPage).Execute()
        if err != nil {
            return nil, err
        }

        ipReservations = append(ipReservations, ipReservationsPage.GetIpAddresses()...)
        if ipReservationsPage.Meta.GetLastPage() > ipReservationsPage.Meta.GetCurrentPage() {. <--- Giving Error
            page = page + 1
            continue
        }
        return ipReservations, nil
    }
codinja1188 commented 1 year ago

Fixed: https://github.com/equinix-labs/metal-go/pull/140