Implement story routes in API

This commit is contained in:
Romain Neutron
2012-12-19 17:48:32 +01:00
parent ee215ce63c
commit 2267af36d1
3 changed files with 275 additions and 22 deletions

View File

@@ -1240,6 +1240,30 @@ class API_V1_adapter extends API_V1_Abstract
return $result;
}
/**
* Return detailed informations about one story
*
* @param Request $request
* @param int $databox_id
* @param int $story_id
* @return API_V1_result
*/
public function get_story(Request $request, $databox_id, $story_id)
{
$result = new API_V1_result($request, $this);
$databox = $this->appbox->get_databox($databox_id);
try {
$story = $databox->get_record($story_id);
$result->set_datas(array('story' => $this->list_story($story)));
} catch (Exception_NotFound $e) {
$result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, _('Story Not Found'));
} catch (Exception $e) {
$result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, _('An error occured'));
}
return $result;
}
/**
* Return the baskets list of the authenticated user
*