Skip to content

Commit

Permalink
Merge pull request #64 from diaspora/comment_like_routes
Browse files Browse the repository at this point in the history
add routes for comment likes
  • Loading branch information
SuperTux88 committed Jun 2, 2024
2 parents e8e34d2 + 7f9eec6 commit 4cc0315
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions _routes/likes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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).
Expand All @@ -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 |

0 comments on commit 4cc0315

Please sign in to comment.