summaryrefslogtreecommitdiffstats
path: root/external/feed.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-21 16:32:36 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-21 16:32:36 +0100
commitac84b27965f5a1aec859e389f099fb844e33de46 (patch)
treec98d7aace90fcb442208349918a3e71cd9a7691a /external/feed.php
parentf475d882d0a76908400e9857f7e8a4ae8ad8a752 (diff)
reorganize folder
Diffstat (limited to 'external/feed.php')
-rw-r--r--external/feed.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/external/feed.php b/external/feed.php
new file mode 100644
index 000000000..a56cd2253
--- /dev/null
+++ b/external/feed.php
@@ -0,0 +1,55 @@
+<?php
+
+namespace OCA\News;
+
+use \OCA\News\Controller\FeedController;
+
+class FeedApi {
+
+ public function __construct($bl){
+ $this->bl = $bl;
+ }
+
+ public function getAll() {
+ $feeds = $this->bl->getAll();
+ $serializedFeeds = array();
+ foreach ($feeds as $feed) {
+ $serializedFeeds[] = $feed->jsonSerialize();
+ }
+ return new \OC_OCS_Result($serializedFeeds);
+ }
+
+ public function getById($params) {
+ $feed = $this->bl->getById($feedid);
+ $serializedFeed = array($feed->jsonSerialize());
+ return new \OC_OCS_Result($serializedFeed);
+ }
+
+ public function delete($params) {
+ //TODO: check parameters here
+
+ $success = $this->bl->delete($params["feedid"]);
+
+ if ($success) {
+ return new \OC_OCS_Result();
+ }
+ else {
+ return new \OC_OCS_Result(null, 101);
+ }
+ }
+
+ public function create() {
+ $url = $_POST['url'];
+ $folderId = $_POST['folderid'];
+ //TODO: check parameters here
+
+ $success = $this->bl->create($url, $folderId);
+
+ if ($success) {
+ return new \OC_OCS_Result();
+ }
+ else {
+ return new \OC_OCS_Result(null, 101);
+ }
+ }
+}