Skip to content

PostLike Controller

JainalGandhi edited this page May 19, 2020 · 3 revisions

API/PostLike/Post

Method Type: POST (authentication required)

Description: Likes the post associated with the inputted PostId for the authenticated user making the request

Input

Input Parameter Type Description
PostId int The PostId of the Post to be liked by the user

Response

Status Code Status Code Meaning Response
401 Unauthorized The request sent by the client could not be authenticated -
404 Not Found No Post with the inputted PostId could be found -
200 OK The Post corresponding to the PostId was already liked by the user -
201 Created A PostLike with the PostId and the User was successfully created -

API/PostLike/Delete

Method Type: POST (authentication required)

Description: Deletes a PostLike with the inputted PostId for the authenticated user making the request

Input

Input Parameter Type Description
PostId int The PostId to be unliked by the user

Response

Status Code Status Code Meaning Response
401 Unauthorized The request sent by the client could not be authenticated -
404 Not Found No Post with the inputted PostId could be found -
204 No Content No PostLike with the PostId was found for the user -
200 OK A PostLike with the PostId and the User was successfully deleted -

API/PostLike/Get?limit={int}&after_id={int}

Method Type: GET (authentication required)

Description: Gets the Liked posts of the authenticated user making the request

Input

Input Parameter Type Description
limit int (optional) The number of posts to retrieve (default: uses GetPostDefaultLimit value in appsettings.json)
after_id int (optional) The last retrieved PostId (default: will start stream at the most recently liked post)

Response

Status Code Status Code Meaning Response
401 Unauthorized The request sent by the client could not be authenticated -
404 Not Found No Post that has been liked by the user with the inputted after_id could be found -
200 Ok The list of liked Posts was successfully retrieved List of PostDto

Clone this wiki locally