From 24de86653440de3f84d585f089caab3734dcb573 Mon Sep 17 00:00:00 2001 From: Pascal MARTIN Date: Tue, 4 Oct 2016 13:57:18 +0200 Subject: [PATCH] API: getEntry can return EPUB --- .../ApiBundle/Controller/WallabagRestController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index a0d9d4f3a..072e5f851 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -127,11 +127,18 @@ class WallabagRestController extends FOSRestController * * @return JsonResponse */ - public function getEntryAction(Entry $entry) + public function getEntryAction(Entry $entry, $_format) { $this->validateAuthentication(); $this->validateUserAccess($entry->getUser()->getId()); + if ($_format === 'epub') { + return $this->get('wallabag_core.helper.entries_export') + ->setEntries($entry) + ->updateTitle('entry') + ->exportAs($_format); + } + $json = $this->get('serializer')->serialize($entry, 'json'); return (new JsonResponse())->setJson($json);