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 ListPostsRepositorylistPostsRepositoryAn autowired Spring component that endpoints utilize to send or receive data from the databaseprivate ListsRepositorylistsRepositoryAn autowired Spring component that endpoints utilize to send or receive data from the lists table in the databaseprivate PostsRepositorypostsRepositoryAn autowired Spring component that endpoints utilize to send or receive data from the databaseprivate WebAccountFunctionswebAccountFunctionsAn 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 newListBeanobject 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 aListBeanobject 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 ofListBeanobjects 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 ofListBeanobjects from the database that have a specific post in themorg.springframework.http.ResponseEntity<?>UpdateUserList(ListUpdateRequest listUpdateRequest)Endpoint that will update aListBeanobject in the databaseorg.springframework.http.ResponseEntity<?>UpdateUserPostLists(ListPostUpdateRequest listPostUpdateRequest)Updates the user's post listsMethods inherited from class com.patreonshout.rest.BaseSvc
catchCustomException, catchSQLIntegrityConstraintViolationExceptionMethods 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 ofListBeanobjects from the database given a login token- Specified by:
GetUserListsin 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 newListBeanobject to the database- Specified by:
AddUserListin interfaceListImpl- Parameters:
listCreationRequest- is theListCreationRequestobject that containsListBeanrequest parameters- Returns:
HttpStatus.CREATEDif successful,HttpStatus.CONFLICTotherwise- Throws:
PSException
-
UpdateUserList
public org.springframework.http.ResponseEntity<?> UpdateUserList(@RequestBody ListUpdateRequest listUpdateRequest)Endpoint that will update aListBeanobject in the database- Specified by:
UpdateUserListin interfaceListImpl- Parameters:
listUpdateRequest- is theListUpdateRequestobject that containsListBeanrequest parameters- Returns:
HttpStatus.OKif successful,HttpStatus.BAD_REQUESTotherwise
-
DeleteUserList
public org.springframework.http.ResponseEntity<?> DeleteUserList(@RequestBody ListDeleteRequest listDeleteRequest) throws PSExceptionEndpoint that will delete aListBeanobject in the database- Specified by:
DeleteUserListin interfaceListImpl- Parameters:
listDeleteRequest- is theListDeleteRequestobject that containsListBeanrequests parameters- Returns:
HttpStatus.OKif successful,HttpStatus.BAD_REQUESTotherwise- Throws:
PSException
-
GetUserListsWithPost
public org.springframework.http.ResponseEntity<?> GetUserListsWithPost(java.lang.String loginToken, java.lang.String url) throws PSExceptionEndpoint that will get a list ofListBeanobjects from the database that have a specific post in them- Specified by:
GetUserListsWithPostin 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:
UpdateUserPostListsin interfaceListImpl- Parameters:
listPostUpdateRequest- is theListPostUpdateRequestobject that containsListPostrequests parameters- Returns:
HttpStatus.OKif successful,HttpStatus.BAD_REQUESTotherwise- 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:
GetPostsFromListin 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
PostBeanobjects 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:
AddPostToFavoritesListin interfaceListImpl- Parameters:
favoriteListRequest- is theFavoriteListRequestobject that containsListPostrequests parameters- Returns:
HttpStatus.CREATEDif successful,HttpStatus.CONFLICTORHttpStatus.BAD_REQUESTotherwise- Throws:
PSException
-
DeletePostFromFavoritesList
public org.springframework.http.ResponseEntity<?> DeletePostFromFavoritesList(FavoriteListRequest favoriteListRequest) throws PSExceptionDeletes a post from the favorites list- Specified by:
DeletePostFromFavoritesListin interfaceListImpl- Parameters:
favoriteListRequest- is theFavoriteListRequestobject that containsListPostrequests parameters- Returns:
HttpStatus.CREATEDif successful,HttpStatus.BAD_REQUESTotherwise- Throws:
PSException
-