d8-contrib-modules / cloudflarephpsdk

PHP SDK For interfacing with CloudFlare's API
8 stars 19 forks source link

Unable to increase per_page limit when listing all zones #26

Open seanhamlin opened 7 years ago

seanhamlin commented 7 years ago

I have the need to increase the per_page limit to be 1000, to which decreases by application's report time significantly.

Currently the method listZones does not allow overriding this value, and the other more raw method makeListingRequest is protected.

Ideal solution

per_page is allowed to be set by the application, and not the library.

aweingarten commented 7 years ago

This should probably be refactored like listZones to use makeListingRequest which will automatically get all the pages in chunks of 50/page.
https://github.com/d8-contrib-modules/cloudflarephpsdk/blob/master/src/ApiEndpoints/ZoneApi.php#L40

Api doesn't allow more that that per page! In some cases they do allow 100. Unfortunately you can't do 1000 in a single request: https://github.com/d8-contrib-modules/cloudflarephpsdk/blob/master/src/ApiEndpoints/CloudFlareAPI.php#L72

seanhamlin commented 7 years ago

In my particular case, I can use this higher pagination limit, I am unsure on what grants me this ability, but it sure is helpful when you have access to a lot of zones.