barrelstrength / craftnet-php

A PHP library which implements the functionality of the Craftnet API
MIT License
9 stars 2 forks source link

Support perPage for pagination #1

Open khalwat opened 6 years ago

khalwat commented 6 years ago

It'd be nice in addition to being able to specify the page query string parameter, if we could also specify the perPage as per: https://docs.api.craftcms.com/pagination.html

BenParizek commented 6 years ago

@khalwat Just added support for that last weekend: https://github.com/barrelstrength/craftnet-php#get-a-secondary-page-of-plugin-licenses-for-the-authenticated-craft-id-user

Have you updated to v1.0.0? https://github.com/barrelstrength/craftnet-php/releases/tag/v1.0.0

The latest release of Craftnet CP also includes a rough pagination implementation (https://github.com/studioespresso/craft3-craftnet-cp/releases/tag/1.2.0), though it'd be nice to be able to group things a bit better before paginating too... maybe that's a GraphQL API request to P&T!

khalwat commented 6 years ago

Right I know you support page -- I'm asking if you could add support for perPage which specifies how many items (the default is 100) appear per page.

Might be best if it was done in a generalized way via:

http://php.net/manual/en/function.http-build-query.php

...so we can pass in whatever query params we like, so as P&T adds them, the API doesn't need updating. Thoughts?

BenParizek commented 6 years ago

Ah, got it. Read that too quickly. Yeah, happy to support it and it does make sense to generalize it. I probably won't have a chance to get to it this week. Happy to accept a pull request if you get around to it first.

khalwat commented 6 years ago

Unfortunately, until P&T's API supports sort and search, I can't really do what I want anyway:

https://github.com/pixelandtonic/craftnet/issues/111

https://github.com/pixelandtonic/craftnet/issues/110

https://github.com/pixelandtonic/craftnet/issues/109

khalwat commented 6 years ago

Or they could add a GraphQL endpoint, and then we could do whatever we wanted in terms of queries.