Closed
feat(discussions): 支持 获取项目讨论详情 API #468
aflyingtoAdd on Jul 13Closed at Aug 8
aflyingto
Aug 8 Comments:
Aug 8 Comments:
验证记录见 #467 评论(gc-api-doc 确认两端点 + 字段与组织讨论一致可复用 Discussion 结构)。与 #467 同片交付。


验证记录见 #467 评论(gc-api-doc 确认两端点 + 字段与组织讨论一致可复用 Discussion 结构)。与 #467 同片交付。


背景
GitCode API 文档已提供 Discussions 页面相关 API,但 gitcode-cli 当前尚未适配。该 Issue 用于跟踪 CLI 对此接口的需求、设计与实现。
API 摘要
GET/api/v5/repos/{owner}/{repo}/discuss/{number}get_api_v5_repos_{owner}_{repo}_discuss_{number}Repositories,RepositoriesfalseRequest Parameters
ownerreponumberaccess_tokenRequest Body
无。
Responses
200
application/jsonapplication/json schema
{ "type": "object", "properties": { "id": { "type": "string" }, "number": { "type": "integer" }, "title": { "type": "string" }, "md_content": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "author": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "id": { "type": "string" }, "object_id": { "type": "string" }, "login": { "type": "string" }, "name": { "type": "string" } }, "required": [ "avatar_url", "id", "object_id", "login", "name" ] }, "is_lock": { "type": "integer", "description": "是否锁定" }, "is_pin": { "type": "integer", "description": "是否置顶" }, "is_category_pin": { "type": "integer", "description": "是否类型下置顶" }, "is_closed": { "type": "integer", "description": "是否关闭" }, "is_answered": { "type": "integer", "description": "是否采纳答案" }, "comment_total": { "type": "integer", "description": "评论总数" }, "category": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "icon": { "type": "string" }, "description": { "type": "string" }, "type": { "type": "integer" } }, "required": [ "id", "name", "icon", "description", "type" ] }, "vote": { "type": "object", "properties": { "id": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "question": { "type": "string", "description": "投票内容" }, "vote_total": { "type": "integer", "description": "投票总数" }, "real_name": { "type": "boolean", "description": "是否实名" }, "creator_view_real_name": { "type": "boolean", "description": "创建者是否可以查看实名投票 0否,1是" }, "modify_vote_times": { "type": "integer", "description": "可修改的投票次数" }, "designated_voter": { "type": "boolean", "description": "是否指定投票人 0否,1是" }, "current_user_is_designated_voter": { "type": "boolean", "description": "当前用户是否是指定投票人" }, "designated_voter_size": { "type": "integer", "description": "指定投票人数量" }, "no_vote_user_size": { "type": "integer", "description": "未投票人数量" } }, "required": [ "id", "created_at", "updated_at", "question", "vote_total", "real_name", "creator_view_real_name", "modify_vote_times", "designated_voter", "current_user_is_designated_voter", "designated_voter_size", "no_vote_user_size" ], "description": "投票类型返回,投票信息" }, "vote_options": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "vote_option": { "type": "string", "description": "投票选项" }, "option_order": { "type": "integer", "description": "投票选项排序" }, "vote_total": { "type": "integer", "description": "此选项投票数" }, "vote_total_percent": { "type": "integer", "description": "此选项投票数百分比" }, "vote_id": { "type": "string" }, "vote_users": { "type": "array", "items": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "id": { "type": "string" }, "object_id": { "type": "string" }, "login": { "type": "string" }, "name": { "type": "string" } } }, "description": "投票用户" } }, "required": [ "id", "created_at", "updated_at", "vote_option", "option_order", "vote_total", "vote_total_percent", "vote_id" ] }, "description": "投票类型返回 选项信息" }, "labels": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "color": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "name", "color", "created_at", "updated_at" ] }, "description": "标签" } }, "required": [ "id", "number", "title", "md_content", "created_at", "updated_at", "author", "is_lock", "is_pin", "is_category_pin", "is_closed", "is_answered", "comment_total", "category", "vote", "vote_options" ] }原始 OpenAPI Operation
{ "deprecated": false, "description": "", "operationId": "get_api_v5_repos_{owner}_{repo}_discuss_{number}", "tags": [ "Repositories", "Repositories" ], "parameters": [ { "name": "owner", "in": "path", "description": "仓库所属空间地址(企业、组织或个人的地址path)", "required": true, "example": "", "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "仓库路径(path)", "required": true, "example": "", "schema": { "type": "string" } }, { "name": "number", "in": "path", "description": "讨论的编号", "required": true, "schema": { "type": "string" } }, { "name": "access_token", "in": "query", "description": "用户授权码", "required": false, "example": "", "schema": { "type": "string" } } ], "responses": { "200": { "description": "成功响应", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "number": { "type": "integer" }, "title": { "type": "string" }, "md_content": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "author": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "id": { "type": "string" }, "object_id": { "type": "string" }, "login": { "type": "string" }, "name": { "type": "string" } }, "required": [ "avatar_url", "id", "object_id", "login", "name" ] }, "is_lock": { "type": "integer", "description": "是否锁定" }, "is_pin": { "type": "integer", "description": "是否置顶" }, "is_category_pin": { "type": "integer", "description": "是否类型下置顶" }, "is_closed": { "type": "integer", "description": "是否关闭" }, "is_answered": { "type": "integer", "description": "是否采纳答案" }, "comment_total": { "type": "integer", "description": "评论总数" }, "category": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "icon": { "type": "string" }, "description": { "type": "string" }, "type": { "type": "integer" } }, "required": [ "id", "name", "icon", "description", "type" ] }, "vote": { "type": "object", "properties": { "id": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "question": { "type": "string", "description": "投票内容" }, "vote_total": { "type": "integer", "description": "投票总数" }, "real_name": { "type": "boolean", "description": "是否实名" }, "creator_view_real_name": { "type": "boolean", "description": "创建者是否可以查看实名投票 0否,1是" }, "modify_vote_times": { "type": "integer", "description": "可修改的投票次数" }, "designated_voter": { "type": "boolean", "description": "是否指定投票人 0否,1是" }, "current_user_is_designated_voter": { "type": "boolean", "description": "当前用户是否是指定投票人" }, "designated_voter_size": { "type": "integer", "description": "指定投票人数量" }, "no_vote_user_size": { "type": "integer", "description": "未投票人数量" } }, "required": [ "id", "created_at", "updated_at", "question", "vote_total", "real_name", "creator_view_real_name", "modify_vote_times", "designated_voter", "current_user_is_designated_voter", "designated_voter_size", "no_vote_user_size" ], "description": "投票类型返回,投票信息" }, "vote_options": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "vote_option": { "type": "string", "description": "投票选项" }, "option_order": { "type": "integer", "description": "投票选项排序" }, "vote_total": { "type": "integer", "description": "此选项投票数" }, "vote_total_percent": { "type": "integer", "description": "此选项投票数百分比" }, "vote_id": { "type": "string" }, "vote_users": { "type": "array", "items": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "id": { "type": "string" }, "object_id": { "type": "string" }, "login": { "type": "string" }, "name": { "type": "string" } } }, "description": "投票用户" } }, "required": [ "id", "created_at", "updated_at", "vote_option", "option_order", "vote_total", "vote_total_percent", "vote_id" ] }, "description": "投票类型返回 选项信息" }, "labels": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "color": { "type": "string" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "name", "color", "created_at", "updated_at" ] }, "description": "标签" } }, "required": [ "id", "number", "title", "md_content", "created_at", "updated_at", "author", "is_lock", "is_pin", "is_category_pin", "is_closed", "is_answered", "comment_total", "category", "vote", "vote_options" ] } } }, "headers": {} } }, "security": [], "method": "get", "path": "/api/v5/repos/{owner}/{repo}/discuss/{number}", "servers": [ { "url": "https://api.gitcode.com", "description": "正式环境" } ], "securitySchemes": {}, "info": { "title": "GicodeOpenAPI", "description": "", "version": "1.0.0" }, "postman": { "name": "获取项目讨论详情", "description": { "content": "", "type": "text/plain" }, "url": { "path": [ "api", "v5", "repos", ":owner", ":repo", "discuss", ":number" ], "host": [ "{{baseUrl}}" ], "query": [ { "disabled": false, "description": { "content": "用户授权码", "type": "text/plain" }, "key": "access_token", "value": "" } ], "variable": [ { "disabled": false, "description": { "content": "(Required) 仓库所属空间地址(企业、组织或个人的地址path)", "type": "text/plain" }, "type": "any", "value": "", "key": "owner" }, { "disabled": false, "description": { "content": "(Required) 仓库路径(path)", "type": "text/plain" }, "type": "any", "value": "", "key": "repo" }, { "disabled": false, "description": { "content": "(Required) 讨论的编号", "type": "text/plain" }, "type": "any", "value": "", "key": "number" } ] }, "header": [ { "key": "Accept", "value": "application/json" } ], "method": "GET" } }初步验收建议
infra-test/*仓库。access_token仅作为 API 参数记录,CLI 优先复用现有认证机制。