diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2013-03-03 22:27:18 +0100 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2013-03-03 22:27:18 +0100 |
commit | ef450898bb702877dafb755e425fe8f37b23417b (patch) | |
tree | 53162b432a7f5a6c9d99d9eb77aee30d670853ae /external_api | |
parent | 0852773340ed26ecc8faa8e61192f38132673bc6 (diff) |
create folder api call
Diffstat (limited to 'external_api')
-rw-r--r-- | external_api/feed.php | 12 | ||||
-rw-r--r-- | external_api/folder.php | 14 |
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(); + } } |