summaryrefslogtreecommitdiffstats
path: root/external
diff options
context:
space:
mode:
Diffstat (limited to 'external')
-rw-r--r--external/itemapi.php31
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);
}