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

Return objects total count #9

Closed
n-elloco opened this issue Feb 13, 2017 · 2 comments
Closed

Return objects total count #9

n-elloco opened this issue Feb 13, 2017 · 2 comments
Assignees

Comments

@n-elloco
Copy link

I would like to organize a pagination on my page. I can pass parameters limit and skip with query. But, when I receive a response I don't recieve total count of records, although this field is returned folowing by CD API.
I can get all records and then make a slice, but it's a bad practice.
I propose to return total count with objects list.
For example:

...
>>> client.entries({'limit':10, 'skip': 20})
{
  "items": [
    <Entry[2PqfXUJwE8qSYKuM0U6w8M] id='6dbjWqNd9SqccegcqYq224'>,
    ...
  ],
  "total": 2564
}

For now, I have to make additional request to Content Management API with parameter limit=0 and get total count from response.

@dlitvakb
Copy link
Contributor

Hey @n-elloco,

Sounds like a valid point,

I will wrap Arrays with an object so that you can have this metadata available.

Cheers

@n-elloco
Copy link
Author

Hello @dlitvakb
Thank you very much. Great job.

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