Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get pagination data? #42

Open
davidyell opened this issue Aug 15, 2017 · 3 comments
Open

How to get pagination data? #42

davidyell opened this issue Aug 15, 2017 · 3 comments

Comments

@davidyell
Copy link
Collaborator

My api response contains a meta element with the pagination data for the response.

{
    "meta": {
        "pagination": {
            "page": 1,
            "next_page": 2,
            "previous_page": null,
            "total_results": 102,
            "total_pages": 6,
            "per_page": 20
        }
    },
    "body": {
        "results": [
            {
                "id": 530,
                "name": "Unlimited Broadband",
// etc

However when the response is parsed into a Resource this data is lost. I can't see it in Muffin\Webservice\Query which makes sense as it's not been executed yet. However when it is executed it will be converted into a Resource, so it's lost then also.

I would rather know from the preceding request if there is a next page or not rather than intentionally making a 404 request to find the last page.

@r0kawa
Copy link

r0kawa commented Nov 28, 2018

Any updates on this for 2.0 release ? If no, is there a way I can send the pagination info to the output ?

$resources = $this->_transformResults($query->endpoint(), $resultArray['tickets']);

_transformResults only sending the result array itself

@davidyell
Copy link
Collaborator Author

We have yet to sufficiently test the release candidate to get the 2.0 release out. Once that is done there are plans to implement Pagination.

I currently use a fork in which I have implemented pagination. https://github.com/davidyell/Webservice/blob/develop/src/Pagination.php

It is on the roadmap though!

@r0kawa
Copy link

r0kawa commented Nov 28, 2018

We have yet to sufficiently test the release candidate to get the 2.0 release out. Once that is done there are plans to implement Pagination.

I currently use a fork in which I have implemented pagination. https://github.com/davidyell/Webservice/blob/develop/src/Pagination.php

It is on the roadmap though!

Can I know how to use this if i just copy the pagination inside current Webservice plugin ? Is't straight forward enough for me to use inside my code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants