获取Pull Request评论的修改历史¶
GET /api/v5/repos/{owner}/{repo}/pulls/comment/{comment_id}/modify_history
该接口用于获取指定仓库中Pull Request评论的修改历史。通过这个接口,用户可以查看评论在创建及历次修改过程中产生的记录,包括修改时间、修改后的内容、评论用户与修改用户等信息。
访问令牌支持说明¶
- AtomGit 用户访问令牌(AtomGit user access tokens)
是否允许匿名访问¶
此接口不允许匿名访问
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
owner |
path | string | 是 | 仓库所属空间地址(企业、组织或个人的地址path) |
repo |
path | string | 是 | 仓库路径(path) |
comment_id |
path | string | 是 | 评论的id |
access_token |
query | string | 是 | 用户授权码 |
响应参数¶
响应为一个数组,数组元素是修改历史记录对象。
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
id |
string | 是 | 否 | 修改记录id |
created_at |
string | 是 | 否 | 创建时间 |
updated_at |
string | 是 | 否 | 修改时间 |
deleted |
boolean | 是 | 否 | 是否已删除 |
created |
boolean | 是 | 否 | 是否是创建 |
content |
string | 是 | 否 | 修改后的内容 |
user |
object | 是 | 否 | 评论用户信息 |
updated_user |
object | 是 | 否 | 修改用户信息 |
user 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
user.login |
string | 是 | 否 | 登录名 |
user.name |
string | 是 | 否 | 姓名 |
user.avatar_url |
string | 是 | 否 | 头像地址 |
user.object_id |
string | 是 | 否 | 用户对象id |
updated_user 对象
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
updated_user.login |
string | 是 | 否 | 登录名 |
updated_user.name |
string | 是 | 否 | 姓名 |
updated_user.avatar_url |
string | 是 | 否 | 头像地址 |
updated_user.object_id |
string | 是 | 否 | 用户对象id |
失败响应¶
400 参数错误
401 未认证
HTTP 响应状态码¶
| 状态码 | 说明 |
|---|---|
200 |
成功(OK) |
401 |
需要认证(Requires authentication) |
403 |
禁止访问(Forbidden) |
404 |
资源不存在(Not found) |
请求示例¶
参数说明¶
示例中的占位符说明:
<owner>— 替换为仓库所属空间地址(企业、组织或个人的地址path);<repo>— 替换为仓库路径(path);<comment_id>— 替换为评论的id;<token>— 替换为你的 AtomGit 用户访问令牌。
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/comment/<comment_id>/modify_history?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/comment/<comment_id>/modify_history?access_token=<token>", {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
throw new Error(`请求失败: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/comment/<comment_id>/modify_history",
params={"access_token": "<token>"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
响应示例¶
状态码: 200
[
{
"id": "1",
"created_at": "2024-01-01 10:00:00",
"updated_at": "2024-01-02 12:00:00",
"deleted": false,
"created": true,
"content": "修改后的评论内容",
"user": {
"login": "octocat",
"name": "octocat",
"avatar_url": "https://api.atomgit.com/avatar.png",
"object_id": "1001"
},
"updated_user": {
"login": "octocat",
"name": "octocat",
"avatar_url": "https://api.atomgit.com/avatar.png",
"object_id": "1001"
}
}
]
错误码¶
| 错误码 | 说明 |
|---|---|
401 |
未认证或凭证无效(缺少/无效的访问凭证) |
400 |
参数错误或请求无法解析 |
404 |
请求路径不存在 |
403 |
禁止访问 |
429 |
请求过于频繁,触发限流 |
500 |
系统内部错误 |
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc