1 | <?php |
||
41 | class StackApiController extends ApiController { |
||
42 | |||
43 | private $boardService; |
||
44 | private $stackService; |
||
45 | |||
46 | /** |
||
47 | * @param string $appName |
||
48 | * @param IRequest $request |
||
49 | * @param StackService $stackService |
||
50 | */ |
||
51 | public function __construct($appName, IRequest $request, StackService $stackService, BoardService $boardService) { |
||
56 | |||
57 | /** |
||
58 | * @NoAdminRequired |
||
59 | * @CORS |
||
60 | * @NoCSRFRequired |
||
61 | * |
||
62 | * Return all of the stacks in the specified board. |
||
63 | */ |
||
64 | public function index() { |
||
65 | $since = 0; |
||
66 | $modified = $this->request->getHeader('If-Modified-Since'); |
||
67 | if ($modified !== null && $modified !== '') { |
||
68 | $date = Util::parseHTTPDate($modified); |
||
69 | if (!$date) { |
||
70 | throw new StatusException('Invalid If-Modified-Since header provided.'); |
||
71 | } |
||
72 | $since = $date->getTimestamp(); |
||
73 | } |
||
74 | $stacks = $this->stackService->findAll($this->request->getParam('boardId'), $since); |
||
75 | return new DataResponse($stacks, HTTP::STATUS_OK); |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * @NoAdminRequired |
||
80 | * @CORS |
||
81 | * @NoCSRFRequired |
||
82 | * |
||
83 | * Return all of the stacks in the specified board. |
||
84 | */ |
||
85 | public function get() { |
||
89 | |||
90 | /** |
||
91 | * @NoAdminRequired |
||
92 | * @CORS |
||
93 | * @NoCSRFRequired |
||
94 | * |
||
95 | * @params $title |
||
96 | * @params $order |
||
97 | * |
||
98 | * Create a stack with the specified title and order. |
||
99 | */ |
||
100 | public function create($title, $order) { |
||
104 | |||
105 | /** |
||
106 | * @NoAdminRequired |
||
107 | * @CORS |
||
108 | * @NoCSRFRequired |
||
109 | * |
||
110 | * @params $title |
||
111 | * @params $order |
||
112 | * |
||
113 | * Update a stack by the specified stackId and boardId with the values that were put. |
||
114 | */ |
||
115 | public function update($title, $order) { |
||
119 | |||
120 | /** |
||
121 | * @NoAdminRequired |
||
122 | * @CORS |
||
123 | * @NoCSRFRequired |
||
124 | * |
||
125 | * Delete the stack specified by $this->request->getParam('stackId'). |
||
126 | */ |
||
127 | public function delete() { |
||
131 | |||
132 | /** |
||
133 | * @NoAdminRequired |
||
134 | * @CORS |
||
135 | * @NoCSRFRequired |
||
136 | * |
||
137 | * get the stacks that have been archived. |
||
138 | */ |
||
139 | public function getArchived() { |
||
143 | } |
||
144 |