diff options
author | Davide Saurino <davide.saurino@alcacoop.it> | 2014-03-12 23:57:55 +0100 |
---|---|---|
committer | Davide Saurino <davide.saurino@alcacoop.it> | 2014-03-12 23:57:55 +0100 |
commit | c179198a0408f6d3edf27d5e3f8ab006da32bf0c (patch) | |
tree | 77cbd86fc45d818b7555763cee17e47140b1de65 | |
parent | 37181c603b2aaa4dbd0d17ecf4927f28523c2ad8 (diff) |
Add feed renaming to the API (FIX #455)
-rw-r--r-- | api/feedapi.php | 22 | ||||
-rw-r--r-- | appinfo/routes.php | 6 |
2 files changed, 28 insertions, 0 deletions
diff --git a/api/feedapi.php b/api/feedapi.php index 4ad9b3307..0880434d8 100644 --- a/api/feedapi.php +++ b/api/feedapi.php @@ -183,6 +183,28 @@ class FeedAPI extends Controller { /** + * @IsAdminExemption + * @IsSubAdminExemption + * @CSRFExemption + * @Ajax + * @API + */ + public function rename() { + $userId = $this->api->getUserId(); + $feedId = (int) $this->params('feedId'); + $feedTitle = $this->params('feedTitle'); + + try { + $this->feedBusinessLayer->rename($feedId, $feedTitle, $userId); + return new JSONResponse(); + } catch(BusinessLayerException $ex) { + return new JSONResponse(array('message' => $ex->getMessage()), + Http::STATUS_NOT_FOUND); + } + } + + + /** * @CSRFExemption * @Ajax * @API diff --git a/appinfo/routes.php b/appinfo/routes.php index cc697d0a9..fc60a717c 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -354,6 +354,12 @@ $this->create('news_api_feeds_move', '/api/v1-2/feeds/{feedId}/move')->put()->ac } ); +$this->create('news_api_feeds_rename', '/api/v1-2/feeds/{feedId}/rename')->put()->action( + function($params) { + return App::main('FeedAPI', 'rename', $params, new DIContainer()); + } +); + $this->create('news_api_feeds_read', '/api/v1-2/feeds/{feedId}/read')->put()->action( function($params) { return App::main('FeedAPI', 'read', $params, new DIContainer()); |