3 namespace Wallabag\ApiBundle\Controller
;
5 use Nelmio\ApiDocBundle\Annotation\ApiDoc
;
6 use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter
;
7 use Symfony\Component\HttpFoundation\JsonResponse
;
8 use Symfony\Component\HttpFoundation\Request
;
9 use Wallabag\AnnotationBundle\Entity\Annotation
;
10 use Wallabag\CoreBundle\Entity\Entry
;
12 class AnnotationRestController
extends WallabagRestController
15 * Retrieve annotations for an entry.
19 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
23 * @return JsonResponse
25 public function getAnnotationsAction(Entry
$entry)
27 $this->validateAuthentication();
29 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:getAnnotations', [
35 * Creates a new annotation.
39 * {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"},
40 * {"name"="quote", "dataType"="string", "description"="The annotated text"},
41 * {"name"="text", "dataType"="string", "required"=true, "description"="Content of annotation"},
45 * @return JsonResponse
47 public function postAnnotationAction(Request
$request, Entry
$entry)
49 $this->validateAuthentication();
51 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:postAnnotation', [
52 'request' => $request,
58 * Updates an annotation.
62 * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"}
66 * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
68 * @return JsonResponse
70 public function putAnnotationAction(Annotation
$annotation, Request
$request)
72 $this->validateAuthentication();
74 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:putAnnotation', [
75 'annotation' => $annotation,
76 'request' => $request,
81 * Removes an annotation.
85 * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"}
89 * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
91 * @return JsonResponse
93 public function deleteAnnotationAction(Annotation
$annotation)
95 $this->validateAuthentication();
97 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:deleteAnnotation', [
98 'annotation' => $annotation,