外观
Issue
约 4440 字大约 15 分钟
2025-08-01
@candriajs/git-neko-kit / github / Issue
类: Issue
定义于: models/platform/github/issue.ts:78
GitHub Issue 处理类,提供Issue相关操作功能
提供完整的GitHub Issue管理,包括:
- 获取Issue列表
- 获取Issue详情
- 创建/更新/关闭/打开/锁定/解锁Issue
- 获取仓库评论列表
- 获取/创建/更新/删除Issue评论
- 管理子Issue
备注
每个拉取请求都是一个议题,但并非每个议题都是拉取请求。
继承
构造函数
构造函数
new Issue(
base
):Issue
定义于: models/platform/github/issue.ts:79
参数
base
返回
Issue
重写了
属性
api_url
api_url:
string
定义于: models/platform/github/client.ts:79
继承自
app
app:
App
定义于: models/platform/github/client.ts:67
继承自
auth
auth:
Auth
定义于: models/platform/github/client.ts:68
继承自
base_url
base_url:
string
定义于: models/platform/github/client.ts:78
继承自
Client_ID?
readonly
optional
Client_ID:null
|string
定义于: models/platform/github/client.ts:83
继承自
Client_Secret?
readonly
optional
Client_Secret:null
|string
定义于: models/platform/github/client.ts:84
继承自
commit
commit:
Commit
定义于: models/platform/github/client.ts:69
继承自
format
readonly
format:boolean
定义于: models/platform/github/client.ts:86
继承自
issue
issue:
Issue
定义于: models/platform/github/client.ts:73
继承自
jwtToken
jwtToken:
string
定义于: models/platform/github/client.ts:80
继承自
org
org:
Org
定义于: models/platform/github/client.ts:74
继承自
Private_Key?
readonly
optional
Private_Key:null
|string
定义于: models/platform/github/client.ts:82
继承自
pull_request
pull_request:
Pull_Request
定义于: models/platform/github/client.ts:75
继承自
repo
repo:
Repo
定义于: models/platform/github/client.ts:70
继承自
search
search:
Search
定义于: models/platform/github/client.ts:77
继承自
user
user:
User
定义于: models/platform/github/client.ts:71
继承自
userToken?
optional
userToken:null
|string
定义于: models/platform/github/client.ts:81
继承自
webhook
webhook:
WebHook
定义于: models/platform/github/client.ts:72
继承自
WebHook_Secret?
readonly
optional
WebHook_Secret:null
|string
定义于: models/platform/github/client.ts:85
继承自
workflow
workflow:
Workflow
定义于: models/platform/github/client.ts:76
继承自
访问器
is_app_client
Getter 签名
get is_app_client():
boolean
定义于: models/platform/github/client.ts:130
是否是App客户端
示例
const isAppClient = await client.is_app_client
-> true
返回
boolean
是否是App客户端
继承自
type
Getter 签名
get type():
GitType
定义于: models/platform/github/client.ts:117
获取Git平台类型
示例
const type = await client.type
-> 'github'
返回
Git平台类型,如: github,gitee
继承自
方法
add_sub_issue()
add_sub_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:1901
添加子议题 添加一个子议题到指定的议题中
参数
options
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
Github
仅GitHub 平台使用
已被弃用
已弃用,请使用create_sub_issue
方法
close_issue()
close_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:895
关闭一个议题 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
关闭Issue的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
- state_reason 关闭原因
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
包含Issue信息的响应对象
示例
const res = await issue.close_issue({ owner: 'owner', repo:'repo', issue_number:1, state_reason:'completed' })
-> 关闭议题信息对象
create_issue()
create_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:387
创建一个议题 权限:
- Issues: Write
参数
options
发送Issue的参数对象
- owner 仓库拥有者
- repo 仓库名称
- title 标题
- body 内容
- assignee 指派人
- milestone 里程碑
- labels 标签列表
- type 问题类型
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
包含Issue信息的响应对象
示例
const res = await issue.create_issue({ owner: 'owner', repo:'repo', title:'title', body:'body' })
-> 创建议题信息对象
create_issue_comment()
create_issue_comment(
options
):Promise
<ApiResponseType
<IssueCommentInfoResponseType
>>
定义于: models/platform/github/issue.ts:1405
创建一个议题评论 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
创建Issue评论的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
- body 评论内容
返回
Promise
<ApiResponseType
<IssueCommentInfoResponseType
>>
创建的Issue评论信息
示例
const issue = get_issue() // 获取issue实例
const res = await issue.create_issue_comment({ owner: 'owner', repo:'repo', issue_number:1, body:'comment' })
-> 创建议题评论对象
create_sub_issue()
create_sub_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:1758
创建子议题 添加一个子议题到指定的议题中
参数
options
添加子议题的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number 父议题编号
- sub_issue_id 子议题编号
- replace_parent 是否替换父议题
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
添加结果信息
Github
仅GitHub 平台使用 权限:
- Issues:Write
示例
const res = await issue.add_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1, replace_parent:true })
-> 创建子议题信息对象
delete()
delete(
path
,params
,data?
,customHeaders?
):Promise
<ApiResponseType
<any
>>
定义于: models/platform/github/client.ts:602
Github DELETE 请求方法
参数
path
string
请求路径
params
URL查询参数
null
| Record
<string
, string
>
data?
any
请求体数据
customHeaders?
Record
<string
, string
>
请求头,选项
返回
Promise
<ApiResponseType
<any
>>
请求结果
继承自
delete_issue_comment()
delete_issue_comment(
options
):Promise
<ApiResponseType
<RemoveIssueCommentResponseType
>>
定义于: models/platform/github/issue.ts:1597
删除议题评论信息 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
返回
Promise
<ApiResponseType
<RemoveIssueCommentResponseType
>>
已被弃用
请使用 remove_issue_comment 方法代替
delete_sub_issue()
delete_sub_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:2067
删除子议题 删除一个子议题 权限:
- Issues:Write
参数
options
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
已被弃用
请使用 remove_sub_issue 方法代替
get()
get(
path
,parms?
,customHeaders?
):Promise
<ApiResponseType
<any
>>
定义于: models/platform/github/client.ts:455
Github GET 请求方法
参数
path
string
请求路径
parms?
any
请求参数
customHeaders?
Record
<string
, string
>
请求头,选项
返回
Promise
<ApiResponseType
<any
>>
请求结果
继承自
get_app()
get_app():
Promise
<App
>
定义于: models/platform/github/client.ts:177
获取App实例
返回
Promise
<App
>
App实例
示例
const app = await GitHubClient.get_app()
继承自
get_auth()
get_auth():
Promise
<Auth
>
定义于: models/platform/github/client.ts:191
获取Auth实例
返回
Promise
<Auth
>
Auth实例
示例
const auth = await GitHubClient.get_auth()
继承自
get_commit()
get_commit():
Promise
<Commit
>
定义于: models/platform/github/client.ts:205
获取Commit实例
返回
Promise
<Commit
>
Commit实例
示例
const commit = await GitHubClient.get_commit()
继承自
get_issue()
get_issue():
Promise
<Issue
>
定义于: models/platform/github/client.ts:219
获取Issue实例
返回
Promise
<Issue
>
Issue实例
示例
const issue = await GitHubClient.get_issue()
继承自
get_issue_comment_info()
get_issue_comment_info(
options
):Promise
<ApiResponseType
<IssueCommentInfoResponseType
>>
定义于: models/platform/github/issue.ts:1335
获取议题评论信息 权限:
- Issues: Read-only
- Pull requests: Read-only 需以上权限之一
参数
options
获取Issue评论信息的参数对象
- owner 仓库拥有者
- repo 仓库名称
- comment_id 评论ID
返回
Promise
<ApiResponseType
<IssueCommentInfoResponseType
>>
Issue评论信息
示例
const res = await issue.get_issue_comment({ owner: 'owner', repo:'repo', comment_id:1 })
-> 议题评论对象
get_issue_comments_list()
get_issue_comments_list(
options
):Promise
<ApiResponseType
<IssueCommentsListResponseType
>>
定义于: models/platform/github/issue.ts:1260
获取一个议题下的评论列表 权限:
- Issues: Read-only
- Pull requests: Read-only 需以上权限之一
参数
options
获取Issue评论列表的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
- since 评论时间
- per_page 每页评论数量
- page 页码
返回
Promise
<ApiResponseType
<IssueCommentsListResponseType
>>
包含Issue评论列表的响应对象
示例
const res = await issue.get_issue_comments_list({ owner: 'owner', repo:'repo', issue_number:1 })
-> 议题评论对象列表
get_issue_info()
get_issue_info(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:101
获取议题详情 权限:
- Issues: Read-only
参数
options
请求参数列表
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
包含Issue信息的响应对象
示例
const res = await issue.get_issue_info({ owner: 'owner', repo:'repo', issue_number:1 })
-> 议题信息对象
get_issues_list()
get_issues_list(
options
):Promise
<ApiResponseType
<IssueListResponseType
>>
定义于: models/platform/github/issue.ts:252
获取仓库的议题列表 权限:
- Issues:Read-only
参数
options
请求参数列表
- owner 仓库拥有者
- repo 仓库名称
- milestones 里程碑ID列表
- state Issue状态,可选 'open' | 'closed' | 'all', 默认为'all'
- labels 标签名称列表
- assignee 指派人用户名
- type 问题类型
- creator 创建者用户名
- mentioned 提及的用户名
- sort 排序方式,可选 'created' | 'updated' | 'comments', 默认为'created'
- direction 排序方向,可选 'asc' | 'desc', 默认为'desc'
- since 筛选此时间之后的问题
- per_page 每页数量,可选,默认为30
- page 页码,可选,默认为1
返回
Promise
<ApiResponseType
<IssueListResponseType
>>
包含Issue列表的响应对象
示例
const res = await issue.get_issue_list({ owner: 'owner', repo: 'repo' })
-> 议题信息对象列表
get_org()
get_org():
Promise
<Org
>
定义于: models/platform/github/client.ts:261
获取Org实例
返回
Promise
<Org
>
Org实例
示例
const org = await GitHubClient.get_org()
继承自
get_pull_request()
get_pull_request():
Promise
<Pull_Request
>
定义于: models/platform/github/client.ts:289
获取Pull_request实例
返回
Promise
<Pull_Request
>
Pull_request实例
示例
const pull_request = await GitHubClient.get_pull_request()
继承自
get_repo()
get_repo():
Promise
<Repo
>
定义于: models/platform/github/client.ts:233
获取Repo实例
返回
Promise
<Repo
>
Repo实例
示例
const repo = await GitHubClient.get_repo()
继承自
get_repo_comments_list()
get_repo_comments_list(
options
):Promise
<ApiResponseType
<RepoCommentsListResponseType
>>
定义于: models/platform/github/issue.ts:1184
获取一个仓库下议题的评论列表 权限:
- Issues: Read-only
- Pull requests: Read-only 需以上权限之一
参数
options
获取Issue评论列表的参数对象
- owner 仓库拥有者
- repo 仓库名称
- sort 排序方式 可选 'created' | 'updated'
- direction 排序方向 可选 'asc' | 'desc',当sort不存在时此参数会被忽略
- since 评论时间
- per_page 每页评论数量
- page 页码
返回
Promise
<ApiResponseType
<RepoCommentsListResponseType
>>
包含Issue评论列表的响应对象
示例
const res = await issue.get_issue_comments_list({ owner: 'owner', repo:'repo', issue_number:1 })
-> 议题评论对象列表
get_search()
get_search():
Promise
<Search
>
定义于: models/platform/github/client.ts:317
获取Search实例
返回
Promise
<Search
>
Search实例
示例
const search = await GitHubClient.get_search()
继承自
get_sub_issue_list()
get_sub_issue_list(
options
):Promise
<ApiResponseType
<SubIssueListResponseType
>>
定义于: models/platform/github/issue.ts:1622
获取子议题列表
参数
options
获取子议题列表的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number 议题编号
返回
Promise
<ApiResponseType
<SubIssueListResponseType
>>
子议题列表
Github
仅GitHub 平台使用 权限:
- Issues: Read-only
- Pull requests: Read-only 需以上权限之一
示例
const res = await issue.get_sub_issue_list({ owner: 'owner', repo:'repo', issue_number:1 })
-> 子议题信息对象列表
get_user()
get_user():
Promise
<User
>
定义于: models/platform/github/client.ts:247
获取User实例
返回
Promise
<User
>
User实例
示例
const user = await GitHubClient.get_user()
继承自
get_webhook()
get_webhook():
Promise
<WebHook
>
定义于: models/platform/github/client.ts:275
获取WebHook实例
返回
Promise
<WebHook
>
WebHook实例
示例
const webhook = await GitHubClient.get_webhook()
继承自
get_workflow()
get_workflow():
Promise
<Workflow
>
定义于: models/platform/github/client.ts:303
获取Workflow实例
返回
Promise
<Workflow
>
Workflow实例
示例
const workflow = await GitHubClient.get_workflow()
继承自
lock_issue()
lock_issue(
options
):Promise
<ApiResponseType
<LockIssueResponseType
>>
定义于: models/platform/github/issue.ts:1052
锁定一个议题
参数
options
锁定Issue的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
- lock_reason 锁定原因 可选 'off-topic' | 'too heated' | 'resolved' | 'spam'
返回
Promise
<ApiResponseType
<LockIssueResponseType
>>
锁定状态信息
Github
仅GitHub平台可用 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
示例
const res = await issue.lock_issue({ owner: 'owner', repo:'repo', issue_number:1, lock_reason:'off-topic' })
-> 锁定议题信息对象
open_issue()
open_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:724
重新打开一个议题 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
打开Issue的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
包含Issue信息的响应对象
示例
const res = await issue.open_issue({ owner: 'owner', repo:'repo', issue_number:1 })
-> 打开议题信息对象
patch()
patch(
path
,params
,data
,customHeaders?
):Promise
<ApiResponseType
<any
>>
定义于: models/platform/github/client.ts:528
Github PATCH 请求方法
参数
path
string
请求路径
params
URL查询参数
null
| Record
<string
, string
>
data
any
请求数据
customHeaders?
Record
<string
, string
>
请求头,选项
返回
Promise
<ApiResponseType
<any
>>
请求结果
继承自
post()
post(
path
,data
,customHeaders?
):Promise
<ApiResponseType
<any
>>
定义于: models/platform/github/client.ts:491
Github POST 请求方法
参数
path
string
请求路径
data
any
请求数据
customHeaders?
Record
<string
, string
>
请求头,选项
返回
Promise
<ApiResponseType
<any
>>
请求结果
继承自
put()
put(
path
,data
,customHeaders?
):Promise
<ApiResponseType
<any
>>
定义于: models/platform/github/client.ts:565
Github PUT 请求方法
参数
path
string
请求路径
data
any
请求数据
customHeaders?
Record
<string
, string
>
请求头,选项
返回
Promise
<ApiResponseType
<any
>>
请求结果
继承自
remove_issue_comment()
remove_issue_comment(
options
):Promise
<ApiResponseType
<RemoveIssueCommentResponseType
>>
定义于: models/platform/github/issue.ts:1550
删除议题评论信息 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
删除Issue评论信息的参数对象
- owner 仓库拥有者
- repo 仓库名称
- comment_id 评论ID
返回
Promise
<ApiResponseType
<RemoveIssueCommentResponseType
>>
删除结果信息
示例
const res = awaitissue.remove_issue_comment()
-> 删除议题评论对象
remove_sub_issue()
remove_sub_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:1925
删除子议题
参数
options
删除子议题的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number 父议题编号
- sub_issue_id 子议题编号
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
删除结果信息
Github
仅GitHub 平台使用 权限:
- Issues:Write
示例
const res = await issue.remove_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1 })
-> 删除子议题信息对象
reopen_issue()
reopen_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:871
重新打开一个议题 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
已被弃用
请使用 open_issue 方法代替
reprioritize_sub_issue()
reprioritize_sub_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:2093
重新排序子议题 重新确定子议题优先级
参数
options
重新排序子议题的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number 父议题编号
- sub_issue_id 子议题编号
- before_id 指定要在哪个子议题之前插入,传入目标子议题的编号
- after_id 指定要在哪个子议题之后插入,传入目标子议题的编号
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
Github
仅GitHub 平台使用 权限:
- Issues:Write
示例
const res = await issue.reprioritize_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1, before_id:1 })
-> 排序子议题信息对象
setProxy()
setProxy(
proxy
):void
定义于: models/platform/github/client.ts:343
设置请求代理
参数
proxy
代理参数
返回
void
示例
setProxy({
type: 'http',
address: 'http://127.0.0.1:7890'
})
继承自
setRequestConfig()
protected
setRequestConfig(config
):void
定义于: models/platform/github/client.ts:428
设置当前请求的配置
- 仅在父类与子类中方法中可访问
参数
config
配置对象,包含以下属性:
- url: 请求的URL
- token: 认证令牌
- tokenType: 认证令牌类型,默认为 'Bearer'
返回
void
继承自
setToken()
setToken(
token
):void
定义于: models/platform/github/client.ts:390
设置 token 传入的 token 必须以 ghu_ 或 ghp_ 或 ghs_ 开头,否则会抛出错误
参数
token
string
传入的 token
返回
void
示例
setToken('ghu_xxxx')
继承自
unlock_issue()
unlock_issue(
options
):Promise
<ApiResponseType
<UnLockIssueResponseType
>>
定义于: models/platform/github/issue.ts:1119
解锁一个议题
参数
options
解锁Issue的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
返回
Promise
<ApiResponseType
<UnLockIssueResponseType
>>
解锁状态信息
Github
仅GitHub平台可用 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
示例
const res = await issue.unlock_issue({ owner: 'owner', repo:'repo', issue_number})
-> 解锁议题信息对象
update_issue()
update_issue(
options
):Promise
<ApiResponseType
<IssueInfoResponseType
>>
定义于: models/platform/github/issue.ts:557
更新一个议题 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
更新Issue的参数对象
- owner 仓库拥有者
- repo 仓库名称
- issue_number Issue编号
- title 标题
- body 内容
- assignee 指派人
- milestone 里程碑
- labels 标签列表
- type 问题类型
返回
Promise
<ApiResponseType
<IssueInfoResponseType
>>
包含Issue信息的响应对象
示例
const res = await issue.update_issue({ owner: 'owner', repo:'repo', issue_number:1, title:'title', body:'body' })
-> 更新议题信息对象
update_issue_comment()
update_issue_comment(
options
):Promise
<ApiResponseType
<IssueCommentInfoResponseType
>>
定义于: models/platform/github/issue.ts:1480
更新议题评论信息 权限:
- Issues: Write
- Pull requests: Write 需以上权限之一
参数
options
更新Issue评论信息的参数对象
- owner 仓库拥有者
- repo 仓库名称
- comment_id 评论ID
- body 评论内容
返回
Promise
<ApiResponseType
<IssueCommentInfoResponseType
>>
更新后的Issue评论信息
示例
const res = await issue.update_issue_comment({ owner: 'owner', repo:'repo', comment_id:1, body:'body' })
-> 更新议题评论对象