Class ListSvc

java.lang.Object
com.patreonshout.rest.BaseSvc
com.patreonshout.rest.ListSvc
All Implemented Interfaces:
ListImpl

@RestController
public class ListSvc
extends BaseSvc
implements ListImpl
Lists RESTful Endpoint Interface
  • Field Details

    • listsRepository

      @Autowired private ListsRepository listsRepository
      An autowired Spring component that endpoints utilize to send or receive data from the lists table in the database
    • webAccountFunctions

      @Autowired private WebAccountFunctions webAccountFunctions
      An autowired Spring component that endpoints utilize to send or receive data from the database
    • postsRepository

      @Autowired private PostsRepository postsRepository
      An autowired Spring component that endpoints utilize to send or receive data from the database
    • listPostsRepository

      @Autowired private ListPostsRepository listPostsRepository
      An autowired Spring component that endpoints utilize to send or receive data from the database
  • Constructor Details

    • ListSvc

      public ListSvc()
  • Method Details

    • GetUserLists

      public org.springframework.http.ResponseEntity<?> GetUserLists​(@RequestParam(name="loginToken") java.lang.String loginToken) throws PSException
      Endpoint that will get a list of ListBean objects from the database given a login token
      Specified by:
      GetUserLists in interface ListImpl
      Parameters:
      loginToken - is the login token provided to the user upon sign in
      Returns:
      a json body of list objects for a user
      Throws:
      PSException
    • AddUserList

      public org.springframework.http.ResponseEntity<?> AddUserList​(@RequestBody ListCreationRequest listCreationRequest) throws PSException
      Endpoint that will add a new ListBean object to the database
      Specified by:
      AddUserList in interface ListImpl
      Parameters:
      listCreationRequest - is the ListCreationRequest object that contains ListBean request parameters
      Returns:
      HttpStatus.CREATED if successful, HttpStatus.CONFLICT otherwise
      Throws:
      PSException
    • UpdateUserList

      public org.springframework.http.ResponseEntity<?> UpdateUserList​(@RequestBody ListUpdateRequest listUpdateRequest)
      Endpoint that will update a ListBean object in the database
      Specified by:
      UpdateUserList in interface ListImpl
      Parameters:
      listUpdateRequest - is the ListUpdateRequest object that contains ListBean request parameters
      Returns:
      HttpStatus.OK if successful, HttpStatus.BAD_REQUEST otherwise
    • DeleteUserList

      public org.springframework.http.ResponseEntity<?> DeleteUserList​(@RequestBody ListDeleteRequest listDeleteRequest) throws PSException
      Endpoint that will delete a ListBean object in the database
      Specified by:
      DeleteUserList in interface ListImpl
      Parameters:
      listDeleteRequest - is the ListDeleteRequest object that contains ListBean requests parameters
      Returns:
      HttpStatus.OK if successful, HttpStatus.BAD_REQUEST otherwise
      Throws:
      PSException
    • GetUserListsWithPost

      public org.springframework.http.ResponseEntity<?> GetUserListsWithPost​(java.lang.String loginToken, java.lang.String url) throws PSException
      Endpoint that will get a list of ListBean objects from the database that have a specific post in them
      Specified by:
      GetUserListsWithPost in interface ListImpl
      Parameters:
      loginToken - is the login token provided to the user upon sign in
      url - is the url of the post we want to get the lists of
      Returns:
      a json body of list objects for a user
      Throws:
      PSException
    • UpdateUserPostLists

      public org.springframework.http.ResponseEntity<?> UpdateUserPostLists​(ListPostUpdateRequest listPostUpdateRequest) throws PSException
      Updates the user's post lists
      Specified by:
      UpdateUserPostLists in interface ListImpl
      Parameters:
      listPostUpdateRequest - is the ListPostUpdateRequest object that contains ListPost requests parameters
      Returns:
      HttpStatus.OK if successful, HttpStatus.BAD_REQUEST otherwise
      Throws:
      PSException
    • GetPostsFromList

      public org.springframework.http.ResponseEntity<?> GetPostsFromList​(java.lang.String loginToken, int list_id) throws PSException
      Gets the post from a specific list for a specific user
      Specified by:
      GetPostsFromList in interface ListImpl
      Parameters:
      loginToken - is the login token provided to the user upon sign in
      list_id - is the id of the list we want to get the posts of
      Returns:
      a list of PostBean objects from the specified list_id
      Throws:
      PSException
    • AddPostToFavoritesList

      public org.springframework.http.ResponseEntity<?> AddPostToFavoritesList​(FavoriteListRequest favoriteListRequest) throws PSException
      Adds a post to the favorites list
      Specified by:
      AddPostToFavoritesList in interface ListImpl
      Parameters:
      favoriteListRequest - is the FavoriteListRequest object that contains ListPost requests parameters
      Returns:
      HttpStatus.CREATED if successful, HttpStatus.CONFLICT OR HttpStatus.BAD_REQUEST otherwise
      Throws:
      PSException
    • DeletePostFromFavoritesList

      public org.springframework.http.ResponseEntity<?> DeletePostFromFavoritesList​(FavoriteListRequest favoriteListRequest) throws PSException
      Deletes a post from the favorites list
      Specified by:
      DeletePostFromFavoritesList in interface ListImpl
      Parameters:
      favoriteListRequest - is the FavoriteListRequest object that contains ListPost requests parameters
      Returns:
      HttpStatus.CREATED if successful, HttpStatus.BAD_REQUEST otherwise
      Throws:
      PSException