]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
implement api/laconica/version method
authorEvan Prodromou <evan@prodromou.name>
Tue, 30 Dec 2008 20:59:39 +0000 (15:59 -0500)
committerEvan Prodromou <evan@prodromou.name>
Tue, 30 Dec 2008 20:59:39 +0000 (15:59 -0500)
darcs-hash:20081230205939-84dde-4b6096859c6b44169dd3d809442fab15337061b2.gz

_darcs/inventory
_darcs/patches/20081230205939-84dde-4b6096859c6b44169dd3d809442fab15337061b2.gz [new file with mode: 0644]
_darcs/pristine/actions/twitapilaconica.php
_darcs/tentative_pristine
actions/twitapilaconica.php

index 172053797d0fea99afd64a65bbe5baf5ebac0cd3..4a5f9fd97686325e9b8f661b5dd0b87b7a069962 100644 (file)
@@ -102,4 +102,6 @@ Evan Prodromou <evan@prodromou.name>**20081230202019]
 [add laconica-specific methods to htaccess.sample
 Evan Prodromou <evan@prodromou.name>**20081230202513] 
 [add laconica methods to unauthed ones
-Evan Prodromou <evan@prodromou.name>**20081230203747] 
\ No newline at end of file
+Evan Prodromou <evan@prodromou.name>**20081230203747] 
+[implement api/laconica/version method
+Evan Prodromou <evan@prodromou.name>**20081230205939] 
\ No newline at end of file
diff --git a/_darcs/patches/20081230205939-84dde-4b6096859c6b44169dd3d809442fab15337061b2.gz b/_darcs/patches/20081230205939-84dde-4b6096859c6b44169dd3d809442fab15337061b2.gz
new file mode 100644 (file)
index 0000000..b44138c
Binary files /dev/null and b/_darcs/patches/20081230205939-84dde-4b6096859c6b44169dd3d809442fab15337061b2.gz differ
index 092f9e7d137d3cb6edc30f2ef81657cae282dfdd..4ecbf94e17c0c81389615f86c1a95f8d5ef5e351 100644 (file)
@@ -53,6 +53,8 @@ class TwitapilaconicaAction extends TwitterapiAction
      *
      * Returns a version number for this version of Laconica, which
      * should make things a bit easier for upgrades.
+     * URL: http://identi.ca/api/laconica/version.(xml|json)
+     * Formats: xml, json
      *
      * @param array $args    Web arguments
      * @param array $apidata Twitter API data
@@ -65,7 +67,18 @@ class TwitapilaconicaAction extends TwitterapiAction
     function version($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), 501);
+        switch ($apidata['content-type']) {
+         case 'xml':
+            $this->init_document('xml');
+            common_element('version', null, LACONICA_VERSION);
+            $this->end_document('xml');
+         case 'json':
+            $this->init_document('json');
+            print '"'.LACONICA_VERSION.'"';
+            $this->end_document('json');
+         default:
+            $this->client_error(_('API method not found!'), $code=404);
+        }
     }
 
     /**
index ce01d3b5be56d8d8a3cb46c9a5447ad247a4e2dc..02f15d0f665515bb73b2fc8c2ee0e018abc68c5b 100644 (file)
@@ -1,6 +1,17 @@
-hunk ./actions/api.php 120
--                                'help/downtime_schedule');
-+                                'help/downtime_schedule',
-+                                'laconica/version',
-+                                'laconica/config',
-+                                'laconica/wadl');
+hunk ./actions/twitapilaconica.php 56
++     * URL: http://identi.ca/api/laconica/version.(xml|json)
++     * Formats: xml, json
+hunk ./actions/twitapilaconica.php 70
+-        common_server_error(_('API method under construction.'), 501);
++        switch ($apidata['content-type']) {
++         case 'xml':
++            $this->init_document('xml');
++            common_element('version', null, LACONICA_VERSION);
++            $this->end_document('xml');
++         case 'json':
++            $this->init_document('json');
++            print '"'.LACONICA_VERSION.'"';
++            $this->end_document('json');
++         default:
++            $this->client_error(_('API method not found!'), $code=404);
++        }
index 092f9e7d137d3cb6edc30f2ef81657cae282dfdd..4ecbf94e17c0c81389615f86c1a95f8d5ef5e351 100644 (file)
@@ -53,6 +53,8 @@ class TwitapilaconicaAction extends TwitterapiAction
      *
      * Returns a version number for this version of Laconica, which
      * should make things a bit easier for upgrades.
+     * URL: http://identi.ca/api/laconica/version.(xml|json)
+     * Formats: xml, json
      *
      * @param array $args    Web arguments
      * @param array $apidata Twitter API data
@@ -65,7 +67,18 @@ class TwitapilaconicaAction extends TwitterapiAction
     function version($args, $apidata)
     {
         parent::handle($args);
-        common_server_error(_('API method under construction.'), 501);
+        switch ($apidata['content-type']) {
+         case 'xml':
+            $this->init_document('xml');
+            common_element('version', null, LACONICA_VERSION);
+            $this->end_document('xml');
+         case 'json':
+            $this->init_document('json');
+            print '"'.LACONICA_VERSION.'"';
+            $this->end_document('json');
+         default:
+            $this->client_error(_('API method not found!'), $code=404);
+        }
     }
 
     /**