diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-29 16:56:58 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-29 16:56:58 +0100 |
commit | f8bf8952541b51481a7463c6efc0b2bc9c1edff1 (patch) | |
tree | cb632798f4c6f763ba7c827dcaa885eec4255094 /src/Wallabag/CoreBundle/Controller | |
parent | 589dce52c63219d917498d2fdf18e5d7ebe5bf92 (diff) | |
download | wallabag-f8bf8952541b51481a7463c6efc0b2bc9c1edff1.tar.gz wallabag-f8bf8952541b51481a7463c6efc0b2bc9c1edff1.tar.zst wallabag-f8bf8952541b51481a7463c6efc0b2bc9c1edff1.zip |
routing for API, trying to respect #414
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/StaticController.php | 8 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 157 |
2 files changed, 157 insertions, 8 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php index 07931f58..0fd19d65 100644 --- a/src/Wallabag/CoreBundle/Controller/StaticController.php +++ b/src/Wallabag/CoreBundle/Controller/StaticController.php | |||
@@ -17,12 +17,4 @@ class StaticController extends Controller | |||
17 | array() | 17 | array() |
18 | ); | 18 | ); |
19 | } | 19 | } |
20 | |||
21 | /** | ||
22 | * @Route("/", name="homepage") | ||
23 | */ | ||
24 | public function apiAction() | ||
25 | { | ||
26 | return $this->redirect($this->generateUrl('nelmio_api_doc_index')); | ||
27 | } | ||
28 | } | 20 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php new file mode 100644 index 00000000..a2a9af38 --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php | |||
@@ -0,0 +1,157 @@ | |||
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\Security\Core\Exception\AccessDeniedException; | ||
9 | use Wallabag\CoreBundle\Entity\Entries; | ||
10 | use Wallabag\CoreBundle\Entity\Tags; | ||
11 | use Wallabag\CoreBundle\Entity\Users; | ||
12 | |||
13 | class WallabagRestController | ||
14 | { | ||
15 | |||
16 | /** | ||
17 | * Fetches all entries | ||
18 | * | ||
19 | * @ApiDoc( | ||
20 | * ) | ||
21 | * @return Entries | ||
22 | */ | ||
23 | public function getEntriesAction() | ||
24 | { | ||
25 | |||
26 | } | ||
27 | |||
28 | /** | ||
29 | * Fetches an entry | ||
30 | * | ||
31 | * @ApiDoc( | ||
32 | * requirements={ | ||
33 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | ||
34 | * } | ||
35 | * ) | ||
36 | * @return Entries | ||
37 | */ | ||
38 | public function getEntryAction(Entries $entry) | ||
39 | { | ||
40 | return $entry; | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Deletes an entry | ||
45 | * | ||
46 | * @ApiDoc( | ||
47 | * requirements={ | ||
48 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | ||
49 | * } | ||
50 | * ) | ||
51 | */ | ||
52 | public function deleteEntriesAction(Entries $entry) | ||
53 | { | ||
54 | |||
55 | } | ||
56 | |||
57 | /** | ||
58 | * Changes several properties of an entry. I.E tags, archived, starred and deleted status | ||
59 | * | ||
60 | * @ApiDoc( | ||
61 | * requirements={ | ||
62 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | ||
63 | * } | ||
64 | * ) | ||
65 | */ | ||
66 | public function patchEntriesAction(Entries $entry) | ||
67 | { | ||
68 | |||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Saves a new entry | ||
73 | * | ||
74 | * @ApiDoc( | ||
75 | * ) | ||
76 | */ | ||
77 | public function postEntriesAction() | ||
78 | { | ||
79 | |||
80 | } | ||
81 | |||
82 | /** | ||
83 | * Gets tags for an entry | ||
84 | * | ||
85 | * @ApiDoc( | ||
86 | * requirements={ | ||
87 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | ||
88 | * } | ||
89 | * ) | ||
90 | */ | ||
91 | public function getEntriesTagsAction(Entries $entry) { | ||
92 | |||
93 | } | ||
94 | |||
95 | /** | ||
96 | * Saves new tag for an entry | ||
97 | * | ||
98 | * @ApiDoc( | ||
99 | * requirements={ | ||
100 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | ||
101 | * } | ||
102 | * ) | ||
103 | */ | ||
104 | public function postEntriesTagsAction(Entries $entry) { | ||
105 | |||
106 | } | ||
107 | |||
108 | /** | ||
109 | * Remove tag for an entry | ||
110 | * | ||
111 | * @ApiDoc( | ||
112 | * requirements={ | ||
113 | * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"}, | ||
114 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | ||
115 | * } | ||
116 | * ) | ||
117 | */ | ||
118 | public function deleteEntriesTagsAction(Entries $entry, Tags $tag) | ||
119 | { | ||
120 | |||
121 | } | ||
122 | |||
123 | /** | ||
124 | * Gets tags for a user | ||
125 | * | ||
126 | * @ApiDoc( | ||
127 | * ) | ||
128 | */ | ||
129 | public function getTagsAction() { | ||
130 | |||
131 | } | ||
132 | |||
133 | /** | ||
134 | * Gets one tag | ||
135 | * | ||
136 | * @ApiDoc( | ||
137 | * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"} | ||
138 | * ) | ||
139 | */ | ||
140 | public function getTagAction(Tags $tag) { | ||
141 | |||
142 | } | ||
143 | |||
144 | /** | ||
145 | * Delete tag | ||
146 | * | ||
147 | * @ApiDoc( | ||
148 | * requirements={ | ||
149 | * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"} | ||
150 | * } | ||
151 | * ) | ||
152 | */ | ||
153 | public function deleteTagAction(Tags $tag) | ||
154 | { | ||
155 | |||
156 | } | ||
157 | } \ No newline at end of file | ||