# 评论
如果使用 project_full_path,确保 project_full_path 编码过,例子:/api/v3/projects/tencent/code--> /api/v3/projects/tencent%2Fcode (/ 编码 %2F)
返回值说明:
risk: 默认 - 0:"none" 、轻微 - 1:"minor"、一般 - 2:"general" 、严重 - 3: "major"resolve_state: 默认 - 0:"default" 、未解决 - 1:"unresolved" 、已解决 - 2:"resolved"
# 创建合并请求的评论
在项目内给某个指定合并请求新增评论
POST /api/v3/projects/:id/merge_requests/:merge_request_id/notes
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| merge_request_id | integer | 合并请求 id |
| body | string | 评论的内容 |
| path | string(可选) | 文件路径 |
| line | string(可选) | 行号 |
| line_type | string(可选) | 变更类型(对代码行评论时必填),可选old、new |
| risk | string(可选) | 严重程度 可选值 0、1、2、3 0 : "default"(默认)1 : "slight"(轻微) 2 : "normal"(一般)3 : "serious"(严重) |
| resolve_state | string(可选) | 需解决 可选值 0、1、2 0 : "default"(默认) 1 : "unresolved"(未解决) 2 : "resolved"(已解决) |
| label_ids | integer(可选) | 评审问题分类的标签 id ,支持添加多个参数 |
| is_person_note | boolean (可选) | 值为 true 的时,该评论记录至 comments tab false(默认值)的时,只进入 conversation tab |
| notify_enabled | boolean(可选) | 默认值为 true,发通知给相关用户 |
返回值:
{
"id": 265654,
"body": "查看中",
"parent_id": null,
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-22T06:52:05+0000",
"system": true,
"risk": 0,
"resolve_state": 0,
"line_code": "e86e440035468307fcf2382ff2e7a795b89a763e_0_17",
"commit_id": null,
"file_path": "一万.md",
"note_position": {
"origin_position": {
"note_id": 37085434,
"left_line_num": null,
"right_line_num": 17,
"base_commit_sha": "b352aea36fd166c962c5d74c121d7b90c8f05893",
"start_commit_sha": "634667cba663ad403f3762d941e5ab784dc823d0",
"head_commit_sha": "b352aea36fd166c962c5d74c121d7b90c8f05893",
"new_path": "一万.md",
"old_path": "/dev/null"
},
"outdate_position": null,
"latest_position": {
"note_id": 37085434,
"left_line_num": null,
"right_line_num": 17,
"base_commit_sha": "b352aea36fd166c962c5d74c121d7b90c8f05893",
"start_commit_sha": "634667cba663ad403f3762d941e5ab784dc823d0",
"head_commit_sha": "b352aea36fd166c962c5d74c121d7b90c8f05893",
"new_path": "一万.md",
"old_path": "/dev/null"
}
}
}
# 编辑合并请求的评论
在项目内编辑某个指定合并请求的指定评论
PUT /api/v3/projects/:id/merge_requests/:merge_request_id/notes/:note_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| merge_request_id | integer | 合并请求 id |
| note_id | integer | 评论 id |
| body | string | 评论的内容 |
| risk | string(可选) | 严重程度 可选值 0、1、2、3 0 : "default"(默认)1 : "slight"(轻微) 2 : "normal"(一般)3 : "serious"(严重) |
| resolve_state | string(可选) | 需解决 可选值 0、1、2 0 : "default"(默认) 1 : "unresolved"(未解决) 2 : "resolved"(已解决) |
| label_ids | integer(可选) | 评审问题分类的标签 id ,支持添加多个参数 |
返回值:
{
"id": 265451,
"parent_id": null,
"body": "有待修改 ing",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-22T06:52:05+0000",
"system": true,
"risk": 0,
"resolve_state": 0,
"line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_2_1",
"commit_id": null,
"file_path": "README.md",
"note_position": {
"originPosition": {
"id": 6328,
"projectId": 10834830,
"reviewId": 486351,
"noteId": 1996483,
"positionType": 0,
"noteType": 0,
"lineType": 1,
"width": null,
"height": null,
"x": null,
"y": null,
"leftLineNum": null,
"rightLineNum": 1,
"baseCommitSha": "4005aa9208694462804d22ed314127afda8e3098",
"startCommitSha": "71a4e53e47ad4b6b20e6ddb13e493c669c4d631d",
"headCommitSha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"newPath": "README.md",
"oldPath": "README.md",
"filePath": "README.md",
"pathCrc": 160655574,
"startLeftLineNum": null,
"startRightLineNum": null,
"startSelectNum": null,
"endSelectNum": null,
"createdAt": "2022-11-04T09:15:25+0000",
"updatedAt": "2022-11-04T09:15:25+0000",
"added": true,
"newLineType": true,
"unchangedLineType": false,
"unchanged": false,
"oldLineType": false,
"removed": false
},
"outdatePosition": null,
"latestPosition": {
"id": 6329,
"projectId": 10834830,
"reviewId": 486351,
"noteId": 1996483,
"positionType": 2,
"noteType": 0,
"lineType": 1,
"width": null,
"height": null,
"x": null,
"y": null,
"leftLineNum": null,
"rightLineNum": 1,
"baseCommitSha": "4005aa9208694462804d22ed314127afda8e3098",
"startCommitSha": "71a4e53e47ad4b6b20e6ddb13e493c669c4d631d",
"headCommitSha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"newPath": "README.md",
"oldPath": "README.md",
"filePath": "README.md",
"pathCrc": 160655574,
"startLeftLineNum": null,
"startRightLineNum": null,
"startSelectNum": null,
"endSelectNum": null,
"createdAt": "2022-11-04T09:15:25+0000",
"updatedAt": "2022-11-04T09:15:25+0000",
"added": true,
"newLineType": true,
"unchangedLineType": false,
"unchanged": false,
"oldLineType": false,
"removed": false
}
},
"comments": []
}
# 回复合并请求的评论
在项目中回复某 mr 中的评论 回复的评论必须是评论在代码行上的第一条评论,不支持回复已经是回复的评论
POST /api/v3/projects/:id/merge_requests/:merge_request_id/notes/:note_id/replies
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| merge_request_id | integer | 合并请求 id |
| note_id | integer | 需要回复的评论 id |
| body | string | 评论的内容 |
| notify_enabled | boolean(可选) | 默认值为 true,发通知给相关用户 |
返回值:
{
"id": 12607548,
"parent_id": 12607540,
"body": "replyToNote33",
"attachment": null,
"author": {
"id": 70664,
"username": "xxxx",
"web_url": "xxxxx",
"name": "xxxxxx",
"state": "active",
"avatar_url": "xxxx"
},
"created_at": "2020-12-07T08:02:13+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_13_15",
"commit_id": null,
"file_path": "README.md",
"note_position": null
}
# 查询合并请求的评论
在项目内查看某个指定合并请求的指定评论
GET /api/v3/projects/:id/merge_requests/:merge_request_id/notes/:note_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| merge_request_id | integer | 合并请求 id |
| note_id | integer | 评论 id |
返回值:
{
"id": 32561,
"parent_id": null,
"body": "ok",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-22T06:52:05+0000",
"system": true,
"risk": 0,
"resolve_state": 0,
"line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_2_1",
"commit_id": null,
"file_path": "README.md",
"note_position": {
"originPosition": {
"id": 6106,
"projectId": 10834830,
"reviewId": 486351,
"noteId": 1994887,
"positionType": 0,
"noteType": 0,
"lineType": 1,
"width": null,
"height": null,
"x": null,
"y": null,
"leftLineNum": null,
"rightLineNum": 1,
"baseCommitSha": "4005aa9208694462804d22ed314127afda8e3098",
"startCommitSha": "71a4e53e47ad4b6b20e6ddb13e493c669c4d631d",
"headCommitSha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"newPath": "README.md",
"oldPath": "README.md",
"filePath": "README.md",
"pathCrc": 160655574,
"startLeftLineNum": null,
"startRightLineNum": null,
"startSelectNum": null,
"endSelectNum": null,
"createdAt": "2022-11-02T06:50:39+0000",
"updatedAt": "2022-11-02T06:50:39+0000",
"added": true,
"newLineType": true,
"unchangedLineType": false,
"unchanged": false,
"oldLineType": false,
"removed": false
},
"outdatePosition": null,
"latestPosition": {
"id": 6107,
"projectId": 10834830,
"reviewId": 486351,
"noteId": 1994887,
"positionType": 2,
"noteType": 0,
"lineType": 1,
"width": null,
"height": null,
"x": null,
"y": null,
"leftLineNum": null,
"rightLineNum": 1,
"baseCommitSha": "4005aa9208694462804d22ed314127afda8e3098",
"startCommitSha": "71a4e53e47ad4b6b20e6ddb13e493c669c4d631d",
"headCommitSha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"newPath": "README.md",
"oldPath": "README.md",
"filePath": "README.md",
"pathCrc": 160655574,
"startLeftLineNum": null,
"startRightLineNum": null,
"startSelectNum": null,
"endSelectNum": null,
"createdAt": "2022-11-02T06:50:39+0000",
"updatedAt": "2022-11-02T06:50:39+0000",
"added": true,
"newLineType": true,
"unchangedLineType": false,
"unchanged": false,
"oldLineType": false,
"removed": false
}
},
"first_note_labels": [],
"comments": [{
"comment": 1,
"created_at": "2019-08-14T13:39:49+0000",
"author": {
"id": 80899,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
}
}]
}
# 查询合并请求的评论列表
在项目内查询某个指定合并请求的评论列表
GET /api/v3/projects/:id/merge_requests/:merge_request_id/notes
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| merge_request_id | integer | 合并请求 id |
| page | integer | 分页(默认值:1) |
| per_page | integer | 默认页面大小(默认值: 20,最大值: 100) |
| system | boolean(可选) | 是否仅需要系统评论(全部评论:null,仅系统评论:true,仅非系统评论:false。默认全部评论) |
| sort | string(可选) | 结果排序(按创建时间正序:created_asc,按创建时间逆序:created_desc。默认created_desc) |
| resolve_states | number[](可选) | 解决状态,0 : "default"(默认)1 : "unresolved"(未解决)2 : "resolved"(已解决)。默认为null全部状态。 |
返回值:
[
{
"id": 16545,
"parent_id": null,
"body": "milestone removed",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-20T10:17:05+0000",
"system": true,
"risk": 0,
"resolve_state": 0,
"line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_2_1",
"commit_id": null,
"file_path": "README.md",
"note_position": {
"origin_position": {
"note_id": 1994887,
"left_line_num": null,
"right_line_num": 1,
"base_commit_sha": "4005aa9208694462804d22ed314127afda8e3098",
"start_commit_sha": "71a4e53e47ad4b6b20e6ddb13e493c669c4d631d",
"head_commit_sha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"new_path": "README.md",
"old_path": "README.md"
},
"outdate_position": null,
"latest_position": {
"note_id": 1994887,
"left_line_num": null,
"right_line_num": 1,
"base_commit_sha": "4005aa9208694462804d22ed314127afda8e3098",
"start_commit_sha": "71a4e53e47ad4b6b20e6ddb13e493c669c4d631d",
"head_commit_sha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"new_path": "README.md",
"old_path": "README.md"
}
},
"comments": [{
"comment": 1,
"created_at": "2019-08-14T13:39:49+0000",
"author": {
"id": 80899,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
}
}]
}
]
# 查询代码评审的单个评论
在项目内查看某个指定代码评审的指定评论
GET /api/v3/projects/:id/reviews/:review_id/notes/:note_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| review_id | integer | 代码评审 id |
| note_id | integer | 评论 id |
返回值:
{
"id": 323561,
"parent_id": null,
"body": "new",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-04-25T12:07:41+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": null,
"file_path": null,
"note_position": null,
"comments": []
}
# 查询代码评审的评论
在项目内获取某个指定代码评审的评论
GET /api/v3/projects/:id/reviews/:review_id/notes
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| review_id | integer | 代码评审的 id |
| page | integer | 分页(默认值:1) |
| per_page | integer | 默认页面大小(默认值: 20,最大值: 100) |
返回值:
[
{
"id": 167754,
"parent_id": null,
"body": "milestone removed",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-20T10:17:05+0000",
"system": true,
"risk": 0,
"resolve_state": 1,
"line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_2_1",
"file_path": "README.md",
"note_position": {
"origin_position": {
"note_id": 1996909,
"left_line_num": null,
"right_line_num": 1,
"base_commit_sha": "18a1709bbb3d2cbf68ea1de5af12404582d704ec",
"start_commit_sha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"head_commit_sha": "18a1709bbb3d2cbf68ea1de5af12404582d704ec",
"new_path": "README.md",
"old_path": "README.md"
},
"outdate_position": null,
"latest_position": {
"note_id": 1996909,
"left_line_num": null,
"right_line_num": 1,
"base_commit_sha": "18a1709bbb3d2cbf68ea1de5af12404582d704ec",
"start_commit_sha": "98886e92114d016d01c8d2b669b6affbaae8d1f1",
"head_commit_sha": "18a1709bbb3d2cbf68ea1de5af12404582d704ec",
"new_path": "README.md",
"old_path": "README.md"
}
},
"comments": [{
"comment": 1,
"created_at": "2019-08-14T13:39:44+0000",
"author": {
"id": 80899,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
}
}]
},
{
"id": 167755,
"parent_id": null,
"body": "这里要改一下",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-20T10:17:05+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": null,
"file_path": null,
"note_position": null,
"comments": []
}
]
# 创建代码评审的评论
在项目内给某个指定代码评审新增评论
POST /api/v3/projects/:id/reviews/:review_id/notes
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| review_id | integer | 代码评审 id |
| body | string | 评论的内容 |
| path | string(可选) | 文件路径 |
| line | string(可选) | 行号 |
| line_type | string(可选) | 变更类型(对代码行评论时必填),可选old、new |
| risk | string(可选) | 严重程度 可选值 0、1、2、3 0 : "default"(默认)1 : "slight"(轻微) 2 : "normal"(一般)3 : "serious"(严重) |
| resolve_state | string(可选) | 需解决 可选值 0、1、2 0 : "default"(默认) 1 : "unresolved"(未解决) 2 : "resolved"(已解决) |
| label_ids | integer(可选) | 评审问题分类的标签 id ,支持添加多个参数 |
| is_person_note | boolean (可选) | 值为 true 的时,该评论记录至 comments tab false(默认值)的时,只进入 conversation tab |
| notify_enabled | boolean(可选) | 默认值为 true,发通知给相关用户 |
返回值:
{
"id": 1673429,
"parent_id": null,
"body": "评论",
"attachment": null,
"author": {
"id": 0001,
"username": "git_user01",
"web_url": "https://git.tencent.com/u/git_user01",
"name": "git_user01",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
},
"created_at": "2019-04-19T09:58:21+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": null,
"file_path": null,
"note_position": null
}
# 编辑代码评审的评论
在项目内编辑某个指定代码评审的指定评论
PUT /api/v3/projects/:id/reviews/:review_id/notes/:note_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| review_id | integer | 代码评审 id |
| note_id | integer | 评论 id |
| body | string | 评论的内容 |
| risk | string(可选) | 严重程度 可选值 0、1、2、3 0 : "default"(默认)1 : "slight"(轻微) 2 : "normal"(一般)3 : "serious"(严重) |
| resolve_state | string(可选) | 需解决 可选值 0、1、2 0 : "default"(默认) 1 : "unresolved"(未解决) 2 : "resolved"(已解决) |
| label_ids | integer(可选) | 评审问题分类的标签 id ,支持添加多个参数 |
返回值:
{
"id": 1673431,
"parent_id": null,
"body": "修改第一次评论",
"attachment": null,
"author": {
"id": 0001,
"username": "git_user01",
"web_url": "https://git.tencent.com/u/git_user01",
"name": "git_user01",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
},
"created_at": "2019-04-19T10:03:15+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": null,
"file_path": null,
"note_position": null,
"comments": []
}
# 回复代码评审的评论
在项目中回复某代码评审中的评论 回复的评论必须是评论在代码行上的第一条评论,不支持回复已经是回复的评论
POST /api/v3/projects/:id/reviews/:review_id/notes/:note_id/replies
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| review_id | integer | 代码评审 id |
| note_id | integer | 需要回复的评论 id |
| body | string | 评论的内容 |
| notify_enabled | boolean(可选) | 默认值为 true,发通知给相关用户 |
返回值:
{
"id": 12607548,
"parent_id": 12607540,
"body": "replyToNote33",
"attachment": null,
"author": {
"id": 70664,
"username": "xxxx",
"web_url": "xxxxx",
"name": "xxxxxx",
"state": "active",
"avatar_url": "xxxx"
},
"created_at": "2020-12-07T08:02:13+0000",
"system": false,
"line_code": "8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_13_15",
"file_path": "README.md"
}
# 置顶代码评审的评论
在项目中置顶某代码评审中的评论 一个代码评审中只能有一条评论被置顶
PUT /api/v3/projects/:id/reviews/:review_id/notes/:note_id/pin
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| review_id | integer | 代码评审 id |
| note_id | integer | 需要回复的评论 id |
| pinned | boolean(可选) | true:置顶,false:取消置顶。默认值为 true |
返回值:
200 或状态码
# 创建项目的议题评论
在项目内给某个指定的议题新增评论
POST /api/v3/projects/:id/issues/:issue_id/notes
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| issue_id | integer | 议题 id |
| body | string | 评论的内容 |
返回值:
{
"id": 25546,
"parent_id": null,
"body": "请尽快处理",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-22T06:43:36+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": null,
"file_path": null,
"note_position": null,
"upvote": false,
"downvote": false
}
# 修改项目的议题评论
修改项目内某个指定议题的指定评论
PUT /api/v3/projects/:id/issues/:issue_id/notes/:note_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| issue_id | integer | 议题 id |
| note_id | integer | 评论 id |
| body | string | 评论 内容 |
返回值:
{
"id": 25642,
"parent_id": null,
"body": "已经修复待验证",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-20T07:13:22+0000",
"system": true,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": null,
"file_path": null,
"note_position": null,
"comments": [],
"upvote": false,
"downvote": false
}
# 获取议题评论列表
查询项目的某个议题的评论列表
GET /api/v3/projects/:id/issues/:issue_id/notes
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| issue_id | integer | 议题 id |
| page | integer | 分页(默认值:1) |
| per_page | integer | 默认页面大小(默认值: 20,最大值: 100) |
返回值:
[
{
"id": 2,
"parent_id": null,
"body": "note1",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-20T07:13:22+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": "",
"file_path": null,
"note_position": null,
"comments": [],
"upvote": false,
"downvote": false
}
]
# 查询单个议题的评论
在项目内查询某个指定的议题的指定评论
GET /api/v3/projects/:id/issues/:issue_id/notes/:note_id
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| issue_id | integer | 议题 id |
| note_id | integer | 评论 id |
返回值:
{
"id": 25644,
"parent_id": null,
"body": "note1",
"attachment": null,
"author": {
"id": 11323,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "git.tencent.com/uploads/user/avatar/11323/a75ba2738c7a409cab1d15dd993149aa.jpg"
},
"created_at": "2015-03-20T07:13:22+0000",
"system": false,
"risk": 0,
"resolve_state": 0,
"line_code": null,
"commit_id": null,
"file_path": "README.md",
"comments": [
{
"comment": 2,
"created_at": "2019-07-31T09:48:54+0000",
"author": {
"id": 0001,
"username": "git_user1",
"web_url": "https://git.tencent.com/u/git_user1",
"name": "git_user1",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
}
}
],
"upvote": false,
"downvote": false
}
# 查询项目的 Review, Merge Request 评论列表
查询项目的某个时间区间的评论列表,时间为 0 时区时间
GET /api/v3/projects/:id/notes
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer or string | 项目 ID 或 项目全路径 project_full_path |
| begin_date | yyyy-MM-dd'T'HH:mm:ssZ | 评论的更新时间,查询的开始时间;例如 2019-03-25T00:10:19+0000 或 2019-03-25T00:10:19+0800,时间参数必须转码,如“2019-03-25T00:10:19%2B0800” |
| end_date | yyyy-MM-dd'T'HH:mm:ssZ | 评论的更新时间,查询的结束时间;例如 2019-03-25T00:10:19+0000 或 2019-03-25T00:10:19+0800,时间参数必须转码,如“2019-03-25T00:10:19%2B0800”, 结束时间必须大于开始时间 |
| start | integer | 起始位置,从 0 开始 |
| size | integer | 获取的评论数量(默认值: 20,最大值: 1000) |
返回值:
{
"total": 1,
"notes": [{
"id": 8805918,
"parent_id": null,
"body": "??1",
"attachment": null,
"author": {
"id": 838,
"username": "lusiferli",
"web_url": "https://git.tencent.com/u/lusiferli",
"name": "lusiferli",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
},
"created_at": "2020-03-10T04:04:28+0000",
"system": false,
"line_code": "f186088047aec0bd665cb2da9f649cc0643e73c3_0_21",
"file_path": "js/weakdialog/weekdialog.js",
"comments": [{
"comment": 2,
"created_at": "2020-03-10T04:04:33+0000",
"author": {
"id": 838,
"username": "lusiferli",
"web_url": "https://git.tencent.com/u/lusiferli",
"name": "lusiferli",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
}
},
{
"comment": 3,
"created_at": "2020-03-10T04:04:37+0000",
"author": {
"id": 838,
"username": "lusiferli",
"web_url": "https://git.tencent.com/u/lusiferli",
"name": "lusiferli",
"state": "active",
"avatar_url": "https://git.tencent.com/assets/images/avatar/no_user_avatar.png"
}
}
]
}]
}