评论

优质
小牛编辑
130浏览
2023-12-01

Send comment

POST /feeds/:feed/comments

Input

NameTypeDescription
bodyStringComment body.
reply_userIntegerReply comment to users.
Response
Status: 201 Created
{
  "message": [
    "操作成功"
  ],
  "comment": {
    "user_id": 1,
    "reply_user": 0,
    "target_user": 1,
    "body": "我是第三条评论",
    "commentable_type": "feeds",
    "commentable_id": 1,
    "updated_at": "2017-07-20 08:53:24",
    "created_at": "2017-07-20 08:53:24",
    "id": 3
  }
}

Get all comments

GET /feeds/:feed/comments

Parameters

NameTypeDescription
limitIntegerList comments limit, By default 20.
afterIntegerThe integer ID of the last Comment that you've seen.
Response
Status: 200 OK
{
  "pinneds": [
    {
      "id": 2,
      "user_id": 1,
      "target_user": 1,
      "reply_user": 0,
      "body": "我是第一条评论",
      "commentable_id": 1,
      "commentable_type": "feeds",
      "created_at": "2017-07-20 08:35:18",
      "updated_at": "2017-07-20 08:35:18"
    }
  ],
  "comments": [
    {
      "id": 3,
      "user_id": 1,
      "target_user": 1,
      "reply_user": 0,
      "body": "我是第三条评论",
      "commentable_id": 1,
      "commentable_type": "feeds",
      "created_at": "2017-07-20 08:53:24",
      "updated_at": "2017-07-20 08:53:24"
    }
  ]
}
NameDescription
pinnedsPinned comments list.
commentComments list.
*.idThe ID of the comment.
*.user_idCommentator.
*.target_userOwn dynamic publisher.
*.reply_userReverted to the user.
*.bodyThe body of the comment.
*.commentable_idFeeds id.
*.commentable_typeCommentable type.
*.created_atComment release time.
*.updated_atComment update time.

Get a single comment

GET /feeds/:feed/comments/:comment
Response
Status: 200 OK
{
  "id": 1,
  "user_id": 1,
  "target_user": 1,
  "reply_user": 0,
  "body": "我是第一条评论",
  "commentable_id": 1,
  "commentable_type": "feeds",
  "created_at": "2017-07-20 08:34:41",
  "updated_at": "2017-07-20 08:34:41"
}
NameDescription
idThe ID of the comment.
user_idCommentator.
target_userOwn dynamic publisher.
reply_userReverted to the user.
bodyThe body of the comment.
commentable_idFeeds id.
commentable_typeCommentable type.
created_atComment release time.
updated_atComment update time.

Delete comment

DELETE /feeds/:feed/comments/:comment
Response
Status: 204 No Content