跳转至

修改检视意见解决状态

PUT /api/v5/repos/{owner}/{repo}/pulls/{number}/comments/{discussion_id}

该接口用于修改指定 Pull Request 中检视意见(评论/讨论)的解决状态,通过请求体中的 resolved 字段设置该检视意见是否已解决。

访问令牌支持说明

  • AtomGit 用户访问令牌(AtomGit user access tokens)

是否允许匿名访问

此接口允许匿名访问

请求参数

参数名 位置 类型 必填 说明
owner path string 是 仓库所属空间地址(企业、组织或个人的地址 path)
repo path string 是 仓库路径(path)
number path integer 是 第几个 PR,即本仓库 PR 的序数,对应 iid
discussion_id path string 是 讨论的 ID(字符串类型 id)

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "resolved": {
      "description": "是否已解决",
      "type": "boolean"
    }
  },
  "required": ["resolved"]
}

响应参数

该接口响应体为空(200 OK,无响应体内容)。

失败响应

该接口无业务失败响应。如请求体格式错误或访问凭证无效,将返回对应的 HTTP 状态码(如 400 / 401),错误字段名以后端实际返回为准。

HTTP 响应状态码

状态码 说明
200 成功(OK)
304 未修改(Not modified)
401 需要认证(Requires authentication)
403 禁止访问(Forbidden)

请求示例

参数说明

示例中 <owner> 替换为仓库所属空间地址(企业、组织或个人的地址 path);<repo> 替换为仓库路径;<number> 替换为 PR 序数(iid);<discussion_id> 替换为讨论的 ID。该接口允许匿名访问,可不携带访问令牌(也可携带 AtomGit 用户访问令牌)。

cURL

curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/comments/<discussion_id>' \
  -H 'Content-Type: application/json' \
  -d '{"resolved": true}'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/comments/<discussion_id>", {
  method: "PUT",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ resolved: true }),
});

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

Python

import requests

resp = requests.put(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/comments/<discussion_id>",
    json={"resolved": True},
    timeout=10,
)
resp.raise_for_status()

响应示例

状态码: 200

{}

错误码

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

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