blob: a56cd2253443fa746f26da927a6020d5b308f073 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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);
}
}
}
|