diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-06-12 14:50:15 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-06-12 14:50:25 +0200 |
commit | 4faa08d70891da48a0f7647f7eb8730f7f9dc82e (patch) | |
tree | a7f66c2748e2f731be2f20f2af36181a29bf6ff1 /external | |
parent | a70a85bc1839fbd2ebb27f051fe7c473107c5204 (diff) |
add annotations for api controllers
Diffstat (limited to 'external')
-rw-r--r-- | external/feedapi.php | 39 | ||||
-rw-r--r-- | external/folderapi.php | 37 | ||||
-rw-r--r-- | external/itemapi.php | 56 | ||||
-rw-r--r-- | external/newsapi.php | 5 |
4 files changed, 124 insertions, 13 deletions
diff --git a/external/feedapi.php b/external/feedapi.php index 9ebfbc012..dc7e1781b 100644 --- a/external/feedapi.php +++ b/external/feedapi.php @@ -54,6 +54,11 @@ class FeedAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function getAll() { $userId = $this->api->getUserId(); @@ -68,7 +73,7 @@ class FeedAPI extends Controller { // check case when there are no items try { - $result['newestItemId'] = + $result['newestItemId'] = $this->itemBusinessLayer->getNewestItemId($userId); } catch(BusinessLayerException $ex) {} @@ -76,6 +81,11 @@ class FeedAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function create() { $userId = $this->api->getUserId(); $feedUrl = $this->params('url'); @@ -83,29 +93,34 @@ class FeedAPI extends Controller { try { $this->feedBusinessLayer->purgeDeleted($userId, false); - + $feed = $this->feedBusinessLayer->create($feedUrl, $folderId, $userId); $result = array( 'feeds' => array($feed->toAPI()) ); try { - $result['newestItemId'] = + $result['newestItemId'] = $this->itemBusinessLayer->getNewestItemId($userId); } catch(BusinessLayerException $ex) {} return new NewsAPIResult($result); } catch(BusinessLayerExistsException $ex) { - return new NewsAPIResult(null, NewsAPIResult::EXISTS_ERROR, + return new NewsAPIResult(null, NewsAPIResult::EXISTS_ERROR, $ex->getMessage()); } catch(BusinessLayerException $ex) { - return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, + return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, $ex->getMessage()); } } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function delete() { $userId = $this->api->getUserId(); $feedId = (int) $this->params('feedId'); @@ -114,12 +129,17 @@ class FeedAPI extends Controller { $this->feedBusinessLayer->delete($feedId, $userId); return new NewsAPIResult(); } catch(BusinessLayerException $ex) { - return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, + return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, $ex->getMessage()); } } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function read() { $userId = $this->api->getUserId(); $feedId = (int) $this->params('feedId'); @@ -130,6 +150,11 @@ class FeedAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function move() { $userId = $this->api->getUserId(); $feedId = (int) $this->params('feedId'); @@ -139,7 +164,7 @@ class FeedAPI extends Controller { $this->feedBusinessLayer->move($feedId, $folderId, $userId); return new NewsAPIResult(); } catch(BusinessLayerException $ex) { - return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, + return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, $ex->getMessage()); } } diff --git a/external/folderapi.php b/external/folderapi.php index bbe32ab24..5b90eff9e 100644 --- a/external/folderapi.php +++ b/external/folderapi.php @@ -40,7 +40,7 @@ class FolderAPI extends Controller { private $folderBusinessLayer; private $itemBusinessLayer; - public function __construct(API $api, + public function __construct(API $api, Request $request, FolderBusinessLayer $folderBusinessLayer, ItemBusinessLayer $itemBusinessLayer){ @@ -50,6 +50,11 @@ class FolderAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function getAll() { $userId = $this->api->getUserId(); $result = array( @@ -64,7 +69,12 @@ class FolderAPI extends Controller { } - public function create() { + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ + public function create() { $userId = $this->api->getUserId(); $folderName = $this->params('name'); $result = array( @@ -78,12 +88,17 @@ class FolderAPI extends Controller { return new NewsAPIResult($result); } catch(BusinessLayerExistsException $ex) { - return new NewsAPIResult(null, NewsAPIResult::EXISTS_ERROR, + return new NewsAPIResult(null, NewsAPIResult::EXISTS_ERROR, $ex->getMessage()); } } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function delete() { $userId = $this->api->getUserId(); $folderId = (int) $this->params('folderId'); @@ -92,12 +107,17 @@ class FolderAPI extends Controller { $this->folderBusinessLayer->delete($folderId, $userId); return new NewsAPIResult(); } catch(BusinessLayerException $ex) { - return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, + return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, $ex->getMessage()); } } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function update() { $userId = $this->api->getUserId(); $folderId = (int) $this->params('folderId'); @@ -108,16 +128,21 @@ class FolderAPI extends Controller { return new NewsAPIResult(); } catch(BusinessLayerExistsException $ex) { - return new NewsAPIResult(null, NewsAPIResult::EXISTS_ERROR, + return new NewsAPIResult(null, NewsAPIResult::EXISTS_ERROR, $ex->getMessage()); } catch(BusinessLayerException $ex) { - return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, + return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, $ex->getMessage()); } } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function read() { $userId = $this->api->getUserId(); $folderId = (int) $this->params('folderId'); diff --git a/external/itemapi.php b/external/itemapi.php index adca0a3d8..fae0b3593 100644 --- a/external/itemapi.php +++ b/external/itemapi.php @@ -45,6 +45,11 @@ class ItemAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function getAll() { $result = array( 'items' => array() @@ -80,6 +85,11 @@ class ItemAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function getUpdated() { $result = array( 'items' => array() @@ -133,26 +143,51 @@ class ItemAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function read() { return $this->setRead(true); } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function unread() { return $this->setRead(false); } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function star() { return $this->setStarred(true); } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function unstar() { return $this->setStarred(false); } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function readAll() { $userId = $this->api->getUserId(); $newestItemId = (int) $this->params('newestItemId'); @@ -178,11 +213,21 @@ class ItemAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function readMultiple() { return $this->setMultipleRead(true); } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function unreadMultiple() { return $this->setMultipleRead(false); } @@ -205,13 +250,24 @@ class ItemAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function starMultiple() { return $this->setMultipleStarred(true); } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function unstarMultiple() { return $this->setMultipleStarred(false); } + } diff --git a/external/newsapi.php b/external/newsapi.php index 747f818ec..bb3e3bc28 100644 --- a/external/newsapi.php +++ b/external/newsapi.php @@ -38,6 +38,11 @@ class NewsAPI extends Controller { } + /** + * @IsAdminExemption + * @IsSubAdminExemption + * @Ajax + */ public function version() { $version = $this->api->getAppValue('installed_version'); return new NewsAPIResult(array('version' => $version)); |