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"}
25 * @return JsonResponse
27 public function getAnnotationsAction(Entry
$entry)
29 $this->validateAuthentication();
31 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:getAnnotations', [
37 * Creates a new annotation.
41 * {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"},
42 * {"name"="quote", "dataType"="string", "required"=false, "description"="Optional, quote for the annotation"},
43 * {"name"="text", "dataType"="string", "required"=true, "description"=""},
47 * @param Request $request
50 * @return JsonResponse
52 public function postAnnotationAction(Request
$request, Entry
$entry)
54 $this->validateAuthentication();
56 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:postAnnotation', [
57 'request' => $request,
63 * Updates an annotation.
67 * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"}
71 * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
73 * @param Annotation $annotation
74 * @param Request $request
76 * @return JsonResponse
78 public function putAnnotationAction(Annotation
$annotation, Request
$request)
80 $this->validateAuthentication();
82 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:putAnnotation', [
83 'annotation' => $annotation,
84 'request' => $request,
89 * Removes an annotation.
93 * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"}
97 * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation")
99 * @param Annotation $annotation
101 * @return JsonResponse
103 public function deleteAnnotationAction(Annotation
$annotation)
105 $this->validateAuthentication();
107 return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:deleteAnnotation', [
108 'annotation' => $annotation,