-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from diaspora/comment_like_routes
add routes for comment likes
- Loading branch information
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,48 @@ GET /api/v1/posts/:post_guid/likes | |
| ----------- | ------------------------------------------ | | ||
| 404 | Post with provided guid could not be found | | ||
|
||
## Get likes for a comment | ||
|
||
Required API scope: the one which gives read access to the post (`public:read` for public posts and `private:read` for private posts). | ||
|
||
### Request | ||
|
||
~~~ | ||
GET /api/v1/posts/:post_guid/comments/:comment_guid/likes | ||
~~~ | ||
|
||
### Response | ||
|
||
~~~json | ||
[ | ||
{ | ||
"guid": "b6098440b8e00133e40d406c8f31e210", | ||
"author": { | ||
"guid": "f50ffc00b188013355e3705681972339", | ||
"diaspora_id": "[email protected]", | ||
"name": "Alice Testing", | ||
"avatar": "http://example.com/uploads/images/thumb_medium_83abe5319ef830c2bd84.jpg" | ||
} | ||
}, | ||
{ | ||
"guid": "cf6a25b0b8e00133e40d406c8f31e210", | ||
"author": { | ||
"guid": "cb7e4aa0b82f0133e40d406c8f31e210", | ||
"diaspora_id": "[email protected]", | ||
"name": "Bob Testing", | ||
"avatar": "http://example.com/uploads/images/thumb_medium_a51bf501fe86c198c0b1.jpg" | ||
} | ||
} | ||
] | ||
~~~ | ||
|
||
### Errors | ||
|
||
| Status code | Error reason | | ||
| ----------- | ----------------------------------------------------- | | ||
| 404 | Post or comment with provided guid could not be found | | ||
|
||
|
||
## Like a post | ||
|
||
Required API scope: `interactions`. Read access to the post must be present too (`public:read` for public posts and `private:read` for private posts). | ||
|
@@ -69,6 +111,30 @@ Status: 204 No Content | |
| 422 | User is not allowed to like | | ||
| 409 | Like already exists | | ||
|
||
## Like a comment | ||
|
||
Required API scope: `interactions`. Read access to the post must be present too (`public:read` for public posts and `private:read` for private posts). | ||
|
||
### Request | ||
|
||
~~~ | ||
POST /api/v1/posts/:post_guid/comments/:comment_guid/likes | ||
~~~ | ||
|
||
### Response | ||
|
||
~~~ | ||
Status: 204 No Content | ||
~~~ | ||
|
||
### Errors | ||
|
||
| Status code | Error reason | | ||
| ----------- | ----------------------------------------------------- | | ||
| 404 | Post or comment with provided guid could not be found | | ||
| 422 | User is not allowed to like | | ||
| 409 | Like already exists | | ||
|
||
## Unlike a post | ||
|
||
Required API scope: `interactions`. Read access to the post must be present too (`public:read` for public posts and `private:read` for private posts). | ||
|
@@ -91,3 +157,26 @@ Status: 204 No Content | |
| ----------- | ------------------------------------------ | | ||
| 404 | Post with provided guid could not be found | | ||
| 410 | Like doesn't exist | | ||
|
||
## Unlike a comment | ||
|
||
Required API scope: `interactions`. Read access to the post must be present too (`public:read` for public posts and `private:read` for private posts). | ||
|
||
### Request | ||
|
||
~~~ | ||
DELETE /api/v1/posts/:post_guid/comments/:comment_guid/likes | ||
~~~ | ||
|
||
### Response | ||
|
||
~~~ | ||
Status: 204 No Content | ||
~~~ | ||
|
||
### Errors | ||
|
||
| Status code | Error reason | | ||
| ----------- | ----------------------------------------------------- | | ||
| 404 | Post or comment with provided guid could not be found | | ||
| 410 | Like doesn't exist | |