1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Re-create all API routes

This commit is contained in:
Jeremy Benoist 2022-11-23 12:44:55 +01:00
parent 2efb990a14
commit 27e788d0be
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
12 changed files with 82 additions and 20 deletions

View file

@ -2,7 +2,7 @@
namespace Wallabag\ApiBundle\Controller;
use Hateoas\Configuration\Route;
use Hateoas\Configuration\Route as HateoasRoute;
use Hateoas\Representation\Factory\PagerfantaFactory;
use Nelmio\ApiDocBundle\Annotation\Operation;
use Pagerfanta\Pagerfanta;
@ -13,6 +13,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Event\EntryDeletedEvent;
@ -80,6 +81,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/exists.{_format}", methods={"GET"}, name="api_get_entries_exists", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function getEntriesExistsAction(Request $request)
@ -272,6 +275,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries.{_format}", methods={"GET"}, name="api_get_entries", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function getEntriesAction(Request $request)
@ -314,7 +319,7 @@ class EntryRestController extends WallabagRestController
$pagerfantaFactory = new PagerfantaFactory('page', 'perPage');
$paginatedCollection = $pagerfantaFactory->createRepresentation(
$pager,
new Route(
new HateoasRoute(
'api_get_entries',
[
'archive' => $isArchived,
@ -355,6 +360,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}.{_format}", methods={"GET"}, name="api_get_entry", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function getEntryAction(Entry $entry)
@ -393,6 +400,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}/export.{_format}", methods={"GET"}, name="api_get_entry_export", defaults={"_format": "json"})
*
* @return Response
*/
public function getEntryExportAction(Entry $entry, Request $request)
@ -426,6 +435,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/list.{_format}", methods={"DELETE"}, name="api_delete_entries_list", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function deleteEntriesListAction(Request $request)
@ -483,6 +494,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/lists.{_format}", methods={"POST"}, name="api_post_entries_list", defaults={"_format": "json"})
*
* @throws HttpException When limit is reached
*
* @return JsonResponse
@ -666,6 +679,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries.{_format}", methods={"POST"}, name="api_post_entries", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function postEntriesAction(Request $request)
@ -869,6 +884,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}.{_format}", methods={"PATCH"}, name="api_patch_entries", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function patchEntriesAction(Entry $entry, Request $request)
@ -985,6 +1002,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}/reload.{_format}", methods={"PATCH"}, name="api_patch_entries_reload", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function patchEntriesReloadAction(Entry $entry)
@ -1041,6 +1060,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}.{_format}", methods={"DELETE"}, name="api_delete_entries", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function deleteEntriesAction(Entry $entry, Request $request)
@ -1091,6 +1112,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}/tags.{_format}", methods={"GET"}, name="api_get_entries_tags", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function getEntriesTagsAction(Entry $entry)
@ -1131,6 +1154,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}/tags.{_format}", methods={"POST"}, name="api_post_entries_tags", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function postEntriesTagsAction(Request $request, Entry $entry)
@ -1178,6 +1203,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/{entry}/tags/{tag}.{_format}", methods={"DELETE"}, name="api_delete_entries_tags", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function deleteEntriesTagsAction(Entry $entry, Tag $tag)
@ -1212,6 +1239,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/tags/list.{_format}", methods={"DELETE"}, name="api_delete_entries_tags_list", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function deleteEntriesTagsListAction(Request $request)
@ -1280,6 +1309,8 @@ class EntryRestController extends WallabagRestController
* )
* )
*
* @Route("/api/entries/tags/lists.{_format}", methods={"POST"}, name="api_post_entries_tags_list", defaults={"_format": "json"})
*
* @return JsonResponse
*/
public function postEntriesTagsListAction(Request $request)