diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-02 22:11:59 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-02 22:11:59 +0200 |
commit | d2e9cbd3c99fff54857e0e513f563079c6dd3c26 (patch) | |
tree | f33dff23f55d0dbff03bc1ec3291e80738d52ba0 /external | |
parent | ec8394eda1b1769b3cf1032fc03a107092b222a4 (diff) |
implement item api methods
Diffstat (limited to 'external')
-rw-r--r-- | external/itemapi.php | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/external/itemapi.php b/external/itemapi.php index b1b75ca35..99dc8ddef 100644 --- a/external/itemapi.php +++ b/external/itemapi.php @@ -103,28 +103,47 @@ class ItemAPI extends Controller { private function setRead($isRead) { $userId = $this->api->getUserId(); $itemId = $this->params('itemId'); - $this->itemBusinessLayer->read($itemId, $isRead, $userId); + try { + $this->itemBusinessLayer->read($itemId, $isRead, $userId); + return new NewsAPIResult(); + } catch(BusinessLayerException $ex){ + return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, + $ex->getMessage()); + } + } + + + private function setStarred($isStarred) { + $userId = $this->api->getUserId(); + $feedId = $this->params('feedId'); + $guidHash = $this->params('guidHash'); + try { + $this->itemBusinessLayer->star($feedId, $guidHash, $isStarred, $userId); + return new NewsAPIResult(); + } catch(BusinessLayerException $ex){ + return new NewsAPIResult(null, NewsAPIResult::NOT_FOUND_ERROR, + $ex->getMessage()); + } } public function read() { - $this->setRead(true); - return new NewsAPIResult(); + return $this->setRead(true); } public function unread() { - + return $this->setRead(false); } public function star() { - + return $this->setStarred(true); } public function unstar() { - + return $this->setStarred(false); } |