]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/WallabagRestController.php
API: getEntry can return EPUB
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / WallabagRestController.php
index a0d9d4f3a144336735468ad3fd4f04b67eda8087..072e5f85115ab91ab931a2d67eb97dc2030fc030 100644 (file)
@@ -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);