跳转至

获取issue评论的修改历史

GET /api/v5/repos/{owner}/{repo}/issues/comment/{comment_id}/modify_history

该接口用于获取指定 issue 评论的修改历史记录,返回包含修改时间、修改后内容以及操作用户与被修改用户信息的历史记录数组。

访问令牌支持说明

  • 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

失败响应

该接口为公开只读接口,主要失败场景为路径参数错误或目标资源不存在。

404 资源不存在

{
  "error": "not_found",
  "message": "issue comment not found"
}

(错误字段名以后端实际返回为准。)

HTTP 响应状态码

状态码 说明
200 成功(OK)
404 请求的资源不存在
401 需要认证(Requires authentication)
429 请求过于频繁,触发限流
500 系统内部错误

请求示例

参数说明

<owner> 替换为仓库所属空间地址(组织或个人的地址 path); <repo> 替换为仓库路径(path); <comment_id> 替换为评论的 id; <token> 替换为你的 AtomGit 用户访问令牌(可选,允许匿名访问时可不携带)。

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/issues/comment/<comment_id>/modify_history?access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const owner = "<owner>";
const repo = "<repo>";
const commentId = "<comment_id>";
const token = "<token>"; // 可选,允许匿名访问时可省略

const url = `https://api.atomgit.com/api/v5/repos/${owner}/${repo}/issues/comment/${commentId}/modify_history${
  token ? `?access_token=${token}` : ""
}`;

const response = await fetch(url, {
  headers: {
    "Accept": "application/json",
  },
});

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

owner = "<owner>"
repo = "<repo>"
comment_id = "<comment_id>"
token = "<token>"  # 可选,允许匿名访问时可省略

params = {}
if token:
    params["access_token"] = token

resp = requests.get(
    f"https://api.atomgit.com/api/v5/repos/{owner}/{repo}/issues/comment/{comment_id}/modify_history",
    params=params,
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

响应示例

状态码: 200

[
  {
    "id": "string",
    "created_at": "string",
    "updated_at": "string",
    "deleted": true,
    "created": true,
    "content": "string",
    "user": {
      "login": "octocat",
      "name": "Octo Cat",
      "avatar_url": "https://api.atomgit.com/avatar.png",
      "object_id": "string"
    },
    "updated_user": {
      "login": "octocat",
      "name": "Octo Cat",
      "avatar_url": "https://api.atomgit.com/avatar.png",
      "object_id": "string"
    }
  }
]

错误码

错误码 说明
401 未认证或凭证无效(缺少/无效的访问凭证)
400 参数错误或请求无法解析
404 请求路径不存在
405 请求方法不支持
429 请求过于频繁,触发限流
500 系统内部错误

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc