Package com.patreonshout.rest
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 Summary
Fields Modifier and Type Field Description private ListPostsRepository
listPostsRepository
An autowired Spring component that endpoints utilize to send or receive data from the databaseprivate ListsRepository
listsRepository
An autowired Spring component that endpoints utilize to send or receive data from the lists table in the databaseprivate PostsRepository
postsRepository
An autowired Spring component that endpoints utilize to send or receive data from the databaseprivate WebAccountFunctions
webAccountFunctions
An autowired Spring component that endpoints utilize to send or receive data from the database -
Constructor Summary
Constructors Constructor Description ListSvc()
-
Method Summary
Modifier and Type Method Description org.springframework.http.ResponseEntity<?>
AddPostToFavoritesList(FavoriteListRequest favoriteListRequest)
Adds a post to the favorites listorg.springframework.http.ResponseEntity<?>
AddUserList(ListCreationRequest listCreationRequest)
Endpoint that will add a newListBean
object to the databaseorg.springframework.http.ResponseEntity<?>
DeletePostFromFavoritesList(FavoriteListRequest favoriteListRequest)
Deletes a post from the favorites listorg.springframework.http.ResponseEntity<?>
DeleteUserList(ListDeleteRequest listDeleteRequest)
Endpoint that will delete aListBean
object in the databaseorg.springframework.http.ResponseEntity<?>
GetPostsFromList(java.lang.String loginToken, int list_id)
Gets the post from a specific list for a specific userorg.springframework.http.ResponseEntity<?>
GetUserLists(java.lang.String loginToken)
Endpoint that will get a list ofListBean
objects from the database given a login tokenorg.springframework.http.ResponseEntity<?>
GetUserListsWithPost(java.lang.String loginToken, java.lang.String url)
Endpoint that will get a list ofListBean
objects from the database that have a specific post in themorg.springframework.http.ResponseEntity<?>
UpdateUserList(ListUpdateRequest listUpdateRequest)
Endpoint that will update aListBean
object in the databaseorg.springframework.http.ResponseEntity<?>
UpdateUserPostLists(ListPostUpdateRequest listPostUpdateRequest)
Updates the user's post listsMethods inherited from class com.patreonshout.rest.BaseSvc
catchCustomException, catchSQLIntegrityConstraintViolationException
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
listsRepository
An autowired Spring component that endpoints utilize to send or receive data from the lists table in the database -
webAccountFunctions
An autowired Spring component that endpoints utilize to send or receive data from the database -
postsRepository
An autowired Spring component that endpoints utilize to send or receive data from the database -
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 PSExceptionEndpoint that will get a list ofListBean
objects from the database given a login token- Specified by:
GetUserLists
in interfaceListImpl
- 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 PSExceptionEndpoint that will add a newListBean
object to the database- Specified by:
AddUserList
in interfaceListImpl
- Parameters:
listCreationRequest
- is theListCreationRequest
object that containsListBean
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 aListBean
object in the database- Specified by:
UpdateUserList
in interfaceListImpl
- Parameters:
listUpdateRequest
- is theListUpdateRequest
object that containsListBean
request parameters- Returns:
HttpStatus.OK
if successful,HttpStatus.BAD_REQUEST
otherwise
-
DeleteUserList
public org.springframework.http.ResponseEntity<?> DeleteUserList(@RequestBody ListDeleteRequest listDeleteRequest) throws PSExceptionEndpoint that will delete aListBean
object in the database- Specified by:
DeleteUserList
in interfaceListImpl
- Parameters:
listDeleteRequest
- is theListDeleteRequest
object that containsListBean
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 PSExceptionEndpoint that will get a list ofListBean
objects from the database that have a specific post in them- Specified by:
GetUserListsWithPost
in interfaceListImpl
- Parameters:
loginToken
- is the login token provided to the user upon sign inurl
- 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 PSExceptionUpdates the user's post lists- Specified by:
UpdateUserPostLists
in interfaceListImpl
- Parameters:
listPostUpdateRequest
- is theListPostUpdateRequest
object that containsListPost
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 PSExceptionGets the post from a specific list for a specific user- Specified by:
GetPostsFromList
in interfaceListImpl
- Parameters:
loginToken
- is the login token provided to the user upon sign inlist_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 PSExceptionAdds a post to the favorites list- Specified by:
AddPostToFavoritesList
in interfaceListImpl
- Parameters:
favoriteListRequest
- is theFavoriteListRequest
object that containsListPost
requests parameters- Returns:
HttpStatus.CREATED
if successful,HttpStatus.CONFLICT
ORHttpStatus.BAD_REQUEST
otherwise- Throws:
PSException
-
DeletePostFromFavoritesList
public org.springframework.http.ResponseEntity<?> DeletePostFromFavoritesList(FavoriteListRequest favoriteListRequest) throws PSExceptionDeletes a post from the favorites list- Specified by:
DeletePostFromFavoritesList
in interfaceListImpl
- Parameters:
favoriteListRequest
- is theFavoriteListRequest
object that containsListPost
requests parameters- Returns:
HttpStatus.CREATED
if successful,HttpStatus.BAD_REQUEST
otherwise- Throws:
PSException
-