-
Notifications
You must be signed in to change notification settings - Fork 45
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
Include Meta Information on the response json #4
Comments
Sample format would be like this: [ |
I thought a lot about this and I decided to first support the meta information in the http headers. However I may indeed add this optional feature in the future. There are multiple ways to do this. This of course isn't implemented right now. With the tools available right now you can still manually implement an envelope. This is however not that clean but it works: $result = ApiHandler::parseMultiple($foo, array('foo', 'bar'));
$builder = $result->getBuilder();
$metaProviders = $result->getMetaProviders();
$response = array();
foreach($metaProviders as $provider) {
if($provider->getTitle() == 'Meta-Total-Count') $response['meta_total_count'] = $provider->get();
else if($provider->getTitle() == 'Meta-Filter-Count') $response['meta_filter_count'] = $provider->get();
}
$response['data'] = $builder->get();
return $response; |
Thanks, it just shows the flexibility that you have implemented this handler in a way to make it open for modification. Once again thank you for considering my request. |
Lets keep this issue open. I'll close it when there is a more sophisticated solution. |
Hi my I suggest if you can add the meta information from the response. The purpose was to use this on javascript tables such as jquery DataTable as a source. If you can make another method to have a parameter or a flag that indicate if the meta information be included in the response.
Again thanks for this wonderful API handler.
The text was updated successfully, but these errors were encountered: