Closed phillbaker closed 6 years ago
I'm not sure if this is a good idea, but something I did when calling functions was:
client.droplets.listActions(dropletID, 1, Number.MAX_SAFE_INTEGER, callback);
Using 1 page with all the resources on that page?
I guess if that's not a good idea, one could return an iterator that stores a constant number of objects internally, and when the code requires more, another request is made.
Ah, unfortunately there's a hardcoded max of 200 on the API side: https://developers.digitalocean.com/documentation/v2/#links.
I guess if that's not a good idea, one could return an iterator that stores a constant number of objects internally, and when the code requires more, another request is made.
👍 Stripe does a great job of this in their ruby api bindings.
Closed by 72932c074fceaaf9d4719699cd91696227214f4e
It'd be great to not expose the internals of DO's API pagination. We should return a array-like object that handles the pagination internally.
JS generators and iterators could be used under the hood to power this.