]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Controller/WallabagRestController.php
improve API
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / WallabagRestController.php
1 <?php
2
3 namespace Wallabag\CoreBundle\Controller;
4
5 use Nelmio\ApiDocBundle\Annotation\ApiDoc;
6 use FOS\RestBundle\Controller\Annotations\View;
7 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8 use Symfony\Component\HttpFoundation\Request;
9 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
10 use Wallabag\CoreBundle\Entity\Entries;
11 use Wallabag\CoreBundle\Entity\Tags;
12 use Wallabag\CoreBundle\Entity\Users;
13
14 class WallabagRestController
15 {
16
17 /**
18 * Fetches all entries
19 *
20 * @ApiDoc(
21 * )
22 * @return Entries
23 */
24 public function getEntriesAction(Request $request)
25 {
26 $isArchive = $request->query->get('archive');
27 var_dump($isArchive);
28 $isStarred = $request->query->get('star');
29 $isDeleted = $request->query->get('delete');
30 $sort = $request->query->get('sort');
31 $order = $request->query->get('order');
32 $page = $request->query->get('page');
33 $perPage = $request->query->get('perPage');
34 $tags = $request->query->get('tags', array());
35
36 return 'plop';
37 }
38
39 /**
40 * Fetches an entry
41 *
42 * @ApiDoc(
43 * requirements={
44 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
45 * }
46 * )
47 * @return Entries
48 */
49 public function getEntryAction(Entries $entry)
50 {
51 return $entry;
52 }
53
54 /**
55 * Deletes an entry
56 *
57 * @ApiDoc(
58 * requirements={
59 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
60 * }
61 * )
62 */
63 public function deleteEntriesAction(Entries $entry)
64 {
65
66 }
67
68 /**
69 * Changes several properties of an entry. I.E tags, archived, starred and deleted status
70 *
71 * @ApiDoc(
72 * requirements={
73 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
74 * }
75 * )
76 */
77 public function patchEntriesAction(Entries $entry)
78 {
79
80 }
81
82 /**
83 * Saves a new entry
84 *
85 * @ApiDoc(
86 * )
87 */
88 public function postEntriesAction()
89 {
90
91 }
92
93 /**
94 * Gets tags for an entry
95 *
96 * @ApiDoc(
97 * requirements={
98 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
99 * }
100 * )
101 */
102 public function getEntriesTagsAction(Entries $entry) {
103
104 }
105
106 /**
107 * Saves new tag for an entry
108 *
109 * @ApiDoc(
110 * requirements={
111 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
112 * }
113 * )
114 */
115 public function postEntriesTagsAction(Entries $entry) {
116
117 }
118
119 /**
120 * Remove tag for an entry
121 *
122 * @ApiDoc(
123 * requirements={
124 * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"},
125 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
126 * }
127 * )
128 */
129 public function deleteEntriesTagsAction(Entries $entry, Tags $tag)
130 {
131
132 }
133
134 /**
135 * Gets tags for a user
136 *
137 * @ApiDoc(
138 * )
139 */
140 public function getTagsAction() {
141
142 }
143
144 /**
145 * Gets one tag
146 *
147 * @ApiDoc(
148 * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"}
149 * )
150 */
151 public function getTagAction(Tags $tag) {
152
153 }
154
155 /**
156 * Delete tag
157 *
158 * @ApiDoc(
159 * requirements={
160 * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"}
161 * }
162 * )
163 */
164 public function deleteTagAction(Tags $tag)
165 {
166
167 }
168 }