DigitalOceanPHP / Client

DigitalOcean API v2 client for PHP
MIT License
710 stars 205 forks source link

Sizes API defaults to 20 per page and getAll doesn't page #308

Closed mikebarlow closed 1 year ago

mikebarlow commented 1 year ago

The DigitalOcean API defaults its API requests to 20 items per page, but the Sizes object getAll method doesn't page nor does it set a high items per page limit, so the sizes API always returns just 20 items.

Either the getAll needs to perform multiple requests or when calling $sizes = $this->get('sizes'); within src/Api/Size.php it should overwrite the number of items per page so it does indeed get all.

A quick flick through the code for the SDK shows that all instances of a "getAll" method suffer from the same bug.

mrsimonbennett commented 1 year ago

Want to submit a PR?

GrahamCampbell commented 1 year ago

You'll need to use the result pager class to get all results. See the README for more information: https://github.com/DigitalOceanPHP/Client#examples.