X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FController%2FWallabagRestController.php;h=5f342825f08c3ca12c891df01ee0ae0f313e3e75;hb=9761bfa18e7a481ce9d73c1650e77bccab1927b3;hp=03990088218971850a9c87240381e911c3a1a2e0;hpb=12b5a8cea12c7c8b10ede7fd00d1f07ca06b1033;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 03990088..5f342825 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -97,6 +97,8 @@ class WallabagRestController extends FOSRestController * {"name"="url", "dataType"="string", "required"=true, "format"="http://www.test.com/article.html", "description"="Url for the entry."}, * {"name"="title", "dataType"="string", "required"=false, "description"="Optional, we'll get the title from the page."}, * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."}, + * {"name"="starred", "dataType"="boolean", "required"=false, "format"="true or false", "description"="entry already starred"}, + * {"name"="archive", "dataType"="boolean", "required"=false, "format"="true or false", "description"="entry already archived"}, * } * ) * @@ -107,6 +109,8 @@ class WallabagRestController extends FOSRestController $this->validateAuthentication(); $url = $request->request->get('url'); + $isArchived = $request->request->get('archive'); + $isStarred = $request->request->get('starred'); $entry = $this->get('wallabag_core.content_proxy')->updateEntry( new Entry($this->getUser()), @@ -118,8 +122,17 @@ class WallabagRestController extends FOSRestController $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); } + if (true === (bool) $isStarred) { + $entry->setStarred(true); + } + + if (true === (bool) $isArchived) { + $entry->setArchived(true); + } + $em = $this->getDoctrine()->getManager(); $em->persist($entry); + $em->flush(); $json = $this->get('serializer')->serialize($entry, 'json'); @@ -327,6 +340,19 @@ class WallabagRestController extends FOSRestController return $this->renderJsonResponse($json); } + /** + * Retrive version. + * + * @return Response + */ + public function getVersionAction() + { + $version = $this->container->getParameter('wallabag_core.version'); + + $json = $this->get('serializer')->serialize($version, 'json'); + + return $this->renderJsonResponse($json); + } /** * Validate that the first id is equal to the second one.