@candriajs/git-neko-kit 0.5.2 → 0.6.0

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.
package/dist/index.d.ts CHANGED
@@ -59,15 +59,18 @@ type ResponseSuccessType = boolean;
59
59
  type ResponseStatusCodeType = number;
60
60
  /** 消息响应类型 */
61
61
  type ResponseMsgType = string;
62
+ /** 响应头类型 */
63
+ type ResponseHeadersType = Record<string, string | string[] | number | boolean | null>;
62
64
  /** 响应类型 */
63
65
  interface ResponseType<D = any> {
64
66
  success: ResponseSuccessType;
65
67
  statusCode: ResponseStatusCodeType;
68
+ headers: ResponseHeadersType;
66
69
  msg: ResponseMsgType;
67
70
  data: D;
68
71
  }
69
72
  /** API响应类型 */
70
- interface ApiResponseType<D = any> extends Omit<ResponseType<D>, 'success'> {
73
+ interface ApiResponseType<D = any> extends Omit<ResponseType<D>, 'headers'> {
71
74
  status: 'ok' | 'error';
72
75
  }
73
76
 
@@ -137,652 +140,98 @@ interface formatParamType {
137
140
  /** 是否格式化 */
138
141
  format: boolean;
139
142
  }
140
- /** guthub基础入口类型 */
141
- interface GitHubAuthType {
142
- /** 私钥内容 */
143
- Private_Key: string;
144
- /** Base App Client ID */
143
+ /**
144
+ * 一个仓库基本参数
145
+ * 包含:
146
+ * - owner: 仓库拥有者
147
+ * - repo: 仓库名称
148
+ */
149
+ type RepoBaseParamType = RepoOwnerParamType & RepoNameParamType;
150
+ /**
151
+ * 一个仓库参数, 可以是基本参数,也可以是仓库地址
152
+ * 包含:
153
+ * - owner: 仓库拥有者
154
+ * - repo: 仓库名称
155
+ * - url: 仓库地址
156
+ */
157
+ type RepoParamType = RepoBaseParamType | RepoUrlParamType;
158
+ /**
159
+ * 议题参数
160
+ */
161
+ interface IssueIdParamType {
162
+ /** 问题id */
163
+ issue_id: number | string;
164
+ }
165
+ /** App 基础入口类型 */
166
+ interface AppClientType {
167
+ /** App Client ID */
145
168
  Client_ID: string;
146
- /** Base App Client Secret */
169
+ /** App Client Secret */
147
170
  Client_Secret: string;
171
+ /** 私钥内容 */
172
+ Private_Key: string;
148
173
  /** WebHook Secret */
149
174
  WebHook_Secret: string;
150
175
  /** 是否格式化 */
151
176
  format?: formatParamType['format'];
152
177
  }
153
178
 
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;
179
+ interface ClientType {
180
+ github: AppClientType;
265
181
  }
266
182
 
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;
183
+ /** 用户信息参数类型 */
184
+ interface UserInfoParamType extends UserNameParamType {
185
+ /** 授权token */
186
+ access_token?: AccessTokenType['access_token'];
683
187
  }
684
- interface RepoDefaultBranchResponseType {
685
- /** * 仓库的默认分支名称 */
686
- default_branch: string;
188
+ /** 授权用户信息参数对象类型 */
189
+ interface UserInfoByAuthParamType {
190
+ /** 授权token */
191
+ access_token?: AccessTokenType['access_token'];
687
192
  }
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;
193
+ /** 通过用户ID 获取用户信息参数类型 */
194
+ interface UserInfoByIdParamType extends UserIdParamType {
195
+ /** 授权token */
196
+ access_token?: AccessTokenType['access_token'];
708
197
  }
709
- /** 协作者列表参数类型 */
710
- type CollaboratorListParamType = RepoInfoParamType & {
711
- /**
712
- * 筛选按隶属关系返回的协作者
713
- * outside - 列出所有外部协作者,包括仓库成员和外部 collaborator。
714
- * direct - 列出仓库成员。
715
- * all - 列出仓库成员和外部 collaborator。
716
- */
717
- affiliation?: 'outside' | 'direct' | 'all';
198
+ /** 用户信息响应类型 */
199
+ interface UserInfoResponseType {
200
+ /** 账号ID */
201
+ id: number;
202
+ /** 账号登录名 */
203
+ login: string;
204
+ /** 用户全名 */
205
+ name: string | null;
206
+ /** 邮箱 */
207
+ email: string | null;
718
208
  /**
719
- * 筛选按权限关系返回的协作者
720
- * pull - 只读访问,协作者可以查看仓库内容。
721
- * triage - 允许管理议题和拉取请求,包括标记、分配和修改状态。
722
- * push - 允许推送代码到仓库分支,同时拥有 pull 权限。
723
- * maintain - 允许管理仓库中的代码和议题,但不能更改仓库设置。
724
- * admin - 拥有仓库的完全控制权,包括更改设置和删除仓库。
209
+ * 账号类型
210
+ * User: 用户
211
+ * Organization: 组织
725
212
  */
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;
213
+ type: string;
214
+ /** 账号主页URL */
215
+ html_url: string;
216
+ /** 账号头像URL */
217
+ avatar_url: string;
218
+ /** 公司 */
219
+ company: string | null;
220
+ /** 个人简介 */
221
+ bio: string | null;
222
+ /** 博客URL */
223
+ blog: string | null;
224
+ /** 粉丝数 */
225
+ followers: number;
226
+ /** 关注数 */
227
+ following: number;
780
228
  }
781
229
 
230
+ type AppOwner = Omit<UserInfoResponseType, 'company' | 'bio' | 'blog' | 'followers' | 'following'>;
782
231
  /**
783
232
  * 定义 Base 应用所需的权限
784
233
  */
785
- interface GitHubAppPermissions {
234
+ interface AppPermissions {
786
235
  /** 对仓库内容的权限(例如读取、写入) */
787
236
  contents: string;
788
237
  /** 对部署的权限(例如读取、写入) */
@@ -794,172 +243,74 @@ interface GitHubAppPermissions {
794
243
  /** 对元数据的权限(例如读取) */
795
244
  metadata: string;
796
245
  }
246
+ interface AppInfoParamType {
247
+ /**
248
+ * 应用的标识符
249
+ * 是https://github.com/settings/apps/:app_slug的
250
+ * */
251
+ app_slug: string;
252
+ /** 访问令牌 */
253
+ access_token?: AccessTokenType['access_token'];
254
+ }
797
255
  /**
798
- * 定义 Base 应用的详细信息
256
+ * 应用的详细信息
799
257
  */
800
- interface GitHubAppInfoType {
258
+ interface AppInfoResponseType {
801
259
  /** 应用的唯一 ID */
802
260
  id: number;
261
+ /** 应用的名称 */
262
+ name: string;
803
263
  /** 应用的 Client ID */
804
264
  client_id: string;
805
265
  /** 应用的标识符(slug) */
806
266
  slug: string;
807
- /** 应用的唯一 Node ID */
808
- node_id: string;
809
267
  /** 应用所有者的信息 */
810
- owner: Owner;
811
- /** 应用的名称 */
812
- name: string;
268
+ owner: AppOwner;
813
269
  /** 应用的描述 */
814
270
  description: string;
815
271
  /** 应用的外部 URL */
816
272
  external_url: string;
817
273
  /** 应用的 Base 页面 URL */
818
274
  html_url: string;
275
+ /** 应用所需的权限 */
276
+ permissions: AppPermissions;
277
+ /** 应用监听的事件列表 */
278
+ events: string[];
819
279
  /** 应用创建时间的时间戳 */
820
280
  created_at: string;
821
281
  /** 应用最后更新时间的时间戳 */
822
282
  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
283
  }
925
284
  /** GitHub应用安装仓库信息响应类型 */
926
- interface GitHubAppRepoInfoResponseType {
285
+ interface AppRepoInfoResponseType {
927
286
  /** 安装的唯一ID */
928
287
  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
288
  /** 安装页面URL */
938
289
  html_url: string;
939
290
  /** 应用ID */
940
291
  app_id: number;
292
+ /** 应用标识符 */
293
+ app_slug: string;
941
294
  /** 目标ID(用户或组织的ID) */
942
295
  target_id: number;
943
296
  /** 目标类型(如'Organization') */
944
297
  target_type: string;
298
+ /** 安装的账户信息,可以是用户或企业 */
299
+ account: AppOwner | null;
300
+ /** 仓库选择类型 */
301
+ repository_selection: 'all' | 'selected';
302
+ /** 访问令牌URL */
303
+ access_tokens_url: string;
304
+ /** 仓库列表URL */
305
+ repositories_url: string;
945
306
  /** 权限配置 */
946
- permissions: GitHubAppDetailedPermissions;
307
+ permissions: AppPermissions;
947
308
  /** 事件列表 */
948
309
  events: string[];
949
310
  /** 创建时间 */
950
311
  created_at: string;
951
312
  /** 更新时间 */
952
313
  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
314
  }
964
315
 
965
316
  /** Github 授权令牌接口返回类型 */
@@ -1008,43 +359,27 @@ interface CommitInfoCommonParamType {
1008
359
  /** 提交SHA */
1009
360
  sha?: ShaParamType['sha'];
1010
361
  /** 是否格式化消息和日期 */
1011
- format: formatParamType['format'];
362
+ format?: formatParamType['format'];
1012
363
  }
1013
364
  /**
1014
365
  * 提交信息基础参数类型
1015
366
  * 用于获取提交信息的基础参数类型,包含仓库的拥有者、仓库名称、提交SHA等信息。
1016
367
  * */
1017
- interface CommitInfoBaseParamType extends RepoOwnerParamType, RepoNameParamType, CommitInfoCommonParamType {
1018
- }
368
+ type CommitInfoBaseParamType = RepoBaseParamType & CommitInfoCommonParamType;
1019
369
  /**
1020
370
  * 提交信息URL参数类型
1021
371
  * 用于获取提交信息的URL参数类型,包含仓库的URL和提交SHA等信息。
1022
372
  * */
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;
373
+ type CommitInfoUrlParamType = RepoUrlParamType & CommitInfoCommonParamType;
374
+ /** Git提交用户信息 */
375
+ interface GitUser extends Omit<UserInfoResponseType, 'company' | 'bio' | 'blog' | 'followers' | 'following'> {
1032
376
  /** 日期字符串 */
1033
377
  date: string;
1034
378
  }
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
- }
379
+ /**
380
+ * 验证信息类型
381
+ * 这个只有GitHub平台返回
382
+ */
1048
383
  interface Commit$1 {
1049
384
  /** 提交的URL */
1050
385
  url: string;
@@ -1062,11 +397,9 @@ interface Commit$1 {
1062
397
  title?: string;
1063
398
  /** 提交正文
1064
399
  * 仅在开启格式化消息时返回
1065
- * @example "This is a new feature that adds a new feature to the application."
400
+ * @example "- add new feature"
1066
401
  */
1067
402
  body?: string;
1068
- /** 评论数量 */
1069
- comment_count: number;
1070
403
  /** 提交树信息 */
1071
404
  tree: {
1072
405
  /** 树对象的SHA */
@@ -1074,8 +407,6 @@ interface Commit$1 {
1074
407
  /** 树对象的URL */
1075
408
  url: string;
1076
409
  };
1077
- /** 验证信息 */
1078
- verification: Verification;
1079
410
  }
1080
411
  interface DiffEntry {
1081
412
  /** 文件SHA */
@@ -1094,12 +425,6 @@ interface DiffEntry {
1094
425
  blob_url: string;
1095
426
  /** 文件原始URL */
1096
427
  raw_url: string;
1097
- /** 文件内容URL */
1098
- contents_url: string;
1099
- /** 文件差异补丁 */
1100
- patch: string;
1101
- /** 之前的文件名 */
1102
- previous_filename: string | null;
1103
428
  }
1104
429
  interface CommitStats {
1105
430
  /** 新增行数 */
@@ -1114,157 +439,54 @@ interface ParentCommit {
1114
439
  sha: string;
1115
440
  /** 父提交URL */
1116
441
  url: string;
1117
- /** 父提交HTML URL */
1118
- html_url: string;
1119
442
  }
443
+ /** 提交参数类型 */
444
+ type CommitInfoParamType = CommitInfoBaseParamType | CommitInfoUrlParamType;
445
+ /** 提交信息响应类型 */
1120
446
  interface CommitInfoResponseType {
1121
447
  /** 提交URL */
1122
448
  url: string;
1123
449
  /** 提交SHA */
1124
450
  sha: string;
1125
- /** 节点ID */
1126
- node_id: string;
1127
451
  /** HTML URL */
1128
452
  html_url: string;
1129
453
  /** 评论URL */
1130
454
  comments_url: string;
1131
455
  /** 提交信息 */
1132
456
  commit: Commit$1;
1133
- /** 提交作者 */
1134
- author: AccountBaseType | null;
1135
- /** 提交者 */
1136
- committer: AccountBaseType | null;
1137
457
  /** 父提交列表 */
1138
458
  parents: ParentCommit[];
1139
459
  /** 提交统计信息 */
1140
- stats?: CommitStats;
460
+ stats: CommitStats;
1141
461
  /** 变更文件列表 */
1142
- files?: DiffEntry[];
462
+ files: DiffEntry[];
1143
463
  }
1144
464
 
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
- };
465
+ /** 议题用户信息响应类型 */
466
+ type IssueUser = Omit<UserInfoResponseType, 'company' | 'bio' | 'blog' | 'followers' | 'following'>;
1229
467
  /** 议题标签类型 */
1230
468
  interface IssueLabelType {
1231
469
  /** 标签ID */
1232
- id?: number;
1233
- /** 标签节点ID */
1234
- node_id?: string;
1235
- /** 标签URL */
1236
- url?: string;
470
+ id: number;
1237
471
  /** 标签名称 */
1238
472
  name: string;
1239
- /** 标签描述 */
1240
- description?: string | null;
1241
473
  /** 标签颜色代码 */
1242
474
  color?: string | null;
1243
- /** 是否是默认标签 */
1244
- default?: boolean;
1245
475
  }
1246
476
  /** 议题里程碑类型 */
1247
477
  interface MilestoneType {
1248
- /** 里程碑URL */
1249
- url: string;
1250
- /** 里程碑HTML URL */
1251
- html_url: string;
1252
- /** 里程碑标签URL */
1253
- labels_url: string;
1254
478
  /** 里程碑ID */
1255
479
  id: number;
1256
- /** 里程碑节点ID */
1257
- node_id: string;
480
+ /** 里程碑URL */
481
+ url: string;
1258
482
  /** 里程碑编号 */
1259
483
  number: number;
1260
- /** 里程碑状态: open/closed */
484
+ /** 里程碑状态: open/closed/active */
1261
485
  state: string;
1262
486
  /** 里程碑标题 */
1263
487
  title: string;
1264
488
  /** 里程碑描述 */
1265
489
  description: string | null;
1266
- /** 里程碑创建者 */
1267
- creator: UserInfoResponseType | null;
1268
490
  /** 开放议题数 */
1269
491
  open_issues: number;
1270
492
  /** 关闭议题数 */
@@ -1278,39 +500,21 @@ interface MilestoneType {
1278
500
  /** 截止时间 */
1279
501
  due_on: string | null;
1280
502
  }
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
- }
503
+ /** 议题信息参数类型 */
504
+ type IssueInfoParamType = RepoParamType & {
505
+ /** 议题ID */
506
+ issue_number: IssueIdParamType['issue_id'];
507
+ };
1294
508
  /** 议题详情响应类型 */
1295
509
  interface IssueInfoResponseType {
1296
510
  /** 议题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;
511
+ id: IssueIdParamType['issue_id'];
1310
512
  /** 议题HTML页面URL */
1311
513
  html_url: string;
1312
514
  /** 议题编号 */
1313
515
  number: number;
516
+ /** 评论数 */
517
+ comments: number;
1314
518
  /** 议题状态: open/closed */
1315
519
  state: string;
1316
520
  /** 状态原因: completed/reopened/not_planned/null */
@@ -1320,34 +524,106 @@ interface IssueInfoResponseType {
1320
524
  /** 议题正文内容 */
1321
525
  body: string | null;
1322
526
  /** 议题创建者用户信息 */
1323
- user: UserInfoResponseType | null;
527
+ user: IssueUser | null;
1324
528
  /** 议题标签 */
1325
- labels: Array<IssueLabelType | string>;
1326
- /** 议题指派人 */
1327
- assignee: UserInfoResponseType | null;
1328
- /** 议题所有指派人列表 */
1329
- assignees: Array<UserInfoResponseType> | null;
529
+ labels: Array<IssueLabelType> | null;
530
+ /**
531
+ * 议题指派人
532
+ * 当没有指派人时,返回 null
533
+ */
534
+ assignee: IssueUser | null;
535
+ /**
536
+ * 议题所有指派人列表
537
+ * 先不处理,后面再说
538
+ * */
1330
539
  /** 议题所属里程碑 */
1331
540
  milestone: MilestoneType | null;
1332
- /** 是否锁定 */
1333
- locked: boolean;
1334
- /** 活跃锁定原因 */
1335
- active_lock_reason: string | null;
1336
- /** 评论数 */
1337
- comments: number;
1338
- /** 关联的拉取请求信息 */
1339
- pull_request?: PullRequestType;
1340
541
  /** 关闭时间 */
1341
542
  closed_at: string | null;
1342
543
  /** 创建时间 */
1343
544
  created_at: string;
1344
545
  /** 更新时间 */
1345
546
  updated_at: string;
1346
- /** 是否是草稿 */
1347
- draft?: boolean;
1348
- /** 关闭者信息 */
1349
- closed_by?: UserInfoResponseType | null;
1350
547
  }
548
+ /** 议题列表参数类型 */
549
+ type RepoIssueListParamType = RepoParamType & {
550
+ /**
551
+ * 里程碑筛选
552
+ * @default *
553
+ * @enum {string | number}
554
+ * - 传入数字时:按里程碑编号筛选
555
+ * - 传入 "*":接受任何里程碑的议题
556
+ * - 传入 "none":返回没有里程碑的议题
557
+ */
558
+ milestone?: string | number;
559
+ /**
560
+ * 议题状态
561
+ * @default "open"
562
+ * @enum {string}
563
+ * - open: 打开的议题
564
+ * - closed: 关闭的议题
565
+ * - all: 所有议题
566
+ */
567
+ state?: 'all' | 'open' | 'closed';
568
+ /**
569
+ * 指派人用户名
570
+ * - 传入用户名:返回指派给该用户的议题
571
+ * - 传入 "none":返回所有的议题
572
+ * - 传入用户名:返回指派给该用户的议题
573
+ * - 传入 "*":返回已指派给任何用户的议题
574
+ */
575
+ assignee?: string;
576
+ /**
577
+ * 议题类型
578
+ * - 传入类型名:返回指定类型的议题
579
+ * - 传入 "*":接受任何类型的议题
580
+ * - 传入 "none":返回没有类型的议题
581
+ */
582
+ type?: string;
583
+ /** 创建者用户名,筛选由特定用户创建的议题 */
584
+ creator?: string;
585
+ /**
586
+ * 标签列表
587
+ * 以逗号分隔的标签名称列表
588
+ * @example "bug,ui,@high"
589
+ */
590
+ labels?: string;
591
+ /**
592
+ * 排序方式
593
+ * @default "created"
594
+ * @enum {string}
595
+ * - created: 按创建时间排序
596
+ * - updated: 按更新时间排序
597
+ * - comments: 按评论数排序
598
+ */
599
+ sort?: 'created' | 'updated' | 'comments';
600
+ /**
601
+ * 排序方向
602
+ * @default "desc"
603
+ * @enum {string}
604
+ * - asc: 升序
605
+ * - desc: 降序
606
+ */
607
+ direction?: 'asc' | 'desc';
608
+ /**
609
+ * 筛选此时间之后更新的议题
610
+ * 仅显示在指定时间之后更新的结果
611
+ * 格式为 ISO 8601: YYYY-MM-DDTHH:MM:SSZ
612
+ * @example "2023-01-01T00:00:00Z"
613
+ */
614
+ since?: string;
615
+ /**
616
+ * 每页结果数量
617
+ * @default 30
618
+ * @remarks 取值范围:1-100
619
+ */
620
+ per_page?: number;
621
+ /**
622
+ * 页码
623
+ * @default 1
624
+ */
625
+ page?: number;
626
+ };
1351
627
  /** 议题列表响应类型 */
1352
628
  type IssueListResponseType = IssueInfoResponseType[];
1353
629
  /** 创建议题参数类型 */
@@ -1356,65 +632,43 @@ type CreteIssueParamType = RepoBaseParamType & {
1356
632
  title: string;
1357
633
  /** 正文内容 */
1358
634
  body?: string | null;
1359
- /**
1360
- * 分配的用户
1361
- * @deprecated 已弃用,请使用 assignees 字段
1362
- */
1363
- assignee?: string | null;
1364
635
  /** 里程碑 */
1365
636
  milestone?: number | string | null;
1366
637
  /** 标签列表 */
1367
- labels?: Array<string> | null;
638
+ labels?: Array<string> | string | null;
1368
639
  /** 指派的用户名 */
1369
- assignees?: Array<string> | null;
1370
- /** 议题类型 */
1371
- type?: string;
640
+ assignees?: Array<string> | string | null;
1372
641
  };
1373
642
  /** 创建议题响应类型 */
1374
643
  type CreateIssueResponseType = IssueInfoResponseType;
1375
644
  /** 更新议题参数类型 */
1376
645
  interface UpdateIssueParamType extends Omit<CreteIssueParamType, 'title' | 'type'> {
1377
- /** 议题ID */
1378
- issue_number: number;
646
+ /** 问题ID */
647
+ issue_number: IssueIdParamType['issue_id'];
1379
648
  /** 问题的名称 */
1380
649
  title?: string | null;
1381
650
  /** 问题的内容 */
1382
651
  body?: string | null;
1383
- /** 要分配给此问题的用户名(已弃用) */
1384
- assignee?: string | null;
1385
652
  /** 问题的状态:open/closed */
1386
653
  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
654
  }
1398
655
  /** 更新议题响应类型 */
1399
656
  type UpdateIssueResponseType = IssueInfoResponseType;
1400
657
  /** 打开议题参数类型 */
1401
658
  interface OpenIssueParamType extends RepoBaseParamType {
1402
659
  /** 议题ID */
1403
- issue_number: number;
660
+ issue_number: IssueIdParamType['issue_id'];
1404
661
  }
1405
662
  /** 打开议题响应类型 */
1406
663
  type OpenIssueResponseType = IssueInfoResponseType;
1407
664
  /** 关闭议题参数类型 */
1408
- interface CloseIssueParamType extends OpenIssueParamType {
1409
- /** 关闭原因 */
1410
- state_reason?: IssueInfoResponseType['state_reason'];
1411
- }
665
+ type CloseIssueParamType = OpenIssueParamType;
1412
666
  /** 关闭议题响应类型 */
1413
667
  type CloseIssueResponseType = IssueInfoResponseType;
1414
668
  /** 锁定议题参数类型 */
1415
669
  interface LockIssueParamType extends RepoBaseParamType {
1416
670
  /** 议题ID */
1417
- issue_number: number;
671
+ issue_number: IssueIdParamType['issue_id'];
1418
672
  /**
1419
673
  * 锁定原因
1420
674
  * 可以是以下之一:
@@ -1437,36 +691,22 @@ type UnLockIssueResponseType = LockIssueResponseType;
1437
691
  /** 议题评论信息参数类型 */
1438
692
  interface IssueCommentInfoParamType extends RepoBaseParamType {
1439
693
  /** 评论id,评论唯一标识符 */
1440
- comment_id: string;
694
+ comment_id: string | number;
1441
695
  }
1442
696
  /** 议题评论信息响应类型 */
1443
697
  interface IssueCommentInfoResponseType {
1444
698
  /** 评论ID */
1445
699
  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
700
  /** 评论HTML页面URL */
1457
701
  html_url: string;
702
+ /** 评论内容 */
703
+ body: string;
1458
704
  /** 评论用户信息 */
1459
- user: UserInfoResponseType | null;
705
+ user: IssueUser | null;
1460
706
  /** 创建时间 */
1461
707
  created_at: string;
1462
708
  /** 更新时间 */
1463
709
  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
710
  }
1471
711
  /** 仓库评论列表参数类型 */
1472
712
  interface RepoCommentListParamType extends RepoBaseParamType {
@@ -1542,7 +782,7 @@ type IssueCommentListResponseType = IssueCommentInfoResponseType[];
1542
782
  /** 创建议题评论参数类型 */
1543
783
  interface CreteIssueCommentParamType extends RepoBaseParamType {
1544
784
  /** 议题ID */
1545
- issue_number: number;
785
+ issue_number: IssueIdParamType['issue_id'];
1546
786
  /** 评论内容 */
1547
787
  body: string;
1548
788
  }
@@ -1558,7 +798,7 @@ type UpdateIssueCommentResponseType = IssueCommentInfoResponseType;
1558
798
  /** 删除议题评论参数类型 */
1559
799
  interface RemoveIssueCommentParamType extends RepoBaseParamType {
1560
800
  /** 评论ID */
1561
- comment_id: string;
801
+ comment_id: string | number;
1562
802
  }
1563
803
  /** 删除议题评论响应类型 */
1564
804
  interface RemoveIssueCommentResponseType {
@@ -1568,7 +808,7 @@ interface RemoveIssueCommentResponseType {
1568
808
  /** 获取子议题列表参数类型 */
1569
809
  interface SubIssueListParamType extends RepoBaseParamType {
1570
810
  /** 议题ID */
1571
- issue_number: number;
811
+ issue_number: IssueIdParamType['issue_id'];
1572
812
  /**
1573
813
  * 每页结果数量
1574
814
  * @default 30
@@ -1585,9 +825,9 @@ type SubIssueListResponseType = IssueInfoResponseType[];
1585
825
  /** 添加子议题参数类型 */
1586
826
  interface AddSubIssueParamType extends RepoBaseParamType {
1587
827
  /** 议题ID */
1588
- issue_number: number;
828
+ issue_number: IssueIdParamType['issue_id'];
1589
829
  /** * 子议题ID */
1590
- sub_issue_id: number;
830
+ sub_issue_id: IssueIdParamType['issue_id'];
1591
831
  /** * 是否替换父议题 */
1592
832
  replace_parent: boolean;
1593
833
  }
@@ -1596,32 +836,341 @@ type AddSubIssueResponseType = IssueInfoResponseType;
1596
836
  /** 删除子议题参数类型 */
1597
837
  interface RemoveSubIssueParamType extends RepoBaseParamType {
1598
838
  /** 议题ID */
1599
- issue_number: number;
839
+ issue_number: IssueIdParamType['issue_id'];
840
+ /** 子议题ID */
841
+ sub_issue_id: IssueIdParamType['issue_id'];
842
+ }
843
+ /** 删除子议题响应类型 */
844
+ type RemoveSubIssueResponseType = IssueInfoResponseType;
845
+ /** 重新确定子议题优先级参数类型 */
846
+ interface ReprioritizeSubIssueParamType extends RepoBaseParamType {
847
+ /** 议题ID */
848
+ issue_number: IssueIdParamType['issue_id'];
1600
849
  /** 子议题ID */
1601
- sub_issue_id: number;
850
+ sub_issue_id: IssueIdParamType['issue_id'];
851
+ /**
852
+ * 要优先排序的子问题的 ID(与 before_id 互斥,只能指定其中一个)
853
+ * 在此 ID 之后放置子问题
854
+ */
855
+ after_id?: IssueIdParamType['issue_id'];
856
+ /**
857
+ * 要优先排序的子问题的 ID(与 after_id 互斥,只能指定其中一个)
858
+ * 在此 ID 之前放置子问题
859
+ */
860
+ before_id?: IssueIdParamType['issue_id'];
861
+ }
862
+ /** 重新确定子议题优先级响应类型 */
863
+ type ReprioritizeSubIssueResponseType = IssueInfoResponseType;
864
+
865
+ /** 组织信息参数类型 */
866
+ interface OrgInfoParamType {
867
+ /** 组织名称 */
868
+ org: string;
869
+ }
870
+ /** 组织信息响应类型 */
871
+ interface OrgInfoResponseType {
872
+ /** 组织ID */
873
+ id: number;
874
+ /** 组织名称 */
875
+ login: string;
876
+ /** 组织描述 */
877
+ name: string;
878
+ /** 组织头像 */
879
+ avatar_url: string;
880
+ /** 组织描述 */
881
+ description: string;
882
+ /** 组织地址 */
883
+ html_url: string;
884
+ }
885
+
886
+ type ReleaseUser = Omit<UserInfoResponseType, 'company' | 'bio' | 'blog' | 'followers' | 'following'>;
887
+ /** 反应信息类型 */
888
+ interface ReactionInfoType {
889
+ /** 反应 API URL */
890
+ url: string;
891
+ /** 总反应数 */
892
+ total_count: number;
893
+ /** 👍 反应数 */
894
+ '+1': number;
895
+ /** 👎 反应数 */
896
+ '-1': number;
897
+ /** 😄 反应数 */
898
+ laugh: number;
899
+ /** 😕 反应数 */
900
+ confused: number;
901
+ /** ❤️ 反应数 */
902
+ heart: number;
903
+ /** 🎉 反应数 */
904
+ hooray: number;
905
+ /** 👀 反应数 */
906
+ eyes: number;
907
+ /** 🚀 反应数 */
908
+ rocket: number;
909
+ }
910
+ /** 发布资源类型 */
911
+ interface ReleaseAssetsType {
912
+ /** 资源 URL */
913
+ url: string;
914
+ /** 资源下载 URL */
915
+ browser_download_url: string;
916
+ }
917
+ /** 获取Release信息参数类型 */
918
+ type ReleaseInfoParamType = RepoParamType & {
919
+ /** 发布ID */
920
+ release_id: number;
921
+ };
922
+ /** 获Release信息响应类型 */
923
+ interface ReleaseInfoResponseType {
924
+ /**
925
+ * 发布版本的 ID
926
+ * 该字段在gitcode平台同target_commitish一致
927
+ */
928
+ id: number | string;
929
+ /** 标签名称 */
930
+ tag_name: string;
931
+ /** 目标分支或提交 */
932
+ target_commitish: string;
933
+ /** 发布版本名称 */
934
+ name: string | null;
935
+ /** 发布说明 */
936
+ body: string | null;
937
+ /** 是否为预发布版本 */
938
+ prerelease: boolean;
939
+ /** 发布者信息 */
940
+ author: ReleaseUser;
941
+ /** 发布资源列表 */
942
+ assets: Array<ReleaseAssetsType>;
943
+ /** 发布时间 */
944
+ created_at: string;
945
+ }
946
+ /** 获取最新Release参数类型 */
947
+ type ReleaseLatestParamTypeType = RepoParamType;
948
+ /** 获取最新Release响应类型 */
949
+ type ReleaseLatestResponseType = ReleaseInfoResponseType;
950
+ /** 通过Tag获取Release信息参数类型 */
951
+ type ReleaseInfoByTagParamType = RepoParamType & {
952
+ /** 标签名称 */
953
+ tag: string;
954
+ };
955
+ /** 通过Tag获取Release信息响应类型 */
956
+ type ReleaseInfoByTagResponseType = ReleaseInfoResponseType;
957
+ /** 获取Release列表参数类型 */
958
+ type ReleaseListParamType = RepoParamType & {
959
+ /** 每页数量 */
960
+ per_page?: number;
961
+ /** 页码 */
962
+ page?: number;
963
+ };
964
+ /** 获取Release列表响应类型 */
965
+ type ReleaseListResponseType = Array<ReleaseInfoResponseType>;
966
+ /** 创建Release参数类型 */
967
+ type CreateReleaseParamType = RepoBaseParamType & {
968
+ /** 标签名称 */
969
+ tag_name: string;
970
+ /** 目标分支或提交 */
971
+ target_commitish: string;
972
+ /** 发布版本名称 */
973
+ name: string;
974
+ /** 发布说明 */
975
+ body: string;
976
+ /** 是否为预发布版本 */
977
+ prerelease: boolean;
978
+ };
979
+ /** 获取Release列表参数类型 */
980
+ type CreateReleaseResponseType = ReleaseInfoResponseType;
981
+ /** 更新Release参数类型 */
982
+ type UpdateReleaseParamType = CreateReleaseParamType;
983
+ /** 更新Release响应类型 */
984
+ type UpdateReleaseResponseType = ReleaseInfoResponseType;
985
+ /** 删除Release参数类型 */
986
+ type DeleteReleaseParamType = ReleaseInfoParamType;
987
+ /** 删除Release响应类型 */
988
+ interface DeleteReleaseResponseType {
989
+ /** 删除信息 */
990
+ info: string;
991
+ }
992
+
993
+ /** 仓库列表参数类型 */
994
+ interface RepoListBaseParamType {
995
+ /** 排序方式,可选created, updated, pushed, full_name, 默认为 full_name */
996
+ sort?: 'created' | 'updated' | 'pushed' | 'full_name';
997
+ /** 排序方式,可选asc, desc, 默认为 desc */
998
+ direction?: 'asc' | 'desc';
999
+ /** 每页数量 */
1000
+ per_page?: number;
1001
+ /** 页码 */
1002
+ page?: number;
1003
+ }
1004
+ interface UserByTokenRepoListParamType extends RepoListBaseParamType {
1005
+ /** 仓库的可见性,可选all, public, private, 默认为 all */
1006
+ visibility?: 'all' | 'public' | 'private';
1007
+ /** 仓库的状态,可选all, public, private, 默认为 all */
1008
+ affiliation?: 'owner' | 'collaborator' | 'organization_member';
1009
+ /** 类型,可选all, owner, member, 默认为 all */
1010
+ type?: 'all' | 'owner' | 'member';
1011
+ /** 是否格式化日期 */
1012
+ format?: formatParamType['format'];
1013
+ }
1014
+ /** 仓库信息请求参数 */
1015
+ type RepoInfoParamType = RepoParamType & {
1016
+ /** 是否格式化日期 */
1017
+ format?: formatParamType['format'];
1018
+ };
1019
+ /** 许可证信息 */
1020
+ interface License {
1021
+ /** * 许可证的键,例如 'mit' */
1022
+ key: string;
1023
+ /** * 许可证的名称,例如 'MIT License' */
1024
+ name: string;
1025
+ /** * 许可证的 SPDX ID,例如 'MIT' */
1026
+ spdx_id: string;
1027
+ /** * 许可证的 URL 地址 */
1028
+ url: string | null;
1029
+ /** * 许可证的 HTML URL */
1030
+ html_url?: string;
1031
+ /** * 许可证的节点 ID */
1032
+ node_id: string;
1033
+ }
1034
+ /** 仓库行为准则 */
1035
+ interface CodeOfConduct {
1036
+ /** * 行为准则的键 */
1037
+ key: string;
1038
+ /** * 行为准则的名称 */
1039
+ name: string;
1040
+ /** * 行为准则的 URL */
1041
+ url: string;
1042
+ /** * 行为准则的主体 */
1043
+ body?: string;
1044
+ /** * 行为准则的 HTML URL */
1045
+ html_url: string | null;
1046
+ }
1047
+ /** 仓库高级安全状态 */
1048
+ interface SecurityAnalysisAdvancedSecurity {
1049
+ /** * 高级安全状态 */
1050
+ status: string;
1051
+ }
1052
+ /** Dependabot 安全更新状态 */
1053
+ interface SecurityAnalysisDependabotSecurityUpdates {
1054
+ /** * Dependabot 安全更新状态 */
1055
+ status: string;
1056
+ }
1057
+ /** 秘钥扫描状态 */
1058
+ interface SecurityAnalysisSecretScanning {
1059
+ /** * 秘钥扫描状态 */
1060
+ status: string;
1061
+ }
1062
+ /** 秘钥扫描推送保护状态 */
1063
+ interface SecurityAnalysisSecretScanningPushProtection {
1064
+ /** * 秘钥扫描推送保护状态 */
1065
+ status: string;
1066
+ }
1067
+ /** 仓库安全和分析设置 */
1068
+ interface SecurityAndAnalysis {
1069
+ /** * 高级安全设置 */
1070
+ advanced_security?: SecurityAnalysisAdvancedSecurity;
1071
+ /** * Dependabot 安全更新设置 */
1072
+ dependabot_security_updates?: SecurityAnalysisDependabotSecurityUpdates;
1073
+ /** * 秘钥扫描设置 */
1074
+ secret_scanning?: SecurityAnalysisSecretScanning;
1075
+ /** * 秘钥扫描推送保护设置 */
1076
+ secret_scanning_push_protection?: SecurityAnalysisSecretScanningPushProtection;
1077
+ }
1078
+ /** 仓库的权限信息 */
1079
+ interface Permissions {
1080
+ /** * 管理员权限 */
1081
+ admin: boolean;
1082
+ /** * 推送权限 */
1083
+ push: boolean;
1084
+ /** * 拉取权限 */
1085
+ pull: boolean;
1086
+ /** * 维护权限 */
1087
+ maintain?: boolean;
1088
+ /** * 分类权限 */
1089
+ triage?: boolean;
1090
+ }
1091
+ /**
1092
+ * 合并提交标题的格式选项
1093
+ * - PR_TITLE: 使用 Pull Request 标题作为合并提交标题
1094
+ * - MERGE_MESSAGE: 使用默认的合并消息格式作为标题
1095
+ */
1096
+ type MergeCommitTitle = 'PR_TITLE' | 'MERGE_MESSAGE';
1097
+ /**
1098
+ * 合并提交消息的格式选项
1099
+ * - PR_BODY: 使用 Pull Request 正文作为合并提交消息
1100
+ * - PR_TITLE: 使用 Pull Request 标题作为合并提交消息
1101
+ * - BLANK: 留空合并提交消息
1102
+ */
1103
+ type MergeCommitMessage = 'PR_BODY' | 'PR_TITLE' | 'BLANK';
1104
+ /**
1105
+ * Squash 合并提交标题的格式选项
1106
+ * - PR_TITLE: 使用 Pull Request 标题作为 Squash 合并提交标题
1107
+ * - COMMIT_OR_PR_TITLE: 使用提交信息或 Pull Request 标题作为标题
1108
+ */
1109
+ type SquashMergeCommitTitle = 'PR_TITLE' | 'COMMIT_OR_PR_TITLE';
1110
+ /**
1111
+ * Squash 合并提交消息的格式选项
1112
+ * - PR_BODY: 使用 Pull Request 正文作为 Squash 合并提交消息
1113
+ * - COMMIT_MESSAGES: 使用所有提交信息作为 Squash 合并提交消息
1114
+ * - BLANK: 留空 Squash 合并提交消息
1115
+ */
1116
+ type SquashMergeCommitMessage = 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';
1117
+ /** * 仓库信息 */
1118
+ interface RepoInfoResponseType {
1119
+ /** * 仓库的唯一 ID */
1120
+ id: number;
1121
+ /** * 仓库的名称 */
1122
+ name: string;
1123
+ /** * 仓库的完整名称,包含用户名或组织名 */
1124
+ full_name: string;
1125
+ /** * 仓库拥有者的信息 */
1126
+ owner: UserInfoResponseType;
1127
+ /** 仓库是否公开 */
1128
+ public: boolean;
1129
+ /** * 仓库是否私有 */
1130
+ private: boolean;
1131
+ /** * 仓库的可见性 */
1132
+ visibility: 'public' | 'private';
1133
+ /** * 仓库是否是 fork 仓库 */
1134
+ fork: boolean;
1135
+ /** * 仓库是否已归档 */
1136
+ archived: boolean;
1137
+ /** * 仓库是否被禁用 */
1138
+ disabled: boolean;
1139
+ /** * 仓库的 HTML 页面 URL */
1140
+ html_url: string;
1141
+ /** * 仓库的描述信息 */
1142
+ description: string | null;
1143
+ /** * 仓库的创建时间 */
1144
+ created_at: string;
1145
+ /** * 仓库的更新时间 */
1146
+ updated_at: string;
1147
+ /** * 仓库的 Stargazer 数量 */
1148
+ stargazers_count: number;
1149
+ /** * 仓库的 Watcher 数量 */
1150
+ watchers_count: number;
1151
+ /** * 仓库的主编程语言 */
1152
+ language: string | null;
1153
+ /** * 仓库的 fork 数量 */
1154
+ forks_count: number;
1155
+ /** * 开放的 issue 数量 */
1156
+ open_issues_count: number;
1157
+ /** * 仓库的默认分支 */
1158
+ default_branch: string;
1602
1159
  }
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;
1160
+ /** 组织仓库列表参数类型 */
1161
+ interface OrgRepoListParmType extends RepoListBaseParamType {
1162
+ /** 组织名称 */
1163
+ org: string;
1164
+ /** 类型,可选all, public, private, forks, sources, member, 默认为 all */
1165
+ type?: 'all' | 'public' | 'private' | 'forks' | 'sources' | 'member';
1166
+ /** 是否格式化日期 */
1167
+ format?: formatParamType['format'];
1621
1168
  }
1622
- /** 重新确定子议题优先级响应类型 */
1623
- type ReprioritizeSubIssueResponseType = IssueInfoResponseType;
1624
-
1169
+ /**
1170
+ * 组织仓库列表类型
1171
+ * 该类型包含了多个仓库的信息,每个仓库都有自己的详细信息。
1172
+ */
1173
+ type OrgRepoListType = RepoInfoResponseType[];
1625
1174
  /** 创建组织仓库请求参数 */
1626
1175
  interface OrgRepoCreateParamType extends RepoOwnerParamType {
1627
1176
  /** 仓库名称 */
@@ -1673,155 +1222,141 @@ interface OrgRepoCreateParamType extends RepoOwnerParamType {
1673
1222
  [key: string]: string;
1674
1223
  };
1675
1224
  /** 是否格式化日期 */
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;
1225
+ format?: formatParamType['format'];
1706
1226
  }
1707
- /**
1708
- * 组织的计划信息
1709
- */
1710
- interface OrganizationPlanType {
1711
- name: string;
1712
- space: number;
1713
- private_repos: number;
1714
- filled_seats?: number;
1715
- seats?: number;
1227
+ /** 创建组织仓库响应类型 */
1228
+ type OrgRepoCreateResponseType = RepoInfoResponseType;
1229
+ /** 用户仓库列表参数类型 */
1230
+ interface UserRepoListParamType extends RepoListBaseParamType {
1231
+ /** 用户名 */
1232
+ username: string;
1233
+ /** 类型,可选all, owner, member, 默认为 all */
1234
+ type?: 'all' | 'owner' | 'member';
1235
+ /** 是否格式化日期 */
1236
+ format?: formatParamType['format'];
1716
1237
  }
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;
1238
+ /** 用户仓库列表类型 */
1239
+ type UserRepoListType = Array<RepoInfoResponseType & {
1240
+ /** * 仓库的角色名称 */
1241
+ role_name?: string;
1242
+ }>;
1243
+ /** 仓库语言信息类型 */
1244
+ interface LanguageInfo {
1245
+ /** 编程语言名称 */
1246
+ language: string;
1247
+ /** 语言对应的颜色 */
1248
+ color: string;
1249
+ /** 在仓库中的占比(百分比) */
1250
+ percent: number;
1251
+ /** 该语言的代码字节数 */
1252
+ bytes: number;
1253
+ }
1254
+ /** 仓库语言列表参数类型 */
1255
+ type RepoLanguagesListParamType = RepoParamType;
1256
+ /** 仓库语言列表类型 */
1257
+ interface RepoLanguagesListType {
1258
+ /** 仓库的语言统计信息列表 */
1259
+ languages: LanguageInfo[];
1260
+ }
1261
+ /** 仓库文件列表参数类型 */
1262
+ /** 仓库可见性响应类型 */
1263
+ interface RepoVisibilityResponseType {
1264
+ /** * 仓库的可见性 */
1265
+ visibility: RepoInfoResponseType['visibility'];
1729
1266
  }
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;
1267
+ /** 仓库默认分支响应类型 */
1268
+ interface RepoDefaultBranchResponseType {
1269
+ /** * 仓库的默认分支名称 */
1270
+ default_branch: RepoInfoResponseType['default_branch'];
1746
1271
  }
1747
- /**
1748
- * 组织的成员信息
1749
- */
1750
- interface OrganizationMemberType {
1751
- /** 组织的关注者数量 */
1752
- followers: number;
1753
- /** 组织关注的数量 */
1754
- following: number;
1755
- /** 私有仓库中的协作者数量 */
1756
- collaborators?: number | null;
1272
+ /** 仓库主要语言响应类型 */
1273
+ interface RepoMainLanguageResponseType {
1274
+ /** * 仓库的主要语言 */
1275
+ language: RepoInfoResponseType['language'];
1757
1276
  }
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;
1277
+ /** 协作者参数类型 */
1278
+ type CollaboratorParamType = RepoInfoParamType & UserNameParamType & {
1279
+ /**
1280
+ * 协作者权限 ,可选 pull,triage, push, maintain, admin,默认pull
1281
+ * pull - 只读访问,协作者可以查看仓库内容。
1282
+ * triage - 允许管理议题和拉取请求,包括标记、分配和修改状态。
1283
+ * push - 允许推送代码到仓库分支,同时拥有 pull 权限。
1284
+ * maintain - 允许管理仓库中的代码和议题,但不能更改仓库设置。
1285
+ * admin - 拥有仓库的完全控制权,包括更改设置和删除仓库。
1286
+ */
1287
+ permission?: 'pull' | 'triage' | 'push' | 'maintain' | 'admin';
1288
+ /** 是否格式化日期 */
1289
+ format: formatParamType['format'];
1290
+ };
1291
+ /** 邀请协作者响应类型 */
1292
+ interface AddCollaboratorResponseType {
1293
+ /** 邀请唯一id */
1294
+ id: number;
1295
+ /** 邀请仓库信息 */
1296
+ repository: RepoInfoResponseType;
1796
1297
  }
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;
1298
+ /** 协作者列表参数类型 */
1299
+ type CollaboratorListParamType = RepoInfoParamType & {
1300
+ /**
1301
+ * 筛选按隶属关系返回的协作者
1302
+ * outside - 列出所有外部协作者,包括仓库成员和外部 collaborator。
1303
+ * direct - 列出仓库成员。
1304
+ * all - 列出仓库成员和外部 collaborator。
1305
+ */
1306
+ affiliation?: 'outside' | 'direct' | 'all';
1307
+ /**
1308
+ * 筛选按权限关系返回的协作者
1309
+ * pull - 只读访问,协作者可以查看仓库内容。
1310
+ * triage - 允许管理议题和拉取请求,包括标记、分配和修改状态。
1311
+ * push - 允许推送代码到仓库分支,同时拥有 pull 权限。
1312
+ * maintain - 允许管理仓库中的代码和议题,但不能更改仓库设置。
1313
+ * admin - 拥有仓库的完全控制权,包括更改设置和删除仓库。
1314
+ */
1315
+ permission?: 'pull' | 'triage' | 'push' | 'maintain' | 'admin';
1316
+ /** 每页数量 */
1317
+ per_page?: number;
1318
+ /** 页码 */
1319
+ page?: number;
1320
+ };
1321
+ /** 协作者信息类型 */
1322
+ interface CollaboratorInfoResponseType {
1323
+ /** 协作者id */
1324
+ id: number;
1325
+ /** 协作者登录名 */
1326
+ login: string;
1327
+ /** 头像URL */
1328
+ avatar_url: string;
1329
+ /** 协作者邮箱 */
1330
+ email: string | null;
1331
+ /** 协作者姓名 */
1332
+ name: string | null;
1333
+ /** 权限设置 */
1334
+ permissions: {
1335
+ /** 拉取权限 */
1336
+ pull: boolean;
1337
+ /** 分类权限 */
1338
+ triage: boolean;
1339
+ /** 推送权限 */
1340
+ push: boolean;
1341
+ /** 维护权限 */
1342
+ maintain: boolean;
1343
+ /** 管理权限 */
1344
+ admin: boolean;
1345
+ };
1346
+ /** 角色名称 */
1347
+ role_name: string;
1817
1348
  }
1818
- /**
1819
- * GitHub 组织的完整信息
1820
- */
1821
- interface OrganizationInfoType extends OrganizationBaseType, OrganizationUrlType, OrganizationRepositoryAndGistsType, OrganizationMemberType, OrganizationPermissionsAndConfigType, OrganizationSecurityConfigType {
1349
+ /** 协作者列表响应类型 */
1350
+ type CollaboratorListResponseType = CollaboratorInfoResponseType[];
1351
+ /** 移除协作者参数类型 */
1352
+ type RemoveCollaboratorParamType = RepoParamType & UserNameParamType;
1353
+ /** 移除协作者响应类型 */
1354
+ interface RemoveCollaboratorResponseType {
1355
+ /** 状态信息 */
1356
+ info: string;
1822
1357
  }
1823
1358
 
1824
- interface WebHookParamType {
1359
+ interface WebHookSignatureParamType {
1825
1360
  /** WebHook 的 secret */
1826
1361
  secret?: string;
1827
1362
  /** 请求体 */
@@ -1829,6 +1364,10 @@ interface WebHookParamType {
1829
1364
  /** GitHub 发送的签名头 */
1830
1365
  signature: string;
1831
1366
  }
1367
+ interface WebHookSignatureResponseType {
1368
+ /** 验证信息 */
1369
+ info: string;
1370
+ }
1832
1371
 
1833
1372
  /**
1834
1373
  * 格式化日期
@@ -1853,6 +1392,16 @@ declare function formatDate(dateString: string, locale?: string, format?: string
1853
1392
  * ```
1854
1393
  */
1855
1394
  declare function get_relative_time(dateString: string, locale?: string): Promise<string>;
1395
+ /**
1396
+ * 根据语言名称获取对应的颜色值
1397
+ * @param language - 语言名称
1398
+ * @returns 颜色值的十六进制字符串
1399
+ * @example
1400
+ * ```ts
1401
+ * console.log(get_langage_color('JavaScript')) // 输出 "#f1e05a"
1402
+ * ```
1403
+ */
1404
+ declare function get_langage_color(language: string): string;
1856
1405
 
1857
1406
  /**
1858
1407
  * 生成一个用户唯一的标识符
@@ -1876,8 +1425,8 @@ declare function create_state_id(): Promise<string>;
1876
1425
  * @class Auth
1877
1426
  * @extends Base GitHub基础操作类
1878
1427
  */
1879
- declare class Auth extends Base {
1880
- constructor(base: Base);
1428
+ declare class Auth extends GitHubClient {
1429
+ constructor(base: GitHubClient);
1881
1430
  /**
1882
1431
  * 生成Github App 授权链接
1883
1432
  * @param state_id - 随机生成的 state_id,用于验证授权请求的状态,可选,默认不使用
@@ -1930,13 +1479,13 @@ declare class Auth extends Base {
1930
1479
  }
1931
1480
 
1932
1481
  /**
1933
- * Base 提交操作类
1482
+ * Commit 提交操作类
1934
1483
  *
1935
1484
  * 提供对GitHub Commit的CRUD操作,包括:
1936
1485
  * - 获取一个提交信息
1937
1486
  */
1938
- declare class Commit extends Base {
1939
- constructor(base: Base);
1487
+ declare class Commit extends GitHubClient {
1488
+ constructor(base: GitHubClient);
1940
1489
  /**
1941
1490
  * 获取一个提交信息
1942
1491
  * 权限:
@@ -1971,8 +1520,8 @@ declare class Commit extends Base {
1971
1520
  *
1972
1521
  * @remarks 每个拉取请求都是一个议题,但并非每个议题都是拉取请求。
1973
1522
  */
1974
- declare class Issue extends Base {
1975
- constructor(base: Base);
1523
+ declare class Issue extends GitHubClient {
1524
+ constructor(base: GitHubClient);
1976
1525
  /**
1977
1526
  * 获取Issue详情
1978
1527
  * 权限:
@@ -2119,6 +1668,7 @@ declare class Issue extends Base {
2119
1668
  close_issue(options: CloseIssueParamType): Promise<ApiResponseType<CloseIssueResponseType>>;
2120
1669
  /**
2121
1670
  * 锁定一个Issue
1671
+ * 仅GitHub平台可用
2122
1672
  * 权限:
2123
1673
  * - Issues: Write
2124
1674
  * - Pull requests: Write
@@ -2139,6 +1689,7 @@ declare class Issue extends Base {
2139
1689
  lock_issue(options: LockIssueParamType): Promise<ApiResponseType<LockIssueResponseType>>;
2140
1690
  /**
2141
1691
  * 解锁一个Issue
1692
+ * 仅GitHub平台可用
2142
1693
  * 权限:
2143
1694
  * - Issues: Write
2144
1695
  * - Pull requests: Write
@@ -2174,11 +1725,11 @@ declare class Issue extends Base {
2174
1725
  * @example
2175
1726
  * ```ts
2176
1727
  * const issue = get_issue() // 获取issue实例
2177
- * const res = await issue.get_issue_comment_list({ owner: 'owner', repo:'repo', issue_number:1 })
1728
+ * const res = await issue.get_issue_comments_list({ owner: 'owner', repo:'repo', issue_number:1 })
2178
1729
  * console.log(res) // { data: IssueCommentListResponseType[] }
2179
1730
  * ```
2180
1731
  */
2181
- get_repo_comment_list(options: RepoCommentListParamType): Promise<ApiResponseType<RepoCommentListResponseType>>;
1732
+ get_repo_comments_list(options: RepoCommentListParamType): Promise<ApiResponseType<RepoCommentListResponseType>>;
2182
1733
  /**
2183
1734
  * 获取一个Issue下的评论列表
2184
1735
  * 权限:
@@ -2196,11 +1747,11 @@ declare class Issue extends Base {
2196
1747
  * @example
2197
1748
  * ```ts
2198
1749
  * const issue = get_issue() // 获取issue实例
2199
- * const res = await issue.get_issue_comment_list({ owner: 'owner', repo:'repo', issue_number:1 })
1750
+ * const res = await issue.get_issue_comments_list({ owner: 'owner', repo:'repo', issue_number:1 })
2200
1751
  * console.log(res) // { data: IssueCommentListResponseType[] }
2201
1752
  * ```
2202
1753
  */
2203
- get_issue_comment_list(options: IssueCommentListParamType): Promise<ApiResponseType<IssueCommentListParamType>>;
1754
+ get_issue_comments_list(options: IssueCommentListParamType): Promise<ApiResponseType<IssueCommentListResponseType>>;
2204
1755
  /**
2205
1756
  * 获取Issue评论信息
2206
1757
  * 权限:
@@ -2290,6 +1841,7 @@ declare class Issue extends Base {
2290
1841
  delete_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2291
1842
  /**
2292
1843
  * 获取子议题列表
1844
+ * 仅GitHub 平台使用
2293
1845
  * 权限:
2294
1846
  * - Issues: Read-only
2295
1847
  * - Pull requests: Read-only
@@ -2310,6 +1862,7 @@ declare class Issue extends Base {
2310
1862
  /**
2311
1863
  * 添加子议题
2312
1864
  * 添加一个子议题到指定的议题中
1865
+ * 仅GitHub 平台使用
2313
1866
  * 权限:
2314
1867
  * - Issues:Write
2315
1868
  * @param options 添加子议题的参数对象
@@ -2381,8 +1934,8 @@ declare class Issue extends Base {
2381
1934
  * 提供对GitHub组织的CRUD操作,包括:
2382
1935
  * - 获取组织信息
2383
1936
  */
2384
- declare class Org extends Base {
2385
- constructor(base: Base);
1937
+ declare class Org extends GitHubClient {
1938
+ constructor(base: GitHubClient);
2386
1939
  /**
2387
1940
  * 获取组织信息
2388
1941
  * 权限:
@@ -2396,7 +1949,7 @@ declare class Org extends Base {
2396
1949
  * console.log(orgInfo)
2397
1950
  * ```
2398
1951
  */
2399
- get_org_info(options: OrganizationNameParamType): Promise<ApiResponseType<OrganizationInfoType>>;
1952
+ get_org_info(options: OrgInfoParamType): Promise<ApiResponseType<OrgInfoResponseType>>;
2400
1953
  }
2401
1954
 
2402
1955
  /**
@@ -2409,8 +1962,8 @@ declare class Org extends Base {
2409
1962
  * - 支持通过URL或owner/repo两种方式操作仓库
2410
1963
  *
2411
1964
  */
2412
- declare class Repo extends Base {
2413
- constructor(base: Base);
1965
+ declare class Repo extends GitHubClient {
1966
+ constructor(base: GitHubClient);
2414
1967
  /**
2415
1968
  * 获取组织仓库列表
2416
1969
  * 权限: Metadata - Read-only , 如果获取公开仓库可无需此权限
@@ -2428,7 +1981,7 @@ declare class Repo extends Base {
2428
1981
  * console.log(repos)
2429
1982
  * ```
2430
1983
  */
2431
- get_org_repos_list(options: OrgRepoListParmsType): Promise<ApiResponseType<OrgRepoListType>>;
1984
+ get_org_repos_list(options: OrgRepoListParmType): Promise<ApiResponseType<OrgRepoListType>>;
2432
1985
  /**
2433
1986
  * 查询仓库详细信息
2434
1987
  * 权限: Metadata - read-only , 如果获取公开仓库可无需此权限
@@ -2474,11 +2027,12 @@ declare class Repo extends Base {
2474
2027
  * url参数和owner、repo参数传入其中的一种
2475
2028
  * @example
2476
2029
  * ```ts
2477
- * const repo = await repo.get_repo_info({ url: 'https://github.com/ClarityJS/git-neko-kit' })
2030
+ * const repo = await repo.get_repo_info({ url: 'https://github.com/CandriaJS/git-neko-kit' })
2478
2031
  * console.log(repo)
2479
2032
  * ```
2480
2033
  */
2481
2034
  get_repo_info(options: RepoInfoParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
2035
+ get_repo_languages_list(options: RepoLanguagesListParamType): Promise<ApiResponseType<RepoLanguagesListType>>;
2482
2036
  /**
2483
2037
  * 创建组织仓库
2484
2038
  * 权限:
@@ -2510,7 +2064,7 @@ declare class Repo extends Base {
2510
2064
  * - custom_properties: 自定义键值对属性
2511
2065
  * @returns 返回创建成功的仓库信息
2512
2066
  */
2513
- create_org_repo(options: OrgRepoCreateParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
2067
+ create_org_repo(options: OrgRepoCreateParamType): Promise<ApiResponseType<OrgRepoCreateResponseType>>;
2514
2068
  /**
2515
2069
  * 获取协作者列表
2516
2070
  * 权限:
@@ -2527,11 +2081,11 @@ declare class Repo extends Base {
2527
2081
  * @returns 返回获取协作者列表结果
2528
2082
  * @example
2529
2083
  * ```ts
2530
- * const result = await collaborator.get_collaborator_list(options)
2084
+ * const result = await collaborator.get_collaborators_list(options)
2531
2085
  * console.log(result)
2532
2086
  * ```
2533
2087
  */
2534
- get_collaborator_list(options: CollaboratorListParamType): Promise<ApiResponseType<CollaboratorListResponseType>>;
2088
+ get_collaborators_list(options: CollaboratorListParamType): Promise<ApiResponseType<CollaboratorListResponseType>>;
2535
2089
  /**
2536
2090
  * 邀请协作者
2537
2091
  * 权限:
@@ -2578,6 +2132,22 @@ declare class Repo extends Base {
2578
2132
  * ```
2579
2133
  */
2580
2134
  remove_collaborator(options: RemoveCollaboratorParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2135
+ /**
2136
+ * 删除协作者
2137
+ * @deprecated 请使用remove_collaborator方法
2138
+ * @param options 删除协作者对象
2139
+ * @returns 返回删除协作者结果
2140
+ * @example
2141
+ * ```ts
2142
+ * const result = await collaborator.delete_collaborator({
2143
+ * owner: 'owner',
2144
+ * repo:'repo',
2145
+ * username: 'username'
2146
+ * })
2147
+ * console.log(result)
2148
+ * ```
2149
+ */
2150
+ delete_collaborator(options: RemoveCollaboratorParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2581
2151
  /**
2582
2152
  * 快速获取仓库可见性
2583
2153
  * 权限:
@@ -2591,11 +2161,11 @@ declare class Repo extends Base {
2591
2161
  * @returns 仓库可见性,
2592
2162
  * @example
2593
2163
  * ```ts
2594
- * const visibility = await repo.get_repo_visibility({url: 'https://github.com/ClarityJS/git-neko-kit'})
2164
+ * const visibility = await repo.get_repo_visibility({url: 'https://github.com/CandriaJS/git-neko-kit'})
2595
2165
  * console.log(visibility) // 输出 public 或 private
2596
2166
  * ```
2597
2167
  */
2598
- get_repo_visibility(options: RepoInfoParamType): Promise<RepoVisibilityResponseType['visibility'] | null>;
2168
+ get_repo_visibility(options: RepoInfoParamType): Promise<RepoVisibilityResponseType['visibility']>;
2599
2169
  /**
2600
2170
  * 获取仓库默认分支
2601
2171
  * 权限:
@@ -2607,11 +2177,27 @@ declare class Repo extends Base {
2607
2177
  * url参数和owner、repo参数传入其中的一种
2608
2178
  * @example
2609
2179
  * ```ts
2610
- * const defaultBranch = await repo.get_repo_default_branch({url: 'https://github.com/ClarityJS/meme-plugin')}
2180
+ * const defaultBranch = await repo.get_repo_default_branch({url: 'https://github.com/CandriaJS/meme-plugin')}
2611
2181
  * console.log(defaultBranch) // 输出 main
2612
2182
  * ```ts
2613
2183
  */
2614
- get_repo_default_branch(options: RepoInfoParamType): Promise<RepoDefaultBranchResponseType['default_branch']>;
2184
+ get_repo_default_branch(options: RepoInfoParamType): Promise<RepoDefaultBranchResponseType['default_branch'] | null>;
2185
+ /**
2186
+ * 获取仓库主要语言
2187
+ * 权限:
2188
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
2189
+ * @param options
2190
+ * - url 仓库URL地址
2191
+ * - owner 仓库拥有者
2192
+ * - repo 仓库名称
2193
+ * url参数和owner、repo参数传入其中的一种
2194
+ * @example
2195
+ * ```ts
2196
+ * const language = await repo.get_repo_language({url: 'URL_ADDRESS.com/CandriaJS/meme-plugin')}
2197
+ * console.log(language) // 输出 JavaScript
2198
+ * ```ts
2199
+ */
2200
+ get_repo_main_language(options: RepoInfoParamType): Promise<RepoMainLanguageResponseType['language']>;
2615
2201
  }
2616
2202
 
2617
2203
  /**
@@ -2621,8 +2207,8 @@ declare class Repo extends Base {
2621
2207
  * - 获取用户信息
2622
2208
  * - 关注指定用户
2623
2209
  */
2624
- declare class User extends Base {
2625
- constructor(base: Base);
2210
+ declare class User extends GitHubClient {
2211
+ constructor(base: GitHubClient);
2626
2212
  /**
2627
2213
  * 获取指定的用户信息
2628
2214
  * 不止可以获取用户信息还可以获取组织信息
@@ -2649,10 +2235,23 @@ declare class User extends Base {
2649
2235
  * console.log(userInfo)
2650
2236
  * ```
2651
2237
  */
2652
- get_user_info_by_user_id(options: UserIdParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2238
+ get_user_info_by_user_id(options: UserInfoByIdParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2239
+ /**
2240
+ * 通过访问令牌获取用户信息
2241
+ * 权限:无需任何权限
2242
+ * @param options - 访问令牌配置参数对象
2243
+ * - access_token - 访问令牌
2244
+ * @example
2245
+ * ```ts
2246
+ * const userInfo = await user.get_user_info_by_token({ access_token: 'access_token' })
2247
+ * console.log(userInfo)
2248
+ * ```
2249
+ */
2250
+ get_user_info_by_auth(options?: UserInfoByAuthParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2653
2251
  /**
2654
2252
  * 通过访问令牌获取用户信息
2655
2253
  * 权限:无需任何权限
2254
+ * @deprecated 该方法已过时,请使用get_user_info_by_auth方法
2656
2255
  * @param options - 访问令牌配置参数对象
2657
2256
  * - access_token - 访问令牌
2658
2257
  * @example
@@ -2661,7 +2260,7 @@ declare class User extends Base {
2661
2260
  * console.log(userInfo)
2662
2261
  * ```
2663
2262
  */
2664
- get_user_info_by_token(options?: UserInfoByTokenParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2263
+ get_user_info_by_token(options: UserInfoByAuthParamType): Promise<ApiResponseType<UserInfoResponseType>>;
2665
2264
  /**
2666
2265
  * 获取用户贡献数据
2667
2266
  * 权限:无需任何权限
@@ -2734,7 +2333,7 @@ declare class User extends Base {
2734
2333
  * console.log(avatarUrl)
2735
2334
  * ```
2736
2335
  */
2737
- get_avatar_url(): Promise<string | null>;
2336
+ get_avatar_url(): Promise<string>;
2738
2337
  }
2739
2338
 
2740
2339
  /**
@@ -2743,8 +2342,8 @@ declare class User extends Base {
2743
2342
  * 提供对GitHub WebHook的CRUD操作,包括:
2744
2343
  * - 检查webhook签名是否正确
2745
2344
  */
2746
- declare class WebHook extends Base {
2747
- constructor(base: Base);
2345
+ declare class WebHook extends GitHubClient {
2346
+ constructor(base: GitHubClient);
2748
2347
  /**
2749
2348
  * 检查WebHook签名是否正确
2750
2349
  * 权限:无需任何权限
@@ -2762,7 +2361,7 @@ declare class WebHook extends Base {
2762
2361
  * })
2763
2362
  * ```
2764
2363
  */
2765
- check_webhook_signature(options: WebHookParamType): Promise<ApiResponseType<boolean>>;
2364
+ check_webhook_signature(options: WebHookSignatureParamType): Promise<ApiResponseType<WebHookSignatureResponseType>>;
2766
2365
  }
2767
2366
 
2768
2367
  /**
@@ -2786,7 +2385,7 @@ declare class WebHook extends Base {
2786
2385
  * });
2787
2386
  * ```
2788
2387
  */
2789
- declare class Base {
2388
+ declare class GitHubClient {
2790
2389
  app: App;
2791
2390
  auth: Auth;
2792
2391
  commit: Commit;
@@ -2806,7 +2405,7 @@ declare class Base {
2806
2405
  readonly WebHook_Secret: string;
2807
2406
  private currentRequestConfig;
2808
2407
  private proxy?;
2809
- constructor(options: GitHubAuthType);
2408
+ constructor(options: AppClientType);
2810
2409
  /**
2811
2410
  * 获取App实例
2812
2411
  * @returns App实例
@@ -2976,13 +2575,34 @@ declare class Base {
2976
2575
  * - 生成应用配置链接
2977
2576
  *
2978
2577
  */
2979
- declare class App extends Base {
2980
- constructor(base: Base);
2578
+ declare class App extends GitHubClient {
2579
+ constructor(base: GitHubClient);
2580
+ get_app_info(options: AppInfoParamType): Promise<ApiResponseType<AppInfoResponseType>>;
2981
2581
  /**
2982
2582
  * 获取当前 Github App 信息
2983
2583
  * @returns 返回 Github App 信息
2584
+ * @example
2585
+ * ```ts
2586
+ * const app = base.get_app()
2587
+ * console.log(app.get_app_info_by_auth()) // 输出App信息
2588
+ * ```
2589
+ */
2590
+ private get_app_info_by_auth;
2591
+ /**
2592
+ * 获取仓库的应用安装信息
2593
+ * @param options - 仓库安装应用参数对象
2594
+ * - owner 拥有者
2595
+ * - repo 仓库名
2596
+ * - url 仓库地址
2597
+ * ownwe和repo与url只能二选一
2598
+ * @returns 返回应用安装信息
2599
+ * @example
2600
+ * ```ts
2601
+ * const app = base.get_app()
2602
+ * console.log(app.get_app_installation_by_repo({owner: 'owner', repo: 'repo'})) // 输出仓库的应用信息
2603
+ * ```
2984
2604
  */
2985
- private get_info;
2605
+ get_app_installation_by_repo(options: RepoInfoParamType): Promise<ApiResponseType<AppRepoInfoResponseType>>;
2986
2606
  /**
2987
2607
  * 生成Github App 安装链接
2988
2608
  * @param state_id - 随机生成的 state_id,用于验证授权请求的状态,可选,默认不使用
@@ -3003,21 +2623,6 @@ declare class App extends Base {
3003
2623
  * ```
3004
2624
  */
3005
2625
  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
2626
  /**
3022
2627
  * 快速获取当前 Github App 名称
3023
2628
  * @returns 返回 Github App 名称
@@ -3030,26 +2635,15 @@ declare class App extends Base {
3030
2635
  get_app_name(): Promise<string>;
3031
2636
  }
3032
2637
 
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
- }
2638
+ declare class Client {
2639
+ github: GitHubClient;
2640
+ constructor(options: ClientType);
2641
+ }
2642
+ declare const utils: {
2643
+ create_state_id: typeof create_state_id;
2644
+ formatDate: typeof formatDate;
2645
+ get_relative_time: typeof get_relative_time;
2646
+ get_langage_color: typeof get_langage_color;
2647
+ };
3054
2648
 
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 };
2649
+ export { type AccessCodeType, type AccessTokenType, type AddCollaboratorResponseType, type AddSubIssueParamType, type AddSubIssueResponseType, type ApiResponseType, type ApiType, type AppClientType, type AppInfoParamType, type AppInfoResponseType, type AppOwner, type AppPermissions, type AppRepoInfoResponseType, Client, type ClientType, type CloseIssueParamType, type CloseIssueResponseType, type CodeOfConduct, type CollaboratorInfoResponseType, 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 CreateReleaseParamType, type CreateReleaseResponseType, type CreteIssueCommentParamType, type CreteIssueCommentResponseType, type CreteIssueParamType, type DeleteReleaseParamType, type DeleteReleaseResponseType, type DiffEntry, GitHubClient, type GitUser, type GithubOauthCheckTokenResponseType, type GithubOauthRefreshTokenResponseType, type GithubOauthTokenResponseType, type HttpProxyType, type HttpsProxyType, type IssueCommentInfoParamType, type IssueCommentInfoResponseType, type IssueCommentListParamType, type IssueCommentListResponseType, type IssueIdParamType, type IssueInfoParamType, type IssueInfoResponseType, type IssueLabelType, type IssueListResponseType, type IssueUser, type LanguageInfo, type License, type LockIssueParamType, type LockIssueResponseType, type MergeCommitMessage, type MergeCommitTitle, type MilestoneType, type OpenIssueParamType, type OpenIssueResponseType, type OrgInfoParamType, type OrgInfoResponseType, type OrgRepoCreateParamType, type OrgRepoCreateResponseType, type OrgRepoListParmType, type OrgRepoListType, type OrganizationNameParamType, type ParentCommit, type Permissions, type PkgInfoType, type ProxyParamsType, type ReactionInfoType, type RefreshTokenType, type ReleaseAssetsType, type ReleaseInfoByTagParamType, type ReleaseInfoByTagResponseType, type ReleaseInfoParamType, type ReleaseInfoResponseType, type ReleaseLatestParamTypeType, type ReleaseLatestResponseType, type ReleaseListParamType, type ReleaseListResponseType, type ReleaseUser, 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 RepoLanguagesListParamType, type RepoLanguagesListType, type RepoListBaseParamType, type RepoMainLanguageResponseType, type RepoNameParamType, type RepoOwnerParamType, type RepoParamType, type RepoUrlParamType, type RepoVisibilityResponseType, type ReprioritizeSubIssueParamType, type ReprioritizeSubIssueResponseType, type RequestConfigType, type RequestTokenType, type ResponseHeadersType, 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 UpdateReleaseParamType, type UpdateReleaseResponseType, type UserByTokenRepoListParamType, type UserIdParamType, type UserInfoByAuthParamType, type UserInfoByIdParamType, type UserInfoParamType, type UserInfoResponseType, type UserNameParamType, type UserRepoListParamType, type UserRepoListType, type WebHookSignatureParamType, type WebHookSignatureResponseType, Client as default, type formatParamType, utils };