From a3f601cd4e45832fb8bdd89419dde93d9a89aadb Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 30 Dec 2008 15:59:39 -0500 Subject: [PATCH] implement api/laconica/version method darcs-hash:20081230205939-84dde-4b6096859c6b44169dd3d809442fab15337061b2.gz --- _darcs/inventory | 4 ++- ...b6096859c6b44169dd3d809442fab15337061b2.gz | Bin 0 -> 403 bytes _darcs/pristine/actions/twitapilaconica.php | 15 +++++++++++- _darcs/tentative_pristine | 23 +++++++++++++----- actions/twitapilaconica.php | 15 +++++++++++- 5 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 _darcs/patches/20081230205939-84dde-4b6096859c6b44169dd3d809442fab15337061b2.gz diff --git a/_darcs/inventory b/_darcs/inventory index 172053797d..4a5f9fd976 100644 --- a/_darcs/inventory +++ b/_darcs/inventory @@ -102,4 +102,6 @@ Evan Prodromou **20081230202019] [add laconica-specific methods to htaccess.sample Evan Prodromou **20081230202513] [add laconica methods to unauthed ones -Evan Prodromou **20081230203747] \ No newline at end of file +Evan Prodromou **20081230203747] +[implement api/laconica/version method +Evan Prodromou **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 index 0000000000000000000000000000000000000000..b44138c6cbfab55c362f4ea764a032642e23a5b8 GIT binary patch literal 403 zcmV;E0c`#siwFP!000001C5ehOT#b}hVT0;jxtC$x3-&3-Tc5I69&T#MQ=n(NFt3k zNl8*aQ2)E9v&xu5cJ7j#bKa-#+dHX>TqvPE&_c#JWkyRz<7Z)=G#Zrfnc>0snQE9@ z!>v)Kgkyo{v*PC*X{y9&tJO=A!)|Xk=_UQa?%*EYgRIm~5XF>vT;^i`B0b9ds6<6p zKz~2jfvQ??b2S}8=6x}YW66<8Mu@VGD+*s#{_*IHZvIYR7^|pvL%^ptRBxNeA0$Bs z>S9JIqf;j=%A~?tW5YBgqxq!v0ZPq<#Xjx4Ef-rO(riON={ApQ5G;o}EQ7FtVw`$< zM{vU9_jLSQA;^6bo%wABMx6kH&}6uDi`DR%be&VFrBAtGWtCF6Xj~Rs0vF#&hNO0h zv_Y3SnlT-n&n_qDqx5!sbv>C~uFls=Li7KGzCkNvHzQqiu1XbF;=e|=Nwf+T;pHY= xf7f#HK+D{(hhn+Jv9)Pxinit_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); + } } /** diff --git a/_darcs/tentative_pristine b/_darcs/tentative_pristine index ce01d3b5be..02f15d0f66 100644 --- a/_darcs/tentative_pristine +++ b/_darcs/tentative_pristine @@ -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); ++ } diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php index 092f9e7d13..4ecbf94e17 100644 --- a/actions/twitapilaconica.php +++ b/actions/twitapilaconica.php @@ -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); + } } /** -- 2.39.5