mirror of
https://github.com/wallabag/wallabag.git
synced 2024-05-14 15:22:38 +00:00
34 lines
831 B
PHP
34 lines
831 B
PHP
<?php
|
|
|
|
namespace Wallabag\ApiBundle\Controller;
|
|
|
|
use JMS\Serializer\SerializationContext;
|
|
use JMS\Serializer\SerializerInterface;
|
|
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
|
|
class ConfigRestController extends WallabagRestController
|
|
{
|
|
/**
|
|
* Retrieve configuration for current user.
|
|
*
|
|
* @ApiDoc()
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function getConfigAction()
|
|
{
|
|
$this->validateAuthentication();
|
|
|
|
$json = $this->get(SerializerInterface::class)->serialize(
|
|
$this->getUser()->getConfig(),
|
|
'json',
|
|
SerializationContext::create()->setGroups(['config_api'])
|
|
);
|
|
|
|
return (new JsonResponse())
|
|
->setJson($json)
|
|
->setStatusCode(JsonResponse::HTTP_OK);
|
|
}
|
|
}
|