Add a version tag to RPC replies

This is needed for clients to quickly differentiate between different
versions of the RPC API. The version number should be bumped whenever
there is a change that breaks backwards compatibility.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-04-27 23:03:57 +02:00
parent eb6cf1fad0
commit e50f352643

View file

@ -115,7 +115,12 @@ class AurJSON {
* @return mixed A json formatted result response.
**/
private function json_results($type, $count, $data) {
return json_encode( array('type' => $type, 'resultcount' => $count, 'results' => $data) );
return json_encode(array(
'version' => 2,
'type' => $type,
'resultcount' => $count,
'results' => $data
));
}
private function get_extended_fields($pkgid) {