kontent-ai / delivery-sdk-php

Kontent.ai Delivery SDK for PHP
https://kontent.ai
MIT License
46 stars 15 forks source link

Add support for includeTotalCount query parameter #86

Closed tobiaskamenicky closed 2 years ago

tobiaskamenicky commented 4 years ago

Motivation

Allow users to render paging navigation for a list of content items.

Proposed solution

When the item listing request URL includes the includeTotalCount query string parameter, the response contains the total number of content items matching the search criteria. As a result, the client needs only one API call to fetch all information necessary to display a list of content items and the paging navigation.

To return the total number of content items, the includeTotalCount parameter must have value 1 or true or no value at all.

The total number of content items is returned in the pagination section of the response in the total_count property. Please note that if the user does not ask for the total item count, this property is not present.

Add support for the includeTotalCount parameter and also provide the total number of content items, if available. Also, please provide a warning in documentation comments that asking for the total number of content items might increase the response time and, therefore, users should use it only when they need it.

Additional context

For a reference implementation please have a look at https://github.com/Kentico/kontent-delivery-sdk-net/blob/master/Kentico.Kontent.Delivery/QueryParameters/Parameters/IncludeTotalCountParameter.cs