aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle
diff options
context:
space:
mode:
authorPascal MARTIN <pmartin@tea-ebook.com>2016-10-04 13:57:18 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-08 12:05:41 +0200
commit24de86653440de3f84d585f089caab3734dcb573 (patch)
treea8fa0fd4c78f799fbd9c38ef6c2fdcc65f9bb615 /src/Wallabag/ApiBundle
parent3d4b0b306456aa7e5f16d9dda9043a74438f320f (diff)
downloadwallabag-24de86653440de3f84d585f089caab3734dcb573.tar.gz
wallabag-24de86653440de3f84d585f089caab3734dcb573.tar.zst
wallabag-24de86653440de3f84d585f089caab3734dcb573.zip
API: getEntry can return EPUB
Diffstat (limited to 'src/Wallabag/ApiBundle')
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index a0d9d4f3..072e5f85 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -127,11 +127,18 @@ class WallabagRestController extends FOSRestController
127 * 127 *
128 * @return JsonResponse 128 * @return JsonResponse
129 */ 129 */
130 public function getEntryAction(Entry $entry) 130 public function getEntryAction(Entry $entry, $_format)
131 { 131 {
132 $this->validateAuthentication(); 132 $this->validateAuthentication();
133 $this->validateUserAccess($entry->getUser()->getId()); 133 $this->validateUserAccess($entry->getUser()->getId());
134 134
135 if ($_format === 'epub') {
136 return $this->get('wallabag_core.helper.entries_export')
137 ->setEntries($entry)
138 ->updateTitle('entry')
139 ->exportAs($_format);
140 }
141
135 $json = $this->get('serializer')->serialize($entry, 'json'); 142 $json = $this->get('serializer')->serialize($entry, 'json');
136 143
137 return (new JsonResponse())->setJson($json); 144 return (new JsonResponse())->setJson($json);