summaryrefslogtreecommitdiffstats
path: root/external_api
diff options
context:
space:
mode:
Diffstat (limited to 'external_api')
-rw-r--r--external_api/feed.php12
-rw-r--r--external_api/folder.php14
2 files changed, 22 insertions, 4 deletions
diff --git a/external_api/feed.php b/external_api/feed.php
index dba518b7a..fcdfd2c7f 100644
--- a/external_api/feed.php
+++ b/external_api/feed.php
@@ -6,6 +6,10 @@ use \OCA\News\Controller\FeedController;
class API_Feed {
+// public __construct($feedbl) {
+// $this->bl = $feedbl;
+// }
+
public static function getAll() {
$container = createDIContainer();
$bl = $container['FeedBL'];
@@ -17,7 +21,7 @@ class API_Feed {
return new \OC_OCS_Result($serializedFeeds);
}
- public static function getById($parameters) {
+ public function getById($parameters) {
$feedid = $parameters['feedid'];
$container = createDIContainer();
$bl = $container['FeedBL'];
@@ -29,17 +33,17 @@ class API_Feed {
public static function create() {
$url = $_POST['url'];
- $folderId = $_POST['folderId'];
+ $folderId = $_POST['folderid'];
$container = createDIContainer();
$bl = $container['FeedBL'];
$success = $bl->create($url, $folderId);
if ($success) {
- return new OC_OCS_Result();
+ return new \OC_OCS_Result();
}
else {
- return new OC_OCS_Result(null, 101);
+ return new \OC_OCS_Result(null, 101);
}
}
}
diff --git a/external_api/folder.php b/external_api/folder.php
index e2bbeb870..f9dae7535 100644
--- a/external_api/folder.php
+++ b/external_api/folder.php
@@ -11,10 +11,24 @@ class API_Folder {
$bl = $container['FolderBL'];
$folders = $bl->getAll();
$serializedFolders = array();
+
+ //TODO: check the behaviour for nested folders
foreach ($folders as $folder) {
$serializedFolders[] = $folder->jsonSerialize();
}
return new \OC_OCS_Result($serializedFolders);
}
+
+ public static function create() {
+
+ $name = $_POST['name'];
+ $parentId = $_POST['parentid'];
+
+ $container = createDIContainer();
+ $bl = $container['FolderBL'];
+ $bl->create($name, $parentId);
+
+ return new \OC_OCS_Result();
+ }
}