Class ClipController


  • @RestController
    @RequestMapping("/clips")
    @ExposesResourceFor(Clip.class)
    public class ClipController
    extends java.lang.Object
    ClipController provides endpoints which allow the client to access data relating to Clip.
    Since:
    1.0
    Version:
    1.0
    Author:
    Robert Dominugez, Roderick Frechette, Laura Steiner
    • Constructor Summary

      Constructors 
      Constructor Description
      ClipController​(ClipService clipService)
      Autowired constructor for ClipController.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(org.springframework.security.core.Authentication auth, Clip clip)
      Deletes a clip only if it has been posted by the current user.
      Clip get​(org.springframework.security.core.Authentication auth, long clipId)
      Gets a selected clip by id.
      java.util.List<Clip> getAll​(org.springframework.security.core.Authentication auth, int limit, int offset, ClipService.Source source)
      Returns all of the most recent clips, limited by parameters.
      Clip post​(org.springframework.security.core.Authentication auth, Clip clip)
      Posts a clip for the current user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClipController

        @Autowired
        public ClipController​(ClipService clipService)
        Autowired constructor for ClipController.
        Parameters:
        clipService - ClipService
    • Method Detail

      • getAll

        @GetMapping(produces="application/json")
        public java.util.List<Clip> getAll​(org.springframework.security.core.Authentication auth,
                                           @RequestParam(required=false,defaultValue="10")
                                           int limit,
                                           @RequestParam(required=false,defaultValue="0")
                                           int offset,
                                           @RequestParam(required=false,defaultValue="ALL")
                                           ClipService.Source source)
        Returns all of the most recent clips, limited by parameters. The source parameter allows for the client to get all clips, only clips by friends, only clips by followers, only clips by users in a relationship with the user, or only clips by the user.
        Parameters:
        auth - Authentication
        limit - int
        offset - int
        source - Source enum
        Returns:
        List<Clip>
      • get

        @GetMapping(value="/{clipId}",
                    produces="application/json")
        public Clip get​(org.springframework.security.core.Authentication auth,
                        @PathVariable
                        long clipId)
        Gets a selected clip by id.
        Parameters:
        auth - Authentication
        clipId - long
        Returns:
        a selected clip
      • post

        @ResponseStatus(CREATED)
        @PostMapping(consumes="application/json",
                     produces="application/json")
        public Clip post​(org.springframework.security.core.Authentication auth,
                         @RequestBody
                         Clip clip)
        Posts a clip for the current user.
        Parameters:
        auth - Authentication
        clip - Clip
        Returns:
        the clip that was posted
      • delete

        @ResponseStatus(NO_CONTENT)
        @DeleteMapping(consumes="application/json")
        public void delete​(org.springframework.security.core.Authentication auth,
                           @RequestBody
                           Clip clip)
        Deletes a clip only if it has been posted by the current user.
        Parameters:
        auth - Authentication
        clip - Clip