From 864c1dd23a4aa9e5f412302694d9303070dca6dc Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 3 Nov 2016 17:29:16 +0100 Subject: Fix rest controller merge --- .../Controller/AnnotationRestController.php | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/Wallabag/ApiBundle/Controller/AnnotationRestController.php (limited to 'src/Wallabag/ApiBundle/Controller/AnnotationRestController.php') diff --git a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php new file mode 100644 index 00000000..2dd26c07 --- /dev/null +++ b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php @@ -0,0 +1,111 @@ +validateAuthentication(); + + return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:getAnnotations', [ + 'entry' => $entry, + ]); + } + + /** + * Creates a new annotation. + * + * @ApiDoc( + * requirements={ + * {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"}, + * {"name"="quote", "dataType"="string", "required"=false, "description"="Optional, quote for the annotation"}, + * {"name"="text", "dataType"="string", "required"=true, "description"=""}, + * } + * ) + * + * @param Request $request + * @param Entry $entry + * + * @return JsonResponse + */ + public function postAnnotationAction(Request $request, Entry $entry) + { + $this->validateAuthentication(); + + return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:postAnnotation', [ + 'request' => $request, + 'entry' => $entry, + ]); + } + + /** + * Updates an annotation. + * + * @ApiDoc( + * requirements={ + * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"} + * } + * ) + * + * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * + * @param Annotation $annotation + * @param Request $request + * + * @return JsonResponse + */ + public function putAnnotationAction(Annotation $annotation, Request $request) + { + $this->validateAuthentication(); + + return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:putAnnotation', [ + 'annotation' => $annotation, + 'request' => $request, + ]); + } + + /** + * Removes an annotation. + * + * @ApiDoc( + * requirements={ + * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"} + * } + * ) + * + * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * + * @param Annotation $annotation + * + * @return JsonResponse + */ + public function deleteAnnotationAction(Annotation $annotation) + { + $this->validateAuthentication(); + + return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:deleteAnnotation', [ + 'annotation' => $annotation, + ]); + } +} -- cgit v1.2.3