Skip to main content

反应

反应 API 使您能够创建、列出和删除评论中的反应。

关于反应 API

您可以使用反应 API 创建和管理对评论的反应。 创建反应时,content 参数的允许值如下(带有相应的表情符号供参考):

content 表情符号
+1 👍
-1 👎
微笑 😄
困惑 😕
heart ❤️
欢呼 🎉
火箭 🚀
眼睛 👀

List reactions for a team discussion comment

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

参数

标头
名称, 类型, 描述
acceptstring

Setting to application/vnd.github+json is recommended.

路径参数
名称, 类型, 描述
orgstring必选

The organization name. The name is not case sensitive.

team_slugstring必选

The slug of the team name.

discussion_numberinteger必选

The number that identifies the discussion.

comment_numberinteger必选

The number that identifies the comment.

查询参数
名称, 类型, 描述
contentstring

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

可以是以下其中之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_pageinteger

The number of results per page (max 100).

默认值: 30

pageinteger

Page number of the results to fetch.

默认值: 1

HTTP 响应状态代码

状态代码描述
200

OK

代码示例

get/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/DISCUSSION_NUMBER/comments/COMMENT_NUMBER/reactions

Response

Status: 200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif