@candriajs/git-neko-kit 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3055 @@
1
+ /** 反向代理地址 */
2
+ type ReverseProxyCommonUrlType = string;
3
+ /** Git类型 */
4
+ type ApiType = 'github' | 'gitee' | 'gitcode';
5
+ /**
6
+ * 通用代理配置
7
+ */
8
+ interface CommonProxyType {
9
+ type: 'common';
10
+ /** 代理基础地址 */
11
+ address: string;
12
+ }
13
+ /**
14
+ * HTTP 代理配置
15
+ */
16
+ interface HttpProxyType {
17
+ type: 'http';
18
+ address: string;
19
+ }
20
+ /**
21
+ * HTTPS 代理配置
22
+ */
23
+ interface HttpsProxyType {
24
+ type: 'https';
25
+ address: string;
26
+ }
27
+ /**
28
+ * SOCKS5 代理配置
29
+ */
30
+ interface SocksProxyType {
31
+ type: 'socks';
32
+ address: string;
33
+ }
34
+ /** 代理配置参数类型 */
35
+ type ProxyParamsType = HttpProxyType | HttpsProxyType | SocksProxyType | CommonProxyType;
36
+
37
+ interface PkgInfoType {
38
+ /** 包名 */
39
+ name: string;
40
+ /** 版本号 */
41
+ version: string;
42
+ }
43
+
44
+ /** 请求令牌的类型 */
45
+ type RequestTokenType = 'Bearer' | 'Basic';
46
+ /** 请求配置类型 */
47
+ interface RequestConfigType {
48
+ /** 请求地址 */
49
+ url?: string;
50
+ /** 请求令牌 */
51
+ token?: string | null;
52
+ /** 令牌类型,默认为 Bearer,即使用 Bearer 令牌 */
53
+ tokenType?: RequestTokenType;
54
+ }
55
+
56
+ /** 是否响应成功类型 */
57
+ type ResponseSuccessType = boolean;
58
+ /** 状态码响应类型 */
59
+ type ResponseStatusCodeType = number;
60
+ /** 消息响应类型 */
61
+ type ResponseMsgType = string;
62
+ /** 响应类型 */
63
+ interface ResponseType<D = any> {
64
+ success: ResponseSuccessType;
65
+ statusCode: ResponseStatusCodeType;
66
+ msg: ResponseMsgType;
67
+ data: D;
68
+ }
69
+ /** API响应类型 */
70
+ interface ApiResponseType<D = any> extends Omit<ResponseType<D>, 'success'> {
71
+ status: 'ok' | 'error';
72
+ }
73
+
74
+ /**
75
+ * 单日贡献数据
76
+ */
77
+ interface ContributionData {
78
+ /** 日期字符串,格式为YYYY-MM-DD */
79
+ date: string;
80
+ /** 当日的贡献次数 */
81
+ count: number;
82
+ }
83
+ /**
84
+ * 贡献统计结果
85
+ */
86
+ interface ContributionResult {
87
+ /** 总贡献次数 */
88
+ total: number;
89
+ /**
90
+ * 二维数组结构的贡献数据
91
+ * 第一维通常表示周数,第二维表示每周的贡献数据
92
+ */
93
+ contributions: ContributionData[][];
94
+ }
95
+
96
+ interface AccessTokenType {
97
+ /** 访问令牌 */
98
+ access_token: string;
99
+ }
100
+ interface AccessCodeType {
101
+ /** 授权码 */
102
+ code: string;
103
+ }
104
+ interface RefreshTokenType {
105
+ /** 刷新令牌 */
106
+ refresh_token: string;
107
+ }
108
+ interface UserNameParamType {
109
+ /** 用户名 */
110
+ username: string;
111
+ }
112
+ interface OrganizationNameParamType {
113
+ /** 组织登录名 */
114
+ org: string;
115
+ }
116
+ interface UserIdParamType {
117
+ /** 用户id */
118
+ user_id: number;
119
+ }
120
+ interface RepoOwnerParamType {
121
+ /** 仓库的拥有者 */
122
+ owner: string;
123
+ }
124
+ interface RepoNameParamType {
125
+ /** 仓库的名称 */
126
+ repo: string;
127
+ }
128
+ interface RepoUrlParamType {
129
+ /** 仓库地址 */
130
+ url: string;
131
+ }
132
+ interface ShaParamType {
133
+ /** 仓库的SHA值 */
134
+ sha: string;
135
+ }
136
+ interface formatParamType {
137
+ /** 是否格式化 */
138
+ format: boolean;
139
+ }
140
+ /** guthub基础入口类型 */
141
+ interface GitHubAuthType {
142
+ /** 私钥内容 */
143
+ Private_Key: string;
144
+ /** Base App Client ID */
145
+ Client_ID: string;
146
+ /** Base App Client Secret */
147
+ Client_Secret: string;
148
+ /** WebHook Secret */
149
+ WebHook_Secret: string;
150
+ /** 是否格式化 */
151
+ format?: formatParamType['format'];
152
+ }
153
+
154
+ /** 用户信息参数对象类型 */
155
+ interface UserInfoParamType extends UserNameParamType {
156
+ /** 是否格式化日期 */
157
+ format?: formatParamType['format'];
158
+ }
159
+ /** 授权用户信息参数对象类型 */
160
+ interface UserInfoByTokenParamType extends AccessTokenType {
161
+ /** 是否格式化日期 */
162
+ format?: formatParamType['format'];
163
+ }
164
+ /** 账户基本信息 */
165
+ interface AccountBaseType {
166
+ /** 账号登录名 */
167
+ login: string;
168
+ /** 账号ID */
169
+ id: number;
170
+ /** 账号视图类型 */
171
+ user_view_type: string;
172
+ /** 账号节点ID */
173
+ node_id: string;
174
+ /** 账号头像URL */
175
+ avatar_url: string;
176
+ /** Gravatar ID */
177
+ gravatar_id: string | null;
178
+ /** 用户API URL */
179
+ url: string;
180
+ /** 账号主页URL */
181
+ html_url: string;
182
+ /** 仓库列表URL */
183
+ repos_url: string;
184
+ /** 账号类型 */
185
+ type: string;
186
+ /** 是否是站点管理员 */
187
+ site_admin: boolean;
188
+ }
189
+ interface UserPlanType {
190
+ /** 协作者数量 */
191
+ collaborators: number;
192
+ /** 计划名称 */
193
+ name: string;
194
+ /** 存储空间 */
195
+ space: number;
196
+ /** 私有仓库数量 */
197
+ private_repos: number;
198
+ }
199
+ /** GitHub用户详细信息 */
200
+ interface UserInfoResponseType extends AccountBaseType {
201
+ /** 用户全名 */
202
+ name: string | null;
203
+ /** 公司 */
204
+ company: string | null;
205
+ /** 博客URL */
206
+ blog: string | null;
207
+ /** 所在地 */
208
+ location: string | null;
209
+ /** 邮箱 */
210
+ email: string | null;
211
+ /** 通知邮箱 */
212
+ notification_email?: string | null;
213
+ /** 是否可雇佣 */
214
+ hireable: boolean | null;
215
+ /** 个人简介 */
216
+ bio: string | null;
217
+ /** Twitter用户名 */
218
+ twitter_username: string | null;
219
+ /** 订阅列表URL */
220
+ subscriptions_url: string;
221
+ /** 组织列表URL */
222
+ organizations_url: string;
223
+ /** 事件列表URL */
224
+ events_url: string;
225
+ /** 接收事件列表URL */
226
+ received_events_url: string;
227
+ /** 粉丝列表URL */
228
+ followers_url: string;
229
+ /** 关注列表URL */
230
+ following_url: string;
231
+ /** Gists列表URL */
232
+ gists_url: string;
233
+ /** 星标仓库URL */
234
+ starred_url: string;
235
+ /** 公开仓库数量 */
236
+ public_repos: number;
237
+ /** 公开Gists数量 */
238
+ public_gists: number;
239
+ /** 粉丝数 */
240
+ followers: number;
241
+ /** 关注数 */
242
+ following: number;
243
+ /** 创建时间 */
244
+ created_at: string;
245
+ /** 更新时间 */
246
+ updated_at: string;
247
+ /** 私有Gists数量 */
248
+ private_gists?: number;
249
+ /** 总私有仓库数 */
250
+ total_private_repos?: number;
251
+ /** 拥有的私有仓库数 */
252
+ owned_private_repos?: number;
253
+ /** 磁盘使用量(单位KB) */
254
+ disk_usage?: number;
255
+ /** 协作者数量 */
256
+ collaborators?: number;
257
+ /** 是否启用双重认证 */
258
+ two_factor_authentication?: boolean;
259
+ /** 订阅计划 */
260
+ plan?: UserPlanType;
261
+ /** 是否是商业增强版 */
262
+ business_plus?: boolean;
263
+ /** LDAP DN */
264
+ ldap_dn?: string;
265
+ }
266
+
267
+ /** 仓库列表参数类型 */
268
+ interface RepoListBaseParamType {
269
+ /** 排序方式,可选created, updated, pushed, full_name, 默认为 full_name */
270
+ sort?: 'created' | 'updated' | 'pushed' | 'full_name';
271
+ /** 排序方式,可选asc, desc, 默认为 desc */
272
+ direction?: 'asc' | 'desc';
273
+ /** 每页数量 */
274
+ per_page?: number;
275
+ /** 页码 */
276
+ page?: number;
277
+ }
278
+ /** 组织仓库列表参数类型 */
279
+ interface OrgRepoListParmsType extends RepoListBaseParamType {
280
+ /** 组织名称 */
281
+ org: string;
282
+ /** 类型,可选all, public, private, forks, sources, member, 默认为 all */
283
+ type?: 'all' | 'public' | 'private' | 'forks' | 'sources' | 'member';
284
+ /** 是否格式化日期 */
285
+ format?: formatParamType['format'];
286
+ }
287
+ /** 用户仓库列表参数类型 */
288
+ interface UserRepoListParamType extends RepoListBaseParamType {
289
+ /** 用户名 */
290
+ username: string;
291
+ /** 类型,可选all, owner, member, 默认为 all */
292
+ type?: 'all' | 'owner' | 'member';
293
+ /** 是否格式化日期 */
294
+ format?: formatParamType['format'];
295
+ }
296
+ interface UserByTokenRepoListParamType extends RepoListBaseParamType {
297
+ /** 仓库的可见性,可选all, public, private, 默认为 all */
298
+ visibility?: 'all' | 'public' | 'private';
299
+ /** 仓库的状态,可选all, public, private, 默认为 all */
300
+ affiliation?: 'owner' | 'collaborator' | 'organization_member';
301
+ /** 类型,可选all, owner, member, 默认为 all */
302
+ type?: 'all' | 'owner' | 'member';
303
+ /** 是否格式化日期 */
304
+ format?: formatParamType['format'];
305
+ }
306
+ /** 仓库信息响应类型 */
307
+ interface RepoBaseParamType extends RepoOwnerParamType, RepoNameParamType {
308
+ }
309
+ /** 仓库信息请求参数 */
310
+ type RepoInfoParamType = (RepoBaseParamType | RepoUrlParamType) & {
311
+ /** 是否格式化日期 */
312
+ format?: formatParamType['format'];
313
+ };
314
+ /** 拥有者信息 */
315
+ interface Owner {
316
+ /** * 仓库的拥有者 */
317
+ name: string | null;
318
+ /** * 仓库的拥有者的邮箱 */
319
+ email: string | null;
320
+ /** * 拥有者的 Base 用户名 */
321
+ login: string;
322
+ /** * 拥有者的 Base 用户 ID */
323
+ id: number;
324
+ /** * 拥有者的节点 ID */
325
+ node_id: string;
326
+ /** * 拥有者的头像 URL */
327
+ avatar_url: string;
328
+ /** * 拥有者的 Gravatar ID */
329
+ gravatar_id: string | null;
330
+ /** * 拥有者的 Base API URL */
331
+ url: string;
332
+ /** * 拥有者的 Base 主页 URL */
333
+ html_url: string;
334
+ /** * 拥有者的粉丝列表 URL */
335
+ followers_url: string;
336
+ /** * 拥有者的关注列表 URL */
337
+ following_url: string;
338
+ /** * 拥有者的 Gists URL */
339
+ gists_url: string;
340
+ /** * 拥有者的 starred 仓库列表 URL */
341
+ starred_url: string;
342
+ /** * 拥有者的订阅列表 URL */
343
+ subscriptions_url: string;
344
+ /** * 拥有者的组织 URL */
345
+ organizations_url: string;
346
+ /** * 拥有者的仓库列表 URL */
347
+ repos_url: string;
348
+ /** * 拥有者的事件 URL */
349
+ events_url: string;
350
+ /** * 拥有者的接收事件 URL */
351
+ received_events_url: string;
352
+ /** * 拥有者的类型,例如 'User' 或 'Organization' */
353
+ type: string;
354
+ /** * 用户查看类型,通常是 'public' */
355
+ user_view_type: string;
356
+ /** * 是否是站点管理员 */
357
+ site_admin: boolean;
358
+ /** * 用户标星时间 */
359
+ starred_at: string;
360
+ }
361
+ /** 许可证信息 */
362
+ interface License {
363
+ /** * 许可证的键,例如 'mit' */
364
+ key: string;
365
+ /** * 许可证的名称,例如 'MIT License' */
366
+ name: string;
367
+ /** * 许可证的 SPDX ID,例如 'MIT' */
368
+ spdx_id: string;
369
+ /** * 许可证的 URL 地址 */
370
+ url: string | null;
371
+ /** * 许可证的 HTML URL */
372
+ html_url?: string;
373
+ /** * 许可证的节点 ID */
374
+ node_id: string;
375
+ }
376
+ /** 仓库行为准则 */
377
+ interface CodeOfConduct {
378
+ /** * 行为准则的键 */
379
+ key: string;
380
+ /** * 行为准则的名称 */
381
+ name: string;
382
+ /** * 行为准则的 URL */
383
+ url: string;
384
+ /** * 行为准则的主体 */
385
+ body?: string;
386
+ /** * 行为准则的 HTML URL */
387
+ html_url: string | null;
388
+ }
389
+ /** 仓库高级安全状态 */
390
+ interface SecurityAnalysisAdvancedSecurity {
391
+ /** * 高级安全状态 */
392
+ status: string;
393
+ }
394
+ /** Dependabot 安全更新状态 */
395
+ interface SecurityAnalysisDependabotSecurityUpdates {
396
+ /** * Dependabot 安全更新状态 */
397
+ status: string;
398
+ }
399
+ /** 秘钥扫描状态 */
400
+ interface SecurityAnalysisSecretScanning {
401
+ /** * 秘钥扫描状态 */
402
+ status: string;
403
+ }
404
+ /** 秘钥扫描推送保护状态 */
405
+ interface SecurityAnalysisSecretScanningPushProtection {
406
+ /** * 秘钥扫描推送保护状态 */
407
+ status: string;
408
+ }
409
+ /** 仓库安全和分析设置 */
410
+ interface SecurityAndAnalysis {
411
+ /** * 高级安全设置 */
412
+ advanced_security?: SecurityAnalysisAdvancedSecurity;
413
+ /** * Dependabot 安全更新设置 */
414
+ dependabot_security_updates?: SecurityAnalysisDependabotSecurityUpdates;
415
+ /** * 秘钥扫描设置 */
416
+ secret_scanning?: SecurityAnalysisSecretScanning;
417
+ /** * 秘钥扫描推送保护设置 */
418
+ secret_scanning_push_protection?: SecurityAnalysisSecretScanningPushProtection;
419
+ }
420
+ /** 仓库的权限信息 */
421
+ interface Permissions {
422
+ /** * 管理员权限 */
423
+ admin: boolean;
424
+ /** * 推送权限 */
425
+ push: boolean;
426
+ /** * 拉取权限 */
427
+ pull: boolean;
428
+ /** * 维护权限 */
429
+ maintain?: boolean;
430
+ /** * 分类权限 */
431
+ triage?: boolean;
432
+ }
433
+ /**
434
+ * 合并提交标题的格式选项
435
+ * - PR_TITLE: 使用 Pull Request 标题作为合并提交标题
436
+ * - MERGE_MESSAGE: 使用默认的合并消息格式作为标题
437
+ */
438
+ type MergeCommitTitle = 'PR_TITLE' | 'MERGE_MESSAGE';
439
+ /**
440
+ * 合并提交消息的格式选项
441
+ * - PR_BODY: 使用 Pull Request 正文作为合并提交消息
442
+ * - PR_TITLE: 使用 Pull Request 标题作为合并提交消息
443
+ * - BLANK: 留空合并提交消息
444
+ */
445
+ type MergeCommitMessage = 'PR_BODY' | 'PR_TITLE' | 'BLANK';
446
+ /**
447
+ * Squash 合并提交标题的格式选项
448
+ * - PR_TITLE: 使用 Pull Request 标题作为 Squash 合并提交标题
449
+ * - COMMIT_OR_PR_TITLE: 使用提交信息或 Pull Request 标题作为标题
450
+ */
451
+ type SquashMergeCommitTitle = 'PR_TITLE' | 'COMMIT_OR_PR_TITLE';
452
+ /**
453
+ * Squash 合并提交消息的格式选项
454
+ * - PR_BODY: 使用 Pull Request 正文作为 Squash 合并提交消息
455
+ * - COMMIT_MESSAGES: 使用所有提交信息作为 Squash 合并提交消息
456
+ * - BLANK: 留空 Squash 合并提交消息
457
+ */
458
+ type SquashMergeCommitMessage = 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';
459
+ /** * 仓库信息 */
460
+ interface RepoInfoResponseType {
461
+ /** * 仓库的唯一 ID */
462
+ id: number;
463
+ /** * 仓库的节点 ID */
464
+ node_id: string;
465
+ /** * 仓库的名称 */
466
+ name: string;
467
+ /** * 仓库的完整名称,包含用户名或组织名 */
468
+ full_name: string;
469
+ /** * 仓库拥有者的信息 */
470
+ owner: Owner;
471
+ /** * 仓库是否私有 */
472
+ private: boolean;
473
+ /** * 仓库的 HTML 页面 URL */
474
+ html_url: string;
475
+ /** * 仓库的描述信息 */
476
+ description: string | null;
477
+ /** * 仓库是否是 fork 仓库 */
478
+ fork: boolean;
479
+ /** * 仓库的 API URL */
480
+ url: string;
481
+ /** * 获取仓库 fork 列表的 URL */
482
+ forks_url: string;
483
+ /** * 获取仓库 keys 列表的 URL */
484
+ keys_url: string;
485
+ /** * 获取仓库协作者列表的 URL */
486
+ collaborators_url: string;
487
+ /** * 获取仓库团队信息的 URL */
488
+ teams_url: string;
489
+ /** * 获取仓库 hooks 列表的 URL */
490
+ hooks_url: string;
491
+ /** * 获取仓库 issue 事件列表的 URL */
492
+ issue_events_url: string;
493
+ /** * 获取仓库所有事件的 URL */
494
+ events_url: string;
495
+ /** * 获取仓库分配人信息的 URL */
496
+ assignees_url: string;
497
+ /** * 获取仓库分支列表的 URL */
498
+ branches_url: string;
499
+ /** * 获取仓库标签列表的 URL */
500
+ tags_url: string;
501
+ /** * 获取仓库 blob 信息的 URL */
502
+ blobs_url: string;
503
+ /** * 获取仓库 git 标签信息的 URL */
504
+ git_tags_url: string;
505
+ /** * 获取仓库 git 引用信息的 URL */
506
+ git_refs_url: string;
507
+ /** * 获取仓库 git 树信息的 URL */
508
+ trees_url: string;
509
+ /** * 获取仓库状态信息的 URL */
510
+ statuses_url: string;
511
+ /** * 获取仓库语言信息的 URL */
512
+ languages_url: string;
513
+ /** * 获取仓库 Stargazers 列表的 URL */
514
+ stargazers_url: string;
515
+ /** * 获取仓库贡献者列表的 URL */
516
+ contributors_url: string;
517
+ /** * 获取仓库订阅者列表的 URL */
518
+ subscribers_url: string;
519
+ /** * 获取仓库订阅信息的 URL */
520
+ subscription_url: string;
521
+ /** * 获取仓库提交历史的 URL */
522
+ commits_url: string;
523
+ /** * 获取仓库 git 提交历史的 URL */
524
+ git_commits_url: string;
525
+ /** * 获取仓库评论的 URL */
526
+ comments_url: string;
527
+ /** * 获取仓库问题评论的 URL */
528
+ issue_comment_url: string;
529
+ /** * 获取仓库文件内容的 URL */
530
+ contents_url: string;
531
+ /** * 获取仓库比较信息的 URL */
532
+ compare_url: string;
533
+ /** * 获取仓库合并信息的 URL */
534
+ merges_url: string;
535
+ /** * 获取仓库归档的 URL */
536
+ archive_url: string;
537
+ /** * 获取仓库下载的 URL */
538
+ downloads_url: string;
539
+ /** * 获取仓库所有 issues 的 URL */
540
+ issues_url: string;
541
+ /** * 获取仓库所有 pull requests 的 URL */
542
+ pulls_url: string;
543
+ /** * 获取仓库所有里程碑的 URL */
544
+ milestones_url: string;
545
+ /** * 获取仓库所有通知的 URL */
546
+ notifications_url: string;
547
+ /** * 获取仓库所有标签的 URL */
548
+ labels_url: string;
549
+ /** * 获取仓库所有发布版本的 URL */
550
+ releases_url: string;
551
+ /** * 获取仓库所有部署的 URL */
552
+ deployments_url: string;
553
+ /** * 仓库的创建时间 */
554
+ created_at: string;
555
+ /** * 仓库的更新时间 */
556
+ updated_at: string;
557
+ /** * 仓库的推送时间 */
558
+ pushed_at: string;
559
+ /** * 仓库的 Git URL */
560
+ git_url: string;
561
+ /** * 仓库的 SSH URL */
562
+ ssh_url: string;
563
+ /** * 仓库的克隆 URL */
564
+ clone_url: string;
565
+ /** * 仓库的 SVN URL */
566
+ svn_url: string;
567
+ /** * 仓库的主页 URL,若无则为 null */
568
+ homepage: string | null;
569
+ /** * 仓库的大小(单位:KB) */
570
+ size: number;
571
+ /** * 仓库的 Stargazer 数量 */
572
+ stargazers_count: number;
573
+ /** * 仓库的 Watcher 数量 */
574
+ watchers_count: number;
575
+ /** * 仓库的主编程语言 */
576
+ language: string | null;
577
+ /** * 是否开启 issue 功能 */
578
+ has_issues: boolean;
579
+ /** * 是否开启项目功能 */
580
+ has_projects: boolean;
581
+ /** * 是否允许下载 */
582
+ has_downloads: boolean;
583
+ /** * 是否开启 Wiki 功能 */
584
+ has_wiki: boolean;
585
+ /** * 是否开启 Pages 功能 */
586
+ has_pages: boolean;
587
+ /** * 是否开启讨论区功能 */
588
+ has_discussions: boolean;
589
+ /** * 仓库的 fork 数量 */
590
+ forks_count: number;
591
+ /** * 仓库的镜像 URL */
592
+ mirror_url: string | null;
593
+ /** * 仓库是否已归档 */
594
+ archived: boolean;
595
+ /** * 仓库是否被禁用 */
596
+ disabled: boolean;
597
+ /** * 开放的 issue 数量 */
598
+ open_issues_count: number;
599
+ /** * 仓库的许可证信息 */
600
+ license: License | null;
601
+ /** * 是否允许 fork 仓库 */
602
+ allow_forking: boolean;
603
+ /** * 是否是模板仓库 */
604
+ is_template: boolean;
605
+ /** * 是否要求提交时签署承诺 */
606
+ web_commit_signoff_required: boolean;
607
+ /** * 仓库的主题标签 */
608
+ topics: string[];
609
+ /** * 仓库的可见性(如 public, private) */
610
+ visibility: string;
611
+ /** * 仓库的 fork 数量 */
612
+ forks: number;
613
+ /** * 仓库的开放问题数量 */
614
+ open_issues: number;
615
+ /** * 仓库的 Watcher 数量 */
616
+ watchers: number;
617
+ /** * 仓库的默认分支 */
618
+ default_branch: string;
619
+ /** *
620
+ * 仓库的主分支
621
+ * 该属性已被弃用,在部分旧版本的 API 中可能存在,
622
+ * @deprecated 已弃用,使用 default_branch 代替
623
+ * */
624
+ master_branch?: string;
625
+ /** * 临时克隆令牌 */
626
+ temp_clone_token: string | null;
627
+ /** * 仓库的网络计数 */
628
+ network_count: number;
629
+ /** * 仓库的订阅者数量 */
630
+ subscribers_count: number;
631
+ /** * 仓库的组织信息,如果属于组织的话 */
632
+ organization?: Owner | null;
633
+ /** * 模板仓库信息,如果是从模板创建的话 */
634
+ template_repository: RepoInfoResponseType | null;
635
+ /** * 父仓库信息,如果是 fork 的话 */
636
+ parent: RepoInfoResponseType | null;
637
+ /** * 源仓库信息,如果是 fork 的话 */
638
+ source: RepoInfoResponseType | null;
639
+ /** * 是否允许 rebase 合并 */
640
+ allow_rebase_merge?: boolean;
641
+ /** * 是否允许 squash 合并 */
642
+ allow_squash_merge?: boolean;
643
+ /** * 是否允许自动合并 */
644
+ allow_auto_merge?: boolean;
645
+ /** * 合并后是否删除分支 */
646
+ delete_branch_on_merge?: boolean;
647
+ /** * 是否允许合并提交 */
648
+ allow_merge_commit?: boolean;
649
+ /** * 是否允许更新分支 */
650
+ allow_update_branch?: boolean;
651
+ /** * 是否允许匿名 Git 访问 */
652
+ anonymous_access_enabled?: boolean;
653
+ /** * squash 合并提交标题的格式 */
654
+ squash_merge_commit_title?: SquashMergeCommitTitle;
655
+ /** * squash 合并提交消息的格式 */
656
+ squash_merge_commit_message?: SquashMergeCommitMessage;
657
+ /** * 合并提交标题的格式 */
658
+ merge_commit_title?: MergeCommitTitle;
659
+ /** * 合并提交消息的格式 */
660
+ merge_commit_message?: MergeCommitMessage;
661
+ /** * 行为准则信息 */
662
+ code_of_conduct?: CodeOfConduct | null;
663
+ /** * 安全和分析设置 */
664
+ security_and_analysis?: SecurityAndAnalysis | null;
665
+ /** * 权限设置 */
666
+ permissions?: Permissions;
667
+ /** * 自定义属性 */
668
+ custom_properties?: Record<string, any>;
669
+ }
670
+ /**
671
+ * 组织仓库列表类型
672
+ * 该类型包含了多个仓库的信息,每个仓库都有自己的详细信息。
673
+ */
674
+ type OrgRepoListType = RepoInfoResponseType[];
675
+ /** 用户仓库列表类型 */
676
+ type UserRepoListType = Array<RepoInfoResponseType & {
677
+ /** * 仓库的角色名称 */
678
+ role_name?: string;
679
+ }>;
680
+ interface RepoVisibilityResponseType {
681
+ /** * 仓库的可见性 */
682
+ visibility: string;
683
+ }
684
+ interface RepoDefaultBranchResponseType {
685
+ /** * 仓库的默认分支名称 */
686
+ default_branch: string;
687
+ }
688
+ /** 协作者参数类型 */
689
+ type CollaboratorParamType = RepoInfoParamType & UserNameParamType & {
690
+ /**
691
+ * 协作者权限 ,可选 pull,triage, push, maintain, admin,默认pull
692
+ * pull - 只读访问,协作者可以查看仓库内容。
693
+ * triage - 允许管理议题和拉取请求,包括标记、分配和修改状态。
694
+ * push - 允许推送代码到仓库分支,同时拥有 pull 权限。
695
+ * maintain - 允许管理仓库中的代码和议题,但不能更改仓库设置。
696
+ * admin - 拥有仓库的完全控制权,包括更改设置和删除仓库。
697
+ */
698
+ permission?: 'pull' | 'triage' | 'push' | 'maintain' | 'admin';
699
+ };
700
+ /** 邀请协作者响应类型 */
701
+ interface AddCollaboratorResponseType {
702
+ /** 邀请唯一id */
703
+ id: number;
704
+ /** 邀请节点id */
705
+ node_id: string;
706
+ /** 邀请仓库信息 */
707
+ repository: RepoInfoResponseType;
708
+ }
709
+ /** 协作者列表参数类型 */
710
+ type CollaboratorListParamType = RepoInfoParamType & {
711
+ /**
712
+ * 筛选按隶属关系返回的协作者
713
+ * outside - 列出所有外部协作者,包括仓库成员和外部 collaborator。
714
+ * direct - 列出仓库成员。
715
+ * all - 列出仓库成员和外部 collaborator。
716
+ */
717
+ affiliation?: 'outside' | 'direct' | 'all';
718
+ /**
719
+ * 筛选按权限关系返回的协作者
720
+ * pull - 只读访问,协作者可以查看仓库内容。
721
+ * triage - 允许管理议题和拉取请求,包括标记、分配和修改状态。
722
+ * push - 允许推送代码到仓库分支,同时拥有 pull 权限。
723
+ * maintain - 允许管理仓库中的代码和议题,但不能更改仓库设置。
724
+ * admin - 拥有仓库的完全控制权,包括更改设置和删除仓库。
725
+ */
726
+ permission?: 'pull' | 'triage' | 'push' | 'maintain' | 'admin';
727
+ /** 每页数量 */
728
+ per_page?: number;
729
+ /** 页码 */
730
+ page?: number;
731
+ };
732
+ /** 协作者信息类型 */
733
+ interface CollaboratorInfo extends AccountBaseType {
734
+ /** 协作者邮箱 */
735
+ email: string | null;
736
+ /** 协作者姓名 */
737
+ name: string | null;
738
+ /** 粉丝URL */
739
+ followers_url: string;
740
+ /** 关注URL */
741
+ following_url: string;
742
+ /** Gists URL */
743
+ gists_url: string;
744
+ /** 标星URL */
745
+ starred_url: string;
746
+ /** 订阅URL */
747
+ subscriptions_url: string;
748
+ /** 组织URL */
749
+ organizations_url: string;
750
+ /** 仓库URL */
751
+ repos_url: string;
752
+ /** 事件URL */
753
+ events_url: string;
754
+ /** 接收事件URL */
755
+ received_events_url: string;
756
+ /** 权限设置 */
757
+ permissions: {
758
+ /** 拉取权限 */
759
+ pull: boolean;
760
+ /** 分类权限 */
761
+ triage: boolean;
762
+ /** 推送权限 */
763
+ push: boolean;
764
+ /** 维护权限 */
765
+ maintain: boolean;
766
+ /** 管理权限 */
767
+ admin: boolean;
768
+ };
769
+ /** 角色名称 */
770
+ role_name: string;
771
+ }
772
+ /** 协作者列表响应类型 */
773
+ type CollaboratorListResponseType = CollaboratorInfo[];
774
+ /** 移除协作者参数类型 */
775
+ type RemoveCollaboratorParamType = (RepoBaseParamType | RepoUrlParamType) & UserNameParamType;
776
+ /** 移除协作者响应类型 */
777
+ interface RemoveCollaboratorResponseType {
778
+ /** 状态信息 */
779
+ info: string;
780
+ }
781
+
782
+ /**
783
+ * 定义 Base 应用所需的权限
784
+ */
785
+ interface GitHubAppPermissions {
786
+ /** 对仓库内容的权限(例如读取、写入) */
787
+ contents: string;
788
+ /** 对部署的权限(例如读取、写入) */
789
+ deployments: string;
790
+ /** 对议题的权限(例如写) */
791
+ issues: string;
792
+ /** 对检查的权限 */
793
+ checks: string;
794
+ /** 对元数据的权限(例如读取) */
795
+ metadata: string;
796
+ }
797
+ /**
798
+ * 定义 Base 应用的详细信息
799
+ */
800
+ interface GitHubAppInfoType {
801
+ /** 应用的唯一 ID */
802
+ id: number;
803
+ /** 应用的 Client ID */
804
+ client_id: string;
805
+ /** 应用的标识符(slug) */
806
+ slug: string;
807
+ /** 应用的唯一 Node ID */
808
+ node_id: string;
809
+ /** 应用所有者的信息 */
810
+ owner: Owner;
811
+ /** 应用的名称 */
812
+ name: string;
813
+ /** 应用的描述 */
814
+ description: string;
815
+ /** 应用的外部 URL */
816
+ external_url: string;
817
+ /** 应用的 Base 页面 URL */
818
+ html_url: string;
819
+ /** 应用创建时间的时间戳 */
820
+ created_at: string;
821
+ /** 应用最后更新时间的时间戳 */
822
+ updated_at: string;
823
+ /** 应用所需的权限 */
824
+ permissions: GitHubAppPermissions;
825
+ /** 应用监听的事件列表 */
826
+ events: string[];
827
+ /** 应用的安装数量 */
828
+ installations_count: number;
829
+ }
830
+ /** GitHub 账户基础信息类型 */
831
+ interface GitHubAccountBaseType {
832
+ /** 账户名称 */
833
+ name: string | null;
834
+ /** 账户邮箱 */
835
+ email: string | null;
836
+ /** 账户登录名 */
837
+ login: string;
838
+ /** 账户ID */
839
+ id: number;
840
+ /** 账户节点ID */
841
+ node_id: string;
842
+ /** 账户头像URL */
843
+ avatar_url: string;
844
+ /** Gravatar ID */
845
+ gravatar_id: string | null;
846
+ /** API URL */
847
+ url: string;
848
+ /** 主页URL */
849
+ html_url: string;
850
+ }
851
+ /** GitHub 账户完整信息类型 */
852
+ interface GitHubAccountType extends GitHubAccountBaseType {
853
+ /** 粉丝列表URL */
854
+ followers_url: string;
855
+ /** 关注列表URL */
856
+ following_url: string;
857
+ /** Gists列表URL */
858
+ gists_url: string;
859
+ /** 星标仓库URL */
860
+ starred_url: string;
861
+ /** 订阅列表URL */
862
+ subscriptions_url: string;
863
+ /** 组织列表URL */
864
+ organizations_url: string;
865
+ /** 仓库列表URL */
866
+ repos_url: string;
867
+ /** 事件列表URL */
868
+ events_url: string;
869
+ /** 接收事件列表URL */
870
+ received_events_url: string;
871
+ /** 账户类型 */
872
+ type: string;
873
+ /** 是否是站点管理员 */
874
+ site_admin: boolean;
875
+ }
876
+ /** GitHub 应用权限类型 */
877
+ interface GitHubAppDetailedPermissions {
878
+ /** GitHub Actions工作流权限 */
879
+ actions?: 'read' | 'write';
880
+ /** 仓库管理权限 */
881
+ administration?: 'read' | 'write';
882
+ /** 代码检查权限 */
883
+ checks?: 'read' | 'write';
884
+ /** Codespaces权限 */
885
+ codespaces?: 'read' | 'write';
886
+ /** 仓库内容权限 */
887
+ contents?: 'read' | 'write';
888
+ /** Dependabot密钥权限 */
889
+ dependabot_secrets?: 'read' | 'write';
890
+ /** 部署权限 */
891
+ deployments?: 'read' | 'write';
892
+ /** 环境权限 */
893
+ environments?: 'read' | 'write';
894
+ /** Issues权限 */
895
+ issues?: 'read' | 'write';
896
+ /** 元数据权限 */
897
+ metadata?: 'read' | 'write';
898
+ /** 包管理权限 */
899
+ packages?: 'read' | 'write';
900
+ /** Pages权限 */
901
+ pages?: 'read' | 'write';
902
+ /** Pull Requests权限 */
903
+ pull_requests?: 'read' | 'write';
904
+ /** 仓库自定义属性权限 */
905
+ repository_custom_properties?: 'read' | 'write';
906
+ /** Webhook权限 */
907
+ repository_hooks?: 'read' | 'write';
908
+ /** 仓库项目权限 */
909
+ repository_projects?: 'read' | 'write' | 'admin';
910
+ /** 密钥扫描警报权限 */
911
+ secret_scanning_alerts?: 'read' | 'write';
912
+ /** 密钥管理权限 */
913
+ secrets?: 'read' | 'write';
914
+ /** 安全事件权限 */
915
+ security_events?: 'read' | 'write';
916
+ /** 单文件权限 */
917
+ single_file?: 'read' | 'write';
918
+ /** 状态权限 */
919
+ statuses?: 'read' | 'write';
920
+ /** 漏洞警报权限 */
921
+ vulnerability_alerts?: 'read' | 'write';
922
+ /** 工作流文件权限 */
923
+ workflows?: 'write';
924
+ }
925
+ /** GitHub应用安装仓库信息响应类型 */
926
+ interface GitHubAppRepoInfoResponseType {
927
+ /** 安装的唯一ID */
928
+ id: number;
929
+ /** 安装的账户信息,可以是用户或企业 */
930
+ account: GitHubAccountType | null;
931
+ /** 仓库选择类型 */
932
+ repository_selection: 'all' | 'selected';
933
+ /** 访问令牌URL */
934
+ access_tokens_url: string;
935
+ /** 仓库列表URL */
936
+ repositories_url: string;
937
+ /** 安装页面URL */
938
+ html_url: string;
939
+ /** 应用ID */
940
+ app_id: number;
941
+ /** 目标ID(用户或组织的ID) */
942
+ target_id: number;
943
+ /** 目标类型(如'Organization') */
944
+ target_type: string;
945
+ /** 权限配置 */
946
+ permissions: GitHubAppDetailedPermissions;
947
+ /** 事件列表 */
948
+ events: string[];
949
+ /** 创建时间 */
950
+ created_at: string;
951
+ /** 更新时间 */
952
+ updated_at: string;
953
+ /** 单文件名称 */
954
+ single_file_name: string | null;
955
+ /** 是否有多个单文件 */
956
+ has_multiple_single_files: boolean;
957
+ /** 单文件路径列表 */
958
+ single_file_paths: string[];
959
+ /** 应用标识符 */
960
+ app_slug: string;
961
+ /** 暂停操作的用户信息 */
962
+ suspended_by: GitHubAccountBaseType | null;
963
+ }
964
+
965
+ /** Github 授权令牌接口返回类型 */
966
+ interface GithubOauthTokenResponseType {
967
+ /** 用户访问令牌, 格式为 ghu_ 开头 */
968
+ access_token: string;
969
+ /** access_token 过期前的秒数,默认值为 28800(8小时) */
970
+ expires_in: number | null;
971
+ /** 刷新令牌,格式为 ghr_ 开头,可能为 null */
972
+ refresh_token: `ghr_${string}` | null;
973
+ /** refresh_token 过期前的秒数,默认值为 15897600(6个月) */
974
+ refresh_token_expires_in: number | null;
975
+ /** 令牌范围,默认是空字符串 */
976
+ scope: string;
977
+ /** 令牌类型,始终为 'bearer' */
978
+ token_type: 'bearer';
979
+ }
980
+ /** Github 刷新令牌接口返回类型 */
981
+ interface GithubOauthRefreshTokenResponseType {
982
+ /** 是否成功刷新 */
983
+ success: boolean;
984
+ /** 刷新令牌信息 */
985
+ info: string;
986
+ /** 用户访问令牌,格式为 ghu_ 开头 */
987
+ access_token: string;
988
+ /** access_token 过期前的秒数,默认值为 28800(8小时) */
989
+ expires_in: number | null;
990
+ /** 刷新令牌,格式为 ghr_ 开头,可能为 null */
991
+ refresh_token: `ghr_${string}` | null;
992
+ /** refresh_token 过期前的秒数,默认值为 15897600(6个月),可能为 null */
993
+ refresh_token_expires_in: number | null;
994
+ /** 令牌范围,默认是空字符串 */
995
+ scope: string;
996
+ /** 令牌类型,始终为 'bearer' */
997
+ token_type: 'bearer';
998
+ }
999
+ /** 检查Token状态返回类型 */
1000
+ interface GithubOauthCheckTokenResponseType {
1001
+ /** 令牌是否有效 */
1002
+ success: boolean;
1003
+ /** 状态信息 */
1004
+ info: string;
1005
+ }
1006
+
1007
+ interface CommitInfoCommonParamType {
1008
+ /** 提交SHA */
1009
+ sha?: ShaParamType['sha'];
1010
+ /** 是否格式化消息和日期 */
1011
+ format: formatParamType['format'];
1012
+ }
1013
+ /**
1014
+ * 提交信息基础参数类型
1015
+ * 用于获取提交信息的基础参数类型,包含仓库的拥有者、仓库名称、提交SHA等信息。
1016
+ * */
1017
+ interface CommitInfoBaseParamType extends RepoOwnerParamType, RepoNameParamType, CommitInfoCommonParamType {
1018
+ }
1019
+ /**
1020
+ * 提交信息URL参数类型
1021
+ * 用于获取提交信息的URL参数类型,包含仓库的URL和提交SHA等信息。
1022
+ * */
1023
+ interface CommitInfoUrlParamType extends RepoUrlParamType, CommitInfoCommonParamType {
1024
+ }
1025
+ /** 提交参数类型 */
1026
+ type CommitInfoParamType = CommitInfoBaseParamType | CommitInfoUrlParamType;
1027
+ interface GitUser {
1028
+ /** 用户姓名 */
1029
+ name: string | null;
1030
+ /** 用户邮箱 */
1031
+ email: string | null;
1032
+ /** 日期字符串 */
1033
+ date: string;
1034
+ }
1035
+ /** 验证信息类型 */
1036
+ interface Verification {
1037
+ /** 是否已验证 */
1038
+ verified: boolean;
1039
+ /** 验证原因 */
1040
+ reason: string;
1041
+ /** 验证负载 */
1042
+ payload: string | null;
1043
+ /** 验证签名 */
1044
+ signature: string | null;
1045
+ /** 验证时间 */
1046
+ verified_at: string | null;
1047
+ }
1048
+ interface Commit$1 {
1049
+ /** 提交的URL */
1050
+ url: string;
1051
+ /** 提交作者信息 */
1052
+ author: GitUser | null;
1053
+ /** 提交者信息 */
1054
+ committer: GitUser | null;
1055
+ /** 提交信息 */
1056
+ message: string;
1057
+ /**
1058
+ * 提交标题
1059
+ * 仅在开启格式化消息时返回
1060
+ * @example "feat: add new feature"
1061
+ */
1062
+ title?: string;
1063
+ /** 提交正文
1064
+ * 仅在开启格式化消息时返回
1065
+ * @example "This is a new feature that adds a new feature to the application."
1066
+ */
1067
+ body?: string;
1068
+ /** 评论数量 */
1069
+ comment_count: number;
1070
+ /** 提交树信息 */
1071
+ tree: {
1072
+ /** 树对象的SHA */
1073
+ sha: string;
1074
+ /** 树对象的URL */
1075
+ url: string;
1076
+ };
1077
+ /** 验证信息 */
1078
+ verification: Verification;
1079
+ }
1080
+ interface DiffEntry {
1081
+ /** 文件SHA */
1082
+ sha: string;
1083
+ /** 文件名 */
1084
+ filename: string;
1085
+ /** 文件状态 */
1086
+ status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied' | 'changed' | 'unchanged';
1087
+ /** 新增行数 */
1088
+ additions: number;
1089
+ /** 删除行数 */
1090
+ deletions: number;
1091
+ /** 总变更行数 */
1092
+ changes: number;
1093
+ /** 文件blob URL */
1094
+ blob_url: string;
1095
+ /** 文件原始URL */
1096
+ raw_url: string;
1097
+ /** 文件内容URL */
1098
+ contents_url: string;
1099
+ /** 文件差异补丁 */
1100
+ patch: string;
1101
+ /** 之前的文件名 */
1102
+ previous_filename: string | null;
1103
+ }
1104
+ interface CommitStats {
1105
+ /** 新增行数 */
1106
+ additions: number;
1107
+ /** 删除行数 */
1108
+ deletions: number;
1109
+ /** 总变更行数 */
1110
+ total: number;
1111
+ }
1112
+ interface ParentCommit {
1113
+ /** 父提交SHA */
1114
+ sha: string;
1115
+ /** 父提交URL */
1116
+ url: string;
1117
+ /** 父提交HTML URL */
1118
+ html_url: string;
1119
+ }
1120
+ interface CommitInfoResponseType {
1121
+ /** 提交URL */
1122
+ url: string;
1123
+ /** 提交SHA */
1124
+ sha: string;
1125
+ /** 节点ID */
1126
+ node_id: string;
1127
+ /** HTML URL */
1128
+ html_url: string;
1129
+ /** 评论URL */
1130
+ comments_url: string;
1131
+ /** 提交信息 */
1132
+ commit: Commit$1;
1133
+ /** 提交作者 */
1134
+ author: AccountBaseType | null;
1135
+ /** 提交者 */
1136
+ committer: AccountBaseType | null;
1137
+ /** 父提交列表 */
1138
+ parents: ParentCommit[];
1139
+ /** 提交统计信息 */
1140
+ stats?: CommitStats;
1141
+ /** 变更文件列表 */
1142
+ files?: DiffEntry[];
1143
+ }
1144
+
1145
+ /** 议题信息参数类型 */
1146
+ type IssueInfoParamType = (RepoBaseParamType | RepoUrlParamType) & {
1147
+ /** 议题ID */
1148
+ issue_number: number;
1149
+ };
1150
+ /** 议题列表参数类型 */
1151
+ type RepoIssueListParamType = (RepoBaseParamType | RepoUrlParamType) & {
1152
+ /**
1153
+ * 里程碑筛选
1154
+ * @default undefined
1155
+ * - 传入数字时:按里程碑编号筛选
1156
+ * - 传入 "*":接受任何里程碑的议题
1157
+ * - 传入 "none":返回没有里程碑的议题
1158
+ */
1159
+ milestone?: string | number;
1160
+ /**
1161
+ * 议题状态
1162
+ * @default "open"
1163
+ * @enum {string}
1164
+ * - open: 打开的议题
1165
+ * - closed: 关闭的议题
1166
+ * - all: 所有议题
1167
+ */
1168
+ state?: 'all' | 'open' | 'closed';
1169
+ /**
1170
+ * 指派人用户名
1171
+ * - 传入用户名:返回指派给该用户的议题
1172
+ * - 传入 "none":返回未指派的议题
1173
+ * - 传入 "*":返回已指派给任何用户的议题
1174
+ */
1175
+ assignee?: string;
1176
+ /**
1177
+ * 议题类型
1178
+ * - 传入类型名:返回指定类型的议题
1179
+ * - 传入 "*":接受任何类型的议题
1180
+ * - 传入 "none":返回没有类型的议题
1181
+ */
1182
+ type?: string;
1183
+ /** 创建者用户名,筛选由特定用户创建的议题 */
1184
+ creator?: string;
1185
+ /** 提及的用户名,筛选提及特定用户的议题 */
1186
+ mentioned?: string;
1187
+ /**
1188
+ * 标签列表
1189
+ * 以逗号分隔的标签名称列表
1190
+ * @example "bug,ui,@high"
1191
+ */
1192
+ labels?: string;
1193
+ /**
1194
+ * 排序方式
1195
+ * @default "created"
1196
+ * @enum {string}
1197
+ * - created: 按创建时间排序
1198
+ * - updated: 按更新时间排序
1199
+ * - comments: 按评论数排序
1200
+ */
1201
+ sort?: 'created' | 'updated' | 'comments';
1202
+ /**
1203
+ * 排序方向
1204
+ * @default "desc"
1205
+ * @enum {string}
1206
+ * - asc: 升序
1207
+ * - desc: 降序
1208
+ */
1209
+ direction?: 'asc' | 'desc';
1210
+ /**
1211
+ * 筛选此时间之后更新的议题
1212
+ * 仅显示在指定时间之后更新的结果
1213
+ * 格式为 ISO 8601: YYYY-MM-DDTHH:MM:SSZ
1214
+ * @example "2023-01-01T00:00:00Z"
1215
+ */
1216
+ since?: string;
1217
+ /**
1218
+ * 每页结果数量
1219
+ * @default 30
1220
+ * @remarks 取值范围:1-100
1221
+ */
1222
+ per_page?: number;
1223
+ /**
1224
+ * 页码
1225
+ * @default 1
1226
+ */
1227
+ page?: number;
1228
+ };
1229
+ /** 议题标签类型 */
1230
+ interface IssueLabelType {
1231
+ /** 标签ID */
1232
+ id?: number;
1233
+ /** 标签节点ID */
1234
+ node_id?: string;
1235
+ /** 标签URL */
1236
+ url?: string;
1237
+ /** 标签名称 */
1238
+ name: string;
1239
+ /** 标签描述 */
1240
+ description?: string | null;
1241
+ /** 标签颜色代码 */
1242
+ color?: string | null;
1243
+ /** 是否是默认标签 */
1244
+ default?: boolean;
1245
+ }
1246
+ /** 议题里程碑类型 */
1247
+ interface MilestoneType {
1248
+ /** 里程碑URL */
1249
+ url: string;
1250
+ /** 里程碑HTML URL */
1251
+ html_url: string;
1252
+ /** 里程碑标签URL */
1253
+ labels_url: string;
1254
+ /** 里程碑ID */
1255
+ id: number;
1256
+ /** 里程碑节点ID */
1257
+ node_id: string;
1258
+ /** 里程碑编号 */
1259
+ number: number;
1260
+ /** 里程碑状态: open/closed */
1261
+ state: string;
1262
+ /** 里程碑标题 */
1263
+ title: string;
1264
+ /** 里程碑描述 */
1265
+ description: string | null;
1266
+ /** 里程碑创建者 */
1267
+ creator: UserInfoResponseType | null;
1268
+ /** 开放议题数 */
1269
+ open_issues: number;
1270
+ /** 关闭议题数 */
1271
+ closed_issues: number;
1272
+ /** 创建时间 */
1273
+ created_at: string;
1274
+ /** 更新时间 */
1275
+ updated_at: string;
1276
+ /** 关闭时间 */
1277
+ closed_at: string | null;
1278
+ /** 截止时间 */
1279
+ due_on: string | null;
1280
+ }
1281
+ /** 拉取请求关联信息类型 */
1282
+ interface PullRequestType {
1283
+ /** 合并时间 */
1284
+ merged_at: string | null;
1285
+ /** 差异URL */
1286
+ diff_url: string | null;
1287
+ /** HTML URL */
1288
+ html_url: string | null;
1289
+ /** 补丁URL */
1290
+ patch_url: string | null;
1291
+ /** API URL */
1292
+ url: string | null;
1293
+ }
1294
+ /** 议题详情响应类型 */
1295
+ interface IssueInfoResponseType {
1296
+ /** 议题ID */
1297
+ id: number;
1298
+ /** 节点ID */
1299
+ node_id: string;
1300
+ /** 议题API URL */
1301
+ url: string;
1302
+ /** 仓库API URL */
1303
+ repository_url: string;
1304
+ /** 标签URL */
1305
+ labels_url: string;
1306
+ /** 评论URL */
1307
+ comments_url: string;
1308
+ /** 事件URL */
1309
+ events_url: string;
1310
+ /** 议题HTML页面URL */
1311
+ html_url: string;
1312
+ /** 议题编号 */
1313
+ number: number;
1314
+ /** 议题状态: open/closed */
1315
+ state: string;
1316
+ /** 状态原因: completed/reopened/not_planned/null */
1317
+ state_reason: string | null;
1318
+ /** 议题标题 */
1319
+ title: string;
1320
+ /** 议题正文内容 */
1321
+ body: string | null;
1322
+ /** 议题创建者用户信息 */
1323
+ user: UserInfoResponseType | null;
1324
+ /** 议题标签 */
1325
+ labels: Array<IssueLabelType | string>;
1326
+ /** 议题指派人 */
1327
+ assignee: UserInfoResponseType | null;
1328
+ /** 议题所有指派人列表 */
1329
+ assignees: Array<UserInfoResponseType> | null;
1330
+ /** 议题所属里程碑 */
1331
+ milestone: MilestoneType | null;
1332
+ /** 是否锁定 */
1333
+ locked: boolean;
1334
+ /** 活跃锁定原因 */
1335
+ active_lock_reason: string | null;
1336
+ /** 评论数 */
1337
+ comments: number;
1338
+ /** 关联的拉取请求信息 */
1339
+ pull_request?: PullRequestType;
1340
+ /** 关闭时间 */
1341
+ closed_at: string | null;
1342
+ /** 创建时间 */
1343
+ created_at: string;
1344
+ /** 更新时间 */
1345
+ updated_at: string;
1346
+ /** 是否是草稿 */
1347
+ draft?: boolean;
1348
+ /** 关闭者信息 */
1349
+ closed_by?: UserInfoResponseType | null;
1350
+ }
1351
+ /** 议题列表响应类型 */
1352
+ type IssueListResponseType = IssueInfoResponseType[];
1353
+ /** 创建议题参数类型 */
1354
+ type CreteIssueParamType = RepoBaseParamType & {
1355
+ /** 标题 */
1356
+ title: string;
1357
+ /** 正文内容 */
1358
+ body?: string | null;
1359
+ /**
1360
+ * 分配的用户
1361
+ * @deprecated 已弃用,请使用 assignees 字段
1362
+ */
1363
+ assignee?: string | null;
1364
+ /** 里程碑 */
1365
+ milestone?: number | string | null;
1366
+ /** 标签列表 */
1367
+ labels?: Array<string> | null;
1368
+ /** 指派的用户名 */
1369
+ assignees?: Array<string> | null;
1370
+ /** 议题类型 */
1371
+ type?: string;
1372
+ };
1373
+ /** 创建议题响应类型 */
1374
+ type CreateIssueResponseType = IssueInfoResponseType;
1375
+ /** 更新议题参数类型 */
1376
+ interface UpdateIssueParamType extends Omit<CreteIssueParamType, 'title' | 'type'> {
1377
+ /** 议题ID */
1378
+ issue_number: number;
1379
+ /** 问题的名称 */
1380
+ title?: string | null;
1381
+ /** 问题的内容 */
1382
+ body?: string | null;
1383
+ /** 要分配给此问题的用户名(已弃用) */
1384
+ assignee?: string | null;
1385
+ /** 问题的状态:open/closed */
1386
+ state?: 'open' | 'closed';
1387
+ /** 状态更改的原因 */
1388
+ state_reason?: 'completed' | 'not_planned' | 'reopened' | null;
1389
+ /** 与此问题关联的里程碑 */
1390
+ milestone?: number | string | null;
1391
+ /** 与此问题关联的标签数组 */
1392
+ labels?: string[];
1393
+ /** 要分配给此问题的用户名数组 */
1394
+ assignees?: string[];
1395
+ /** 问题类型 */
1396
+ type?: string | null;
1397
+ }
1398
+ /** 更新议题响应类型 */
1399
+ type UpdateIssueResponseType = IssueInfoResponseType;
1400
+ /** 打开议题参数类型 */
1401
+ interface OpenIssueParamType extends RepoBaseParamType {
1402
+ /** 议题ID */
1403
+ issue_number: number;
1404
+ }
1405
+ /** 打开议题响应类型 */
1406
+ type OpenIssueResponseType = IssueInfoResponseType;
1407
+ /** 关闭议题参数类型 */
1408
+ interface CloseIssueParamType extends OpenIssueParamType {
1409
+ /** 关闭原因 */
1410
+ state_reason?: IssueInfoResponseType['state_reason'];
1411
+ }
1412
+ /** 关闭议题响应类型 */
1413
+ type CloseIssueResponseType = IssueInfoResponseType;
1414
+ /** 锁定议题参数类型 */
1415
+ interface LockIssueParamType extends RepoBaseParamType {
1416
+ /** 议题ID */
1417
+ issue_number: number;
1418
+ /**
1419
+ * 锁定原因
1420
+ * 可以是以下之一:
1421
+ * - off-topic:锁定议题,因为该议题与仓库无关
1422
+ * - too heated:锁定议题,因为讨论过于激烈
1423
+ * - resolved:锁定议题,因为该议题已解决
1424
+ * - spam:锁定议题,因为该议题是垃圾邮件
1425
+ */
1426
+ lock_reason?: 'off-topic' | 'too heated' | 'resolved' | 'spam';
1427
+ }
1428
+ /** 锁定议题响应类型 */
1429
+ interface LockIssueResponseType {
1430
+ /** 锁定状态信息 */
1431
+ info: string;
1432
+ }
1433
+ /** 解锁议题参数类型 */
1434
+ type UnLockIssueParamType = Omit<LockIssueParamType, 'lock_reason'>;
1435
+ /** 解锁议题响应类型 */
1436
+ type UnLockIssueResponseType = LockIssueResponseType;
1437
+ /** 议题评论信息参数类型 */
1438
+ interface IssueCommentInfoParamType extends RepoBaseParamType {
1439
+ /** 评论id,评论唯一标识符 */
1440
+ comment_id: string;
1441
+ }
1442
+ /** 议题评论信息响应类型 */
1443
+ interface IssueCommentInfoResponseType {
1444
+ /** 评论ID */
1445
+ id: number;
1446
+ /** 评论节点ID */
1447
+ node_id: string;
1448
+ /** 评论URL */
1449
+ url: string;
1450
+ /** 评论内容 */
1451
+ body: string;
1452
+ /** 评论纯文本内容 */
1453
+ body_text: string;
1454
+ /** 评论HTML内容 */
1455
+ body_html: string;
1456
+ /** 评论HTML页面URL */
1457
+ html_url: string;
1458
+ /** 评论用户信息 */
1459
+ user: UserInfoResponseType | null;
1460
+ /** 创建时间 */
1461
+ created_at: string;
1462
+ /** 更新时间 */
1463
+ updated_at: string;
1464
+ /** 议题URL */
1465
+ issue_url: string;
1466
+ /** 作者关联类型 */
1467
+ author_association: 'COLLABORATOR' | 'CONTRIBUTOR' | 'FIRST_TIMER' | 'FIRST_TIME_CONTRIBUTOR' | 'MANNEQUIN' | 'MEMBER' | 'NONE' | 'OWNER';
1468
+ /** 通过GitHub App执行的操作信息 */
1469
+ performed_via_github_app: GitHubAppInfoType | null;
1470
+ }
1471
+ /** 仓库评论列表参数类型 */
1472
+ interface RepoCommentListParamType extends RepoBaseParamType {
1473
+ /**
1474
+ * 排序依据
1475
+ * 用于指定结果的排序属性
1476
+ * @default created
1477
+ * @enum {string}
1478
+ * - created: 按创建时间排序
1479
+ * - updated: 按更新时间排序
1480
+ */
1481
+ sort?: 'created' | 'updated';
1482
+ /**
1483
+ * 排序方向
1484
+ * 指定结果的排序方向
1485
+ * 注意:如果没有指定 sort 参数,此参数将被忽略
1486
+ * @default desc 当 sort 参数存在时
1487
+ * @enum {string}
1488
+ * - asc: 升序
1489
+ * - desc: 降序
1490
+ */
1491
+ direction?: 'asc' | 'desc';
1492
+ /**
1493
+ * 筛选此时间之后更新的评论
1494
+ * 仅显示在指定时间之后更新的结果
1495
+ * 格式为 ISO 8601: YYYY-MM-DDTHH:MM:SSZ
1496
+ * @example "2023-01-01T00:00:00Z"
1497
+ */
1498
+ since?: string;
1499
+ /**
1500
+ * 每页结果数量
1501
+ * 指定每页返回的结果数
1502
+ * @default 30
1503
+ * @remarks 取值范围:1-100
1504
+ */
1505
+ per_page?: number;
1506
+ /**
1507
+ * 页码
1508
+ * 指定要获取的结果页码
1509
+ * @default 1
1510
+ * @remarks 必须大于等于1
1511
+ */
1512
+ page?: number;
1513
+ }
1514
+ /** 仓库评论列表响应类型 */
1515
+ type RepoCommentListResponseType = IssueCommentInfoResponseType[];
1516
+ /** 议题评论列表参数类型 */
1517
+ interface IssueCommentListParamType extends RepoBaseParamType {
1518
+ /** 议题ID */
1519
+ issue_number: number;
1520
+ /**
1521
+ * 筛选此时间之后更新的评论
1522
+ * 仅显示在指定时间之后更新的结果
1523
+ * 格式为 ISO 8601: YYYY-MM-DDTHH:MM:SSZ
1524
+ * @example "2023-01-01T00:00:00Z"
1525
+ */
1526
+ since?: string;
1527
+ /**
1528
+ * 每页结果数量
1529
+ * @default 30
1530
+ * @remarks 取值范围:1-100
1531
+ */
1532
+ per_page?: number;
1533
+ /**
1534
+ * 页码
1535
+ * @default 1
1536
+ * @remarks 取值范围:1-100
1537
+ */
1538
+ page?: number;
1539
+ }
1540
+ /** 议题评论列表响应类型 */
1541
+ type IssueCommentListResponseType = IssueCommentInfoResponseType[];
1542
+ /** 创建议题评论参数类型 */
1543
+ interface CreteIssueCommentParamType extends RepoBaseParamType {
1544
+ /** 议题ID */
1545
+ issue_number: number;
1546
+ /** 评论内容 */
1547
+ body: string;
1548
+ }
1549
+ /** 创建议题评论响应类型 */
1550
+ type CreteIssueCommentResponseType = IssueCommentInfoResponseType;
1551
+ /** 更新议题评论参数类型 */
1552
+ interface UpdateIssueCommentParamType extends IssueCommentInfoParamType {
1553
+ /** 评论内容 */
1554
+ body: string;
1555
+ }
1556
+ /** 更新议题评论响应类型 */
1557
+ type UpdateIssueCommentResponseType = IssueCommentInfoResponseType;
1558
+ /** 删除议题评论参数类型 */
1559
+ interface RemoveIssueCommentParamType extends RepoBaseParamType {
1560
+ /** 评论ID */
1561
+ comment_id: string;
1562
+ }
1563
+ /** 删除议题评论响应类型 */
1564
+ interface RemoveIssueCommentResponseType {
1565
+ /** 删除状态信息 */
1566
+ info: string;
1567
+ }
1568
+ /** 获取子议题列表参数类型 */
1569
+ interface SubIssueListParamType extends RepoBaseParamType {
1570
+ /** 议题ID */
1571
+ issue_number: number;
1572
+ /**
1573
+ * 每页结果数量
1574
+ * @default 30
1575
+ */
1576
+ per_page?: number;
1577
+ /**
1578
+ * 页码
1579
+ * @default 1
1580
+ */
1581
+ page?: number;
1582
+ }
1583
+ /** 获取子议题列表响应类型 */
1584
+ type SubIssueListResponseType = IssueInfoResponseType[];
1585
+ /** 添加子议题参数类型 */
1586
+ interface AddSubIssueParamType extends RepoBaseParamType {
1587
+ /** 议题ID */
1588
+ issue_number: number;
1589
+ /** * 子议题ID */
1590
+ sub_issue_id: number;
1591
+ /** * 是否替换父议题 */
1592
+ replace_parent: boolean;
1593
+ }
1594
+ /** 添加子议题响应类型 */
1595
+ type AddSubIssueResponseType = IssueInfoResponseType;
1596
+ /** 删除子议题参数类型 */
1597
+ interface RemoveSubIssueParamType extends RepoBaseParamType {
1598
+ /** 议题ID */
1599
+ issue_number: number;
1600
+ /** 子议题ID */
1601
+ sub_issue_id: number;
1602
+ }
1603
+ /** 删除子议题响应类型 */
1604
+ type RemoveSubIssueResponseType = IssueInfoResponseType;
1605
+ /** 重新确定子议题优先级参数类型 */
1606
+ interface ReprioritizeSubIssueParamType extends RepoBaseParamType {
1607
+ /** 议题ID */
1608
+ issue_number: number;
1609
+ /** 子议题ID */
1610
+ sub_issue_id: number;
1611
+ /**
1612
+ * 要优先排序的子问题的 ID(与 before_id 互斥,只能指定其中一个)
1613
+ * 在此 ID 之后放置子问题
1614
+ */
1615
+ after_id?: number;
1616
+ /**
1617
+ * 要优先排序的子问题的 ID(与 after_id 互斥,只能指定其中一个)
1618
+ * 在此 ID 之前放置子问题
1619
+ */
1620
+ before_id?: number;
1621
+ }
1622
+ /** 重新确定子议题优先级响应类型 */
1623
+ type ReprioritizeSubIssueResponseType = IssueInfoResponseType;
1624
+
1625
+ /** 创建组织仓库请求参数 */
1626
+ interface OrgRepoCreateParamType extends RepoOwnerParamType {
1627
+ /** 仓库名称 */
1628
+ name: string;
1629
+ /** 仓库描述 */
1630
+ description?: string;
1631
+ /** 仓库主页 */
1632
+ homepage?: string;
1633
+ /** 仓库可见性 */
1634
+ visibility?: 'public' | 'private';
1635
+ /** 是否开启议题issue */
1636
+ has_issues?: boolean;
1637
+ /** 是否开启项目project */
1638
+ has_projects?: boolean;
1639
+ /** 是否开启wiki */
1640
+ has_wiki?: boolean;
1641
+ /** 是否开启下载 */
1642
+ has_downloads?: boolean;
1643
+ /** 是否设置为模板仓库 */
1644
+ is_template?: boolean;
1645
+ /** 仓库团队id, 这仅在组织中创建仓库时有效。 */
1646
+ team_id?: number;
1647
+ /** 仓库自动初始化 */
1648
+ auto_init?: boolean;
1649
+ /** 仓库的gitignore模板 */
1650
+ gitignore_template?: string;
1651
+ /** 仓库的license模板 */
1652
+ license_template?: string;
1653
+ /** 是否允许合并提交 */
1654
+ allow_squash_merge?: boolean;
1655
+ /** 是否允许变基合并提交 */
1656
+ allow_merge_commit?: boolean;
1657
+ /** 是否允许重新基础合并提交 */
1658
+ allow_rebase_merge?: boolean;
1659
+ /** 是否允许自动合并 */
1660
+ allow_auto_merge?: boolean;
1661
+ /** 是否删除分支后合并 */
1662
+ delete_branch_on_merge?: boolean;
1663
+ /** 合并提交标题格式 */
1664
+ squash_merge_commit_title?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE';
1665
+ /** 合并提交消息格式 */
1666
+ squash_merge_commit_message?: 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';
1667
+ /** 合并提交标题格式 */
1668
+ merge_commit_title?: 'PR_TITLE' | 'MERGE_MESSAGE';
1669
+ /** 合并提交消息格式 */
1670
+ merge_commit_message?: 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';
1671
+ /** 新存储库的自定义属性 */
1672
+ custom_properties?: {
1673
+ [key: string]: string;
1674
+ };
1675
+ /** 是否格式化日期 */
1676
+ format: formatParamType['format'];
1677
+ }
1678
+ /**
1679
+ * 组织的基本信息
1680
+ */
1681
+ interface OrganizationBaseType extends AccountBaseType {
1682
+ /** 组织的名称 */
1683
+ name?: string;
1684
+ /** 组织的描述 */
1685
+ description: string | null;
1686
+ /** 组织的公司名称 */
1687
+ company?: string;
1688
+ /** 组织的博客 URL */
1689
+ blog: string | null;
1690
+ /** 组织的所在地 */
1691
+ location?: string;
1692
+ /** 组织的邮箱地址 */
1693
+ email?: string;
1694
+ /** 组织的 Twitter 用户名 */
1695
+ twitter_username?: string | null;
1696
+ /** 组织是否已验证 */
1697
+ is_verified?: boolean;
1698
+ /** 账户类型(例如 "Organization") */
1699
+ type: string;
1700
+ /** 创建时间 */
1701
+ created_at: string;
1702
+ /** 更新时间 */
1703
+ updated_at: string;
1704
+ /** 归档时间 */
1705
+ archived_at: string | null;
1706
+ }
1707
+ /**
1708
+ * 组织的计划信息
1709
+ */
1710
+ interface OrganizationPlanType {
1711
+ name: string;
1712
+ space: number;
1713
+ private_repos: number;
1714
+ filled_seats?: number;
1715
+ seats?: number;
1716
+ }
1717
+ /**
1718
+ * 组织的 API URL 信息
1719
+ */
1720
+ interface OrganizationUrlType {
1721
+ /** 组织的 Webhook 列表 API URL */
1722
+ hooks_url: string;
1723
+ /** 组织的 Issues 列表 API URL */
1724
+ issues_url: string;
1725
+ /** 组织的成员列表 API URL 模板 */
1726
+ members_url: string;
1727
+ /** 组织的公开成员列表 API URL 模板 */
1728
+ public_members_url: string;
1729
+ }
1730
+ /**
1731
+ * 组织的仓库和 Gists 信息
1732
+ */
1733
+ interface OrganizationRepositoryAndGistsType {
1734
+ /** 组织的公开仓库数量 */
1735
+ public_repos: number;
1736
+ /** 组织的公开 Gists 数量 */
1737
+ public_gists: number;
1738
+ /** 组织的总私有仓库数量 */
1739
+ total_private_repos?: number;
1740
+ /** 组织拥有的私有仓库数量 */
1741
+ owned_private_repos?: number;
1742
+ /** 组织的私有 Gists 数量 */
1743
+ private_gists?: number | null;
1744
+ /** 组织的磁盘使用量 */
1745
+ disk_usage?: number | null;
1746
+ }
1747
+ /**
1748
+ * 组织的成员信息
1749
+ */
1750
+ interface OrganizationMemberType {
1751
+ /** 组织的关注者数量 */
1752
+ followers: number;
1753
+ /** 组织关注的数量 */
1754
+ following: number;
1755
+ /** 私有仓库中的协作者数量 */
1756
+ collaborators?: number | null;
1757
+ }
1758
+ /**
1759
+ * 组织的权限和配置信息
1760
+ */
1761
+ interface OrganizationPermissionsAndConfigType {
1762
+ /** 组织是否启用了组织项目 */
1763
+ has_organization_projects: boolean;
1764
+ /** 组织是否启用了仓库项目 */
1765
+ has_repository_projects: boolean;
1766
+ /** 组织的账单邮箱地址 */
1767
+ billing_email?: string | null;
1768
+ /** 组织的计划信息 */
1769
+ plan?: OrganizationPlanType;
1770
+ /** 默认的仓库权限 */
1771
+ default_repository_permission?: string | null;
1772
+ /** 成员是否可以创建仓库 */
1773
+ members_can_create_repositories?: boolean | null;
1774
+ /** 是否启用了两因素认证要求 */
1775
+ two_factor_requirement_enabled?: boolean | null;
1776
+ /** 成员允许的仓库创建类型 */
1777
+ members_allowed_repository_creation_type?: string;
1778
+ /** 成员是否可以创建公开仓库 */
1779
+ members_can_create_public_repositories?: boolean;
1780
+ /** 成员是否可以创建私有仓库 */
1781
+ members_can_create_private_repositories?: boolean;
1782
+ /** 成员是否可以创建内部仓库 */
1783
+ members_can_create_internal_repositories?: boolean;
1784
+ /** 成员是否可以创建 Pages */
1785
+ members_can_create_pages?: boolean;
1786
+ /** 成员是否可以创建公开 Pages */
1787
+ members_can_create_public_pages?: boolean;
1788
+ /** 成员是否可以创建私有 Pages */
1789
+ members_can_create_private_pages?: boolean;
1790
+ /** 成员是否可以 Fork 私有仓库 */
1791
+ members_can_fork_private_repositories?: boolean | null;
1792
+ /** 是否要求 Web 提交签名 */
1793
+ web_commit_signoff_required?: boolean;
1794
+ /** 控制是否允许为组织中的仓库添加和使用部署密钥 */
1795
+ deploy_keys_enabled_for_repositories?: boolean;
1796
+ }
1797
+ /**
1798
+ * 组织的安全配置信息
1799
+ */
1800
+ interface OrganizationSecurityConfigType {
1801
+ /** 对于新仓库和转移到此组织的仓库,是否启用了 GitHub Advanced Security */
1802
+ advanced_security_enabled_for_new_repositories?: boolean;
1803
+ /** 对于新仓库和转移到此组织的仓库,是否自动启用了 Dependabot alerts */
1804
+ dependabot_alerts_enabled_for_new_repositories?: boolean;
1805
+ /** 对于新仓库和转移到此组织的仓库,是否自动启用了 Dependabot security updates */
1806
+ dependabot_security_updates_enabled_for_new_repositories?: boolean;
1807
+ /** 对于新仓库和转移到此组织的仓库,是否自动启用了 dependency graph */
1808
+ dependency_graph_enabled_for_new_repositories?: boolean;
1809
+ /** 对于新仓库和转移到此组织的仓库,是否自动启用了 secret scanning */
1810
+ secret_scanning_enabled_for_new_repositories?: boolean;
1811
+ /** 对于新仓库和转移到此组织的仓库,是否自动启用了 secret scanning push protection */
1812
+ secret_scanning_push_protection_enabled_for_new_repositories?: boolean;
1813
+ /** 是否向因 push protection 而被阻止推送 secret 的贡献者显示自定义链接 */
1814
+ secret_scanning_push_protection_custom_link_enabled?: boolean;
1815
+ /** 显示给因 push protection 而被阻止推送 secret 的贡献者 */
1816
+ secret_scanning_push_protection_custom_link?: string | null;
1817
+ }
1818
+ /**
1819
+ * GitHub 组织的完整信息
1820
+ */
1821
+ interface OrganizationInfoType extends OrganizationBaseType, OrganizationUrlType, OrganizationRepositoryAndGistsType, OrganizationMemberType, OrganizationPermissionsAndConfigType, OrganizationSecurityConfigType {
1822
+ }
1823
+
1824
+ interface WebHookParamType {
1825
+ /** WebHook 的 secret */
1826
+ secret?: string;
1827
+ /** 请求体 */
1828
+ payload: string;
1829
+ /** GitHub 发送的签名头 */
1830
+ signature: string;
1831
+ }
1832
+
1833
+ /**
1834
+ * 格式化日期
1835
+ * @param dateString - 日期字符串
1836
+ * @param locale - 语言环境,默认为 'zh-cn'
1837
+ * @param format - 日期格式,默认为 'YYYY-MM-DD HH:mm:ss'
1838
+ * @returns 格式化后的日期字符串
1839
+ * @example
1840
+ * ```ts
1841
+ * console.log(await formatDate('2025-04-16T10:00:00') // 输出 "2025-04-16 10:00:00"
1842
+ * ```
1843
+ */
1844
+ declare function formatDate(dateString: string, locale?: string, format?: string): Promise<string>;
1845
+ /**
1846
+ * 获取相对时间
1847
+ * @param dateString - 日期字符串
1848
+ * @param locale - 语言环境,默认为 'zh-cn'
1849
+ * @returns 相对时间
1850
+ * @example
1851
+ * ```ta
1852
+ * console.log(await get_relative_time('2023-04-01 12:00:00')) // 输出 "1 小时前"
1853
+ * ```
1854
+ */
1855
+ declare function get_relative_time(dateString: string, locale?: string): Promise<string>;
1856
+
1857
+ /**
1858
+ * 生成一个用户唯一的标识符
1859
+ * @returns 生成的唯一标识符
1860
+ * @example
1861
+ * ```ts
1862
+ * const stateId = await create_state_id() // 输出 "34523452345234523452345234523452"
1863
+ * ```
1864
+ */
1865
+ declare function create_state_id(): Promise<string>;
1866
+
1867
+ /**
1868
+ * GitHub OAuth 授权管理类
1869
+ *
1870
+ * 提供完整的GitHub OAuth 2.0授权流程管理,包括:
1871
+ * - 生成授权链接
1872
+ * - 通过授权码(code)获取访问令牌(access_token)
1873
+ * - 检查访问令牌状态
1874
+ * - 刷新访问令牌
1875
+ *
1876
+ * @class Auth
1877
+ * @extends Base GitHub基础操作类
1878
+ */
1879
+ declare class Auth extends Base {
1880
+ constructor(base: Base);
1881
+ /**
1882
+ * 生成Github App 授权链接
1883
+ * @param state_id - 随机生成的 state_id,用于验证授权请求的状态,可选,默认不使用
1884
+ * @returns 返回授权链接对象
1885
+ * @returns create_auth_link 授权链接,用于跳转 Github 授权页
1886
+ * @example
1887
+ * ```ts
1888
+ * const link = await auth.create_auth_link('state_id')
1889
+ * console.log(link) // https://github.com/login/oauth/authorize?client_id=<client_id>&state=<state_id>
1890
+ * ```
1891
+ */
1892
+ create_auth_link(state_id?: string): Promise<string>;
1893
+ /**
1894
+ * 通过 code 获取 token
1895
+ * @param options - 获取 token 的参数
1896
+ * - options.code - Github 返回的 code
1897
+ * @returns 返回 token
1898
+ * @example
1899
+ * ```ts
1900
+ * const token = await auth.get_token_by_code({ code: 'code' })
1901
+ * console.log(token) // 输出token对象
1902
+ * ```
1903
+ */
1904
+ get_token_by_code(options: AccessCodeType): Promise<ApiResponseType<GithubOauthTokenResponseType>>;
1905
+ /**
1906
+ * 获取 token 的状态
1907
+ * @param options - 获取 token 的参数
1908
+ * - options.access_token - Github 返回的 access_token
1909
+ * 上一步 `get_token_by_code` 生成的 token
1910
+ * @returns 返回 token 的状态
1911
+ * @returns info - 返回 token 的状态信息,'Token 有效' | 'Token 无效'
1912
+ * @example
1913
+ * ```ts
1914
+ * const status = await auth.check_token_status({ access_token: 'access_token' })
1915
+ * console.log(status) // 输出token状态对象
1916
+ */
1917
+ check_token_status(options?: AccessTokenType): Promise<ApiResponseType<GithubOauthCheckTokenResponseType>>;
1918
+ /**
1919
+ * 通过 refresh_token 获取 token
1920
+ * @param options - 获取 token 的参数
1921
+ * - options.refresh_token - Github 返回的 refresh_token
1922
+ * @returns 返回 token
1923
+ * @example
1924
+ * ```
1925
+ * const token = await auth.refresh_token({ refresh_token: 'refresh_token' })
1926
+ * console.log(token) // 输出token对象
1927
+ * ```
1928
+ */
1929
+ refresh_token(options: RefreshTokenType): Promise<ApiResponseType<GithubOauthRefreshTokenResponseType>>;
1930
+ }
1931
+
1932
+ /**
1933
+ * Base 提交操作类
1934
+ *
1935
+ * 提供对GitHub Commit的CRUD操作,包括:
1936
+ * - 获取一个提交信息
1937
+ */
1938
+ declare class Commit extends Base {
1939
+ constructor(base: Base);
1940
+ /**
1941
+ * 获取一个提交信息
1942
+ * 权限:
1943
+ * — Contents: read-only
1944
+ * @param options - 提交信息参数对象
1945
+ * - url 仓库URL地址
1946
+ * - owner 仓库拥有者
1947
+ * - repo 仓库名称
1948
+ * url参数和owner、repo参数传入其中的一种
1949
+ * - sha 提交的SHA值,如果不提供,则默认获取仓库的默认分支的最新提交信息
1950
+ * - format - 可选,是否格式化提交信息, 默认为false
1951
+ * @returns 提交信息
1952
+ * @example
1953
+ * ```ts
1954
+ * const commitInfo = await commit.get_commit_info({ owner: 'owner', repo: 'repo' })
1955
+ * console.log(commitInfo)
1956
+ * ```
1957
+ */
1958
+ get_commit_info(options: CommitInfoParamType): Promise<ApiResponseType<CommitInfoResponseType>>;
1959
+ }
1960
+
1961
+ /**
1962
+ * GitHub Issue 处理类,提供WebHook相关操作功能
1963
+ *
1964
+ * 提供完整的GitHub Issue管理,包括:
1965
+ * - 获取Issue列表
1966
+ * - 获取Issue详情
1967
+ * - 创建/更新/关闭/打开/锁定/解锁Issue
1968
+ * - 获取仓库评论列表
1969
+ * - 获取/创建/更新/删除Issue评论
1970
+ * - 管理子Issue
1971
+ *
1972
+ * @remarks 每个拉取请求都是一个议题,但并非每个议题都是拉取请求。
1973
+ */
1974
+ declare class Issue extends Base {
1975
+ constructor(base: Base);
1976
+ /**
1977
+ * 获取Issue详情
1978
+ * 权限:
1979
+ * - Issues: Read-only
1980
+ * @param options 请求参数列表
1981
+ * - url 仓库URL地址
1982
+ * - owner 仓库拥有者
1983
+ * - repo 仓库名称
1984
+ * - issue_number Issue编号
1985
+ * url参数和owner、repo参数传入其中的一种
1986
+ * @returns 包含Issue信息的响应对象
1987
+ * @example
1988
+ * ```ts
1989
+ * const issue = get_issue() // 获取issue实例
1990
+ * const res = await issue.get_issue_info({ owner: 'owner', repo:'repo', issue_number:1 })
1991
+ * console.log(res) // { data: IssueInfoResponseType }
1992
+ * ```
1993
+ */
1994
+ get_issue_info(options: IssueInfoParamType): Promise<ApiResponseType<IssueInfoResponseType>>;
1995
+ /**
1996
+ * 获取仓库的Issue列表
1997
+ * 权限:
1998
+ * - Issues:Read-only
1999
+ * @param options 请求参数列表
2000
+ * - url 仓库URL地址
2001
+ * - owner 仓库拥有者
2002
+ * - repo 仓库名称
2003
+ * url参数和owner、repo参数传入其中的一种
2004
+ * - milestones 里程碑ID列表
2005
+ * - state Issue状态,可选 'open' | 'closed' | 'all', 默认为'all'
2006
+ * - labels 标签名称列表
2007
+ * - assignee 指派人用户名
2008
+ * - type 问题类型
2009
+ * - creator 创建者用户名
2010
+ * - mentioned 提及的用户名
2011
+ * - sort 排序方式,可选 'created' | 'updated' | 'comments', 默认为'created'
2012
+ * - direction 排序方向,可选 'asc' | 'desc', 默认为'desc'
2013
+ * - since 筛选此时间之后的问题
2014
+ * - per_page 每页数量,可选,默认为30
2015
+ * - page 页码,可选,默认为1
2016
+ * @returns 包含Issue列表的响应对象
2017
+ * @example
2018
+ * ```ts
2019
+ * const issue = get_issue() // 获取issue实例
2020
+ * const res = await issue.get_issue_list({ owner: 'owner', repo: 'repo' })
2021
+ * console.log(res) // { data: IssueListResponseType[] }
2022
+ * ```
2023
+ */
2024
+ get_repo_issue_list(options: RepoIssueListParamType): Promise<ApiResponseType<IssueListResponseType>>;
2025
+ /**
2026
+ * 创建一个Issue
2027
+ * 权限:
2028
+ * - Issues: Write
2029
+ * @param options 发送Issue的参数对象
2030
+ * - owner 仓库拥有者
2031
+ * - repo 仓库名称
2032
+ * - title 标题
2033
+ * - body 内容
2034
+ * - assignee 指派人
2035
+ * - milestone 里程碑
2036
+ * - labels 标签列表
2037
+ * - type 问题类型
2038
+ * @returns 包含Issue信息的响应对象
2039
+ * @example
2040
+ * ```ts
2041
+ * const issue = get_issue() // 获取issue实例
2042
+ * const res = await issue.create_issue({ owner: 'owner', repo:'repo', title:'title', body:'body' })
2043
+ * console.log(res) // { data: CreateIssueResponseType }
2044
+ * ```
2045
+ */
2046
+ create_issue(options: CreteIssueParamType): Promise<ApiResponseType<CreateIssueResponseType>>;
2047
+ /**
2048
+ * 更新一个Issue
2049
+ * 权限:
2050
+ * - Issues: Write
2051
+ * - Pull requests: Write
2052
+ * 需以上权限之一
2053
+ * @param options 更新Issue的参数对象
2054
+ * - owner 仓库拥有者
2055
+ * - repo 仓库名称
2056
+ * - issue_number Issue编号
2057
+ * - title 标题
2058
+ * - body 内容
2059
+ * - assignee 指派人
2060
+ * - milestone 里程碑
2061
+ * - labels 标签列表
2062
+ * - type 问题类型
2063
+ * @returns 包含Issue信息的响应对象
2064
+ * @example
2065
+ * ```ts
2066
+ * const issue = get_issue() // 获取issue实例
2067
+ * const res = await issue.update_issue({ owner: 'owner', repo:'repo', issue_number:1, title:'title', body:'body' })
2068
+ * console.log(res) // { data: CreateIssueResponseType }
2069
+ * ```
2070
+ */
2071
+ update_issue(options: UpdateIssueParamType): Promise<ApiResponseType<UpdateIssueResponseType>>;
2072
+ /**
2073
+ * 重新打开一个Issue
2074
+ * 权限:
2075
+ * - Issues: Write
2076
+ * - Pull requests: Write
2077
+ * 需以上权限之一
2078
+ * @param options 打开Issue的参数对象
2079
+ * - owner 仓库拥有者
2080
+ * - repo 仓库名称
2081
+ * - issue_number Issue编号
2082
+ * @returns 包含Issue信息的响应对象
2083
+ * @example
2084
+ * ```ts
2085
+ * const issue = get_issue() // 获取issue实例
2086
+ * const res = await issue.open_issue({ owner: 'owner', repo:'repo', issue_number:1 })
2087
+ * console.log(res) // { data: CreateIssueResponseType }
2088
+ * ```
2089
+ */
2090
+ open_issue(options: OpenIssueParamType): Promise<ApiResponseType<OpenIssueResponseType>>;
2091
+ /**
2092
+ * 重新打开一个议题
2093
+ * 权限:
2094
+ * - Issues: Write
2095
+ * - Pull requests: Write
2096
+ * 需以上权限之一
2097
+ * @deprecated 请使用 open_issue 方法代替
2098
+ */
2099
+ reopen_issue(options: OpenIssueParamType): Promise<ApiResponseType<OpenIssueResponseType>>;
2100
+ /**
2101
+ * 关闭一个Issue
2102
+ * 权限:
2103
+ * - Issues: Write
2104
+ * - Pull requests: Write
2105
+ * 需以上权限之一
2106
+ * @param options 关闭Issue的参数对象
2107
+ * - owner 仓库拥有者
2108
+ * - repo 仓库名称
2109
+ * - issue_number Issue编号
2110
+ * - state_reason 关闭原因
2111
+ * @returns 包含Issue信息的响应对象
2112
+ * @example
2113
+ * ```ts
2114
+ * const issue = get_issue() // 获取issue实例
2115
+ * const res = await issue.close_issue({ owner: 'owner', repo:'repo', issue_number:1, state_reason:'completed' })
2116
+ * console.log(res) // { data: CreateIssueResponseType }
2117
+ * ```
2118
+ */
2119
+ close_issue(options: CloseIssueParamType): Promise<ApiResponseType<CloseIssueResponseType>>;
2120
+ /**
2121
+ * 锁定一个Issue
2122
+ * 权限:
2123
+ * - Issues: Write
2124
+ * - Pull requests: Write
2125
+ * 需以上权限之一
2126
+ * @param options 锁定Issue的参数对象
2127
+ * - owner 仓库拥有者
2128
+ * - repo 仓库名称
2129
+ * - issue_number Issue编号
2130
+ * - lock_reason 锁定原因 可选 'off-topic' | 'too heated' | 'resolved' | 'spam'
2131
+ * @returns 锁定状态信息
2132
+ * @example
2133
+ * ```ts
2134
+ * const issue = get_issue() // 获取issue实例
2135
+ * const res = await issue.lock_issue({ owner: 'owner', repo:'repo', issue_number:1, lock_reason:'off-topic' })
2136
+ * console.log(res) // { data: LockIssueResponseType }
2137
+ * ```
2138
+ */
2139
+ lock_issue(options: LockIssueParamType): Promise<ApiResponseType<LockIssueResponseType>>;
2140
+ /**
2141
+ * 解锁一个Issue
2142
+ * 权限:
2143
+ * - Issues: Write
2144
+ * - Pull requests: Write
2145
+ * 需以上权限之一
2146
+ * @param options 解锁Issue的参数对象
2147
+ * - owner 仓库拥有者
2148
+ * - repo 仓库名称
2149
+ * - issue_number Issue编号
2150
+ * @returns 解锁状态信息
2151
+ * @example
2152
+ * ```ts
2153
+ * const issue = get_issue() // 获取issue实例
2154
+ * const res = await issue.unlock_issue({ owner: 'owner', repo:'repo', issue_number})
2155
+ * console.log(res) // { data: UnLockIssueResponseType }
2156
+ * ```
2157
+ */
2158
+ unlock_issue(options: UnLockIssueParamType): Promise<ApiResponseType<UnLockIssueResponseType>>;
2159
+ /**
2160
+ * 获取一个仓库下Issue的评论列表
2161
+ * 权限:
2162
+ * - Issues: Read-only
2163
+ * - Pull requests: Read-only
2164
+ * 需以上权限之一
2165
+ * @param options 获取Issue评论列表的参数对象
2166
+ * - owner 仓库拥有者
2167
+ * - repo 仓库名称
2168
+ * - sort 排序方式 可选 'created' | 'updated'
2169
+ * - direction 排序方向 可选 'asc' | 'desc',当sort不存在时此参数会被忽略
2170
+ * - since 评论时间
2171
+ * - per_page 每页评论数量
2172
+ * - page 页码
2173
+ * @returns 包含Issue评论列表的响应对象
2174
+ * @example
2175
+ * ```ts
2176
+ * const issue = get_issue() // 获取issue实例
2177
+ * const res = await issue.get_issue_comment_list({ owner: 'owner', repo:'repo', issue_number:1 })
2178
+ * console.log(res) // { data: IssueCommentListResponseType[] }
2179
+ * ```
2180
+ */
2181
+ get_repo_comment_list(options: RepoCommentListParamType): Promise<ApiResponseType<RepoCommentListResponseType>>;
2182
+ /**
2183
+ * 获取一个Issue下的评论列表
2184
+ * 权限:
2185
+ * - Issues: Read-only
2186
+ * - Pull requests: Read-only
2187
+ * 需以上权限之一
2188
+ * @param options 获取Issue评论列表的参数对象
2189
+ * - owner 仓库拥有者
2190
+ * - repo 仓库名称
2191
+ * - issue_number Issue编号
2192
+ * - since 评论时间
2193
+ * - per_page 每页评论数量
2194
+ * - page 页码
2195
+ * @returns 包含Issue评论列表的响应对象
2196
+ * @example
2197
+ * ```ts
2198
+ * const issue = get_issue() // 获取issue实例
2199
+ * const res = await issue.get_issue_comment_list({ owner: 'owner', repo:'repo', issue_number:1 })
2200
+ * console.log(res) // { data: IssueCommentListResponseType[] }
2201
+ * ```
2202
+ */
2203
+ get_issue_comment_list(options: IssueCommentListParamType): Promise<ApiResponseType<IssueCommentListParamType>>;
2204
+ /**
2205
+ * 获取Issue评论信息
2206
+ * 权限:
2207
+ * - Issues: Read-only
2208
+ * - Pull requests: Read-only
2209
+ * 需以上权限之一
2210
+ * @param options 获取Issue评论信息的参数对象
2211
+ * - owner 仓库拥有者
2212
+ * - repo 仓库名称
2213
+ * - comment_id 评论ID
2214
+ * @returns Issue评论信息
2215
+ * @example
2216
+ * ```ts
2217
+ * const issue = get_issue() // 获取issue实例
2218
+ * const res = await issue.get_issue_comment({ owner: 'owner', repo:'repo', comment_id:1 })
2219
+ * console.log(res) // { data: IssueCommentInfoResponseType }
2220
+ * ```
2221
+ */
2222
+ get_issue_comment_info(options: IssueCommentInfoParamType): Promise<ApiResponseType<IssueCommentInfoResponseType>>;
2223
+ /**
2224
+ * 创建一个Issue评论
2225
+ * 权限:
2226
+ * - Issues: Write
2227
+ * - Pull requests: Write
2228
+ * 需以上权限之一
2229
+ * @param options 创建Issue评论的参数对象
2230
+ * - owner 仓库拥有者
2231
+ * - repo 仓库名称
2232
+ * - issue_number Issue编号
2233
+ * - body 评论内容
2234
+ * @returns 创建的Issue评论信息
2235
+ * @example
2236
+ * ```ts
2237
+ * const issue = get_issue() // 获取issue实例
2238
+ * const res = await issue.create_issue_comment({ owner: 'owner', repo:'repo', issue_number:1, body:'comment' })
2239
+ * console.log(res) // { data: CreteIssueCommentResponseType }
2240
+ * ```
2241
+ */
2242
+ create_issue_comment(options: CreteIssueCommentParamType): Promise<ApiResponseType<CreteIssueCommentResponseType>>;
2243
+ /**
2244
+ * 更新Issue评论信息
2245
+ * 权限:
2246
+ * - Issues: Write
2247
+ * - Pull requests: Write
2248
+ * 需以上权限之一
2249
+ * @param options 更新Issue评论信息的参数对象
2250
+ * - owner 仓库拥有者
2251
+ * - repo 仓库名称
2252
+ * - comment_id 评论ID
2253
+ * - body 评论内容
2254
+ * @returns 更新后的Issue评论信息
2255
+ * @example
2256
+ * ```ts
2257
+ * const issue = get_issue() // 获取issue实例
2258
+ * const res = await issue.update_issue_comment({ owner: 'owner', repo:'repo', comment_id:1, body:'body' })
2259
+ * console.log(res) // { data: UpdateIssueCommentResponseType }
2260
+ * ```
2261
+ */
2262
+ update_issue_comment(options: UpdateIssueCommentParamType): Promise<ApiResponseType<UpdateIssueCommentResponseType>>;
2263
+ /**
2264
+ * 删除Issue评论信息
2265
+ * 权限:
2266
+ * - Issues: Write
2267
+ * - Pull requests: Write
2268
+ * 需以上权限之一
2269
+ * @param options 删除Issue评论信息的参数对象
2270
+ * - owner 仓库拥有者
2271
+ * - repo 仓库名称
2272
+ * - comment_id 评论ID
2273
+ * @returns 删除结果信息
2274
+ * @example
2275
+ * ```ts
2276
+ * const issue = get_issue() // 获取issue实例
2277
+ * const res = awaitissue.remove_issue_comment()
2278
+ * console.log(res) // { data: RemoveIssueCommentResponseType }
2279
+ * ```
2280
+ */
2281
+ remove_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2282
+ /**
2283
+ * 删除Issue评论信息
2284
+ * 权限:
2285
+ * - Issues: Write
2286
+ * - Pull requests: Write
2287
+ * 需以上权限之一
2288
+ * @deprecated 请使用 remove_issue_comment 方法代替
2289
+ */
2290
+ delete_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2291
+ /**
2292
+ * 获取子议题列表
2293
+ * 权限:
2294
+ * - Issues: Read-only
2295
+ * - Pull requests: Read-only
2296
+ * 需以上权限之一
2297
+ * @param options 获取子议题列表的参数对象
2298
+ * - owner 仓库拥有者
2299
+ * - repo 仓库名称
2300
+ * - issue_number 议题编号
2301
+ * @returns 子议题列表
2302
+ * @example
2303
+ * ```ts
2304
+ * const issue = get_issue() // 获取issue实例
2305
+ * const res = await issue.get_sub_issue_list({ owner: 'owner', repo:'repo', issue_number:1 })
2306
+ * console.log(res) // { data: SubIssueListResponseType }
2307
+ * ```
2308
+ */
2309
+ get_sub_issue_list(options: SubIssueListParamType): Promise<ApiResponseType<SubIssueListResponseType>>;
2310
+ /**
2311
+ * 添加子议题
2312
+ * 添加一个子议题到指定的议题中
2313
+ * 权限:
2314
+ * - Issues:Write
2315
+ * @param options 添加子议题的参数对象
2316
+ * - owner 仓库拥有者
2317
+ * - repo 仓库名称
2318
+ * - issue_number 父议题编号
2319
+ * - sub_issue_id 子议题编号
2320
+ * - replace_parent 是否替换父议题
2321
+ * @returns 添加结果信息
2322
+ * @example
2323
+ * ```ts
2324
+ * const issue = get_issue() // 获取issue实例
2325
+ * const res = await issue.add_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1, replace_parent:true })
2326
+ * console.log(res) // { data: AddSubIssueResponseType }
2327
+ * ```
2328
+ */
2329
+ add_sub_issue(options: AddSubIssueParamType): Promise<ApiResponseType<AddSubIssueResponseType>>;
2330
+ /**
2331
+ * 删除子议题
2332
+ * 权限:
2333
+ * - Issues:Write
2334
+ * @param options 删除子议题的参数对象
2335
+ * - owner 仓库拥有者
2336
+ * - repo 仓库名称
2337
+ * - issue_number 父议题编号
2338
+ * - sub_issue_id 子议题编号
2339
+ * @returns 删除结果信息
2340
+ * @example
2341
+ * ```ts
2342
+ * const issue = get_issue() // 获取issue实例
2343
+ * const res = await issue.remove_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1 })
2344
+ * console.log(res) // { data: RemoveSubIssueResponseType }
2345
+ * ```
2346
+ */
2347
+ remove_sub_issue(options: RemoveSubIssueParamType): Promise<ApiResponseType<RemoveSubIssueResponseType>>;
2348
+ /**
2349
+ * 删除子议题
2350
+ * 删除一个子议题
2351
+ * 权限:
2352
+ * - Issues:Write
2353
+ * @deprecated 请使用 remove_sub_issue 方法代替
2354
+ */
2355
+ delete_sub_issue(options: RemoveSubIssueParamType): Promise<ApiResponseType<RemoveSubIssueResponseType>>;
2356
+ /**
2357
+ * 重新排序子议题
2358
+ * 重新确定子议题优先级
2359
+ * 权限:
2360
+ * - Issues:Write
2361
+ * @param options 重新排序子议题的参数对象
2362
+ * - owner 仓库拥有者
2363
+ * - repo 仓库名称
2364
+ * - issue_number 父议题编号
2365
+ * - sub_issue_id 子议题编号
2366
+ * - before_id 指定要在哪个子议题之前插入,传入目标子议题的编号
2367
+ * - after_id 指定要在哪个子议题之后插入,传入目标子议题的编号
2368
+ * @example
2369
+ * ```ts
2370
+ * const issue = get_issue() // 获取issue实例
2371
+ * const res = await issue.reprioritize_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1, before_id:1 })
2372
+ * console.log(res) // { data: ReprioritizeSubIssueResponseType }
2373
+ * ```
2374
+ */
2375
+ reprioritize_sub_issue(options: ReprioritizeSubIssueParamType): Promise<ApiResponseType<ReprioritizeSubIssueResponseType>>;
2376
+ }
2377
+
2378
+ /**
2379
+ * Base 组织操作类
2380
+ *
2381
+ * 提供对GitHub组织的CRUD操作,包括:
2382
+ * - 获取组织信息
2383
+ */
2384
+ declare class Org extends Base {
2385
+ constructor(base: Base);
2386
+ /**
2387
+ * 获取组织信息
2388
+ * 权限:
2389
+ * - Plan: Read-only ,若需要获取组织计划则需要该权限,并且是组织所有者
2390
+ * @param options 组织参数
2391
+ * - org 组织名称
2392
+ * @returns 组织信息
2393
+ * @example
2394
+ * ```ts
2395
+ * const orgInfo = await org.get_org_info({ org: 'org' })
2396
+ * console.log(orgInfo)
2397
+ * ```
2398
+ */
2399
+ get_org_info(options: OrganizationNameParamType): Promise<ApiResponseType<OrganizationInfoType>>;
2400
+ }
2401
+
2402
+ /**
2403
+ * GitHub 仓库操作类
2404
+ *
2405
+ * 提供对GitHub仓库的完整CRUD操作接口,包括:
2406
+ * - 组织/用户仓库的查询、创建、删除
2407
+ * - 仓库详细信息的获取
2408
+ * - 仓库可见性检查
2409
+ * - 支持通过URL或owner/repo两种方式操作仓库
2410
+ *
2411
+ */
2412
+ declare class Repo extends Base {
2413
+ constructor(base: Base);
2414
+ /**
2415
+ * 获取组织仓库列表
2416
+ * 权限: Metadata - Read-only , 如果获取公开仓库可无需此权限
2417
+ * @param options - 请求参数对象
2418
+ * - org - 组织名称
2419
+ * - type - 仓库类型,可选值:'all' | 'public' | 'private' | 'forks' | 'sources' | 'member', 默认值:'all'
2420
+ * - sort - 排序字段,可选值:'created' | 'updated' | 'pushed' | 'full_name', 默认值:'created'
2421
+ * - direction - 排序方向,可选值:'asc' | 'desc', 默认值:'desc'
2422
+ * - per_page - 每页数量(1-100), 默认值:30
2423
+ * - page - 页码 默认值:1
2424
+ * @returns 组织仓库列表
2425
+ * @example
2426
+ * ```ts
2427
+ * const repos = await repo.get_org_repos_list({ org: 'org' })
2428
+ * console.log(repos)
2429
+ * ```
2430
+ */
2431
+ get_org_repos_list(options: OrgRepoListParmsType): Promise<ApiResponseType<OrgRepoListType>>;
2432
+ /**
2433
+ * 查询仓库详细信息
2434
+ * 权限: Metadata - read-only , 如果获取公开仓库可无需此权限
2435
+ * @param options - 请求参数对象
2436
+ * - type - 仓库类型,可选值:可选all, public, private
2437
+ * - visibility - 仓库可见性,可选值:'public' | 'private' | 'internal', 默认值:'all'
2438
+ * - affiliation - 仓库关联,可选值:'owner' | 'collaborator' | 'organization_member', 默认值:'owner,collaborator,organization_member'
2439
+ * - sort - 排序字段,可选值:'created' | 'updated' | 'pushed' | 'full_name', 默认值:'created'
2440
+ * - direction - 排序方向,可选值:'asc' | 'desc', 默认值:'desc'
2441
+ * - per_page - 每页数量(1-100), 默认值:30
2442
+ * - page - 页码 默认值:1
2443
+ * @returns 仓库详细信息
2444
+ * @example
2445
+ * ```ts
2446
+ * const repos = await repo.get_repos_list({ username: 'username' })
2447
+ * console.log(repos)
2448
+ * ```
2449
+ */
2450
+ get_user_repos_list_by_token(options?: UserByTokenRepoListParamType): Promise<ApiResponseType<UserRepoListType>>;
2451
+ /**
2452
+ * 获取用户仓库列表
2453
+ * 权限:
2454
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
2455
+ * @param options - 请求参数对象
2456
+ * - username - 用户名
2457
+ * 优先获取授权用户仓库列表,若授权用户不存在则获取指定用户仓库列表
2458
+ * - type - 仓库类型,可选值:all, owner, member,, 默认值:'all'
2459
+ * - sort - 排序字段,可选值:'created' | 'updated' | 'pushed' | 'full_name', 默认值:'created'
2460
+ * - direction - 排序方向,可选值:'asc' | 'desc', 默认值:'desc'
2461
+ * - per_page - 每页数量(1-100), 默认值:30
2462
+ * - page - 页码 默认值:1
2463
+ * @returns 用户仓库列表
2464
+ */
2465
+ get_user_repos_list(options: UserRepoListParamType): Promise<ApiResponseType<UserRepoListType>>;
2466
+ /**
2467
+ * 获取仓库信息
2468
+ * 权限:
2469
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
2470
+ * @param options - 仓库信息参数对象,必须包含以下两种组合之一:
2471
+ * - options.url 仓库URL地址
2472
+ * - options.owner 仓库拥有者
2473
+ * - options.repo 仓库名称
2474
+ * url参数和owner、repo参数传入其中的一种
2475
+ * @example
2476
+ * ```ts
2477
+ * const repo = await repo.get_repo_info({ url: 'https://github.com/ClarityJS/git-neko-kit' })
2478
+ * console.log(repo)
2479
+ * ```
2480
+ */
2481
+ get_repo_info(options: RepoInfoParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
2482
+ /**
2483
+ * 创建组织仓库
2484
+ * 权限:
2485
+ * - Administration: Read and write
2486
+ * @param options 创建组织仓库参数
2487
+ * - owner: 组织名称
2488
+ * - name: 仓库名称
2489
+ * - description: 仓库描述
2490
+ * - homepage: 仓库主页URL
2491
+ * - visibility: 仓库可见性,可选值:'public' | 'private', 默认值:'public'
2492
+ * - has_issues: 是否启用issues功能, 默认值:true
2493
+ * - has_projects: 是否启用projects功能, 默认值:true
2494
+ * - has_wiki: 是否启用wiki功能, 默认值:true
2495
+ * - has_downloads: 是否启用下载功能 默认值:true
2496
+ * - is_template: 是否设置为模板仓库 默认值:false
2497
+ * - team_id: 关联团队ID(组织仓库专用)
2498
+ * - auto_init: 是否自动初始化仓库 默认值:false
2499
+ * - gitignore_template: gitignore模板名称(需配合auto_init使用)
2500
+ * - license_template: license模板名称(需配合auto_init使用)
2501
+ * - allow_squash_merge: 是否允许squash merge, 默认值:true
2502
+ * - allow_merge_commit: 是否允许普通合并, 默认值:true
2503
+ * - allow_rebase_merge: 是否允许rebase合并 默认值:true
2504
+ * - allow_auto_merge: 是否允许自动合并 默认值:false
2505
+ * - delete_branch_on_merge: 合并后是否自动删除分支 默认值:false
2506
+ * - squash_merge_commit_title: squash合并提交标题格式 默认值:'PR_TITLE'
2507
+ * - squash_merge_commit_message: squash合并提交信息格式 默认值:'PR_BODY'
2508
+ * - merge_commit_title: 合并提交标题格式 默认值:'PR_TITLE'
2509
+ * - merge_commit_message: 合并提交信息格式 默认值:'PR_BODY'
2510
+ * - custom_properties: 自定义键值对属性
2511
+ * @returns 返回创建成功的仓库信息
2512
+ */
2513
+ create_org_repo(options: OrgRepoCreateParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
2514
+ /**
2515
+ * 获取协作者列表
2516
+ * 权限:
2517
+ * - Metadata: Read
2518
+ * @param options 获取协作者列表对象
2519
+ * - owner: 仓库拥有者
2520
+ * - repo: 仓库名称
2521
+ * - url: 仓库地址
2522
+ * url和owner、repo参数传入其中的一种
2523
+ * - affiliation: 协作者类型,可选outside, direct, all,默认为all
2524
+ * - permission: 协作者权限,可选pull,triage, push, maintain, admin,默认为pull
2525
+ * - per_page: 每页数量,默认为30
2526
+ * - page: 页码,默认为1
2527
+ * @returns 返回获取协作者列表结果
2528
+ * @example
2529
+ * ```ts
2530
+ * const result = await collaborator.get_collaborator_list(options)
2531
+ * console.log(result)
2532
+ * ```
2533
+ */
2534
+ get_collaborator_list(options: CollaboratorListParamType): Promise<ApiResponseType<CollaboratorListResponseType>>;
2535
+ /**
2536
+ * 邀请协作者
2537
+ * 权限:
2538
+ * - Administration: Read and write
2539
+ * @param options 邀请协作者对象
2540
+ * - owner: 仓库拥有者
2541
+ * - repo: 仓库名称
2542
+ * - url: 仓库地址
2543
+ * owner和repo或者url选择一个即可
2544
+ * - username: 要邀请协作者用户名
2545
+ * - permission: 协作者权限,可选pull,triage, push, maintain, admin,默认为pull
2546
+ * @returns 返回邀请协作者结果
2547
+ * @example
2548
+ * ```ts
2549
+ * const result = await collaborator.add_collaborator({
2550
+ * owner: 'owner',
2551
+ * repo: 'repo',
2552
+ * username: 'username',
2553
+ * permission: 'pull'
2554
+ * })
2555
+ * console.log(result)
2556
+ * ```
2557
+ */
2558
+ add_collaborator(options: CollaboratorParamType): Promise<ApiResponseType<AddCollaboratorResponseType>>;
2559
+ /**
2560
+ * 删除协作者
2561
+ * 权限:
2562
+ * - Administration: Read and write
2563
+ * @param options 删除协作者对象
2564
+ * - owner: 仓库拥有者
2565
+ * - repo: 仓库名称
2566
+ * - url: 仓库地址
2567
+ * owner和repo或者url选择一个即可
2568
+ * - username: 要删除协作者用户名
2569
+ * @returns 返回删除协作者结果
2570
+ * @example
2571
+ * ```ts
2572
+ * const result = await collaborator.remove_collaborator({
2573
+ * owner: 'owner',
2574
+ * repo:'repo',
2575
+ * username: 'username'
2576
+ * })
2577
+ * console.log(result)
2578
+ * ```
2579
+ */
2580
+ remove_collaborator(options: RemoveCollaboratorParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2581
+ /**
2582
+ * 快速获取仓库可见性
2583
+ * 权限:
2584
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
2585
+ * @param options
2586
+ * - url 仓库URL地址
2587
+ * - owner 仓库拥有者
2588
+ * - repo 仓库名称
2589
+ * url参数和owner、repo参数传入其中的一种
2590
+ * @remarks 优先使用url参数,若url参数不存在则使用owner和repo参数
2591
+ * @returns 仓库可见性,
2592
+ * @example
2593
+ * ```ts
2594
+ * const visibility = await repo.get_repo_visibility({url: 'https://github.com/ClarityJS/git-neko-kit'})
2595
+ * console.log(visibility) // 输出 public 或 private
2596
+ * ```
2597
+ */
2598
+ get_repo_visibility(options: RepoInfoParamType): Promise<RepoVisibilityResponseType['visibility'] | null>;
2599
+ /**
2600
+ * 获取仓库默认分支
2601
+ * 权限:
2602
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
2603
+ * @param options
2604
+ * - url 仓库URL地址
2605
+ * - owner 仓库拥有者
2606
+ * - repo 仓库名称
2607
+ * url参数和owner、repo参数传入其中的一种
2608
+ * @example
2609
+ * ```ts
2610
+ * const defaultBranch = await repo.get_repo_default_branch({url: 'https://github.com/ClarityJS/meme-plugin')}
2611
+ * console.log(defaultBranch) // 输出 main
2612
+ * ```ts
2613
+ */
2614
+ get_repo_default_branch(options: RepoInfoParamType): Promise<RepoDefaultBranchResponseType['default_branch']>;
2615
+ }
2616
+
2617
+ /**
2618
+ * Base 用户操作类
2619
+ *
2620
+ * 提供对GitHub用户的CRUD操作,包括:
2621
+ * - 获取用户信息
2622
+ * - 关注指定用户
2623
+ */
2624
+ declare class User extends Base {
2625
+ constructor(base: Base);
2626
+ /**
2627
+ * 获取指定的用户信息
2628
+ * 不止可以获取用户信息还可以获取组织信息
2629
+ * 权限:无需任何权限
2630
+ * @param options - 用户参数
2631
+ * - username - 用户名或组织名
2632
+ * @example
2633
+ * ```ts
2634
+ * const userInfo = await user.get_user_info({ username: 'username' })
2635
+ * console.log(userInfo)
2636
+ * ```
2637
+ */
2638
+ get_user_info(options: UserInfoParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2639
+ /**
2640
+ * 通过用户id获取用户信息
2641
+ * user_id 不是用户名, 而是github平台上用户的唯一标识符
2642
+ * 权限:无需任何权限
2643
+ * @param options - 用户参数
2644
+ * - user_id: 用户id
2645
+ * @returns 用户信息
2646
+ * @example
2647
+ * ```ts
2648
+ * const userInfo = await user.get_user_info_by_user_id({ user_id: 123456789 })
2649
+ * console.log(userInfo)
2650
+ * ```
2651
+ */
2652
+ get_user_info_by_user_id(options: UserIdParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2653
+ /**
2654
+ * 通过访问令牌获取用户信息
2655
+ * 权限:无需任何权限
2656
+ * @param options - 访问令牌配置参数对象
2657
+ * - access_token - 访问令牌
2658
+ * @example
2659
+ * ```ts
2660
+ * const userInfo = await user.get_user_info_by_token({ access_token: 'access_token' })
2661
+ * console.log(userInfo)
2662
+ * ```
2663
+ */
2664
+ get_user_info_by_token(options?: UserInfoByTokenParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2665
+ /**
2666
+ * 获取用户贡献数据
2667
+ * 权限:无需任何权限
2668
+ * @param options - 用户参数
2669
+ * - username: 用户名
2670
+ * @returns 用户贡献数据
2671
+ * @example
2672
+ * ```ts
2673
+ * const contribution = await user.get_user_contribution({ username: 'username' })
2674
+ * console.log(contribution)
2675
+ * ```
2676
+ */
2677
+ get_user_contribution(options: UserNameParamType): Promise<ApiResponseType<ContributionResult>>;
2678
+ /**
2679
+ * 快速获取获取用户id
2680
+ * 权限:无需任何权限
2681
+ * 该方法会自动获取当前用户的id,需要传入token
2682
+ * @returns 用户id
2683
+ * @example
2684
+ * ```ts
2685
+ * const userId = await user.get_user_id()
2686
+ * console.log(userId)
2687
+ */
2688
+ get_user_id(): Promise<number | null>;
2689
+ /**
2690
+ * 快速获取获取用户名
2691
+ * 权限:无需任何权限
2692
+ * 该方法会自动获取当前用户的用户名,需要传入token
2693
+ * @returns 用户名
2694
+ * @example
2695
+ * ```ts
2696
+ * const username = await user.get_username()
2697
+ * console.log(username)
2698
+ * ```
2699
+ */
2700
+ get_username(): Promise<string | null>;
2701
+ /**
2702
+ * 快速获取获取用户昵称
2703
+ * 该方法会自动获取当前用户的昵称,需要传入token
2704
+ * 权限:无需任何权限
2705
+ * @remarks 用户昵称可能会为null
2706
+ * @returns 昵称
2707
+ * @example
2708
+ * ```ts
2709
+ * const nickname = await user.get_nickname()
2710
+ * console.log(nickname)
2711
+ * ```
2712
+ */
2713
+ get_nickname(): Promise<string | null>;
2714
+ /**
2715
+ * 快速获取获取用户邮箱
2716
+ * 该方法会自动获取当前用户的邮箱,需要传入token
2717
+ * 权限:无需任何权限
2718
+ * @returns 邮箱
2719
+ * @example
2720
+ * ```ts
2721
+ * const email = await user.get_email()
2722
+ * console.log(email)
2723
+ * ```
2724
+ */
2725
+ get_user_email(): Promise<string | null>;
2726
+ /**
2727
+ * 快速获取获取用户头像地址
2728
+ * 该方法会自动获取当前用户的头像地址,需要传入token
2729
+ * 权限:无需任何权限
2730
+ * @returns 头像地址
2731
+ * @example
2732
+ * ```ts
2733
+ * const avatarUrl = await user.get_avatar_url()
2734
+ * console.log(avatarUrl)
2735
+ * ```
2736
+ */
2737
+ get_avatar_url(): Promise<string | null>;
2738
+ }
2739
+
2740
+ /**
2741
+ * Base WebHook操作类
2742
+ *
2743
+ * 提供对GitHub WebHook的CRUD操作,包括:
2744
+ * - 检查webhook签名是否正确
2745
+ */
2746
+ declare class WebHook extends Base {
2747
+ constructor(base: Base);
2748
+ /**
2749
+ * 检查WebHook签名是否正确
2750
+ * 权限:无需任何权限
2751
+ * @param options - WebHook参数对象,必须包含以下参数:
2752
+ * - secret: WebHook的密钥, 可以从Base类入口传递
2753
+ * - payload: 要验证的签名主体
2754
+ * - signature: 要验证的签名
2755
+ * @returns 验证结果
2756
+ * @example
2757
+ * ```ts
2758
+ * const res = await check_webhook_signature({
2759
+ * secret: 'your_secret',
2760
+ * payload: 'your_payload',
2761
+ * signature: 'your_signature'
2762
+ * })
2763
+ * ```
2764
+ */
2765
+ check_webhook_signature(options: WebHookParamType): Promise<ApiResponseType<boolean>>;
2766
+ }
2767
+
2768
+ /**
2769
+ * GitHub API 基础服务类,提供与GitHub API交互的核心功能
2770
+ *
2771
+ * 此类作为GitHub API功能的入口点,封装了以下核心能力:
2772
+ * - JWT令牌生成与管理
2773
+ * - 请求代理配置
2774
+ * - 基础HTTP请求方法(GET/POST)
2775
+ * - 应用认证管理
2776
+ * - 模块化服务(App/Auth/Commit/Repo/User/WebHook)
2777
+ *
2778
+ * @example
2779
+ * ```ts
2780
+ * const base = new Base({
2781
+ * APP_ID: 12345,
2782
+ * Private_Key: '-----BEGIN PRIVATE KEY-----...',
2783
+ * Client_ID: 'Iv1.1234567890abcdef',
2784
+ * Client_Secret: 'abcdef1234567890abcdef1234567890abcdef12',
2785
+ * WebHook_Secret: 'webhook_secret'
2786
+ * });
2787
+ * ```
2788
+ */
2789
+ declare class Base {
2790
+ app: App;
2791
+ auth: Auth;
2792
+ commit: Commit;
2793
+ repo: Repo;
2794
+ user: User;
2795
+ webhook: WebHook;
2796
+ issue: Issue;
2797
+ org: Org;
2798
+ BaseUrl: string;
2799
+ ApiUrl: string;
2800
+ jwtToken: string;
2801
+ userToken: string | null;
2802
+ readonly format: boolean;
2803
+ readonly Private_Key: string;
2804
+ readonly Client_ID: string;
2805
+ readonly Client_Secret: string;
2806
+ readonly WebHook_Secret: string;
2807
+ private currentRequestConfig;
2808
+ private proxy?;
2809
+ constructor(options: GitHubAuthType);
2810
+ /**
2811
+ * 获取App实例
2812
+ * @returns App实例
2813
+ * @example
2814
+ * ```ts
2815
+ * const app = await base.get_app()
2816
+ * ```
2817
+ */
2818
+ get_app(): Promise<App>;
2819
+ /**
2820
+ * 获取Auth实例
2821
+ * @returns Auth实例
2822
+ * @example
2823
+ * ```ts
2824
+ * const auth = await base.get_auth()
2825
+ * ```
2826
+ */
2827
+ get_auth(): Promise<Auth>;
2828
+ /**
2829
+ * 获取Commit实例
2830
+ * @returns Commit实例
2831
+ * @example
2832
+ * ```ts
2833
+ * const commit = await base.get_commit()
2834
+ * ```
2835
+ */
2836
+ get_commit(): Promise<Commit>;
2837
+ /**
2838
+ * 获取Issue实例
2839
+ * @returns Issue实例
2840
+ * @example
2841
+ * ```ts
2842
+ * const issue = await base.get_issue()
2843
+ * ```
2844
+ */
2845
+ get_issue(): Promise<Issue>;
2846
+ /**
2847
+ * 获取Repo实例
2848
+ * @returns Repo实例
2849
+ * @example
2850
+ * ```ts
2851
+ * const repo = await base.get_repo()
2852
+ * ```
2853
+ */
2854
+ get_repo(): Promise<Repo>;
2855
+ /**
2856
+ * 获取User实例
2857
+ * @returns User实例
2858
+ * @example
2859
+ * ```ts
2860
+ * const user = await base.get_user()
2861
+ * ```
2862
+ */
2863
+ get_user(): Promise<User>;
2864
+ /**
2865
+ * 获取Org实例
2866
+ * @returns Org实例
2867
+ * @example
2868
+ * ```ts
2869
+ * const org = await base.get_org()
2870
+ * ```
2871
+ */
2872
+ get_org(): Promise<Org>;
2873
+ /**
2874
+ * 获取WebHook实例
2875
+ * @returns WebHook实例
2876
+ * @example
2877
+ * ```ts
2878
+ * const webhook = await base.get_webhook()
2879
+ * ```
2880
+ */
2881
+ get_webhook(): Promise<WebHook>;
2882
+ /**
2883
+ * 设置请求代理
2884
+ * @param proxy 代理参数
2885
+ * @example
2886
+ * ```ts
2887
+ * setProxy({
2888
+ * type: 'http',
2889
+ * address: 'http://127.0.0.1:7890'
2890
+ * })
2891
+ * ```
2892
+ */
2893
+ setProxy(proxy: ProxyParamsType): void;
2894
+ /**
2895
+ * 设置 token
2896
+ * 传入的 token 必须以 ghu_ 开头,否则会抛出错误
2897
+ * @param token 传入的 token
2898
+ * @example
2899
+ * ```ts
2900
+ * setToken('ghu_xxxx')
2901
+ * ```
2902
+ */
2903
+ setToken(token: string): this;
2904
+ /**
2905
+ * 生成 JWT Token
2906
+ * @param options 生成 JWT 所需的参数
2907
+ * @param options.APP_ID GitHub App ID
2908
+ * @param options.Private_Key 私钥内容
2909
+ * @returns 返回生成的 JWT
2910
+ */
2911
+ private generate_jwt;
2912
+ /**
2913
+ * 设置当前请求的配置
2914
+ * @protected - 仅在类内部访问
2915
+ * @param config - 配置对象,包含以下属性:
2916
+ * - url: 请求的URL
2917
+ * - token: 认证令牌
2918
+ * - tokenType: 认证令牌类型,默认为 'Bearer'
2919
+ */
2920
+ protected setRequestConfig(config: RequestConfigType): void;
2921
+ /**
2922
+ * 创建一个新的请求实例
2923
+ * @returns 返回一个新的 Request 实例
2924
+ */
2925
+ private createRequest;
2926
+ /**
2927
+ * Github GET 请求方法
2928
+ * @param path - 请求路径
2929
+ * @param parms - 请求参数
2930
+ * @param customHeaders - 请求头,选项
2931
+ * @returns 请求结果
2932
+ */
2933
+ get(path: string, parms?: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
2934
+ /**
2935
+ * Github POST 请求方法
2936
+ * @param path - 请求路径
2937
+ * @param data - 请求数据
2938
+ * @param customHeaders - 请求头,选项
2939
+ * @returns 请求结果
2940
+ */
2941
+ post(path: string, data: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
2942
+ /**
2943
+ * Github PATCH 请求方法
2944
+ * @param path - 请求路径
2945
+ * @param data - 请求数据
2946
+ * @param params - URL查询参数
2947
+ * @param customHeaders - 请求头,选项
2948
+ * @returns 请求结果
2949
+ */
2950
+ patch(path: string, params: (Record<string, string> | null) | undefined, data: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
2951
+ /**
2952
+ * Github PUT 请求方法
2953
+ * @param path - 请求路径
2954
+ * @param data - 请求数据
2955
+ * @param customHeaders - 请求头,选项
2956
+ * @returns 请求结果
2957
+ */
2958
+ put(path: string, data: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
2959
+ /**
2960
+ * Github DELETE 请求方法
2961
+ * @param path - 请求路径
2962
+ * @param params - URL查询参数
2963
+ * @param data - 请求体数据
2964
+ * @param customHeaders - 请求头,选项
2965
+ * @returns 请求结果
2966
+ */
2967
+ delete(path: string, params?: Record<string, string> | null, data?: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
2968
+ }
2969
+
2970
+ /**
2971
+ * GitHub 应用管理类
2972
+ *
2973
+ * 提供对GitHub App的完整管理功能,包括:
2974
+ * - 获取应用基本信息
2975
+ * - 生成应用安装链接
2976
+ * - 生成应用配置链接
2977
+ *
2978
+ */
2979
+ declare class App extends Base {
2980
+ constructor(base: Base);
2981
+ /**
2982
+ * 获取当前 Github App 信息
2983
+ * @returns 返回 Github App 信息
2984
+ */
2985
+ private get_info;
2986
+ /**
2987
+ * 生成Github App 安装链接
2988
+ * @param state_id - 随机生成的 state_id,用于验证授权请求的状态,可选,默认不使用
2989
+ * @returns 返回安装链接对象
2990
+ * @returns state_id 随机生成的字符串,用于验证
2991
+ * @returns install_link 安装链接,用于跳转 Github 安装页
2992
+ */
2993
+ create_install_link(state_id?: string): Promise<string>;
2994
+ /**
2995
+ * 生成Github Apps 配置链接
2996
+ * @param state_id - 传入的 state_id, 随机字符串
2997
+ * @returns 返回配置链接对象
2998
+ * @returns config_install_link 配置链接
2999
+ * @example
3000
+ * ```ts
3001
+ * const link = await app.create_config_install_link('state_id')
3002
+ * console.log(link) // https://github.com/apps/<app_name>/installations/new?state=<state_id></state_id>
3003
+ * ```
3004
+ */
3005
+ create_config_install_link(state_id?: string): Promise<string>;
3006
+ /**
3007
+ * 获取仓库的应用安装信息
3008
+ * @param options - 仓库安装应用参数对象
3009
+ * - owner 拥有者
3010
+ * - repo 仓库名
3011
+ * - url 仓库地址
3012
+ * ownwe和repo与url只能二选一
3013
+ * @returns 返回应用安装信息
3014
+ * @example
3015
+ * ```ts
3016
+ * const app = base.get_app()
3017
+ * console.log(app.get_app_installation_by_repo({owner: 'owner', repo: 'repo'})) // 输出仓库的应用信息
3018
+ * ```
3019
+ */
3020
+ get_app_installation_by_repo(options: RepoInfoParamType): Promise<ApiResponseType<GitHubAppRepoInfoResponseType>>;
3021
+ /**
3022
+ * 快速获取当前 Github App 名称
3023
+ * @returns 返回 Github App 名称
3024
+ * @example
3025
+ * ```ts
3026
+ * const app = base.get_app()
3027
+ * console.log(app.get_app_name()) // 输出AppName
3028
+ * ```
3029
+ */
3030
+ get_app_name(): Promise<string>;
3031
+ }
3032
+
3033
+ type index_App = App;
3034
+ declare const index_App: typeof App;
3035
+ type index_Auth = Auth;
3036
+ declare const index_Auth: typeof Auth;
3037
+ type index_Base = Base;
3038
+ declare const index_Base: typeof Base;
3039
+ type index_Commit = Commit;
3040
+ declare const index_Commit: typeof Commit;
3041
+ type index_Issue = Issue;
3042
+ declare const index_Issue: typeof Issue;
3043
+ type index_Org = Org;
3044
+ declare const index_Org: typeof Org;
3045
+ type index_Repo = Repo;
3046
+ declare const index_Repo: typeof Repo;
3047
+ type index_User = User;
3048
+ declare const index_User: typeof User;
3049
+ type index_WebHook = WebHook;
3050
+ declare const index_WebHook: typeof WebHook;
3051
+ declare namespace index {
3052
+ export { index_App as App, index_Auth as Auth, index_Base as Base, index_Commit as Commit, index_Issue as Issue, index_Org as Org, index_Repo as Repo, index_User as User, index_WebHook as WebHook };
3053
+ }
3054
+
3055
+ export { type AccessCodeType, type AccessTokenType, type AccountBaseType, type AddCollaboratorResponseType, type AddSubIssueParamType, type AddSubIssueResponseType, type ApiResponseType, type ApiType, type CloseIssueParamType, type CloseIssueResponseType, type CodeOfConduct, type CollaboratorInfo, type CollaboratorListParamType, type CollaboratorListResponseType, type CollaboratorParamType, type Commit$1 as Commit, type CommitInfoBaseParamType, type CommitInfoCommonParamType, type CommitInfoParamType, type CommitInfoResponseType, type CommitInfoUrlParamType, type CommitStats, type CommonProxyType, type ContributionData, type ContributionResult, type CreateIssueResponseType, type CreteIssueCommentParamType, type CreteIssueCommentResponseType, type CreteIssueParamType, type DiffEntry, type GitHubAccountBaseType, type GitHubAccountType, type GitHubAppDetailedPermissions, type GitHubAppInfoType, type GitHubAppPermissions, type GitHubAppRepoInfoResponseType, type GitHubAuthType, type GitUser, type GithubOauthCheckTokenResponseType, type GithubOauthRefreshTokenResponseType, type GithubOauthTokenResponseType, type HttpProxyType, type HttpsProxyType, type IssueCommentInfoParamType, type IssueCommentInfoResponseType, type IssueCommentListParamType, type IssueCommentListResponseType, type IssueInfoParamType, type IssueInfoResponseType, type IssueLabelType, type IssueListResponseType, type License, type LockIssueParamType, type LockIssueResponseType, type MergeCommitMessage, type MergeCommitTitle, type MilestoneType, type OpenIssueParamType, type OpenIssueResponseType, type OrgRepoCreateParamType, type OrgRepoListParmsType, type OrgRepoListType, type OrganizationBaseType, type OrganizationInfoType, type OrganizationMemberType, type OrganizationNameParamType, type OrganizationPermissionsAndConfigType, type OrganizationPlanType, type OrganizationRepositoryAndGistsType, type OrganizationSecurityConfigType, type OrganizationUrlType, type Owner, type ParentCommit, type Permissions, type PkgInfoType, type ProxyParamsType, type PullRequestType, type RefreshTokenType, type RemoveCollaboratorParamType, type RemoveCollaboratorResponseType, type RemoveIssueCommentParamType, type RemoveIssueCommentResponseType, type RemoveSubIssueParamType, type RemoveSubIssueResponseType, type RepoBaseParamType, type RepoCommentListParamType, type RepoCommentListResponseType, type RepoDefaultBranchResponseType, type RepoInfoParamType, type RepoInfoResponseType, type RepoIssueListParamType, type RepoListBaseParamType, type RepoNameParamType, type RepoOwnerParamType, type RepoUrlParamType, type RepoVisibilityResponseType, type ReprioritizeSubIssueParamType, type ReprioritizeSubIssueResponseType, type RequestConfigType, type RequestTokenType, type ResponseMsgType, type ResponseStatusCodeType, type ResponseSuccessType, type ResponseType, type ReverseProxyCommonUrlType, type SecurityAnalysisAdvancedSecurity, type SecurityAnalysisDependabotSecurityUpdates, type SecurityAnalysisSecretScanning, type SecurityAnalysisSecretScanningPushProtection, type SecurityAndAnalysis, type ShaParamType, type SocksProxyType, type SquashMergeCommitMessage, type SquashMergeCommitTitle, type SubIssueListParamType, type SubIssueListResponseType, type UnLockIssueParamType, type UnLockIssueResponseType, type UpdateIssueCommentParamType, type UpdateIssueCommentResponseType, type UpdateIssueParamType, type UpdateIssueResponseType, type UserByTokenRepoListParamType, type UserIdParamType, type UserInfoByTokenParamType, type UserInfoParamType, type UserInfoResponseType, type UserNameParamType, type UserPlanType, type UserRepoListParamType, type UserRepoListType, type Verification, type WebHookParamType, create_state_id, formatDate, type formatParamType, get_relative_time, index as github };