[aur-dev] [PATCH 3/3] Add a version tag to RPC replies

Lukas Fleischer archlinux at cryptocrack.de
Sun Apr 27 18:27:07 EDT 2014


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 at cryptocrack.de>
---
 web/lib/aurjson.class.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index ab8ebbc..2e5e06d 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -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) {
-- 
1.9.2



More information about the aur-dev mailing list