mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-06 00:49:47 +00:00
API: getEntry can return EPUB
This commit is contained in:
parent
3d4b0b3064
commit
24de866534
1 changed files with 8 additions and 1 deletions
|
@ -127,11 +127,18 @@ class WallabagRestController extends FOSRestController
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function getEntryAction(Entry $entry)
|
public function getEntryAction(Entry $entry, $_format)
|
||||||
{
|
{
|
||||||
$this->validateAuthentication();
|
$this->validateAuthentication();
|
||||||
$this->validateUserAccess($entry->getUser()->getId());
|
$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');
|
$json = $this->get('serializer')->serialize($entry, 'json');
|
||||||
|
|
||||||
return (new JsonResponse())->setJson($json);
|
return (new JsonResponse())->setJson($json);
|
||||||
|
|
Loading…
Reference in a new issue