@candriajs/git-neko-kit 1.1.1 → 1.2.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.
Files changed (84) hide show
  1. package/dist/app-B5x_z1xR.mjs +1 -0
  2. package/dist/app-COIyIlZp.mjs +1 -0
  3. package/dist/app-DcXcrOHH.cjs +1 -0
  4. package/dist/app-eOPQ8Dot.cjs +1 -0
  5. package/dist/auth-Ccs3QgLP.cjs +1 -0
  6. package/dist/auth-Db-FCcPo.mjs +1 -0
  7. package/dist/auth-cHpwbr3m.mjs +1 -0
  8. package/dist/auth-r8LRtyYY.cjs +1 -0
  9. package/dist/base-BqtGg502.mjs +0 -0
  10. package/dist/base-CUzfuEjq.cjs +0 -0
  11. package/dist/chunk-B9dir_RE.mjs +1 -0
  12. package/dist/client-Bmkb1ges.cjs +1 -0
  13. package/dist/client-sGV7POG-.mjs +1 -0
  14. package/dist/commit-BcWQkCJR.cjs +1 -0
  15. package/dist/commit-D9L4p6A4.mjs +5 -0
  16. package/dist/commit-DUYHx6WQ.mjs +1 -0
  17. package/dist/commit-Dns-Df6e.cjs +5 -0
  18. package/dist/exports/axios.cjs +1 -1
  19. package/dist/exports/axios.d.mts +3 -0
  20. package/dist/exports/axios.mjs +1 -1
  21. package/dist/exports/chunk-CUT6urMc.cjs +1 -0
  22. package/dist/exports/dayjs.cjs +1 -1
  23. package/dist/exports/dayjs.d.mts +2 -0
  24. package/dist/exports/dayjs.mjs +1 -1
  25. package/dist/exports/exec.cjs +1 -1
  26. package/dist/exports/exec.d.mts +1 -0
  27. package/dist/exports/exec.mjs +1 -1
  28. package/dist/exports/markdown.cjs +1 -1
  29. package/dist/exports/markdown.d.mts +2 -0
  30. package/dist/exports/markdown.mjs +1 -1
  31. package/dist/exports/simple-git.cjs +1 -1
  32. package/dist/exports/simple-git.d.mts +3 -0
  33. package/dist/exports/simple-git.mjs +1 -1
  34. package/dist/index.cjs +1 -6
  35. package/dist/index.d.mts +4232 -0
  36. package/dist/index.mjs +1 -6
  37. package/dist/issue-BFS72RBD.mjs +1 -0
  38. package/dist/issue-DWeE5P0Y.mjs +1 -0
  39. package/dist/issue-D_dZXgBG.cjs +1 -0
  40. package/dist/issue-DgiPQKQ2.cjs +1 -0
  41. package/dist/org-BDE4cv_c.cjs +1 -0
  42. package/dist/org-C-sgE96B.cjs +1 -0
  43. package/dist/org-DGNhfEZK.mjs +1 -0
  44. package/dist/org-DUBwi6B4.mjs +1 -0
  45. package/dist/pull_request-C2kirVoE.mjs +1 -0
  46. package/dist/pull_request-CfU8bWD3.mjs +1 -0
  47. package/dist/pull_request-FH9SDPpy.cjs +1 -0
  48. package/dist/pull_request-YYuNBRfz.cjs +1 -0
  49. package/dist/repo-BovlwNiC.mjs +1 -0
  50. package/dist/repo-C3bmC1kp.mjs +1 -0
  51. package/dist/repo-CCp3AF4M.cjs +1 -0
  52. package/dist/repo-CUJpctL3.cjs +1 -0
  53. package/dist/root--c209M1Y.mjs +1 -0
  54. package/dist/root-s6IKP4Xz.cjs +1 -0
  55. package/dist/root.cjs +1 -1
  56. package/dist/root.d.mts +5 -0
  57. package/dist/root.mjs +1 -1
  58. package/dist/search-D_6p-na8.cjs +1 -0
  59. package/dist/search-DxL-o1yv.mjs +1 -0
  60. package/dist/search-VShiQDs8.cjs +1 -0
  61. package/dist/search-bcPx7a6C.mjs +1 -0
  62. package/dist/user-3KZ4a1kT.cjs +1 -0
  63. package/dist/user-CkLZNCr4.mjs +1 -0
  64. package/dist/user-CsxfQJk2.mjs +1 -0
  65. package/dist/user-DTkgxY1i.cjs +1 -0
  66. package/dist/webhook-BRAZACxU.cjs +1 -0
  67. package/dist/webhook-DDN2SS97.mjs +1 -0
  68. package/dist/webhook-Dqf-QKIA.cjs +1 -0
  69. package/dist/webhook-at9Unv7b.mjs +1 -0
  70. package/dist/workflow-6BNjelIP.mjs +1 -0
  71. package/dist/workflow-D5aU6i5t.cjs +1 -0
  72. package/dist/workflow-DfSZx8u4.cjs +1 -0
  73. package/dist/workflow-vxjTvuWu.mjs +1 -0
  74. package/package.json +14 -9
  75. package/dist/exports/axios.d.ts +0 -7
  76. package/dist/exports/dayjs.d.ts +0 -1
  77. package/dist/exports/exec.d.ts +0 -1
  78. package/dist/exports/lodash.cjs +0 -1
  79. package/dist/exports/lodash.d.ts +0 -3
  80. package/dist/exports/lodash.mjs +0 -1
  81. package/dist/exports/markdown.d.ts +0 -1
  82. package/dist/exports/simple-git.d.ts +0 -2
  83. package/dist/index.d.ts +0 -4165
  84. package/dist/root.d.ts +0 -4
@@ -0,0 +1,4232 @@
1
+ import * as Diff2Html from "diff2html";
2
+ import "@candriajs/exec";
3
+ import "color-convert";
4
+ import MarkdownIt from "markdown-it";
5
+ import { AxiosResponseHeaders, RawAxiosResponseHeaders } from "axios";
6
+
7
+ //#region src/common/diff.d.ts
8
+
9
+ /**
10
+ * 渲染差异文本为HTML格式的可视化对比视图
11
+ *
12
+ * @param diff - 需要渲染的Git差异文本(diff格式字符串)
13
+ * @param options - (可选) Diff2Html配置选项,用于自定义渲染行为
14
+ * @returns 渲染后的HTML字符串
15
+ *
16
+ * @example
17
+ * // 基本用法
18
+ * const html = render_diff(diffText);
19
+ *
20
+ * @example
21
+ * // 自定义配置
22
+ * const html = render_diff(diffText, {
23
+ * outputFormat: 'line-by-line',
24
+ * colorScheme: ColorSchemeType.DARK
25
+ * });
26
+ */
27
+ declare function render_diff(diff: string, options?: Diff2Html.Diff2HtmlConfig): string;
28
+ //#endregion
29
+ //#region src/types/base/base.d.ts
30
+ /** 代理地址类型 */
31
+ type ProxyUrlType = string;
32
+ /**
33
+ * 代理类型:
34
+ * - reverse: 反向代理
35
+ * - original: 原始代理
36
+ * - common: 通用代理
37
+ */
38
+ declare enum ProxyType {
39
+ /** 反向代理 */
40
+ Reverse = "reverse",
41
+ /** 原始代理 */
42
+ Original = "original",
43
+ /** 通用代理 */
44
+ Common = "common",
45
+ }
46
+ /** Git类型 */
47
+ type GitType = 'github' | 'gitee' | 'gitcode';
48
+ /** 代理协议类型 */
49
+ declare enum ProxyProtocol {
50
+ /** HTTP */
51
+ HTTP = "http",
52
+ /** HTTPS */
53
+ HTTPS = "https",
54
+ /** SOCKS */
55
+ SOCKS = "socks",
56
+ }
57
+ /**
58
+ * 基本代理配置
59
+ * @typeparam T - 代理类型或协议类型
60
+ */
61
+ interface BaseProxyType<T extends ProxyType | ProxyProtocol> {
62
+ type: T;
63
+ address: ProxyUrlType;
64
+ }
65
+ /** 代理配置参数类型 */
66
+ type ProxyParamsType = BaseProxyType<ProxyProtocol.HTTP> | BaseProxyType<ProxyProtocol.HTTPS> | BaseProxyType<ProxyProtocol.SOCKS> | BaseProxyType<ProxyType.Common> | BaseProxyType<ProxyType.Reverse>;
67
+ //#endregion
68
+ //#region src/types/base/git.d.ts
69
+ /** 本地Git仓库信息 */
70
+ interface GitRepoInfoType {
71
+ /** 文件夹名称 */
72
+ name: string;
73
+ /** 文件夹路径 */
74
+ path: string;
75
+ /**
76
+ * git地址,原始地址可能是反代的地址
77
+ * */
78
+ url: string;
79
+ /**
80
+ * 仓库地址, 这个是经过处理的,保证是不经过任何代理地址的地址
81
+ * */
82
+ html_url: string;
83
+ /** 仓库名称 */
84
+ owner: string;
85
+ /** 仓库名称 */
86
+ repo: string;
87
+ /** 仓库的默认分支 */
88
+ default_branch: string | null;
89
+ }
90
+ /** 获取本地路径的Git仓库信息列表 */
91
+ interface GitInfoListType {
92
+ /** 总数 */
93
+ total: number;
94
+ items: Array<GitRepoInfoType>;
95
+ }
96
+ interface GitRepoInfoListOptionsType {
97
+ /** 是否递归查找 */
98
+ loop?: boolean;
99
+ /** 递归最大深度 */
100
+ maxDepth?: number;
101
+ /** 忽略目录 */
102
+ dir?: string[];
103
+ }
104
+ //#endregion
105
+ //#region src/types/base/npm.d.ts
106
+ /** Npm包信息 */
107
+ interface NpmPackageInfoType {
108
+ /** 包名 */
109
+ name: string;
110
+ /** 文件夹路径 */
111
+ path: string;
112
+ /** 仓库地址 */
113
+ html_url: string;
114
+ /** 仓库名称 */
115
+ owner: string;
116
+ /** 仓库名称 */
117
+ repo: string;
118
+ /** 默认分支 */
119
+ default_branch: string;
120
+ }
121
+ interface NpmPackageInfoListOptionsType {
122
+ /** 忽略的包名 */
123
+ packageName: string[];
124
+ /** 包名前缀 */
125
+ prefix: string;
126
+ }
127
+ interface NpmPackageInfoListType {
128
+ /** 总数 */
129
+ total: number;
130
+ /** 包列表 */
131
+ items: Array<NpmPackageInfoType>;
132
+ }
133
+ //#endregion
134
+ //#region src/types/base/pkg.d.ts
135
+ interface PkgInfoType {
136
+ /** 包名 */
137
+ name: string;
138
+ /** 包版本 */
139
+ version: string;
140
+ /** 描述 */
141
+ description?: string;
142
+ /** 主入口文件 */
143
+ main?: string;
144
+ /** 关键字 */
145
+ keywords?: string[];
146
+ dependencies?: Record<string, string>;
147
+ /** 作者信息 */
148
+ author?: string | {
149
+ name: string;
150
+ email?: string;
151
+ url?: string;
152
+ };
153
+ /** 许可证 */
154
+ license?: string;
155
+ /** 仓库信息 */
156
+ repository?: string | {
157
+ type: string;
158
+ url: string;
159
+ };
160
+ /** 问题追踪 */
161
+ bugs?: {
162
+ url?: string;
163
+ email?: string;
164
+ };
165
+ /** 主页 */
166
+ homepage?: string;
167
+ }
168
+ //#endregion
169
+ //#region src/types/base/request.d.ts
170
+ /** 请求令牌的类型 */
171
+ type RequestTokenType = 'Bearer' | 'Basic';
172
+ /** 请求配置类型 */
173
+ interface RequestConfigType {
174
+ /** 请求地址 */
175
+ url?: string;
176
+ /** 访问令牌令牌 */
177
+ token?: string | null;
178
+ /** 令牌类型,默认为 Bearer,即使用 Bearer 令牌 */
179
+ tokenType?: RequestTokenType;
180
+ }
181
+ //#endregion
182
+ //#region src/types/base/response.d.ts
183
+ /** 是否响应成功类型 */
184
+ type ResponseSuccessType = boolean;
185
+ /** 状态码响应类型 */
186
+ type ResponseStatusCodeType = number;
187
+ /** 消息响应类型 */
188
+ type ResponseMsgType = string;
189
+ /** 响应头类型 */
190
+ type ResponseHeadersType = RawAxiosResponseHeaders | AxiosResponseHeaders;
191
+ /** 响应类型 */
192
+ interface ResponseType<D = any> {
193
+ success: ResponseSuccessType;
194
+ statusCode: ResponseStatusCodeType;
195
+ headers: ResponseHeadersType;
196
+ msg: ResponseMsgType;
197
+ data: D;
198
+ }
199
+ /** API响应类型 */
200
+ interface ApiResponseType<D = any> extends Omit<ResponseType<D>, 'headers'> {
201
+ status: 'ok' | 'error';
202
+ }
203
+ //#endregion
204
+ //#region src/types/base/utils.d.ts
205
+ interface GitRepoType {
206
+ /** 仓库的地址 */
207
+ html_url: string;
208
+ /** 仓库的拥有者 */
209
+ owner: string;
210
+ /** 仓库的名称 */
211
+ repo: string;
212
+ }
213
+ /**
214
+ * 单日贡献数据
215
+ */
216
+ interface ContributionData {
217
+ /** 日期字符串,格式为YYYY-MM-DD */
218
+ date: string;
219
+ /** 当日的贡献次数 */
220
+ count: number;
221
+ }
222
+ /**
223
+ * 贡献统计结果
224
+ */
225
+ interface ContributionResult {
226
+ /** 总贡献次数 */
227
+ total: number;
228
+ /**
229
+ * 二维数组结构的贡献数据
230
+ * 第一维通常表示周数,第二维表示每周的贡献数据
231
+ */
232
+ contributions: ContributionData[][];
233
+ }
234
+ //#endregion
235
+ //#region src/types/platform/base.d.ts
236
+ interface AccessTokenType {
237
+ /** 访问令牌 */
238
+ access_token: string;
239
+ }
240
+ interface AccessCodeType {
241
+ /** 授权码 */
242
+ code: string;
243
+ }
244
+ interface RefreshTokenType {
245
+ /** 刷新令牌 */
246
+ refresh_token: string;
247
+ }
248
+ interface UserNameParamType {
249
+ /** 用户名 */
250
+ username: string;
251
+ }
252
+ interface OrgNameParamType {
253
+ /** 组织登录名 */
254
+ org: string;
255
+ }
256
+ interface UserIdParamType {
257
+ /** 用户id */
258
+ user_id: number;
259
+ }
260
+ interface RepoOwnerParamType {
261
+ /** 仓库的拥有者 */
262
+ owner: string;
263
+ }
264
+ interface RepoNameParamType {
265
+ /** 仓库的名称 */
266
+ repo: string;
267
+ }
268
+ interface RepoUrlParamType {
269
+ /** 仓库地址 */
270
+ url: string;
271
+ }
272
+ interface ShaParamType {
273
+ /** 仓库的SHA值 */
274
+ sha: string;
275
+ }
276
+ interface formatParamType {
277
+ /** 是否格式化 */
278
+ format: boolean;
279
+ }
280
+ /**
281
+ * 一个仓库基本参数
282
+ * 包含:
283
+ * - owner: 仓库拥有者
284
+ * - repo: 仓库名称
285
+ */
286
+ type RepoBaseParamType = RepoOwnerParamType & RepoNameParamType;
287
+ /**
288
+ * 一个仓库参数, 可以是基本参数,也可以是仓库地址
289
+ * 包含:
290
+ * - owner: 仓库拥有者
291
+ * - repo: 仓库名称
292
+ * - url: 仓库地址
293
+ */
294
+ type RepoParamType = RepoBaseParamType | RepoUrlParamType;
295
+ /**
296
+ * 议题参数
297
+ */
298
+ interface IssueNumberParamType {
299
+ /** 问题id */
300
+ issue_number: number | string;
301
+ }
302
+ /**
303
+ * 拉取请求ID参数
304
+ */
305
+ interface PullRequestNumberParamType {
306
+ /** 拉取请求id */
307
+ pr_number: number;
308
+ }
309
+ /**
310
+ * 工作流参数
311
+ */
312
+ interface workflowIdParamType {
313
+ /** 工作流id */
314
+ workflow_id: number | string;
315
+ }
316
+ /**
317
+ * 角色名称参数
318
+ * - 角色名称
319
+ * @default 'member'
320
+ * - admin 管理员
321
+ * - member 成员
322
+ */
323
+ interface RoleNameType {
324
+ role: 'admin' | 'member';
325
+ }
326
+ interface CommentIdParamType {
327
+ /** 评论id */
328
+ comment_id: number | string;
329
+ }
330
+ /** App 客户端类型 */
331
+ interface AppClientType {
332
+ /** App Client ID */
333
+ Client_ID?: string | null;
334
+ /** App Client Secret */
335
+ Client_Secret?: string | null;
336
+ /** 私钥内容 */
337
+ Private_Key?: string | null;
338
+ /** WebHook Secret */
339
+ WebHook_Secret?: string | null;
340
+ }
341
+ /** 访问令牌客户端类型 */
342
+ interface AccessTokenClentTYpe {
343
+ /** 访问令牌 */
344
+ access_token?: string | null;
345
+ }
346
+ //#endregion
347
+ //#region src/types/client.d.ts
348
+ /** GitHub客户端类型 */
349
+ type GitHubBaseClient = AppClientType | AccessTokenClentTYpe;
350
+ type GitHubClientType = GitHubBaseClient & {
351
+ /** 是否格式化 */
352
+ readonly format?: formatParamType['format'];
353
+ };
354
+ /** 客户端类型 */
355
+ interface ClientType {
356
+ /** GitHub客户端 */
357
+ github: GitHubClientType;
358
+ }
359
+ //#endregion
360
+ //#region src/types/platform/user.d.ts
361
+ /** 用户信息参数类型 */
362
+ type UserInfoParamType = UserNameParamType;
363
+ /** 通过用户ID 获取用户信息参数类型 */
364
+ type UserInfoByIdParamType = UserIdParamType;
365
+ /** 用户信息响应类型 */
366
+ interface UserInfoResponseType {
367
+ /** 账号ID */
368
+ id: number;
369
+ /** 账号登录名 */
370
+ login: string;
371
+ /** 用户全名 */
372
+ name: string | null;
373
+ /** 邮箱 */
374
+ email: string | null;
375
+ /**
376
+ * 账号类型
377
+ * User: 用户
378
+ * Organization: 组织
379
+ */
380
+ type: string;
381
+ /** 账号主页URL */
382
+ html_url: string;
383
+ /** 账号头像URL */
384
+ avatar_url: string;
385
+ /** 个人简介 */
386
+ bio: string | null;
387
+ /** 博客URL */
388
+ blog: string | null;
389
+ /** 公开仓库数量 */
390
+ public_repos: number;
391
+ /** 粉丝数 */
392
+ followers: number;
393
+ /** 关注数 */
394
+ following: number;
395
+ }
396
+ //#endregion
397
+ //#region src/types/platform/commit.d.ts
398
+ interface CommitInfoCommonParamType {
399
+ /** 提交SHA */
400
+ sha?: ShaParamType['sha'];
401
+ }
402
+ /** Git提交用户信息 */
403
+ interface GitUser extends Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'> {
404
+ /** 日期字符串 */
405
+ date: string;
406
+ }
407
+ interface Commit {
408
+ /** 提交的URL */
409
+ url: string;
410
+ /** 提交作者信息 */
411
+ author: GitUser;
412
+ /** 提交者信息 */
413
+ committer: GitUser;
414
+ /** 提交信息 */
415
+ message: string;
416
+ /**
417
+ * 提交标题
418
+ * 仅在开启格式化消息时返回
419
+ * @example "feat: add new feature"
420
+ */
421
+ title?: string;
422
+ /** 提交正文
423
+ * 仅在开启格式化消息时返回
424
+ * @example "- add new feature"
425
+ */
426
+ body?: string | null;
427
+ /** 提交树信息 */
428
+ tree: {
429
+ /** 树对象的SHA */
430
+ sha: string;
431
+ /** 树对象的URL */
432
+ url: string;
433
+ };
434
+ }
435
+ interface DiffEntry {
436
+ /** 文件SHA */
437
+ sha: string;
438
+ /** 文件名 */
439
+ filename: string;
440
+ /** 文件状态 */
441
+ status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied' | 'changed' | 'unchanged';
442
+ /** 新增行数 */
443
+ additions: number;
444
+ /** 删除行数 */
445
+ deletions: number;
446
+ /** 总变更行数 */
447
+ changes: number;
448
+ /** 文件blob URL */
449
+ blob_url: string;
450
+ /** 文件原始URL */
451
+ raw_url: string;
452
+ }
453
+ interface CommitStats {
454
+ /** 新增行数 */
455
+ additions: number;
456
+ /** 删除行数 */
457
+ deletions: number;
458
+ /** 总变更行数 */
459
+ total: number;
460
+ }
461
+ interface ParentCommit {
462
+ /** 父提交SHA */
463
+ sha: string;
464
+ /** 父提交URL */
465
+ url: string;
466
+ }
467
+ /** 提交参数类型 */
468
+ type CommitInfoParamType = RepoParamType & CommitInfoCommonParamType;
469
+ /** 提交信息响应类型 */
470
+ interface CommitInfoResponseType {
471
+ /** HTML URL */
472
+ html_url: string;
473
+ /** 提交SHA */
474
+ sha: string;
475
+ /** 评论URL */
476
+ comments_url: string;
477
+ /** 提交信息 */
478
+ commit: Commit;
479
+ /** 父提交列表 */
480
+ parents: ParentCommit[];
481
+ /** 提交统计信息 */
482
+ stats: CommitStats;
483
+ /** 变更文件列表 */
484
+ files: DiffEntry[];
485
+ }
486
+ /** 提交列表参数类型 */
487
+ type CommitListParamType = RepoParamType & {
488
+ /** SHA 或分支名称,用于指定从哪里开始列出提交 */
489
+ sha?: ShaParamType['sha'];
490
+ /** 仅返回包含此文件路径的提交 */
491
+ path?: string;
492
+ /** GitHub 用户名或电子邮件地址,用于按提交作者筛选 */
493
+ author?: string;
494
+ /** ISO 8601 格式的时间戳 (YYYY-MM-DDTHH:MM:SSZ),仅显示此时间之后更新的结果 */
495
+ since?: string;
496
+ /** ISO 8601 格式的时间戳 (YYYY-MM-DDTHH:MM:SSZ),仅返回此时间之前的提交 */
497
+ until?: string;
498
+ /** 每页的结果数(最多 100),默认: 30 */
499
+ per_page?: number;
500
+ /** 要获取的结果页码,默认: 1 */
501
+ page?: number;
502
+ };
503
+ /** 提交列表响应类型 */
504
+ type CommitListResponseType = CommitInfoResponseType[];
505
+ //#endregion
506
+ //#region src/types/platform/repo.d.ts
507
+ /** 仓库所有者参数类型 */
508
+ type RepoUser = Omit<UserInfoResponseType, 'followers' | 'following' | 'blog' | 'bio' | 'public_repos' | 'email'>;
509
+ /** 仓库列表参数类型 */
510
+ interface RepoListBaseParamType {
511
+ /** 排序方式,可选created, updated, pushed, full_name, 默认为 full_name */
512
+ sort?: 'created' | 'updated' | 'pushed' | 'full_name';
513
+ /** 排序方式,可选asc, desc, 默认为 desc */
514
+ direction?: 'asc' | 'desc';
515
+ /** 每页数量 */
516
+ per_page?: number;
517
+ /** 页码 */
518
+ page?: number;
519
+ }
520
+ interface UserByTokenRepoListParamType extends RepoListBaseParamType {
521
+ /** 仓库的可见性,可选all, public, private, 默认为 all */
522
+ visibility?: 'all' | 'public' | 'private';
523
+ /** 仓库的状态,可选all, public, private, 默认为 all */
524
+ affiliation?: 'owner' | 'collaborator' | 'organization_member';
525
+ /** 类型,可选all, owner, member, 默认为 all */
526
+ type?: 'all' | 'owner' | 'member';
527
+ }
528
+ /** 仓库信息请求参数 */
529
+ type RepoInfoParamType = RepoBaseParamType;
530
+ /** * 仓库信息 */
531
+ interface RepoInfoResponseType {
532
+ /** * 仓库的唯一 ID */
533
+ id: number;
534
+ /** * 仓库的名称 */
535
+ name: string;
536
+ /** * 仓库的完整名称,包含用户名或组织名 */
537
+ full_name: string;
538
+ /** * 仓库拥有者的信息 */
539
+ owner: RepoUser;
540
+ /** 仓库是否公开 */
541
+ public: boolean;
542
+ /** * 仓库是否私有 */
543
+ private: boolean;
544
+ /** * 仓库的可见性 */
545
+ visibility: 'public' | 'private';
546
+ /** * 仓库是否是 fork 仓库 */
547
+ fork: boolean;
548
+ /** * 仓库是否已归档 */
549
+ archived: boolean;
550
+ /** * 仓库是否被禁用 */
551
+ disabled: boolean;
552
+ /** * 仓库的 HTML 页面 URL */
553
+ html_url: string;
554
+ /** * 仓库的描述信息 */
555
+ description: string | null;
556
+ /** * 仓库的 Stargazer 数量 */
557
+ stargazers_count: number;
558
+ /** * 仓库的 Watcher 数量 */
559
+ watchers_count: number;
560
+ /** * 仓库的主编程语言 */
561
+ language: string | null;
562
+ /** * 仓库的 fork 数量 */
563
+ forks_count: number;
564
+ /** * 开放的 issue 数量 */
565
+ open_issues_count: number;
566
+ /** * 仓库的默认分支 */
567
+ default_branch: string;
568
+ /** * 仓库的创建时间 */
569
+ created_at: string;
570
+ /** * 仓库的更新时间 */
571
+ updated_at: string;
572
+ /** * 仓库的推送时间 */
573
+ pushed_at: string;
574
+ }
575
+ /** 组织仓库列表参数类型 */
576
+ interface OrgRepoListParmType extends RepoListBaseParamType {
577
+ /** 组织名称 */
578
+ org: string;
579
+ /** 类型,可选all, public, private 默认为 all */
580
+ type?: 'all' | 'public' | 'private';
581
+ }
582
+ /**
583
+ * 组织仓库列表响应类型
584
+ * 该类型包含了多个仓库的信息,每个仓库都有自己的详细信息。
585
+ */
586
+ type OrgRepoListResponseType = RepoInfoResponseType[];
587
+ /** 创建组织仓库请求参数 */
588
+ interface OrgRepoCreateParamType extends OrgNameParamType {
589
+ /** 仓库名称 */
590
+ name: string;
591
+ /** 仓库描述 */
592
+ description?: string;
593
+ /** 仓库主页 */
594
+ homepage?: string;
595
+ /** 仓库可见性 */
596
+ visibility?: 'public' | 'private';
597
+ /** 是否开启议题issue */
598
+ has_issues?: boolean;
599
+ /** 是否开启wiki */
600
+ has_wiki?: boolean;
601
+ /** 仓库自动初始化 */
602
+ auto_init?: boolean;
603
+ }
604
+ /** 创建组织仓库响应类型 */
605
+ type OrgRepoCreateResponseType = RepoInfoResponseType;
606
+ /** 创建用户仓库参数类型 */
607
+ type UserRepoCreateParamType = Omit<OrgRepoCreateParamType, 'org'> & RepoOwnerParamType;
608
+ /** 创建用户仓库响应类型 */
609
+ type UserRepoCreateResponseType = RepoInfoResponseType;
610
+ /** 用户仓库列表参数类型 */
611
+ interface UserRepoListParamType extends RepoListBaseParamType {
612
+ /** 用户名 */
613
+ username: string;
614
+ /** 类型,可选all, owner, member, 默认为 all */
615
+ type?: 'all' | 'owner' | 'member';
616
+ }
617
+ /** 用户仓库列表类型 */
618
+ type UserRepoListType = Array<RepoInfoResponseType & {
619
+ /** * 仓库的角色名称 */
620
+ role_name?: string;
621
+ }>;
622
+ /** 仓库语言信息类型 */
623
+ interface LanguageInfo {
624
+ /** 编程语言名称 */
625
+ language: string;
626
+ /** 语言对应的颜色 */
627
+ color: string;
628
+ /** 在仓库中的占比(百分比) */
629
+ percent: number;
630
+ /** 该语言的代码字节数 */
631
+ bytes: number;
632
+ }
633
+ /** 仓库语言列表参数类型 */
634
+ type RepoLanguagesListParamType = RepoBaseParamType;
635
+ /** 仓库语言列表类型 */
636
+ interface RepoLanguagesListResponseType {
637
+ /** 仓库的语言统计信息列表 */
638
+ languages: LanguageInfo[];
639
+ }
640
+ /** 获取仓库可见性参数类型 */
641
+ type GetRepoVisibilityParamType = RepoBaseParamType;
642
+ /** 获取仓库可见性响应类型 */
643
+ type GetRepoVisibilityResponseType = RepoInfoResponseType['visibility'];
644
+ /** 获取仓库默认分支参数类型 */
645
+ type GetRepoDefaultBranchParamType = RepoBaseParamType;
646
+ /** 获取仓库默认分支响应类型 */
647
+ type GetRepoDefaultBranchResponseType = RepoInfoResponseType['default_branch'];
648
+ /** 获取仓库主要语言参数类型 */
649
+ type GetRepoMainLanguageParamType = RepoBaseParamType;
650
+ /** 仓库主要语言响应类型 */
651
+ type GetRepoMainLanguageResponseType = RepoInfoResponseType['language'];
652
+ /**
653
+ * 协作者权限 ,可选 pull,triage, push, maintain, admin,默认pull
654
+ * pull - 只读访问,协作者可以查看仓库内容。
655
+ * push - 允许推送代码到仓库分支,同时拥有 pull 权限。
656
+ * admin - 拥有仓库的完全控制权,包括更改设置和删除仓库。
657
+ */
658
+ type CollaboratorPermissionType = 'pull' | 'push' | 'admin';
659
+ /** 协作者参数类型 */
660
+ type CollaboratorParamType = RepoInfoParamType & UserNameParamType & {
661
+ /** 邀请的权限 */
662
+ permission?: CollaboratorPermissionType;
663
+ };
664
+ /** 邀请协作者响应类型 */
665
+ interface AddCollaboratorResponseType {
666
+ /** 被邀请者ID */
667
+ id: number;
668
+ /** 被邀请者用户名 */
669
+ login: string;
670
+ /** 被邀请者的别名 */
671
+ name: string | null;
672
+ /** 仓库的地址 */
673
+ html_url: string;
674
+ /** 被邀请者的权限 */
675
+ permissions: string;
676
+ }
677
+ /** 协作者列表参数类型 */
678
+ type GetCollaboratorListParamType = RepoInfoParamType & {
679
+ /**
680
+ * 筛选按隶属关系返回的协作者
681
+ * outside - 列出所有外部协作者,包括仓库成员和外部 collaborator。
682
+ * direct - 列出仓库成员。
683
+ * all - 列出仓库成员和外部 collaborator。
684
+ */
685
+ affiliation?: 'outside' | 'direct' | 'all';
686
+ /** 权限 */
687
+ permission?: CollaboratorPermissionType;
688
+ /** 每页数量 */
689
+ per_page?: number;
690
+ /** 页码 */
691
+ page?: number;
692
+ };
693
+ /** 协作者信息类型 */
694
+ interface CollaboratorInfoResponseType {
695
+ /** 协作者id */
696
+ id: number;
697
+ /** 协作者登录名 */
698
+ login: string;
699
+ /** 头像URL */
700
+ avatar_url: string;
701
+ /** 协作者邮箱 */
702
+ email: string | null;
703
+ /** 协作者姓名 */
704
+ name: string | null;
705
+ /** 权限设置 */
706
+ permissions: {
707
+ /** 拉取权限 */
708
+ pull: boolean;
709
+ /** 分类权限 */
710
+ triage: boolean;
711
+ /** 推送权限 */
712
+ push: boolean;
713
+ /** 维护权限 */
714
+ maintain: boolean;
715
+ /** 管理权限 */
716
+ admin: boolean;
717
+ };
718
+ }
719
+ /** 协作者列表响应类型 */
720
+ type GetCollaboratorListResponseType = CollaboratorInfoResponseType[];
721
+ /** 移除协作者参数类型 */
722
+ type RemoveCollaboratorParamType = RepoBaseParamType & UserNameParamType;
723
+ /** 移除协作者响应类型 */
724
+ interface RemoveCollaboratorResponseType {
725
+ /** 是否移除成功 */
726
+ success: boolean;
727
+ /** 状态信息 */
728
+ message: string;
729
+ }
730
+ //#endregion
731
+ //#region src/types/platform/github/app.d.ts
732
+ type AppUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'>;
733
+ /**
734
+ * 定义 Base 应用所需的权限
735
+ */
736
+ interface AppPermissions {
737
+ /** 对仓库内容的权限(例如读取、写入) */
738
+ contents: string;
739
+ /** 对部署的权限(例如读取、写入) */
740
+ deployments: string;
741
+ /** 对议题的权限(例如写) */
742
+ issues: string;
743
+ /** 对检查的权限 */
744
+ checks: string;
745
+ /** 对元数据的权限(例如读取) */
746
+ metadata: string;
747
+ }
748
+ interface AppInfoParamType {
749
+ /**
750
+ * 应用的标识符
751
+ * 是https://github.com/settings/apps/:app_slug的
752
+ * */
753
+ app_slug: string;
754
+ }
755
+ /**
756
+ * 应用的详细信息
757
+ */
758
+ interface AppInfoResponseType {
759
+ /** 应用的唯一 ID */
760
+ id: number;
761
+ /** 应用的名称 */
762
+ name: string;
763
+ /** 应用的 Client ID */
764
+ client_id: string;
765
+ /** 应用的标识符(slug) */
766
+ slug: string;
767
+ /** 应用所有者的信息 */
768
+ owner: AppUser;
769
+ /** 应用的描述 */
770
+ description: string;
771
+ /** 应用的外部 URL */
772
+ external_url: string;
773
+ /** 应用的 Base 页面 URL */
774
+ html_url: string;
775
+ /** 应用所需的权限 */
776
+ permissions: AppPermissions;
777
+ /** 应用监听的事件列表 */
778
+ events: string[];
779
+ /** 应用创建时间的时间戳 */
780
+ created_at: string;
781
+ /** 应用最后更新时间的时间戳 */
782
+ updated_at: string;
783
+ }
784
+ /** GitHub应用安装仓库信息响应类型 */
785
+ interface AppRepoInfoResponseType {
786
+ /** 安装的唯一ID */
787
+ id: number;
788
+ /** 安装页面URL */
789
+ html_url: string;
790
+ /** 应用ID */
791
+ app_id: number;
792
+ /** 应用标识符 */
793
+ app_slug: string;
794
+ /** 目标ID(用户或组织的ID) */
795
+ target_id: number;
796
+ /** 目标类型(如'Organization') */
797
+ target_type: string;
798
+ /** 安装的账户信息,可以是用户或企业 */
799
+ account: AppUser;
800
+ /** 仓库选择类型 */
801
+ repository_selection: 'all' | 'selected';
802
+ /** 访问令牌URL */
803
+ access_tokens_url: string;
804
+ /** 仓库列表URL */
805
+ repositories_url: string;
806
+ /** 权限配置 */
807
+ permissions: AppPermissions;
808
+ /** 事件列表 */
809
+ events: string[];
810
+ /** 创建时间 */
811
+ created_at: string;
812
+ /** 更新时间 */
813
+ updated_at: string;
814
+ }
815
+ /** 通过仓库信息获取应用信息参数类型 */
816
+ type GetAppInfoByRepoParamType = RepoInfoParamType;
817
+ /** 通过仓库信息获取应用信息响应类型 */
818
+ type GetAppInfoByRepoResponseType = AppRepoInfoResponseType;
819
+ /** 通过用户信息获取应用信息参数 */
820
+ type GetAppInfoByUserParamType = UserNameParamType;
821
+ /** 通过用户信息获取应用信息响应类型 */
822
+ type GetAppInfoByUserResponseType = AppRepoInfoResponseType;
823
+ /** 通过用户信息获取应用信息参数 */
824
+ type GetAppInfoByOrgParamType = OrgNameParamType;
825
+ /** 通过用户信息获取应用信息响应类型 */
826
+ type GetAppInfoByOrgResponseType = AppRepoInfoResponseType;
827
+ /** 访问令牌权限 */
828
+ interface AccessTokenPermissionsType {
829
+ /** GitHub Actions 工作流、工作流运行和工件的权限 */
830
+ actions: 'read' | 'write';
831
+ /** 存储库创建、删除、设置、团队和协作者创建的权限 */
832
+ administration: 'read' | 'write';
833
+ /** 代码检查的权限 */
834
+ checks: 'read' | 'write';
835
+ /** 创建、编辑、删除和列出 GitHub Codespaces 的权限 */
836
+ codespaces: 'read' | 'write';
837
+ /** 存储库内容、提交、分支、下载、发布和合并的权限 */
838
+ contents: 'read' | 'write';
839
+ /** 管理 Dependabot 密钥的权限 */
840
+ dependabot_secrets: 'read' | 'write';
841
+ /** 部署和部署状态的权限 */
842
+ deployments: 'read' | 'write';
843
+ /** 管理存储库环境的权限 */
844
+ environments: 'read' | 'write';
845
+ /** 问题和相关评论、指派、标签和里程碑的权限 */
846
+ issues: 'read' | 'write';
847
+ /** 搜索存储库、列出协作者和访问存储库元数据的权限 */
848
+ metadata: 'read' | 'write';
849
+ /** 管理 GitHub Packages 发布的包的权限 */
850
+ packages: 'read' | 'write';
851
+ /** 获取 Pages 状态、配置和构建的权限,并创建新的构建 */
852
+ pages: 'read' | 'write';
853
+ /** 管理拉取请求及相关评论、指派、标签、里程碑和合并的权限 */
854
+ pull_requests: 'read' | 'write';
855
+ /** 查看和编辑存储库自定义属性的权限 */
856
+ repository_custom_properties: 'read' | 'write';
857
+ /** 管理存储库的 post-receive 钩子的权限 */
858
+ repository_hooks: 'read' | 'write';
859
+ /** 管理存储库项目、列和卡片的权限 */
860
+ repository_projects: 'read' | 'write' | 'admin';
861
+ /** 查看和管理秘密扫描警报的权限 */
862
+ secret_scanning_alerts: 'read' | 'write';
863
+ /** 管理存储库秘密的权限 */
864
+ secrets: 'read' | 'write';
865
+ /** 查看和管理安全事件的权限,比如代码扫描警报 */
866
+ security_events: 'read' | 'write';
867
+ /** 只管理单个文件的权限 */
868
+ single_file: 'read' | 'write';
869
+ /** 管理提交状态的权限 */
870
+ statuses: 'read' | 'write';
871
+ /** 管理 Dependabot 警报的权限 */
872
+ vulnerability_alerts: 'read' | 'write';
873
+ /** 更新 GitHub Actions 工作流文件的权限 */
874
+ workflows: 'write';
875
+ /** 管理组织团队和成员的权限 */
876
+ members: 'read' | 'write';
877
+ /** 管理组织访问权限的权限 */
878
+ organization_administration: 'read' | 'write';
879
+ /** 管理自定义存储库角色的权限 */
880
+ organization_custom_roles: 'read' | 'write';
881
+ /** 管理自定义组织角色的权限 */
882
+ organization_custom_org_roles: 'read' | 'write';
883
+ /** 管理自定义属性的权限 */
884
+ organization_custom_properties: 'read' | 'write' | 'admin';
885
+ /** 管理 GitHub Copilot 组织成员访问权限的权限 */
886
+ organization_copilot_seat_management: 'write';
887
+ /** 查看和管理组织公告横幅的权限 */
888
+ organization_announcement_banners: 'read' | 'write';
889
+ /** 查看组织活动的权限 */
890
+ organization_events: 'read';
891
+ /** 管理组织的 post-receive 钩子的权限 */
892
+ organization_hooks: 'read' | 'write';
893
+ /** 查看和管理组织的个人访问令牌请求的权限 */
894
+ organization_personal_access_tokens: 'read' | 'write';
895
+ /** 查看和管理组织批准的个人访问令牌的权限 */
896
+ organization_personal_access_token_requests: 'read' | 'write';
897
+ /** 查看组织计划的权限 */
898
+ organization_plan: 'read';
899
+ /** 管理组织项目的权限 */
900
+ organization_projects: 'read' | 'write' | 'admin';
901
+ /** 管理组织 GitHub Packages 包的权限 */
902
+ organization_packages: 'read' | 'write';
903
+ /** 管理组织秘密的权限 */
904
+ organization_secrets: 'read' | 'write';
905
+ /** 查看和管理组织 GitHub Actions 自托管运行器的权限 */
906
+ organization_self_hosted_runners: 'read' | 'write';
907
+ /** 查看和管理被组织屏蔽的用户的权限 */
908
+ organization_user_blocking: 'read' | 'write';
909
+ /** 管理团队讨论和相关评论的权限 */
910
+ team_discussions: 'read' | 'write';
911
+ /** 管理用户的电子邮件地址的权限 */
912
+ email_addresses: 'read' | 'write';
913
+ /** 管理用户的关注者的权限 */
914
+ followers: 'read' | 'write';
915
+ /** 管理 Git SSH 密钥的权限 */
916
+ git_ssh_keys: 'read' | 'write';
917
+ /** 查看和管理 GPG 密钥的权限 */
918
+ gpg_keys: 'read' | 'write';
919
+ /** 查看和管理存储库的互动限制的权限 */
920
+ interaction_limits: 'read' | 'write';
921
+ /** 管理用户的个人资料设置的权限 */
922
+ profile: 'write';
923
+ /** 列出和管理用户标星的存储库的权限 */
924
+ starring: 'read' | 'write';
925
+ }
926
+ /** 为应用创建访问令牌参数类型 */
927
+ interface CreateAccessTokenForAppParamType {
928
+ /** 应用安装id */
929
+ installation_id: number;
930
+ /** 存储库名称列表 */
931
+ repositories: Array<string>;
932
+ /** 存储库id列表 */
933
+ repository_ids: Array<number>;
934
+ /** 访问令牌权限 */
935
+ permissions: AccessTokenPermissionsType;
936
+ }
937
+ /** 为应用创建访问令牌响应类型 */
938
+ interface CreateAccessTokenForAppResponseType {
939
+ /** 访问令牌 */
940
+ token: string;
941
+ /** 访问令牌过期时间, UTC 时间格式 */
942
+ expires_at: string;
943
+ /** 访问令牌权限 */
944
+ permissions: Record<string, string>;
945
+ /** 访问令牌仓库选择范围 */
946
+ repository_selection: 'all' | 'selected';
947
+ /** 访问令牌仓库列表 */
948
+ repositories: Array<RepoInfoResponseType>;
949
+ }
950
+ /** 撤销应用程序访问令牌响应类型 */
951
+ interface RevokeAccessTokenResponseType {
952
+ /** 是否撤销成功 */
953
+ success: boolean;
954
+ /** 撤销结果信息 */
955
+ message: string;
956
+ }
957
+ /** 判断应用程序是否安装在仓库中参数类型 */
958
+ type isAppInstalledInRepo = RepoBaseParamType;
959
+ //#endregion
960
+ //#region src/types/platform/github/auth.d.ts
961
+ /** Github 授权令牌接口返回类型 */
962
+ interface TokenResponseType {
963
+ /** 是否成功刷新 */
964
+ success: boolean;
965
+ /** 获取访问令牌信息 */
966
+ message: string;
967
+ /** 用户访问令牌, 格式为 ghu_ 开头 */
968
+ access_token: string;
969
+ /** access_token 过期前的秒数,默认值为 28800(8小时) */
970
+ expires_in: number | null;
971
+ /** 刷新令牌,格式为 ghr_ 开头,可能为 null */
972
+ refresh_token: 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 RefreshTokenResponseType {
982
+ /** 是否成功刷新 */
983
+ success: boolean;
984
+ /** 获取刷新令牌信息 */
985
+ message: string;
986
+ /** 用户访问令牌,格式为 ghu_ 开头 */
987
+ access_token: string;
988
+ /** access_token 过期前的秒数,默认值为 28800(8小时) */
989
+ expires_in: number | null;
990
+ /** 刷新令牌,格式为 ghr_ 开头,可能为 null */
991
+ refresh_token: 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 CheckTokenResponseType {
1001
+ /** 令牌是否有效 */
1002
+ success: boolean;
1003
+ /** 状态信息 */
1004
+ message: string;
1005
+ }
1006
+ //#endregion
1007
+ //#region src/types/platform/github/workflow.d.ts
1008
+ /** 工作流状态 */
1009
+ declare const enum WorkflowState {
1010
+ /** 工作流已激活 */
1011
+ Active = "active",
1012
+ /** 工作流已删除 */
1013
+ Deleted = "deleted",
1014
+ /** for仓库未启用工作流 */
1015
+ DisabledFork = "disabled_fork",
1016
+ /** 工作流已禁用(因为超过30天未使用) */
1017
+ DisabledInactivity = "disabled_inactivity",
1018
+ /** 工作流已禁用(手动) */
1019
+ DisabledManually = "disabled_manually",
1020
+ }
1021
+ /** 工作流信息参数类型 */
1022
+ type WorkflowInfoParamType = RepoBaseParamType & workflowIdParamType;
1023
+ /** 工作流信息响应类型 */
1024
+ interface WorkflowInfoResponseType {
1025
+ /** 工作流id */
1026
+ id: number;
1027
+ /** 工作流所属仓库的URL */
1028
+ html_url: string;
1029
+ /** 工作流名称 */
1030
+ name: string;
1031
+ /** 工作流文件路径 */
1032
+ path: string;
1033
+ /** 工作流状态 */
1034
+ state: WorkflowState;
1035
+ /** 工作流创建时间 */
1036
+ created_at: string;
1037
+ /** 工作流更新时间 */
1038
+ updated_at: string;
1039
+ }
1040
+ /** 获取仓库工作流列表参数类型 */
1041
+ interface GetRepoWorkflowsList extends RepoBaseParamType {
1042
+ /** 每页数量 */
1043
+ per_page?: number;
1044
+ /** 页码 */
1045
+ page?: number;
1046
+ }
1047
+ /** 获取仓库工作流列表响应类型 */
1048
+ interface GetRepoWorkflowsListResponseType {
1049
+ /** 总数 */
1050
+ total: number;
1051
+ /** 工作流列表 */
1052
+ workflows: WorkflowInfoResponseType[];
1053
+ }
1054
+ /** 运行仓库工作流参数类型 */
1055
+ interface RunRepoWorkflow extends WorkflowInfoParamType {
1056
+ /** 分支或者标签名称 */
1057
+ ref: string;
1058
+ /** 工作流输入参数, 该参数最多10个 */
1059
+ inputs?: Record<string, string | number>;
1060
+ }
1061
+ /** 运行仓库工作流响应类型 */
1062
+ interface RunRepoWorkflowResponseType {
1063
+ /** 是否成功 */
1064
+ success: boolean;
1065
+ /** 运行状态信息 */
1066
+ message: string;
1067
+ }
1068
+ /** 启用仓库工作流参数类型 */
1069
+ type EnableRepoWorkflowParamType = WorkflowInfoParamType;
1070
+ /** 启用仓库工作流响应类型 */
1071
+ interface EnableRepoWorkflowResponseType {
1072
+ /** 是否成功 */
1073
+ success: boolean;
1074
+ /** 启用状态信息 */
1075
+ message: string;
1076
+ }
1077
+ /** 禁用仓库工作流参数类型 */
1078
+ type DisEnableRepoWorkflowParamType = WorkflowInfoParamType;
1079
+ /** 禁用仓库工作流响应类型 */
1080
+ interface DisEnableRepoWorkflowResponseType {
1081
+ /** 是否成功 */
1082
+ success: boolean;
1083
+ /** 禁用状态信息 */
1084
+ message: string;
1085
+ }
1086
+ /** 重新运行仓库工作流参数类型 */
1087
+ interface ReRunRepoWorkflowParamType extends Omit<WorkflowInfoParamType, 'workflow_id'> {
1088
+ /** 工作流作业id */
1089
+ job_id: number;
1090
+ }
1091
+ /** 重新运行仓库工作流响应类型 */
1092
+ interface ReRunRepoWorkflowResponseType {
1093
+ /** 是否成功重新运行仓库工作流 */
1094
+ success: boolean;
1095
+ /** 重新运行状态信息 */
1096
+ message: string;
1097
+ }
1098
+ //#endregion
1099
+ //#region src/types/platform/issue.d.ts
1100
+ /** 议题用户信息响应类型 */
1101
+ type IssueUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos' | 'type'>;
1102
+ /** 议题标签类型 */
1103
+ interface IssueLabelType {
1104
+ /** 标签ID */
1105
+ id: number;
1106
+ /** 标签名称 */
1107
+ name: string;
1108
+ /** 标签颜色代码 */
1109
+ color?: string | null;
1110
+ }
1111
+ /** 议题里程碑类型 */
1112
+ interface MilestoneType {
1113
+ /** 里程碑ID */
1114
+ id: number;
1115
+ /** 里程碑URL */
1116
+ url: string;
1117
+ /** 里程碑编号 */
1118
+ number: number;
1119
+ /** 里程碑状态: open/closed */
1120
+ state: 'open' | 'closed';
1121
+ /** 里程碑标题 */
1122
+ title: string;
1123
+ /** 里程碑描述 */
1124
+ description: string | null;
1125
+ /** 开放议题数 */
1126
+ open_issues: number;
1127
+ /** 关闭议题数 */
1128
+ closed_issues: number;
1129
+ /** 创建时间 */
1130
+ created_at: string;
1131
+ /** 更新时间 */
1132
+ updated_at: string;
1133
+ /** 关闭时间 */
1134
+ closed_at: string | null;
1135
+ /** 截止时间 */
1136
+ due_on: string | null;
1137
+ }
1138
+ /** 议题信息参数类型 */
1139
+ type IssueInfoParamType = RepoBaseParamType & IssueNumberParamType;
1140
+ /** 议题详情响应类型 */
1141
+ interface IssueInfoResponseType {
1142
+ /** 问题id */
1143
+ id: IssueNumberParamType['issue_number'];
1144
+ /** 议题HTML页面URL */
1145
+ html_url: string;
1146
+ /** 议题编号 */
1147
+ number: number;
1148
+ /** 议题状态: open/closed */
1149
+ state: string;
1150
+ /** 议题标题 */
1151
+ title: string;
1152
+ /** 议题正文内容 */
1153
+ body: string | null;
1154
+ /** 议题创建者用户信息 */
1155
+ user: IssueUser;
1156
+ /** 议题标签 */
1157
+ labels: Array<IssueLabelType> | null;
1158
+ /**
1159
+ * 议题指派人
1160
+ * 当没有指派人时,返回 null
1161
+ */
1162
+ assignee: IssueUser | null;
1163
+ /**
1164
+ * 议题所有指派人列表
1165
+ * 先不处理,后面再说
1166
+ * */
1167
+ assignees: Array<IssueUser> | null;
1168
+ /** 议题所属里程碑 */
1169
+ milestone: MilestoneType | null;
1170
+ /** 关闭时间 */
1171
+ closed_at: string | null;
1172
+ /** 创建时间 */
1173
+ created_at: string;
1174
+ /** 更新时间 */
1175
+ updated_at: string;
1176
+ }
1177
+ /** 议题列表参数类型 */
1178
+ interface RepoIssueListParamType extends RepoBaseParamType {
1179
+ /**
1180
+ * 里程碑筛选
1181
+ * @default *
1182
+ * - 传入数字时:按里程碑编号筛选
1183
+ * - 传入 "*":接受任何里程碑的议题
1184
+ * - 传入 "none":返回没有里程碑的议题
1185
+ */
1186
+ milestone?: string | number;
1187
+ /**
1188
+ * 议题状态
1189
+ * @default "open"
1190
+ * - open: 打开的议题
1191
+ * - closed: 关闭的议题
1192
+ * - all: 所有议题
1193
+ */
1194
+ state?: 'all' | 'open' | 'closed';
1195
+ /**
1196
+ * 指派人用户名
1197
+ * - 传入用户名:返回指派给该用户的议题
1198
+ * - 传入 "none":返回所有的议题
1199
+ * - 传入用户名:返回指派给该用户的议题
1200
+ * - 传入 "*":返回已指派给任何用户的议题
1201
+ */
1202
+ assignee?: string;
1203
+ /**
1204
+ * 议题类型
1205
+ * - 传入类型名:返回指定类型的议题
1206
+ * - 传入 "*":接受任何类型的议题
1207
+ * - 传入 "none":返回没有类型的议题
1208
+ */
1209
+ type?: string;
1210
+ /** 创建者用户名,筛选由特定用户创建的议题 */
1211
+ creator?: string;
1212
+ /**
1213
+ * 标签列表
1214
+ * 以逗号分隔的标签名称列表
1215
+ * @example "bug,ui,@high"
1216
+ */
1217
+ labels?: string;
1218
+ /**
1219
+ * 排序方式
1220
+ * @default "created"
1221
+ * - created: 按创建时间排序
1222
+ * - updated: 按更新时间排序
1223
+ * - comments: 按评论数排序
1224
+ */
1225
+ sort?: 'created' | 'updated' | 'comments';
1226
+ /**
1227
+ * 排序方向
1228
+ * @default "desc"
1229
+ * - asc: 升序
1230
+ * - desc: 降序
1231
+ */
1232
+ direction?: 'asc' | 'desc';
1233
+ /**
1234
+ * 筛选此时间之后更新的议题
1235
+ * 仅显示在指定时间之后更新的结果
1236
+ * 格式为 ISO 8601: YYYY-MM-DDTHH:MM:SSZ
1237
+ * @example "2023-01-01T00:00:00Z"
1238
+ */
1239
+ since?: string;
1240
+ /**
1241
+ * 每页结果数量
1242
+ * @default 30
1243
+ * @remarks 取值范围:1-100
1244
+ */
1245
+ per_page?: number;
1246
+ /**
1247
+ * 页码
1248
+ * @default 1
1249
+ */
1250
+ page?: number;
1251
+ }
1252
+ /** 议题列表响应类型 */
1253
+ type IssueListResponseType = IssueInfoResponseType[];
1254
+ /** 创建议题参数类型 */
1255
+ type CreteIssueParamType = RepoBaseParamType & {
1256
+ /** 标题 */
1257
+ title: string;
1258
+ /** 正文内容 */
1259
+ body?: string | null;
1260
+ /** 里程碑 */
1261
+ milestone?: number | string | null;
1262
+ /** 标签列表 */
1263
+ labels?: Array<string> | string | null;
1264
+ /** 指派的用户名 */
1265
+ assignees?: Array<string> | string | null;
1266
+ };
1267
+ /** 创建议题响应类型 */
1268
+ type CreateIssueResponseType = IssueInfoResponseType;
1269
+ /** 更新议题参数类型 */
1270
+ interface UpdateIssueParamType extends Omit<CreteIssueParamType, 'title' | 'type'>, IssueNumberParamType {
1271
+ /** 问题的名称 */
1272
+ title?: string | null;
1273
+ /** 问题的内容 */
1274
+ body?: string | null;
1275
+ /** 问题的状态:open/closed */
1276
+ state?: 'open' | 'closed';
1277
+ }
1278
+ /** 更新议题响应类型 */
1279
+ type UpdateIssueResponseType = IssueInfoResponseType;
1280
+ /** 打开议题参数类型 */
1281
+ type OpenIssueParamType = RepoBaseParamType & IssueNumberParamType;
1282
+ /** 打开议题响应类型 */
1283
+ type OpenIssueResponseType = IssueInfoResponseType;
1284
+ /** 关闭议题参数类型 */
1285
+ type CloseIssueParamType = OpenIssueParamType;
1286
+ /** 关闭议题响应类型 */
1287
+ type CloseIssueResponseType = IssueInfoResponseType;
1288
+ /** 锁定议题参数类型 */
1289
+ interface LockIssueParamType extends RepoBaseParamType, IssueNumberParamType {
1290
+ /**
1291
+ * 锁定原因
1292
+ * 可以是以下之一:
1293
+ * - off-topic:锁定议题,因为该议题与仓库无关
1294
+ * - too heated:锁定议题,因为讨论过于激烈
1295
+ * - resolved:锁定议题,因为该议题已解决
1296
+ * - spam:锁定议题,因为该议题是垃圾邮件
1297
+ */
1298
+ lock_reason?: 'off-topic' | 'too heated' | 'resolved' | 'spam';
1299
+ }
1300
+ /** 锁定议题响应类型 */
1301
+ interface LockIssueResponseType {
1302
+ /** 是否成功锁定 */
1303
+ success: boolean;
1304
+ /** 锁定状态信息 */
1305
+ message: string;
1306
+ }
1307
+ /** 解锁议题参数类型 */
1308
+ type UnLockIssueParamType = Omit<LockIssueParamType, 'lock_reason'>;
1309
+ /** 解锁议题响应类型 */
1310
+ interface UnLockIssueResponseType {
1311
+ /** 是否成功解锁 */
1312
+ success: LockIssueResponseType['success'];
1313
+ /** 解锁状态信息 */
1314
+ message: LockIssueResponseType['message'];
1315
+ }
1316
+ /** 议题评论信息参数类型 */
1317
+ type IssueCommentInfoParamType = RepoBaseParamType & CommentIdParamType;
1318
+ /** 议题评论信息响应类型 */
1319
+ interface IssueCommentInfoResponseType {
1320
+ /** 评论ID */
1321
+ id: number;
1322
+ /** 评论HTML页面URL */
1323
+ html_url: string;
1324
+ /** 评论内容 */
1325
+ body: string;
1326
+ /** 评论用户信息 */
1327
+ user: IssueUser;
1328
+ /** 创建时间 */
1329
+ created_at: string;
1330
+ /** 更新时间 */
1331
+ updated_at: string;
1332
+ }
1333
+ /** 仓库评论列表参数类型 */
1334
+ interface RepoCommentsListParamType extends RepoBaseParamType {
1335
+ /**
1336
+ * 排序依据
1337
+ * 用于指定结果的排序属性
1338
+ * @default created
1339
+ * - created: 按创建时间排序
1340
+ * - updated: 按更新时间排序
1341
+ */
1342
+ sort?: 'created' | 'updated';
1343
+ /**
1344
+ * 排序方向
1345
+ * 指定结果的排序方向
1346
+ * 注意:如果没有指定 sort 参数,此参数将被忽略
1347
+ * @default desc 当 sort 参数存在时
1348
+ * - asc: 升序
1349
+ * - desc: 降序
1350
+ */
1351
+ direction?: 'asc' | 'desc';
1352
+ /**
1353
+ * 筛选此时间之后更新的评论
1354
+ * 仅显示在指定时间之后更新的结果
1355
+ * 格式为 ISO 8601: YYYY-MM-DDTHH:MM:SSZ
1356
+ * @example "2023-01-01T00:00:00Z"
1357
+ */
1358
+ since?: string;
1359
+ /**
1360
+ * 每页结果数量
1361
+ * 指定每页返回的结果数
1362
+ * @default 30
1363
+ * @remarks 取值范围:1-100
1364
+ */
1365
+ per_page?: number;
1366
+ /**
1367
+ * 页码
1368
+ * 指定要获取的结果页码
1369
+ * @default 1
1370
+ * @remarks 必须大于等于1
1371
+ */
1372
+ page?: number;
1373
+ }
1374
+ /** 仓库评论列表响应类型 */
1375
+ type RepoCommentsListResponseType = IssueCommentInfoResponseType[];
1376
+ /** 议题评论列表参数类型 */
1377
+ interface IssueCommentsListParamType extends RepoBaseParamType {
1378
+ /** 议题ID */
1379
+ issue_number: IssueNumberParamType['issue_number'];
1380
+ /**
1381
+ * 筛选此时间之后更新的评论
1382
+ * 仅显示在指定时间之后更新的结果
1383
+ * 格式为 ISO 8601: YYYY-MM-DDTHH:MM:SSZ
1384
+ * @example "2023-01-01T00:00:00Z"
1385
+ */
1386
+ since?: string;
1387
+ /**
1388
+ * 每页结果数量
1389
+ * @default 30
1390
+ * @remarks 取值范围:1-100
1391
+ */
1392
+ per_page?: number;
1393
+ /**
1394
+ * 页码
1395
+ * @default 1
1396
+ * @remarks 取值范围:1-100
1397
+ */
1398
+ page?: number;
1399
+ }
1400
+ /** 议题评论列表响应类型 */
1401
+ type IssueCommentsListResponseType = IssueCommentInfoResponseType[];
1402
+ /** 创建议题评论参数类型 */
1403
+ interface CreteIssueCommentParamType extends RepoBaseParamType {
1404
+ /** 议题ID */
1405
+ issue_number: IssueNumberParamType['issue_number'];
1406
+ /** 评论内容 */
1407
+ body: string;
1408
+ }
1409
+ /** 创建议题评论响应类型 */
1410
+ type CreteIssueCommentResponseType = IssueCommentInfoResponseType;
1411
+ /** 更新议题评论参数类型 */
1412
+ interface UpdateIssueCommentParamType extends IssueCommentInfoParamType {
1413
+ /** 评论内容 */
1414
+ body: string;
1415
+ }
1416
+ /** 更新议题评论响应类型 */
1417
+ type UpdateIssueCommentResponseType = IssueCommentInfoResponseType;
1418
+ /** 删除议题评论参数类型 */
1419
+ interface RemoveIssueCommentParamType extends RepoBaseParamType {
1420
+ /** 评论ID */
1421
+ comment_id: string | number;
1422
+ }
1423
+ /** 删除议题评论响应类型 */
1424
+ interface RemoveIssueCommentResponseType {
1425
+ /** 是否成功删除议题 */
1426
+ success: boolean;
1427
+ /** 删除状态信息 */
1428
+ message: string;
1429
+ }
1430
+ /** 获取子议题列表参数类型 */
1431
+ interface SubIssueListParamType extends RepoBaseParamType {
1432
+ /** 议题ID */
1433
+ issue_number: IssueNumberParamType['issue_number'];
1434
+ /**
1435
+ * 每页结果数量
1436
+ * @default 30
1437
+ */
1438
+ per_page?: number;
1439
+ /**
1440
+ * 页码
1441
+ * @default 1
1442
+ */
1443
+ page?: number;
1444
+ }
1445
+ /** 获取子议题列表响应类型 */
1446
+ type SubIssueListResponseType = IssueInfoResponseType[];
1447
+ /** 添加子议题参数类型 */
1448
+ interface CreateSubIssueParamType extends RepoBaseParamType {
1449
+ /** 议题ID */
1450
+ issue_number: IssueNumberParamType['issue_number'];
1451
+ /** * 子议题ID */
1452
+ sub_issue_id: IssueNumberParamType['issue_number'];
1453
+ /** * 是否替换父议题 */
1454
+ replace_parent: boolean;
1455
+ }
1456
+ /** 添加子议题响应类型 */
1457
+ type CreateSubIssueResponseType = IssueInfoResponseType;
1458
+ /** 删除子议题参数类型 */
1459
+ interface RemoveSubIssueParamType extends RepoBaseParamType {
1460
+ /** 议题ID */
1461
+ issue_number: IssueNumberParamType['issue_number'];
1462
+ /** 子议题ID */
1463
+ sub_issue_id: IssueNumberParamType['issue_number'];
1464
+ }
1465
+ /** 删除子议题响应类型 */
1466
+ type RemoveSubIssueResponseType = IssueInfoResponseType;
1467
+ /** 重新确定子议题优先级参数类型 */
1468
+ interface ReprioritizeSubIssueParamType extends RepoBaseParamType {
1469
+ /** 议题ID */
1470
+ issue_number: IssueNumberParamType['issue_number'];
1471
+ /** 子议题ID */
1472
+ sub_issue_id: IssueNumberParamType['issue_number'];
1473
+ /**
1474
+ * 要优先排序的子问题的 ID(与 before_id 互斥,只能指定其中一个)
1475
+ * 在此 ID 之后放置子问题
1476
+ */
1477
+ after_id?: IssueNumberParamType['issue_number'];
1478
+ /**
1479
+ * 要优先排序的子问题的 ID(与 after_id 互斥,只能指定其中一个)
1480
+ * 在此 ID 之前放置子问题
1481
+ */
1482
+ before_id?: IssueNumberParamType['issue_number'];
1483
+ }
1484
+ /** 重新确定子议题优先级响应类型 */
1485
+ type ReprioritizeSubIssueResponseType = IssueInfoResponseType;
1486
+ //#endregion
1487
+ //#region src/types/platform/org.d.ts
1488
+ type OrgUser = Pick<UserInfoResponseType, 'id' | 'login' | 'name' | 'avatar_url' | 'html_url'>;
1489
+ /** 组织信息参数类型 */
1490
+ type OrgInfoParamType = OrgNameParamType;
1491
+ /** 组织信息响应类型 */
1492
+ interface OrgInfoResponseType {
1493
+ /** 组织ID */
1494
+ id: number;
1495
+ /** 组织名称 */
1496
+ login: string;
1497
+ /** 组织昵称 */
1498
+ name: string;
1499
+ /** 组织头像 */
1500
+ avatar_url: string;
1501
+ /** 组织描述 */
1502
+ description: string;
1503
+ /** 组织地址 */
1504
+ html_url: string;
1505
+ }
1506
+ /** 添加组织成员参数类型 */
1507
+ interface AddMemberParamType extends OrgNameParamType, UserNameParamType {
1508
+ /**
1509
+ * 角色
1510
+ */
1511
+ role?: RoleNameType['role'];
1512
+ }
1513
+ /** 添加组织成员响应类型 */
1514
+ interface AddMemberResponseType extends Omit<AddCollaboratorResponseType, 'permissions' | 'html_url'> {
1515
+ /** 组织地址 */
1516
+ html_url: string;
1517
+ /** 角色 */
1518
+ role: RoleNameType['role'];
1519
+ }
1520
+ /** 获取组织成员信息参数类型 */
1521
+ type GetOrgMemberInfoParamType = OrgNameParamType & UserNameParamType;
1522
+ /** 获取组织成员信息响应类型 */
1523
+ interface GetOrgMemberInfoResponseType {
1524
+ /**
1525
+ * 成员状态
1526
+ * - active: 已激活
1527
+ * - pending: 待处理
1528
+ */
1529
+ state: 'active' | 'pending';
1530
+ /**
1531
+ * 成员角色
1532
+ * - admin: 管理员
1533
+ * - member: 成员
1534
+ */
1535
+ role: RoleNameType['role'];
1536
+ /** 组织信息 */
1537
+ organization: Pick<OrgInfoResponseType, 'id' | 'login' | 'name' | 'html_url'>;
1538
+ /** 成员信息 */
1539
+ user: OrgUser;
1540
+ }
1541
+ /** 获取组织成员列表参数 */
1542
+ interface GetOrgMemberListParamType extends OrgNameParamType {
1543
+ /** 每页数量 */
1544
+ per_page: number;
1545
+ /** 页码 */
1546
+ page: number;
1547
+ }
1548
+ interface GetOrgMemberListType extends OrgUser {
1549
+ /** 角色 */
1550
+ role: RoleNameType['role'];
1551
+ }
1552
+ /** 获取组织成员列表的响应类型 */
1553
+ type GetOrgMemberListResponseType = Array<GetOrgMemberListType>;
1554
+ /** 移除组织成员参数类型 */
1555
+ type RemoveOrgMemberParamType = OrgNameParamType & UserNameParamType;
1556
+ /** 移除组织成员响应类型 */
1557
+ interface RemoveOrgMemberResponseType {
1558
+ /** 是否成功 */
1559
+ success: boolean;
1560
+ /** 移除组织成员信息 */
1561
+ message: string;
1562
+ }
1563
+ //#endregion
1564
+ //#region src/types/platform/pull_request.d.ts
1565
+ type PrUser = Pick<UserInfoResponseType, 'id' | 'login' | 'name' | 'avatar_url' | 'html_url'>;
1566
+ type PrRepo = Pick<RepoInfoResponseType, 'id' | 'owner' | 'name' | 'full_name'>;
1567
+ /** 拉取请求信息参数类型 */
1568
+ type PullRequestInfoParamType = PullRequestNumberParamType & RepoBaseParamType;
1569
+ /** 拉取请求信息响应类型 */
1570
+ interface PullRequestInfoResponseType {
1571
+ /** 拉取请求的id */
1572
+ id: number;
1573
+ /** 拉取请求的URL */
1574
+ html_url: string;
1575
+ /** 拉取请求的编号 */
1576
+ number: number;
1577
+ /** 拉取请求的状态 (open/closed) */
1578
+ state: 'open' | 'closed' | 'merged';
1579
+ /** 是否被锁定 */
1580
+ locked: boolean;
1581
+ /** 拉取请求的标题 */
1582
+ title: string;
1583
+ /** 拉取请求的描述 */
1584
+ body: string | null;
1585
+ /** 是否为草稿PR */
1586
+ draft: boolean;
1587
+ /** 创建时间 */
1588
+ created_at: string;
1589
+ /** 更新时间 */
1590
+ updated_at: string | null;
1591
+ /** 关闭时间 */
1592
+ closed_at: string | null;
1593
+ /** 合并时间 */
1594
+ merged_at: string | null;
1595
+ /** PR作者 */
1596
+ user: PrUser;
1597
+ /** PR的目标分支 */
1598
+ base: {
1599
+ /** 分支标签 */
1600
+ label: string;
1601
+ /** 分支名称 */
1602
+ ref: string;
1603
+ /** 当前分支最新提交的 SHA 值 */
1604
+ sha: string;
1605
+ /** 分支的用户信息 */
1606
+ user: PrUser;
1607
+ /** 分支的仓库信息 */
1608
+ repo: PrRepo;
1609
+ };
1610
+ /** PR的源分支信息 */
1611
+ head: {
1612
+ /** 分支标签 */
1613
+ label: string;
1614
+ /** 分支名称 */
1615
+ ref: string;
1616
+ /** 当前分支最新提交的 SHA 值 */
1617
+ sha: string;
1618
+ /** 分支的用户信息 */
1619
+ user: PrUser;
1620
+ /** 分支的仓库信息 */
1621
+ repo: PrRepo;
1622
+ };
1623
+ /** 指派人 */
1624
+ assignee: PrUser | null;
1625
+ /** 指派人列表 */
1626
+ assignees: Array<PrUser> | null;
1627
+ /** 里程碑 */
1628
+ milestone: MilestoneType | null;
1629
+ /** 标签列表 */
1630
+ labels: Array<IssueLabelType>;
1631
+ /** 提交数量 */
1632
+ commits: number;
1633
+ /** 新增行数 */
1634
+ additions: number;
1635
+ /** 删除行数 */
1636
+ deletions: number;
1637
+ /** 更改的文件数 */
1638
+ changed_files: number;
1639
+ }
1640
+ /** 拉取请求列表参数类型 */
1641
+ interface PullRequestListParamType extends RepoBaseParamType {
1642
+ /**
1643
+ * 拉取请求状态
1644
+ * @default "open"
1645
+ * - open: 打开的拉取请求
1646
+ * - closed: 已关闭的拉取请求
1647
+ * - all: 所有拉取请求
1648
+ */
1649
+ state?: 'open' | 'closed' | 'all';
1650
+ /**
1651
+ * 基础分支名称
1652
+ * 用于筛选指定目标分支的拉取请求
1653
+ * @example "main"
1654
+ */
1655
+ base?: string;
1656
+ /**
1657
+ * 排序依据
1658
+ * @default "created"
1659
+ * - created: 按创建时间排序
1660
+ * - updated: 按更新时间排序
1661
+ */
1662
+ sort?: 'created' | 'updated';
1663
+ /**
1664
+ * 排序方向
1665
+ * @default "desc"
1666
+ * - asc: 升序
1667
+ * - desc: 降序
1668
+ */
1669
+ direction?: 'asc' | 'desc';
1670
+ /**
1671
+ * 每页结果数量
1672
+ * @default "30"
1673
+ * @remarks 取值范围:1-100
1674
+ */
1675
+ per_page?: string;
1676
+ /**
1677
+ * 页码
1678
+ * @default "1"
1679
+ * @remarks 必须大于等于1
1680
+ */
1681
+ page?: string;
1682
+ }
1683
+ /** 拉取请求列表响应类型 */
1684
+ type PullRequestListResponseType = Array<PullRequestInfoResponseType>;
1685
+ /** 使用issue填充拉取提交标题与内容 */
1686
+ type WithIssue = {
1687
+ /** 拉取请求标题 */
1688
+ title?: never;
1689
+ /** 拉取请求描述 */
1690
+ body?: never;
1691
+ /**
1692
+ * 关联的议题
1693
+ * Pull Request的标题和内容可以根据指定的Issue Id自动填充
1694
+ */
1695
+ issue: string | number;
1696
+ };
1697
+ /** 不使用issue填充拉取提交标题与内容 */
1698
+ type WithoutIssue = {
1699
+ /** 拉取请求标题 */
1700
+ title: string;
1701
+ /** 拉取请求描述 */
1702
+ body?: string;
1703
+ /**
1704
+ * 关联的议题
1705
+ * Pull Request的标题和内容可以根据指定的Issue Id自动填充
1706
+ */
1707
+ issue?: never;
1708
+ };
1709
+ /** 创建拉取提交参数类型 */
1710
+ type CreatePullRequestParamType = RepoBaseParamType & (WithIssue | WithoutIssue) & {
1711
+ /** 拉取请求源分支 */
1712
+ head: string;
1713
+ /**
1714
+ * 拉取请求源仓库
1715
+ * 。如果两个存储库都由同一组织拥有,则跨存储库拉取请求需要此字段
1716
+ * */
1717
+ head_repo?: string;
1718
+ /** 拉取请求目标分支 */
1719
+ base: string;
1720
+ /** 是否为草稿 */
1721
+ draft?: boolean;
1722
+ };
1723
+ /** 创建拉取请求响应类型 */
1724
+ type CreatePullRequestResponseType = PullRequestInfoResponseType;
1725
+ /** 更新拉取请求参数类型 */
1726
+ interface UpdatePullRequestParamType extends RepoBaseParamType, PullRequestNumberParamType {
1727
+ /** 拉取请求标题 */
1728
+ title?: string;
1729
+ /** 拉取请求内容 */
1730
+ body?: string;
1731
+ /** 拉取请求状态 */
1732
+ state?: 'open' | 'closed';
1733
+ }
1734
+ /** 更新拉取请求响应类型 */
1735
+ type UpdatePullRequestResponseType = PullRequestInfoResponseType;
1736
+ /**
1737
+ * 合并拉取请求方式类型
1738
+ * merge: 合并提交
1739
+ * squash: 压缩提交
1740
+ * rebase: 变基提交
1741
+ */
1742
+ type MergeMethodType = 'merge' | 'squash' | 'rebase';
1743
+ /** 合并拉取请求参数类型 */
1744
+ interface MergePullRequestParamType extends RepoBaseParamType, PullRequestNumberParamType {
1745
+ /** 拉取请求合并提交信息 */
1746
+ commit_title?: string;
1747
+ /** 拉取请求合并提交信息 */
1748
+ commit_message?: string;
1749
+ /**
1750
+ * 拉取请求合并SHA值
1751
+ * 拉取请求头部必须匹配的 SHA 才能允许合并
1752
+ * */
1753
+ sha?: string;
1754
+ /**
1755
+ * 拉取请求合并方式
1756
+ * @default merge
1757
+ * merge: 合并提交
1758
+ * squash: 压缩提交
1759
+ * rebase: 变基提交
1760
+ * */
1761
+ merge_method?: MergeMethodType;
1762
+ }
1763
+ /**
1764
+ * 合并拉取请求响应类型
1765
+ * 对应 GitHub API 返回的 Pull Request Merge Result 结构
1766
+ */
1767
+ interface MergePullRequestResponseType {
1768
+ /**
1769
+ * 合并后的提交 SHA 值
1770
+ * 表示合并操作生成的提交哈希
1771
+ */
1772
+ sha: string;
1773
+ /**
1774
+ * 是否成功合并
1775
+ * - true: 成功合并
1776
+ * - false: 合并失败或冲突
1777
+ */
1778
+ merged: boolean;
1779
+ /**
1780
+ * 合并结果描述信息
1781
+ * 包含成功或失败的具体原因
1782
+ */
1783
+ message: string;
1784
+ }
1785
+ /** 文件列表类型 */
1786
+ interface PullRequestFilesListType {
1787
+ /** 文件的SHA值 */
1788
+ sha: string;
1789
+ /** 文件路径 */
1790
+ filename: string;
1791
+ /** 文件状态 */
1792
+ status: 'added' | 'removed' | 'modified' | 'renamed' | 'changed' | 'unchanged';
1793
+ /** 文件添加行数 */
1794
+ additions: number;
1795
+ /** 文件删除行数 */
1796
+ deletions: number;
1797
+ /** 文件修改行数 */
1798
+ changes: number;
1799
+ /** 文件的blob SHA值 */
1800
+ blob_url: string;
1801
+ /** 文件的raw URL */
1802
+ raw_url: string;
1803
+ /** 文件的patch内容, 也就是diff差异内容 */
1804
+ patch: string;
1805
+ }
1806
+ /** 获取拉取请求文件列表参数类型 */
1807
+ interface GetPullRequestFilesListParamType extends RepoBaseParamType, PullRequestNumberParamType {
1808
+ /** 每页结果数量 */
1809
+ per_page?: string;
1810
+ /** 页码 */
1811
+ page?: string;
1812
+ }
1813
+ /** 获取拉取请求文件列表响应类型 */
1814
+ type GetPullRequestFilesListResponseType = Array<PullRequestFilesListType>;
1815
+ /** 获取拉取请求差异内容参数类型 */
1816
+ type GetPullRequestDiffParamType = RepoBaseParamType & PullRequestNumberParamType;
1817
+ /** 获取拉取请求差异内容响应类型 */
1818
+ type GetPullRequestDiffResponseType = string;
1819
+ /** 获取拉取请求评论信息参数类型 */
1820
+ type GetPullRequestCommentInfoParamType = RepoBaseParamType & CommentIdParamType;
1821
+ /** 获取拉取请求评论信息响应类型 */
1822
+ interface GetPullRequestCommentInfoResponseType {
1823
+ /** 评论ID */
1824
+ id: CommentIdParamType['comment_id'];
1825
+ /** 评论内容 */
1826
+ body: string;
1827
+ /** 评论用户 */
1828
+ user: PrUser;
1829
+ /** 评论创建时间 */
1830
+ created_at: string;
1831
+ /** 评论更新时间 */
1832
+ updated_at: string;
1833
+ }
1834
+ /** 获取拉取请求评论列表参数类型 */
1835
+ interface GetPullRequestCommentsListParamType extends RepoBaseParamType, PullRequestNumberParamType {
1836
+ direction: 'asc' | 'desc';
1837
+ /** 每页结果数量 */
1838
+ per_page?: string;
1839
+ /** 页码 */
1840
+ page?: string;
1841
+ }
1842
+ /** 获取拉取请求评论列表响应类型 */
1843
+ type GetPullRequestCommentsListResponseType = Array<GetPullRequestCommentInfoResponseType>;
1844
+ /** 创建拉取请求评论参数类型 */
1845
+ interface CreatePullRequestCommentParamType extends RepoBaseParamType, PullRequestNumberParamType {
1846
+ /** 评论内容 */
1847
+ body: string;
1848
+ }
1849
+ /** 创建拉取请求评论响应类型 */
1850
+ interface CreatePullRequestCommentResponseType {
1851
+ /** 评论id */
1852
+ id: CommentIdParamType['comment_id'];
1853
+ /** 评论内容 */
1854
+ body: string;
1855
+ }
1856
+ /** 更新拉取请求评论参数类型 */
1857
+ interface UpdatePullRequestCommentParamType extends RepoBaseParamType, CommentIdParamType {
1858
+ /** 评论内容 */
1859
+ body: string;
1860
+ }
1861
+ /** 更新拉取请求评论响应类型 */
1862
+ interface UpdatePullRequestCommentResponseType {
1863
+ /** 是否更新评论信息成功 */
1864
+ success: boolean;
1865
+ /** 更新评论状态信息 */
1866
+ message: string;
1867
+ }
1868
+ /** 删除拉取请求评论参数类型 */
1869
+ type DeletePullRequestCommentParamType = RepoBaseParamType & CommentIdParamType;
1870
+ /** 删除拉取请求评论响应类型 */
1871
+ interface DeletePullRequestCommentResponseType {
1872
+ /** 是否删除成功 */
1873
+ success: boolean;
1874
+ /** 删除状态信息 */
1875
+ message: string;
1876
+ }
1877
+ //#endregion
1878
+ //#region src/types/platform/release.d.ts
1879
+ type ReleaseUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos' | 'email'>;
1880
+ /** 反应信息类型 */
1881
+ interface ReactionInfoType {
1882
+ /** 反应 API URL */
1883
+ url: string;
1884
+ /** 总反应数 */
1885
+ total_count: number;
1886
+ /** 👍 反应数 */
1887
+ '+1': number;
1888
+ /** 👎 反应数 */
1889
+ '-1': number;
1890
+ /** 😄 反应数 */
1891
+ laugh: number;
1892
+ /** 😕 反应数 */
1893
+ confused: number;
1894
+ /** ❤️ 反应数 */
1895
+ heart: number;
1896
+ /** 🎉 反应数 */
1897
+ hooray: number;
1898
+ /** 👀 反应数 */
1899
+ eyes: number;
1900
+ /** 🚀 反应数 */
1901
+ rocket: number;
1902
+ }
1903
+ /** 发布资源类型 */
1904
+ interface ReleaseAssetsType {
1905
+ /** 资源 URL */
1906
+ url: string;
1907
+ /** 资源下载 URL */
1908
+ browser_download_url: string;
1909
+ }
1910
+ /** 获取Release信息参数类型 */
1911
+ type ReleaseInfoParamType = RepoBaseParamType & {
1912
+ /** 发布ID */
1913
+ release_id: number;
1914
+ };
1915
+ /** 获Release信息响应类型 */
1916
+ interface ReleaseInfoResponseType {
1917
+ /**
1918
+ * 发布版本的 ID
1919
+ * 该字段在gitcode平台为null
1920
+ */
1921
+ id: number | null;
1922
+ /** 标签名称 */
1923
+ tag_name: string;
1924
+ /** 目标分支或提交 */
1925
+ target_commitish: string;
1926
+ /** 发布版本名称 */
1927
+ name: string | null;
1928
+ /** 发布说明 */
1929
+ body: string | null;
1930
+ /** 是否为预发布版本 */
1931
+ prerelease: boolean;
1932
+ /** 发布者信息 */
1933
+ author: ReleaseUser;
1934
+ /** 发布资源列表 */
1935
+ assets: Array<ReleaseAssetsType>;
1936
+ /** 发布时间 */
1937
+ created_at: string;
1938
+ }
1939
+ /** 获取最新Release参数类型 */
1940
+ type ReleaseLatestParamTypeType = RepoBaseParamType;
1941
+ /** 获取最新Release响应类型 */
1942
+ type ReleaseLatestResponseType = ReleaseInfoResponseType;
1943
+ /** 通过Tag获取Release信息参数类型 */
1944
+ type ReleaseInfoByTagParamType = RepoBaseParamType & {
1945
+ /** 标签名称 */
1946
+ tag: string;
1947
+ };
1948
+ /** 通过Tag获取Release信息响应类型 */
1949
+ type ReleaseInfoByTagResponseType = ReleaseInfoResponseType;
1950
+ /** 获取Release列表参数类型 */
1951
+ type ReleaseListParamType = RepoBaseParamType & {
1952
+ /** 每页数量 */
1953
+ per_page?: number;
1954
+ /** 页码 */
1955
+ page?: number;
1956
+ };
1957
+ /** 获取Release列表响应类型 */
1958
+ type ReleaseListResponseType = Array<ReleaseInfoResponseType>;
1959
+ /** 创建Release参数类型 */
1960
+ type CreateReleaseParamType = RepoBaseParamType & {
1961
+ /** 标签名称 */
1962
+ tag_name: string;
1963
+ /** 目标分支或提交 */
1964
+ target_commitish: string;
1965
+ /** 发布版本名称 */
1966
+ name: string;
1967
+ /** 发布说明 */
1968
+ body: string;
1969
+ /** 是否为预发布版本 */
1970
+ prerelease: boolean;
1971
+ };
1972
+ /** 获取Release列表参数类型 */
1973
+ type CreateReleaseResponseType = ReleaseInfoResponseType;
1974
+ /** 更新Release参数类型 */
1975
+ type UpdateReleaseParamType = CreateReleaseParamType;
1976
+ /** 更新Release响应类型 */
1977
+ type UpdateReleaseResponseType = ReleaseInfoResponseType;
1978
+ /** 删除Release参数类型 */
1979
+ type DeleteReleaseParamType = ReleaseInfoParamType;
1980
+ /** 删除Release响应类型 */
1981
+ interface DeleteReleaseResponseType {
1982
+ /** 是否删除成功 */
1983
+ success: boolean;
1984
+ /** 删除状态信息 */
1985
+ message: string;
1986
+ }
1987
+ //#endregion
1988
+ //#region src/types/platform/search.d.ts
1989
+ type SearchUser = Pick<UserInfoResponseType, 'id' | 'login' | 'name' | 'avatar_url' | 'html_url' | 'email'>;
1990
+ type SearchRepo = Pick<RepoInfoResponseType, 'id' | 'owner' | 'name' | 'full_name' | 'description' | 'visibility' | 'public' | 'private' | 'archived' | 'language' | 'pushed_at'>;
1991
+ /** 搜索用户参数列表 */
1992
+ interface SearchUsersParamType {
1993
+ /** 搜索关键字 */
1994
+ q: string;
1995
+ /** 排序顺序 */
1996
+ order: 'desc' | 'asc';
1997
+ /** 每页数量 */
1998
+ per_page?: number;
1999
+ /** 页码 */
2000
+ page?: number;
2001
+ }
2002
+ /** 搜索用户响应列表 */
2003
+ interface SearchUsersResponseType {
2004
+ /** 搜索结果数量 */
2005
+ total_count: number;
2006
+ /** 用户列表 */
2007
+ items: Array<SearchUser>;
2008
+ }
2009
+ interface SearchReposParamType {
2010
+ /** 搜索关键字 */
2011
+ q: string;
2012
+ /** 排序顺序 */
2013
+ order: 'desc' | 'asc';
2014
+ /** 每页数量 */
2015
+ per_page?: number;
2016
+ /** 页码 */
2017
+ page?: number;
2018
+ }
2019
+ interface SearchReposResponseType {
2020
+ /** 搜索结果数量 */
2021
+ total_count: number;
2022
+ /** 用户列表 */
2023
+ items: Array<SearchRepo>;
2024
+ }
2025
+ //#endregion
2026
+ //#region src/types/platform/webhook.d.ts
2027
+ interface WebHookSignatureParamType {
2028
+ /** 请求体 */
2029
+ payload: string;
2030
+ /** GitHub 发送的签名头 */
2031
+ signature: string;
2032
+ }
2033
+ interface WebHookSignatureResponseType {
2034
+ /** 是否验证成功 */
2035
+ success: boolean;
2036
+ /** 验证信息 */
2037
+ message: string;
2038
+ }
2039
+ //#endregion
2040
+ //#region src/common/git.d.ts
2041
+ /**
2042
+ * 获取本地 Git 仓库信息
2043
+ * @description 获取本地 Git 仓库信息,返回仓库名称、仓库路径、仓库地址等信息
2044
+ * @param local_path - 本地仓库路径
2045
+ * @returns Git 仓库信息
2046
+ * @example
2047
+ * ```ts
2048
+ * const info = await get_local_git_repo_info('D:/project/repo')
2049
+ * console.log(info)
2050
+ * -> {
2051
+ * name: 'repo',
2052
+ * path: 'D:/project/repo',
2053
+ * url: 'https://github.com/owner/repo.git',
2054
+ * html_url: 'https://github.com/owner/repo',
2055
+ * owner: 'owner',
2056
+ * repo: 'repo'
2057
+ * }
2058
+ * ```
2059
+ */
2060
+ declare function get_local_git_repo_info(local_path: string): Promise<GitRepoInfoType | null>;
2061
+ /**
2062
+ * 获取本地仓库信息列表
2063
+ * @param local_path 本地仓库路径
2064
+ * @param options 配置项
2065
+ * - loop 是否递归查找
2066
+ * - maxDepth 递归最大深度
2067
+ * - dir 忽略的文件夹名称列表
2068
+ * @returns LocalGitInfoListType 仓库信息列表
2069
+ * @example
2070
+ * ```ts
2071
+ * // 无数据
2072
+ * const res = await get_local_git_repo_list('D:\\project\\GitHub', { loop: true, maxDepth: 5, dir: ['node_modules'] })
2073
+ * -> {
2074
+ * total: 0,
2075
+ * items: []
2076
+ * }
2077
+ *
2078
+ * // 有数据
2079
+ * const res = await get_local_git_repo_list('D:\\project\\GitHub', { loop: true, maxDepth: 5, dir: ['node_modules'] })
2080
+ * -> {
2081
+ * total: 1,
2082
+ * items: [{
2083
+ * name: "GitHub",
2084
+ * path: "D:\\project\\GitHub\\GitHub",
2085
+ * url: "https://github.com/GitHub/GitHub.git",
2086
+ * html_url: "https://github.com/GitHub/GitHub",
2087
+ * owner: "GitHub",
2088
+ * repo: "GitHub"
2089
+ * }]
2090
+ * }
2091
+ * ```
2092
+ */
2093
+ declare function get_local_git_repos_list(dirpath: string, options?: GitRepoInfoListOptionsType): Promise<GitInfoListType>;
2094
+ /**
2095
+ * 获取本地仓库的默认分支
2096
+ * @param local_path - 本地仓库路径
2097
+ * @returns 默认分支名称
2098
+ * @example
2099
+ * ```ts
2100
+ * console.log(await get_local_repo_default_branch('/path/to/repo'))
2101
+ * -> 'main'
2102
+ * ```
2103
+ */
2104
+ declare function get_local_repo_default_branch(local_path: string): Promise<string>;
2105
+ /**
2106
+ * 获取远程仓库的默认分支
2107
+ * @param remote_url - 远程仓库URL
2108
+ * @returns 默认分支名称
2109
+ * @example
2110
+ * ```ts
2111
+ * console.log(await get_remote_repo_default_branch('https://github.com/CandriaJS/git-neko-kit'))
2112
+ * -> 'main'
2113
+ * ```
2114
+ */
2115
+ declare function get_remote_repo_default_branch(remote_url: string): Promise<string>;
2116
+ //#endregion
2117
+ //#region src/common/markdown.d.ts
2118
+ /**
2119
+ * 渲染 markdown 内容为 HTML
2120
+ * @description 使用配置好的 markdown-it 实例渲染 markdown 内容
2121
+ * @param md - 要渲染的 markdown 字符串
2122
+ * @returns 渲染后的 HTML 字符串
2123
+ * @example
2124
+ * ```ts
2125
+ * const html = await render_markdown(`# 标题
2126
+ * - 无序列表项1
2127
+ * - 无序列表项2
2128
+ * - 子列表项
2129
+ *
2130
+ * 1. 有序列表项1
2131
+ * 2. 有序列表项2
2132
+ * `);
2133
+ *
2134
+ * -> <h1>标题</h1>
2135
+ * <ul style="list-style: none;">
2136
+ * <li>无序列表项1</li>
2137
+ * <li>无序列表项2</li>
2138
+ * <ul style="list-style: none;">
2139
+ * <li>子列表项</li>
2140
+ * </ul>
2141
+ * </ul>
2142
+ * <ol style="list-style: none;">
2143
+ * <li>有序列表项1</li>
2144
+ * <li>有序列表项2</li>
2145
+ * </ol>
2146
+ * ```
2147
+ */
2148
+ declare function render_markdown(md: string): Promise<string>;
2149
+ //#endregion
2150
+ //#region src/common/npm.d.ts
2151
+ /**
2152
+ * 获取本地 NPM 包信息
2153
+ * @description 获取本地 NPM 包信息
2154
+ * @param packageName - 包名
2155
+ * @returns 包信息
2156
+ * @example
2157
+ * ```ts
2158
+ * console.log(get_local_npm_package_info('npm'))
2159
+ * -> {
2160
+ * name: 'npm',
2161
+ * path: 'C:\\Users\\username\\AppData\\Roaming\\npm\\node_modules\\npm',
2162
+ * html_url: 'https://github.com/npm/cli',
2163
+ * owner: 'npm',
2164
+ * repo: 'cli'
2165
+ * }
2166
+ * ```
2167
+ */
2168
+ declare function get_local_npm_package_info(packageName: string): Promise<NpmPackageInfoType | null>;
2169
+ /**
2170
+ * 获取本地 NPM 包信息列表
2171
+ * @description 获取目录下已安装的生产依赖列表,过滤后递归获取包信息
2172
+ * @param dirpath - 项目目录路径
2173
+ * @param options - 过滤选项
2174
+ * - packageName 忽略的包名
2175
+ * - prefix 包名前缀
2176
+ * @returns 包信息列表
2177
+ * @example
2178
+ * ```ts
2179
+ * const packages = await get_local_npm_packages_list(dirpath)
2180
+ * -> {
2181
+ * total: 1,
2182
+ * items: [
2183
+ * {
2184
+ * name: 'test',
2185
+ * path: 'D:\\test',
2186
+ * html_url: 'https://github.com/test/test',
2187
+ * owner: 'test',
2188
+ * repo: 'test'
2189
+ * }
2190
+ * ]
2191
+ * }
2192
+ * ```
2193
+ */
2194
+ declare function get_local_npm_packages_list(dirpath: string, options?: NpmPackageInfoListOptionsType): Promise<NpmPackageInfoListType>;
2195
+ //#endregion
2196
+ //#region src/common/utils.d.ts
2197
+ /**
2198
+ * 格式化日期
2199
+ * @param dateString - 日期字符串
2200
+ * @param locale - 语言环境,默认为 'zh-cn'
2201
+ * @param format - 日期格式,默认为 'YYYY-MM-DD HH:mm:ss'
2202
+ * @returns 格式化后的日期字符串
2203
+ * @example
2204
+ * ```ts
2205
+ * console.log(await format_date('2025-04-16T10:00:00')
2206
+ * -> '2025-04-16 10:00:00'
2207
+ * ```
2208
+ */
2209
+ declare function format_date(dateString: string, locale?: string, format?: string): Promise<string>;
2210
+ /**
2211
+ * 获取相对时间
2212
+ * @param dateString - 日期字符串
2213
+ * @param options - 可选参数对象
2214
+ * @param options.locale - 语言环境,默认为 'zh-cn'
2215
+ * @param options.useAbsoluteIfOver30Days - 是否在超过30天时返回绝对时间
2216
+ * @returns 相对时间或绝对时间
2217
+ * @example
2218
+ * ```ts
2219
+ * console.log(await get_relative_time('2023-04-01 12:00:00'))
2220
+ * -> "1 小时前"
2221
+ *
2222
+ * // 如果当前时间距离该日期已超过30天,则返回绝对时间
2223
+ * console.log(await get_relative_time('2023-01-01 12:00:00', { useAbsoluteIfOver30Days: true }))
2224
+ * -> "2025-07-01 13:00:00"
2225
+ * ```
2226
+ */
2227
+ declare function get_relative_time(dateString: string, options?: {
2228
+ locale?: string;
2229
+ useAbsoluteIfOver30Days?: boolean;
2230
+ }): Promise<string>;
2231
+ /**
2232
+ * 解析 Git 仓库地址
2233
+ * @description 解析 Git 仓库地址,返回仓库拥有者、仓库名称、仓库类型等信息, 如果是代理地址,则只支持http协议
2234
+ * @param url - Git 仓库地址
2235
+ * @returns Git 仓库信息
2236
+ * @example
2237
+ * ```ts
2238
+ * console.log(parse_git_url('https://github.com/user/repo.git'))
2239
+ * -> { owner: 'user', repo: 'repo', html_url: 'https://github.com/user/repo.git' }
2240
+ * console.log(parse_git_url('https://ghproxy.com/github.com/user/repo.git'))
2241
+ * -> { owner: 'user', repo: 'repo', html_url: 'https://github.com/user/repo.git' }
2242
+ * console.log(parse_git_url('https://ghproxy.com/https://github.com/user/repo.git'))
2243
+ * -> { owner: 'user', repo: 'repo', html_url: 'https://github.com/user/repo.git' }
2244
+ * ```
2245
+ */
2246
+
2247
+ /**
2248
+ * 根据语言名称获取对应的颜色值
2249
+ * @param language - 语言名称
2250
+ * @returns 颜色值的十六进制字符串
2251
+ * @example
2252
+ * ```ts
2253
+ * console.log(get_langage_color('JavaScript'))
2254
+ * -> '#f1e05a'
2255
+ * ```
2256
+ */
2257
+ declare function get_langage_color(language: string): string;
2258
+ /**
2259
+ * 从HTML中解析贡献数据
2260
+ * @param html - 包含贡献数据的HTML字符串
2261
+ * @returns 解析后的贡献数据,包括总贡献数和按周分组的贡献数据
2262
+ * @throws 如果解析过程中发生错误,将抛出异常
2263
+ * @example
2264
+ * ```ts
2265
+ * const result = await get_contribution_data(html)
2266
+ * -> { total: 5, contributions: [[{ date: '2023-04-16', count: 5 }]] }
2267
+ * ```
2268
+ */
2269
+ //#endregion
2270
+ //#region src/models/base/common.d.ts
2271
+ /**
2272
+ * 生成一个用户唯一的标识符
2273
+ * @returns 生成的唯一标识符
2274
+ * @example
2275
+ * ```ts
2276
+ * const stateId = await create_state_id()
2277
+ * -> '34523452345234523452345234523452'
2278
+ * ```
2279
+ */
2280
+ declare function create_state_id(): Promise<string>;
2281
+ //#endregion
2282
+ //#region src/models/platform/github/auth.d.ts
2283
+ /**
2284
+ * GitHub OAuth 授权管理类
2285
+ *
2286
+ * 提供完整的GitHub OAuth 2.0授权流程管理,包括:
2287
+ * - 生成授权链接
2288
+ * - 通过授权码(code)获取访问令牌(access_token)
2289
+ * - 检查访问令牌状态
2290
+ * - 刷新访问令牌
2291
+ *
2292
+ */
2293
+ declare class Auth extends GitHubClient {
2294
+ constructor(base: GitHubClient);
2295
+ /**
2296
+ * 通过 code 获取 token
2297
+ * @param options - 获取 token 的参数
2298
+ * - options.code - Github 返回的 code
2299
+ * @returns 返回 token
2300
+ * @example
2301
+ * ```ts
2302
+ * const token = await auth.get_token_by_code({ code: 'code' })
2303
+ * -> { info: '获取'access_token: 'token', refresh_token: 'refresh_token' }
2304
+ * ```
2305
+ */
2306
+ get_token_by_code(options: AccessCodeType): Promise<ApiResponseType<TokenResponseType>>;
2307
+ /**
2308
+ * 获取 token 的状态
2309
+ * @param options - 获取 token 的参数
2310
+ * - options.access_token - Github 返回的 access_token
2311
+ * 上一步 `get_token_by_code` 生成的 token
2312
+ * @returns 返回 token 的状态
2313
+ * @returns info - 返回 token 的状态信息,'Token 有效' | 'Token 无效'
2314
+ * @example
2315
+ * ```ts
2316
+ * const status = await auth.check_token_status({ access_token: 'access_token' })
2317
+ * console.log(status) // 输出token状态对象
2318
+ */
2319
+ check_token_status(options?: AccessTokenType): Promise<ApiResponseType<CheckTokenResponseType>>;
2320
+ /**
2321
+ * 通过 refresh_token 获取 token
2322
+ * @param options - 获取 token 的参数
2323
+ * - options.refresh_token - Github 返回的 refresh_token
2324
+ * @returns 返回 token
2325
+ * @example
2326
+ * ```
2327
+ * const token = await auth.refresh_token({ refresh_token: 'refresh_token' })
2328
+ * console.log(token) // 输出token对象
2329
+ * ```
2330
+ */
2331
+ refresh_token(options: RefreshTokenType): Promise<ApiResponseType<RefreshTokenResponseType>>;
2332
+ /**
2333
+ * 生成Github App 授权链接
2334
+ * @param state_id - 随机生成的 state_id,用于验证授权请求的状态,可选,默认不使用
2335
+ * @returns 返回授权链接对象
2336
+ * @returns create_auth_link 授权链接,用于跳转 Github 授权页
2337
+ * @example
2338
+ * ```ts
2339
+ * const link = await auth.create_auth_link('state_id')
2340
+ * console.log(link) // https://github.com/login/oauth/authorize?client_id=<client_id>&state=<state_id>
2341
+ * ```
2342
+ */
2343
+ create_auth_link(state_id?: string): Promise<string>;
2344
+ }
2345
+ //#endregion
2346
+ //#region src/models/platform/github/commit.d.ts
2347
+ /**
2348
+ * Commit 提交操作类
2349
+ *
2350
+ * 提供对GitHub Commit的CRUD操作,包括:
2351
+ * - 获取一个提交信息
2352
+ */
2353
+ declare class Commit$1 extends GitHubClient {
2354
+ constructor(base: GitHubClient);
2355
+ /**
2356
+ * 获取一个提交信息
2357
+ * 权限:
2358
+ * — Contents: read-only
2359
+ * @param options - 提交信息参数对象
2360
+ * - url 仓库URL地址
2361
+ * - owner 仓库拥有者
2362
+ * - sha 提交的SHA值,如果不提供,则默认获取仓库的默认分支的最新提交信息
2363
+ * @returns 提交信息
2364
+ * @example
2365
+ * ```ts
2366
+ * const commitInfo = await commit.get_commit_info({ owner: 'owner', repo: 'repo' })
2367
+ * -> 提交信息对象
2368
+ * ```
2369
+ */
2370
+ get_commit_info(options: CommitInfoParamType): Promise<ApiResponseType<CommitInfoResponseType>>;
2371
+ /**
2372
+ * 获取提交列表
2373
+ * 权限:
2374
+ * — Contents: read-only
2375
+ * @param options - 提交列表参数对象
2376
+ * - url 仓库URL地址
2377
+ * - owner 仓库拥有者
2378
+ * - sha 提交的SHA值,如果不提供,则默认获取仓库的默认分支的最新提交信息
2379
+ * - path 可选,提交路径
2380
+ * - author 可选,提交作者
2381
+ * - since 可选,提交时间范围开始
2382
+ * - until 可选,提交时间范围结束
2383
+ * - per_page 可选,每页提交数量,默认为30
2384
+ * - page 可选,页码,默认为1
2385
+ * @returns 提交列表
2386
+ * @example
2387
+ * ```ts
2388
+ * const commitList = await commit.get_commit_list({ owner: 'owner', repo:'repo' })
2389
+ * -> 提交对象列表
2390
+ * ```
2391
+ */
2392
+ get_commit_list(options: CommitListParamType): Promise<ApiResponseType<CommitListResponseType>>;
2393
+ }
2394
+ //#endregion
2395
+ //#region src/models/platform/github/issue.d.ts
2396
+ /**
2397
+ * GitHub Issue 处理类,提供Issue相关操作功能
2398
+ *
2399
+ * 提供完整的GitHub Issue管理,包括:
2400
+ * - 获取Issue列表
2401
+ * - 获取Issue详情
2402
+ * - 创建/更新/关闭/打开/锁定/解锁Issue
2403
+ * - 获取仓库评论列表
2404
+ * - 获取/创建/更新/删除Issue评论
2405
+ * - 管理子Issue
2406
+ *
2407
+ * @remarks 每个拉取请求都是一个议题,但并非每个议题都是拉取请求。
2408
+ */
2409
+ declare class Issue extends GitHubClient {
2410
+ constructor(base: GitHubClient);
2411
+ /**
2412
+ * 获取议题详情
2413
+ * 权限:
2414
+ * - Issues: Read-only
2415
+ * @param options 请求参数列表
2416
+ * - owner 仓库拥有者
2417
+ * - repo 仓库名称
2418
+ * - issue_number Issue编号
2419
+ * @returns 包含Issue信息的响应对象
2420
+ * @example
2421
+ * ```ts
2422
+ * const res = await issue.get_issue_info({ owner: 'owner', repo:'repo', issue_number:1 })
2423
+ * -> 议题信息对象
2424
+ * ```
2425
+ */
2426
+ get_issue_info(options: IssueInfoParamType): Promise<ApiResponseType<IssueInfoResponseType>>;
2427
+ /**
2428
+ * 获取仓库的议题列表
2429
+ * 权限:
2430
+ * - Issues:Read-only
2431
+ * @param options 请求参数列表
2432
+ * - owner 仓库拥有者
2433
+ * - repo 仓库名称
2434
+ * - milestones 里程碑ID列表
2435
+ * - state Issue状态,可选 'open' | 'closed' | 'all', 默认为'all'
2436
+ * - labels 标签名称列表
2437
+ * - assignee 指派人用户名
2438
+ * - type 问题类型
2439
+ * - creator 创建者用户名
2440
+ * - mentioned 提及的用户名
2441
+ * - sort 排序方式,可选 'created' | 'updated' | 'comments', 默认为'created'
2442
+ * - direction 排序方向,可选 'asc' | 'desc', 默认为'desc'
2443
+ * - since 筛选此时间之后的问题
2444
+ * - per_page 每页数量,可选,默认为30
2445
+ * - page 页码,可选,默认为1
2446
+ * @returns 包含Issue列表的响应对象
2447
+ * @example
2448
+ * ```ts
2449
+ * const res = await issue.get_issue_list({ owner: 'owner', repo: 'repo' })
2450
+ * -> 议题信息对象列表
2451
+ * ```
2452
+ */
2453
+ get_issues_list(options: RepoIssueListParamType): Promise<ApiResponseType<IssueListResponseType>>;
2454
+ /**
2455
+ * 创建一个议题
2456
+ * 权限:
2457
+ * - Issues: Write
2458
+ * @param options 发送Issue的参数对象
2459
+ * - owner 仓库拥有者
2460
+ * - repo 仓库名称
2461
+ * - title 标题
2462
+ * - body 内容
2463
+ * - assignee 指派人
2464
+ * - milestone 里程碑
2465
+ * - labels 标签列表
2466
+ * - type 问题类型
2467
+ * @returns 包含Issue信息的响应对象
2468
+ * @example
2469
+ * ```ts
2470
+ * const res = await issue.create_issue({ owner: 'owner', repo:'repo', title:'title', body:'body' })
2471
+ * -> 创建议题信息对象
2472
+ * ```
2473
+ */
2474
+ create_issue(options: CreteIssueParamType): Promise<ApiResponseType<CreateIssueResponseType>>;
2475
+ /**
2476
+ * 更新一个议题
2477
+ * 权限:
2478
+ * - Issues: Write
2479
+ * - Pull requests: Write
2480
+ * 需以上权限之一
2481
+ * @param options 更新Issue的参数对象
2482
+ * - owner 仓库拥有者
2483
+ * - repo 仓库名称
2484
+ * - issue_number Issue编号
2485
+ * - title 标题
2486
+ * - body 内容
2487
+ * - assignee 指派人
2488
+ * - milestone 里程碑
2489
+ * - labels 标签列表
2490
+ * - type 问题类型
2491
+ * @returns 包含Issue信息的响应对象
2492
+ * @example
2493
+ * ```ts
2494
+ * const res = await issue.update_issue({ owner: 'owner', repo:'repo', issue_number:1, title:'title', body:'body' })
2495
+ * -> 更新议题信息对象
2496
+ * ```
2497
+ */
2498
+ update_issue(options: UpdateIssueParamType): Promise<ApiResponseType<UpdateIssueResponseType>>;
2499
+ /**
2500
+ * 重新打开一个议题
2501
+ * 权限:
2502
+ * - Issues: Write
2503
+ * - Pull requests: Write
2504
+ * 需以上权限之一
2505
+ * @param options 打开Issue的参数对象
2506
+ * - owner 仓库拥有者
2507
+ * - repo 仓库名称
2508
+ * - issue_number Issue编号
2509
+ * @returns 包含Issue信息的响应对象
2510
+ * @example
2511
+ * ```ts
2512
+ * const res = await issue.open_issue({ owner: 'owner', repo:'repo', issue_number:1 })
2513
+ * -> 打开议题信息对象
2514
+ * ```
2515
+ */
2516
+ open_issue(options: OpenIssueParamType): Promise<ApiResponseType<OpenIssueResponseType>>;
2517
+ /**
2518
+ * 重新打开一个议题
2519
+ * 权限:
2520
+ * - Issues: Write
2521
+ * - Pull requests: Write
2522
+ * 需以上权限之一
2523
+ * @deprecated 请使用 open_issue 方法代替
2524
+ */
2525
+ reopen_issue(options: OpenIssueParamType): Promise<ApiResponseType<OpenIssueResponseType>>;
2526
+ /**
2527
+ * 关闭一个议题
2528
+ * 权限:
2529
+ * - Issues: Write
2530
+ * - Pull requests: Write
2531
+ * 需以上权限之一
2532
+ * @param options 关闭Issue的参数对象
2533
+ * - owner 仓库拥有者
2534
+ * - repo 仓库名称
2535
+ * - issue_number Issue编号
2536
+ * - state_reason 关闭原因
2537
+ * @returns 包含Issue信息的响应对象
2538
+ * @example
2539
+ * ```ts
2540
+ * const res = await issue.close_issue({ owner: 'owner', repo:'repo', issue_number:1, state_reason:'completed' })
2541
+ * -> 关闭议题信息对象
2542
+ * ```
2543
+ */
2544
+ close_issue(options: CloseIssueParamType): Promise<ApiResponseType<CloseIssueResponseType>>;
2545
+ /**
2546
+ * 锁定一个议题
2547
+ * @github
2548
+ * 仅GitHub平台可用
2549
+ * 权限:
2550
+ * - Issues: Write
2551
+ * - Pull requests: Write
2552
+ * 需以上权限之一
2553
+ * @param options 锁定Issue的参数对象
2554
+ * - owner 仓库拥有者
2555
+ * - repo 仓库名称
2556
+ * - issue_number Issue编号
2557
+ * - lock_reason 锁定原因 可选 'off-topic' | 'too heated' | 'resolved' | 'spam'
2558
+ * @returns 锁定状态信息
2559
+ * @example
2560
+ * ```ts
2561
+ * const res = await issue.lock_issue({ owner: 'owner', repo:'repo', issue_number:1, lock_reason:'off-topic' })
2562
+ * -> 锁定议题信息对象
2563
+ * ```
2564
+ */
2565
+ lock_issue(options: LockIssueParamType): Promise<ApiResponseType<LockIssueResponseType>>;
2566
+ /**
2567
+ * 解锁一个议题
2568
+ * @github
2569
+ * 仅GitHub平台可用
2570
+ * 权限:
2571
+ * - Issues: Write
2572
+ * - Pull requests: Write
2573
+ * 需以上权限之一
2574
+ * @param options 解锁Issue的参数对象
2575
+ * - owner 仓库拥有者
2576
+ * - repo 仓库名称
2577
+ * - issue_number Issue编号
2578
+ * @returns 解锁状态信息
2579
+ * @example
2580
+ * ```ts
2581
+ * const res = await issue.unlock_issue({ owner: 'owner', repo:'repo', issue_number})
2582
+ * -> 解锁议题信息对象
2583
+ * ```
2584
+ */
2585
+ unlock_issue(options: UnLockIssueParamType): Promise<ApiResponseType<UnLockIssueResponseType>>;
2586
+ /**
2587
+ * 获取一个仓库下议题的评论列表
2588
+ * 权限:
2589
+ * - Issues: Read-only
2590
+ * - Pull requests: Read-only
2591
+ * 需以上权限之一
2592
+ * @param options 获取Issue评论列表的参数对象
2593
+ * - owner 仓库拥有者
2594
+ * - repo 仓库名称
2595
+ * - sort 排序方式 可选 'created' | 'updated'
2596
+ * - direction 排序方向 可选 'asc' | 'desc',当sort不存在时此参数会被忽略
2597
+ * - since 评论时间
2598
+ * - per_page 每页评论数量
2599
+ * - page 页码
2600
+ * @returns 包含Issue评论列表的响应对象
2601
+ * @example
2602
+ * ```ts
2603
+ * const res = await issue.get_issue_comments_list({ owner: 'owner', repo:'repo', issue_number:1 })
2604
+ * -> 议题评论对象列表
2605
+ * ```
2606
+ */
2607
+ get_repo_comments_list(options: RepoCommentsListParamType): Promise<ApiResponseType<RepoCommentsListResponseType>>;
2608
+ /**
2609
+ * 获取一个议题下的评论列表
2610
+ * 权限:
2611
+ * - Issues: Read-only
2612
+ * - Pull requests: Read-only
2613
+ * 需以上权限之一
2614
+ * @param options 获取Issue评论列表的参数对象
2615
+ * - owner 仓库拥有者
2616
+ * - repo 仓库名称
2617
+ * - issue_number Issue编号
2618
+ * - since 评论时间
2619
+ * - per_page 每页评论数量
2620
+ * - page 页码
2621
+ * @returns 包含Issue评论列表的响应对象
2622
+ * @example
2623
+ * ```ts
2624
+ * const res = await issue.get_issue_comments_list({ owner: 'owner', repo:'repo', issue_number:1 })
2625
+ * -> 议题评论对象列表
2626
+ * ```
2627
+ */
2628
+ get_issue_comments_list(options: IssueCommentsListParamType): Promise<ApiResponseType<IssueCommentsListResponseType>>;
2629
+ /**
2630
+ * 获取议题评论信息
2631
+ * 权限:
2632
+ * - Issues: Read-only
2633
+ * - Pull requests: Read-only
2634
+ * 需以上权限之一
2635
+ * @param options 获取Issue评论信息的参数对象
2636
+ * - owner 仓库拥有者
2637
+ * - repo 仓库名称
2638
+ * - comment_id 评论ID
2639
+ * @returns Issue评论信息
2640
+ * @example
2641
+ * ```ts
2642
+ * const res = await issue.get_issue_comment({ owner: 'owner', repo:'repo', comment_id:1 })
2643
+ * -> 议题评论对象
2644
+ * ```
2645
+ */
2646
+ get_issue_comment_info(options: IssueCommentInfoParamType): Promise<ApiResponseType<IssueCommentInfoResponseType>>;
2647
+ /**
2648
+ * 创建一个议题评论
2649
+ * 权限:
2650
+ * - Issues: Write
2651
+ * - Pull requests: Write
2652
+ * 需以上权限之一
2653
+ * @param options 创建Issue评论的参数对象
2654
+ * - owner 仓库拥有者
2655
+ * - repo 仓库名称
2656
+ * - issue_number Issue编号
2657
+ * - body 评论内容
2658
+ * @returns 创建的Issue评论信息
2659
+ * @example
2660
+ * ```ts
2661
+ * const issue = get_issue() // 获取issue实例
2662
+ * const res = await issue.create_issue_comment({ owner: 'owner', repo:'repo', issue_number:1, body:'comment' })
2663
+ * -> 创建议题评论对象
2664
+ * ```
2665
+ */
2666
+ create_issue_comment(options: CreteIssueCommentParamType): Promise<ApiResponseType<CreteIssueCommentResponseType>>;
2667
+ /**
2668
+ * 更新议题评论信息
2669
+ * 权限:
2670
+ * - Issues: Write
2671
+ * - Pull requests: Write
2672
+ * 需以上权限之一
2673
+ * @param options 更新Issue评论信息的参数对象
2674
+ * - owner 仓库拥有者
2675
+ * - repo 仓库名称
2676
+ * - comment_id 评论ID
2677
+ * - body 评论内容
2678
+ * @returns 更新后的Issue评论信息
2679
+ * @example
2680
+ * ```ts
2681
+ * const res = await issue.update_issue_comment({ owner: 'owner', repo:'repo', comment_id:1, body:'body' })
2682
+ * -> 更新议题评论对象
2683
+ * ```
2684
+ */
2685
+ update_issue_comment(options: UpdateIssueCommentParamType): Promise<ApiResponseType<UpdateIssueCommentResponseType>>;
2686
+ /**
2687
+ * 删除议题评论信息
2688
+ * 权限:
2689
+ * - Issues: Write
2690
+ * - Pull requests: Write
2691
+ * 需以上权限之一
2692
+ * @param options 删除Issue评论信息的参数对象
2693
+ * - owner 仓库拥有者
2694
+ * - repo 仓库名称
2695
+ * - comment_id 评论ID
2696
+ * @returns 删除结果信息
2697
+ * @example
2698
+ * ```ts
2699
+ * const res = awaitissue.remove_issue_comment()
2700
+ * -> 删除议题评论对象
2701
+ * ```
2702
+ */
2703
+ remove_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveIssueCommentResponseType>>;
2704
+ /**
2705
+ * 删除议题评论信息
2706
+ * 权限:
2707
+ * - Issues: Write
2708
+ * - Pull requests: Write
2709
+ * 需以上权限之一
2710
+ * @deprecated 请使用 remove_issue_comment 方法代替
2711
+ */
2712
+ delete_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveIssueCommentResponseType>>;
2713
+ /**
2714
+ * 获取子议题列表
2715
+ * @github
2716
+ * 仅GitHub 平台使用
2717
+ * 权限:
2718
+ * - Issues: Read-only
2719
+ * - Pull requests: Read-only
2720
+ * 需以上权限之一
2721
+ * @param options 获取子议题列表的参数对象
2722
+ * - owner 仓库拥有者
2723
+ * - repo 仓库名称
2724
+ * - issue_number 议题编号
2725
+ * @returns 子议题列表
2726
+ * @example
2727
+ * ```ts
2728
+ * const res = await issue.get_sub_issue_list({ owner: 'owner', repo:'repo', issue_number:1 })
2729
+ * -> 子议题信息对象列表
2730
+ * ```
2731
+ */
2732
+ get_sub_issue_list(options: SubIssueListParamType): Promise<ApiResponseType<SubIssueListResponseType>>;
2733
+ /**
2734
+ * 创建子议题
2735
+ * 添加一个子议题到指定的议题中
2736
+ * @github
2737
+ * 仅GitHub 平台使用
2738
+ * 权限:
2739
+ * - Issues:Write
2740
+ * @param options 添加子议题的参数对象
2741
+ * - owner 仓库拥有者
2742
+ * - repo 仓库名称
2743
+ * - issue_number 父议题编号
2744
+ * - sub_issue_id 子议题编号
2745
+ * - replace_parent 是否替换父议题
2746
+ * @returns 添加结果信息
2747
+ * @example
2748
+ * ```ts
2749
+ * const res = await issue.add_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1, replace_parent:true })
2750
+ * -> 创建子议题信息对象
2751
+ * ```
2752
+ */
2753
+ create_sub_issue(options: CreateSubIssueParamType): Promise<ApiResponseType<CreateSubIssueResponseType>>;
2754
+ /**
2755
+ * 添加子议题
2756
+ * 添加一个子议题到指定的议题中
2757
+ * @github
2758
+ * 仅GitHub 平台使用
2759
+ * @deprecated 已弃用,请使用`create_sub_issue`方法
2760
+ */
2761
+ add_sub_issue(options: CreateSubIssueParamType): Promise<ApiResponseType<CreateSubIssueResponseType>>;
2762
+ /**
2763
+ * 删除子议题
2764
+ * @github
2765
+ * 仅GitHub 平台使用
2766
+ * 权限:
2767
+ * - Issues:Write
2768
+ * @param options 删除子议题的参数对象
2769
+ * - owner 仓库拥有者
2770
+ * - repo 仓库名称
2771
+ * - issue_number 父议题编号
2772
+ * - sub_issue_id 子议题编号
2773
+ * @returns 删除结果信息
2774
+ * @example
2775
+ * ```ts
2776
+ * const res = await issue.remove_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1 })
2777
+ * -> 删除子议题信息对象
2778
+ * ```
2779
+ */
2780
+ remove_sub_issue(options: RemoveSubIssueParamType): Promise<ApiResponseType<RemoveSubIssueResponseType>>;
2781
+ /**
2782
+ * 删除子议题
2783
+ * 删除一个子议题
2784
+ * 权限:
2785
+ * - Issues:Write
2786
+ * @deprecated 请使用 remove_sub_issue 方法代替
2787
+ */
2788
+ delete_sub_issue(options: RemoveSubIssueParamType): Promise<ApiResponseType<RemoveSubIssueResponseType>>;
2789
+ /**
2790
+ * 重新排序子议题
2791
+ * 重新确定子议题优先级
2792
+ * @github
2793
+ * 仅GitHub 平台使用
2794
+ * 权限:
2795
+ * - Issues:Write
2796
+ * @param options 重新排序子议题的参数对象
2797
+ * - owner 仓库拥有者
2798
+ * - repo 仓库名称
2799
+ * - issue_number 父议题编号
2800
+ * - sub_issue_id 子议题编号
2801
+ * - before_id 指定要在哪个子议题之前插入,传入目标子议题的编号
2802
+ * - after_id 指定要在哪个子议题之后插入,传入目标子议题的编号
2803
+ * @example
2804
+ * ```ts
2805
+ * const res = await issue.reprioritize_sub_issue({ owner: 'owner', repo:'repo', issue_number:1, sub_issue_id:1, before_id:1 })
2806
+ * -> 排序子议题信息对象
2807
+ * ```
2808
+ */
2809
+ reprioritize_sub_issue(options: ReprioritizeSubIssueParamType): Promise<ApiResponseType<ReprioritizeSubIssueResponseType>>;
2810
+ }
2811
+ //#endregion
2812
+ //#region src/models/platform/github/org.d.ts
2813
+ /**
2814
+ * Github 组织操作类
2815
+ *
2816
+ * 提供对GitHub组织的CRUD操作,包括:
2817
+ * - 获取组织信息
2818
+ */
2819
+ declare class Org extends GitHubClient {
2820
+ constructor(base: GitHubClient);
2821
+ /**
2822
+ * 获取组织信息
2823
+ * 权限:
2824
+ * - Metadata Read-only , 如果获取公开组织可无需此权限
2825
+ * @param options 组织参数
2826
+ * - org 组织名称
2827
+ * @returns 组织信息
2828
+ * @example
2829
+ * ```ts
2830
+ * const orgInfo = await org.get_org_info({ org: 'org' })
2831
+ * -> 组织信息对象
2832
+ * ```
2833
+ */
2834
+ get_org_info(options: OrgInfoParamType): Promise<ApiResponseType<OrgInfoResponseType>>;
2835
+ /**
2836
+ * 获取组织成员信息
2837
+ * 权限:
2838
+ * - Member: Read
2839
+ * @description 该函数必需要授权访问,否则会获取失败
2840
+ * @param options 组织信息参数
2841
+ * - org 组织名称
2842
+ * - username 成员名称
2843
+ * @returns 组织信息
2844
+ * @example
2845
+ * ```ts
2846
+ * console.log(await get_org_member_info({ org: 'CandriaJS', username: 'CandriaJS' }))
2847
+ * -> {
2848
+ * "state": "active",
2849
+ * "role": "admin",
2850
+ * "organization": {
2851
+ * "id": 123456789,
2852
+ * "login": "CandriaJS",
2853
+ * "name": "CandriaJS",
2854
+ * "html_url": "https://github.com/CandriaJS"
2855
+ * },
2856
+ * "user": {
2857
+ * "id": 123456789,
2858
+ * "login": "CandriaJS",
2859
+ * "name": "CandriaJS",
2860
+ * "avatar_url": "https://avatars.githubusercontent.com/u/123456789?v=4",
2861
+ * "html_url": "https://github.com/CandriaJS"
2862
+ * }
2863
+ * }
2864
+ * ```
2865
+ */
2866
+ get_org_member_info(options: GetOrgMemberInfoParamType): Promise<ApiResponseType<GetOrgMemberInfoResponseType>>;
2867
+ /**
2868
+ * 获取组织成员列表
2869
+ * 权限:
2870
+ * - Member: Read
2871
+ * @description 该函数必需要授权访问,否则会获取失败
2872
+ * @param options
2873
+ * - org 组织名称
2874
+ * - per_page 每页数量
2875
+ * - page 页码
2876
+ * @returns
2877
+ * @example
2878
+ * ```ts
2879
+ * const res = await github.issue.get_org_member_list({ org: 'CandriaJS'})
2880
+ * -> [
2881
+ * {
2882
+ * "id": 1234567890,
2883
+ * "login": "username",
2884
+ * "name": "username",
2885
+ * "role": "admin",
2886
+ * "avatar_url": "https://avatars.githubusercontent.com/u/1234567890?v=4",
2887
+ * "html_url": "https://github.com/username"
2888
+ * }
2889
+ * ]
2890
+ * ```
2891
+ */
2892
+ get_org_member_list(options: GetOrgMemberListParamType): Promise<ApiResponseType<GetOrgMemberListResponseType>>;
2893
+ /**
2894
+ * 添加组织成员
2895
+ * 权限:
2896
+ * - Members Read-And-Write
2897
+ * @param options 组织参数
2898
+ * - org 组织名称
2899
+ * - username 成员名称
2900
+ * @returns 成员信息
2901
+ * @example
2902
+ * ```ts
2903
+ * const orgInfo = await org.add_member({ org: 'org', username: 'username' })
2904
+ * -> 添加组织成员对象
2905
+ * ```
2906
+ */
2907
+ add_member(options: AddMemberParamType): Promise<ApiResponseType<AddMemberResponseType>>;
2908
+ /**
2909
+ * 移除组织成员
2910
+ * 权限:
2911
+ * - Members Read-And-Write
2912
+ * @param options
2913
+ * - org 组织名
2914
+ * - username 成员名
2915
+ * @returns
2916
+ * @example
2917
+ * ```ts
2918
+ * const res = await github.remove_org_member({ org: 'org', username: 'loli'})
2919
+ * -> {
2920
+ * "success": true,
2921
+ * "message": "喵呜, 移除组织成员loli成功"
2922
+ * }
2923
+ * ```
2924
+ */
2925
+ remove_org_member(options: RemoveOrgMemberParamType): Promise<ApiResponseType<RemoveOrgMemberResponseType>>;
2926
+ }
2927
+ //#endregion
2928
+ //#region src/models/platform/github/pull_request.d.ts
2929
+ /**
2930
+ * GitHub pull_request类
2931
+ *
2932
+ * 提供完整的GitHub pull_request管理,包括
2933
+ * - 获取pull_request列表
2934
+ * - 获取pull_request详情
2935
+ *
2936
+ * @class Auth
2937
+ * @extends GitHubClient GitHub基础操作类
2938
+ */
2939
+ declare class Pull_Request extends GitHubClient {
2940
+ constructor(base: GitHubClient);
2941
+ /**
2942
+ * 获取拉取请求详情
2943
+ * 权限:
2944
+ * - Pull requests: Read-And-Wirte
2945
+ * - Contents: Read-And-Wirte
2946
+ * @param options 请求参数列表
2947
+ * - owner 仓库拥有者
2948
+ * - repo 仓库名称
2949
+ * - pr_number Pr编号
2950
+ * @returns 包含pull_request信息的响应对象
2951
+ * @example
2952
+ * ```ts
2953
+ * const res = await pull_request.get_pull_request_info({ owner: 'owner', repo:'repo', pr_number:1 })
2954
+ * -> 拉取提交信息对象
2955
+ * ```
2956
+ */
2957
+ get_pull_request_info(options: PullRequestInfoParamType): Promise<ApiResponseType<PullRequestInfoResponseType>>;
2958
+ /**
2959
+ * 获取拉取请求列表
2960
+ * 权限:
2961
+ * - Pull requests: Read-Only
2962
+ * @param options 请求参数列表
2963
+ * - owner 仓库拥有者
2964
+ * - repo 仓库名称
2965
+ * - pr_number Pr编号
2966
+ * - state 状态
2967
+ * - base 基准分支
2968
+ * - sort 排序
2969
+ * - direction 排序方向
2970
+ * - per_page 每页数量
2971
+ * - page 页码
2972
+ * @returns 包含pull_request信息的响应对象
2973
+ * @example
2974
+ * ```ts
2975
+ * const res = await pull_request.get_get_pull_request_list({ owner: 'owner', repo:'repo' })
2976
+ * -> 拉取提交信息对象列表
2977
+ * ```
2978
+ */
2979
+ get_get_pull_request_list(options: PullRequestListParamType): Promise<ApiResponseType<PullRequestListResponseType>>;
2980
+ /**
2981
+ * 创建一个拉取请求
2982
+ * 权限:
2983
+ * - Pull requests: Read-And-Write
2984
+ * @param options 请求参数列表
2985
+ * - owner 仓库拥有者
2986
+ * - repo 仓库名称
2987
+ * - title 标题
2988
+ * - body 内容
2989
+ * - issue 关联的议题
2990
+ * title和body与issue参数传入其中一种,当传入issue参数时,title和body参数将自动填充
2991
+ * - head 拉取请求源分支
2992
+ * - head_repo 拉取请求源仓库, 如果两个存储库都由同一组织拥有,则跨存储库拉取请求需要此字段
2993
+ * - base 拉取请求目标分支
2994
+ * - draft 是否为草稿
2995
+ * @returns 包含pull_request信息的响应对象
2996
+ * @example
2997
+ * ```ts
2998
+ * const res = await pull_request.create_pull_requestt({ owner: 'owner', repo:'repo', issue: 1, head: 'head', base: 'base' })
2999
+ * -> 创建拉取提交信息对象
3000
+ */
3001
+ create_pull_request(options: CreatePullRequestParamType): Promise<ApiResponseType<CreatePullRequestResponseType>>;
3002
+ /**
3003
+ * 更新一个拉取请求
3004
+ * 权限:
3005
+ * - Pull requests: Read-And-Write
3006
+ * @param options 请求参数列表
3007
+ * - owner 仓库拥有者
3008
+ * - repo 仓库名称
3009
+ * - title 标题
3010
+ * - body 内容
3011
+ * - state 状态
3012
+ * @returns 包含pull_request信息的响应对象
3013
+ * @example
3014
+ * ```ts
3015
+ * const res = await pull_request.create_pull_requestt({ owner: 'owner', repo:'repo', pr_number:1, state:'open' })
3016
+ * -> 更新拉取提交信息对象
3017
+ */
3018
+ update_pull_request(options: UpdatePullRequestParamType): Promise<ApiResponseType<UpdatePullRequestResponseType>>;
3019
+ /**
3020
+ * 合并拉取请求
3021
+ * 权限:
3022
+ * - Pull requests: Read-And-Write
3023
+ * @param options 请求参数列表
3024
+ * - owner 仓库拥有者
3025
+ * - repo 仓库名称
3026
+ * - pr_number 拉取请求编号
3027
+ * - commit_title 合并提交标题
3028
+ * - commit_message 合并提交信息
3029
+ * - sha 拉取请求头部必须匹配的 SHA 才能允许合并
3030
+ * - merge_method 拉取请求合并方式, 默认为 merge
3031
+ * @returns 包含pull_request信息的响应对象
3032
+ * @example
3033
+ * ```ts
3034
+ * const res = await pull_request.merge_pull_request({ owner: 'owner', repo:'repo', pr_number:1 })
3035
+ * -> 合并拉取提交信息对象
3036
+ * ```
3037
+ */
3038
+ merge_pull_request(options: MergePullRequestParamType): Promise<ApiResponseType<MergePullRequestResponseType>>;
3039
+ get_pull_request_diff(options: GetPullRequestDiffParamType): Promise<ApiResponseType<GetPullRequestDiffResponseType>>;
3040
+ /**
3041
+ * 获取拉取请求文件列表
3042
+ * 权限:
3043
+ * - Pull requests: Read-And-Write
3044
+ * @param options 请求参数列表
3045
+ * - owner 仓库拥有者
3046
+ * - repo 仓库名称
3047
+ * - pr_number 拉取请求编号
3048
+ * - per_page 每页结果数量
3049
+ * - page 页码
3050
+ * @returns 包含拉取请求文件列表的响应对象
3051
+ * @example
3052
+ * ```ts
3053
+ * const res = await pull_request.get_pull_request_files_list({ owner: 'owner', repo:'repo', pr_number:1 })
3054
+ * -> 拉取提交文件信息对象列表
3055
+ * ```
3056
+ */
3057
+ get_pull_request_files_list(options: GetPullRequestFilesListParamType): Promise<ApiResponseType<GetPullRequestFilesListResponseType>>;
3058
+ /**
3059
+ * 获取拉取请求评论信息
3060
+ * 权限:
3061
+ * - Pull requests: Read-And-Write
3062
+ * @param options 请求参数列表
3063
+ * - owner 仓库拥有者
3064
+ * - repo 仓库名称
3065
+ * - comment_id 评论ID
3066
+ * @returns 包含拉取请求指定的评论id的信息
3067
+ * @example
3068
+ * ```ts
3069
+ * const res = await pull_request.get_pull_request_comment_info({ owner: 'owner', repo:'repo', comment_id:1 })
3070
+ * -> 拉取提交评论信息对象
3071
+ * ```
3072
+ */
3073
+ get_pull_request_comment_info(options: GetPullRequestCommentInfoParamType): Promise<ApiResponseType<GetPullRequestCommentInfoResponseType>>;
3074
+ /**
3075
+ * 获取拉取请求评论列表
3076
+ * 权限:
3077
+ * - Pull requests: Read-And-Write
3078
+ * @param options 请求参数列表
3079
+ * - owner 仓库拥有者
3080
+ * - repo 仓库名称
3081
+ * - pr_number 拉取请求编号
3082
+ * - direction 排序方向
3083
+ * - per_page 每页结果数量
3084
+ * - page 页码
3085
+ * @returns 包含拉取请求评论列表响应信息列表
3086
+ * @example
3087
+ * ```ts
3088
+ * const res = await pull_request.get_pull_request_comments_list({ owner: 'owner', repo:'repo', pr_number:1 })
3089
+ * -> 拉取提交评论信息对象
3090
+ * ```
3091
+ */
3092
+ get_pull_request_comments_list(options: GetPullRequestCommentsListParamType): Promise<ApiResponseType<GetPullRequestCommentsListResponseType>>;
3093
+ /**
3094
+ * 创建拉取请求评论
3095
+ * 权限:
3096
+ * - Pull requests: Read-And-Write
3097
+ * @param options 请求参数列表
3098
+ * - owner 仓库拥有者
3099
+ * - repo 仓库名称
3100
+ * - pr_number 拉取请求编号
3101
+ * - body 评论内容
3102
+ * @returns 包含创建拉取请求评论响应信息
3103
+ * @example
3104
+ * ```ts
3105
+ * const res = await pull_request.create_pull_request_comment({ owner: 'owner', repo:'repo', pr_number:1, body: 'loli' })
3106
+ * -> 创建拉取提交评论信息对象
3107
+ * ```
3108
+ */
3109
+ create_pull_request_comment(options: CreatePullRequestCommentParamType): Promise<ApiResponseType<CreatePullRequestCommentResponseType>>;
3110
+ /**
3111
+ * 更新拉取请求评论
3112
+ * 权限:
3113
+ * - Pull requests: Read-And-Write
3114
+ * @param options 请求参数列表
3115
+ * - owner 仓库拥有者
3116
+ * - repo 仓库名称
3117
+ * - comment_id 评论ID
3118
+ * - body 评论内容
3119
+ * @returns 包含更新拉取请求评论响应信息
3120
+ * @example
3121
+ * ```ts
3122
+ * const res = await pull_request.update_pull_request_comment({ owner: 'owner', repo:'repo', comment_id:1, body: 'loli' })
3123
+ * -> 更新拉取提交评论信息对象
3124
+ * ```
3125
+ */
3126
+ update_pull_request_comment(options: UpdatePullRequestCommentParamType): Promise<ApiResponseType<UpdatePullRequestCommentResponseType>>;
3127
+ /**
3128
+ * 编辑拉取请求评论
3129
+ * @deprecated 请使用update_issue_comment方法
3130
+ * 权限:
3131
+ * - Pull requests: Read-And-Write
3132
+ * @param options - 删除拉取请求评论参数对象
3133
+ * @returns 删除结果
3134
+ * ```
3135
+ */
3136
+ edit_pull_request_comment(options: UpdatePullRequestCommentParamType): Promise<ApiResponseType<UpdatePullRequestCommentResponseType>>;
3137
+ /**
3138
+ * 删除拉取请求评论
3139
+ * 权限:
3140
+ * - Pull requests: Read-And-Write
3141
+ * @param options 请求参数列表
3142
+ * - owner 仓库拥有者
3143
+ * - repo 仓库名称
3144
+ * - comment_id 评论ID
3145
+ * @returns 包含更新拉取请求评论响应信息
3146
+ * @example
3147
+ * ```ts
3148
+ * const res = await pull_request.delete_pull_request_comment({ owner: 'owner', repo:'repo', comment_id: 1 })
3149
+ * -> 更新拉取提交评论信息对象
3150
+ * ```
3151
+ */
3152
+ delete_pull_request_comment(options: DeletePullRequestCommentParamType): Promise<ApiResponseType<DeletePullRequestCommentResponseType>>;
3153
+ }
3154
+ //#endregion
3155
+ //#region src/models/platform/github/repo.d.ts
3156
+ /**
3157
+ * GitHub 仓库操作类
3158
+ *
3159
+ * 提供对GitHub仓库的完整CRUD操作接口,包括:
3160
+ * - 组织/用户仓库的查询、创建、删除
3161
+ * - 仓库详细信息的获取
3162
+ * - 仓库可见性检查
3163
+ * - 支持通过URL或owner/repo两种方式操作仓库
3164
+ *
3165
+ */
3166
+ declare class Repo extends GitHubClient {
3167
+ constructor(base: GitHubClient);
3168
+ /**
3169
+ * 获取组织仓库列表
3170
+ * 权限: Metadata - Read-only , 如果获取公开仓库可无需此权限
3171
+ * @param options - 请求参数对象
3172
+ * - org - 组织名称
3173
+ * - type - 仓库类型,可选值:'all' | 'public' | 'private' | 'forks' | 'sources' | 'member', 默认值:'all'
3174
+ * - sort - 排序字段,可选值:'created' | 'updated' | 'pushed' | 'full_name', 默认值:'created'
3175
+ * - direction - 排序方向,可选值:'asc' | 'desc', 默认值:'desc'
3176
+ * - per_page - 每页数量(1-100), 默认值:30
3177
+ * - page - 页码 默认值:1
3178
+ * @returns 组织仓库列表
3179
+ * @example
3180
+ * ```ts
3181
+ * const repos = await repo.get_org_repos_list({ org: 'org' })
3182
+ * -> 组织仓库信息对象列表
3183
+ * ```
3184
+ */
3185
+ get_org_repos_list(options: OrgRepoListParmType): Promise<ApiResponseType<OrgRepoListResponseType>>;
3186
+ /**
3187
+ * 通过授权用户查询仓库列表
3188
+ * 权限: Metadata - read-only , 如果获取公开仓库可无需此权限
3189
+ * @param options - 请求参数对象
3190
+ * - type - 仓库类型,可选值:可选all, public, private
3191
+ * - visibility - 仓库可见性,可选值:'public' | 'private' | 'internal', 默认值:'all'
3192
+ * - affiliation - 仓库关联,可选值:'owner' | 'collaborator' | 'organization_member', 默认值:'owner,collaborator,organization_member'
3193
+ * - sort - 排序字段,可选值:'created' | 'updated' | 'pushed' | 'full_name', 默认值:'created'
3194
+ * - direction - 排序方向,可选值:'asc' | 'desc', 默认值:'desc'
3195
+ * - per_page - 每页数量(1-100), 默认值:30
3196
+ * - page - 页码 默认值:1
3197
+ * @returns 仓库详细信息
3198
+ * @example
3199
+ * ```ts
3200
+ * const repos = await repo.get_repos_list({ username: 'username' })
3201
+ * -> 用户仓库信息对象列表
3202
+ * ```
3203
+ */
3204
+ get_user_repos_list_by_token(options?: UserByTokenRepoListParamType): Promise<ApiResponseType<UserRepoListType>>;
3205
+ /**
3206
+ * 获取用户仓库列表
3207
+ * 权限:
3208
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
3209
+ * @param options - 请求参数对象
3210
+ * - username - 用户名
3211
+ * 优先获取授权用户仓库列表,若授权用户不存在则获取指定用户仓库列表
3212
+ * - type - 仓库类型,可选值:all, owner, member,, 默认值:'all'
3213
+ * - sort - 排序字段,可选值:'created' | 'updated' | 'pushed' | 'full_name', 默认值:'created'
3214
+ * - direction - 排序方向,可选值:'asc' | 'desc', 默认值:'desc'
3215
+ * - per_page - 每页数量(1-100), 默认值:30
3216
+ * - page - 页码 默认值:1
3217
+ * @returns 用户仓库列表
3218
+ * @example
3219
+ * ```ts
3220
+ * const repos = await github.get_user_repos_list({ username: 'loli' })
3221
+ * -> 用户仓库信息对象列表
3222
+ * ```
3223
+ */
3224
+ get_user_repos_list(options: UserRepoListParamType): Promise<ApiResponseType<UserRepoListType>>;
3225
+ /**
3226
+ * 获取仓库信息
3227
+ * 权限:
3228
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
3229
+ * @param options - 仓库信息参数对象,必须包含以下两种组合之一:
3230
+ * - owner 仓库拥有者
3231
+ * - repo 仓库名称
3232
+ * @example
3233
+ * ```ts
3234
+ * const repo = await repo.get_repo_info({ owner: 'owner', repo: 'repo' })
3235
+ * -> 仓库信息对象
3236
+ * ```
3237
+ */
3238
+ get_repo_info(options: RepoInfoParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
3239
+ /**
3240
+ * 获取仓库语言列表
3241
+ * 权限:
3242
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
3243
+ * @param options - 仓库信息参数对象,必须包含以下两种组合之一:
3244
+ * - owner 仓库拥有者
3245
+ * - repo 仓库名称
3246
+ * @example
3247
+ * ```ts
3248
+ * const repo = await repo.get_repo_languages_list({ owner: 'owner', repo: 'repo' })
3249
+ * -> 仓库语言对象列表
3250
+ * ```
3251
+ */
3252
+ get_repo_languages_list(options: RepoLanguagesListParamType): Promise<ApiResponseType<RepoLanguagesListResponseType>>;
3253
+ /**
3254
+ * 创建组织仓库
3255
+ * 权限:
3256
+ * - Administration: Read and write
3257
+ * @param options 创建组织仓库参数
3258
+ * - org: 组织名称
3259
+ * - name: 仓库名称
3260
+ * - description: 仓库描述
3261
+ * - homepage: 仓库主页URL
3262
+ * - visibility: 仓库可见性,可选值:'public' | 'private', 默认值:'public'
3263
+ * - has_issues: 是否启用issues功能, 默认值:true
3264
+ * - has_wiki: 是否启用wiki功能, 默认值:true
3265
+ * - auto_init: 是否自动初始化仓库 默认值:false
3266
+ * @returns 返回创建成功的仓库信息
3267
+ * @example
3268
+ * ```ts
3269
+ * const repoInfo = await org.create_org_repo({org: 'loli', repo: 'git-neko-kit'})
3270
+ * -> 创建组织仓库信息对象
3271
+ * ```
3272
+ */
3273
+ create_org_repo(options: OrgRepoCreateParamType): Promise<ApiResponseType<OrgRepoCreateResponseType>>;
3274
+ /**
3275
+ * 创建用户仓库
3276
+ * 权限:
3277
+ * - Administration: Read and write
3278
+ * @param options 创建组织仓库参数
3279
+ * - owner: 仓库拥有者,用户名称
3280
+ * - name: 仓库名称
3281
+ * - description: 仓库描述
3282
+ * - homepage: 仓库主页URL
3283
+ * - visibility: 仓库可见性,可选值:'public' | 'private', 默认值:'public'
3284
+ * - has_issues: 是否启用issues功能, 默认值:true
3285
+ * - has_wiki: 是否启用wiki功能, 默认值:true
3286
+ * - auto_init: 是否自动初始化仓库 默认值:false
3287
+ * @returns 返回创建成功的仓库信息
3288
+ * @example
3289
+ * ```ts
3290
+ * const repoInfo = await repo.create_user_repo({org: 'loli', repo: 'git-neko-kit'})
3291
+ * -> 创建用户仓库信息对象
3292
+ * ```
3293
+ */
3294
+ create_user_repo(options: UserRepoCreateParamType): Promise<ApiResponseType<UserRepoCreateResponseType>>;
3295
+ /**
3296
+ * 创建用户仓库
3297
+ * @deprecated 请使用create_user_repo方法
3298
+ * 权限:
3299
+ * - Administration: Read and write
3300
+ * @param options 创建组织仓库参数
3301
+ * - owner: 仓库拥有者,用户名称
3302
+ * - name: 仓库名称
3303
+ * - description: 仓库描述
3304
+ * - homepage: 仓库主页URL
3305
+ * - visibility: 仓库可见性,可选值:'public' | 'private', 默认值:'public'
3306
+ * - has_issues: 是否启用issues功能, 默认值:true
3307
+ * - has_wiki: 是否启用wiki功能, 默认值:true
3308
+ * - auto_init: 是否自动初始化仓库 默认值:false
3309
+ * @returns 返回创建成功的仓库信息
3310
+ */
3311
+ create_repo(options: UserRepoCreateParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
3312
+ /**
3313
+ * 获取协作者列表
3314
+ * 权限:
3315
+ * - Metadata: Read
3316
+ * @param options 获取协作者列表对象
3317
+ * - owner: 仓库拥有者
3318
+ * - repo: 仓库名称
3319
+ * - url: 仓库地址
3320
+ * url和owner、repo参数传入其中的一种
3321
+ * - affiliation: 协作者类型,可选outside, direct, all,默认为all
3322
+ * - permission: 协作者权限,可选pull,triage, push, maintain, admin,默认为pull
3323
+ * - per_page: 每页数量,默认为30
3324
+ * - page: 页码,默认为1
3325
+ * @returns 返回获取协作者列表结果
3326
+ * @example
3327
+ * ```ts
3328
+ * const result = await collaborator.get_collaborators_list(options)
3329
+ * -> 仓库协作者信息对象列表
3330
+ * ```
3331
+ */
3332
+ get_collaborators_list(options: GetCollaboratorListParamType): Promise<ApiResponseType<GetCollaboratorListResponseType>>;
3333
+ /**
3334
+ * 邀请协作者
3335
+ * 权限:
3336
+ * - Administration: Read and write
3337
+ * @param options 邀请协作者对象
3338
+ * - owner: 仓库拥有者
3339
+ * - repo: 仓库名称
3340
+ * - url: 仓库地址
3341
+ * owner和repo或者url选择一个即可
3342
+ * - username: 要邀请协作者用户名
3343
+ * - permission: 协作者权限,可选pull,triage, push, maintain, admin,默认为pull
3344
+ * @returns 返回邀请协作者结果
3345
+ * @example
3346
+ * ```ts
3347
+ * const result = await collaborator.add_collaborator({
3348
+ * owner: 'owner',
3349
+ * repo: 'repo',
3350
+ * username: 'username',
3351
+ * permission: 'pull'
3352
+ * })
3353
+ * -> 邀请仓库协作者信息对象
3354
+ * ```
3355
+ */
3356
+ add_collaborator(options: CollaboratorParamType): Promise<ApiResponseType<AddCollaboratorResponseType>>;
3357
+ /**
3358
+ * 删除协作者
3359
+ * 权限:
3360
+ * - Administration: Read and write
3361
+ * @param options 删除协作者对象
3362
+ * - owner: 仓库拥有者
3363
+ * - repo: 仓库名称
3364
+ * - username: 要删除协作者用户名
3365
+ * @returns 返回删除协作者结果
3366
+ * @example
3367
+ * ```ts
3368
+ * const result = await collaborator.remove_collaborator({
3369
+ * owner: 'owner',
3370
+ * repo:'repo',
3371
+ * username: 'username'
3372
+ * })
3373
+ * -> 移除仓库协作者信息对象
3374
+ * ```
3375
+ */
3376
+ remove_collaborator(options: RemoveCollaboratorParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
3377
+ /**
3378
+ * 删除协作者
3379
+ * @deprecated 请使用remove_collaborator方法
3380
+ * @param options 删除协作者对象
3381
+ * @returns 返回删除协作者结果
3382
+ */
3383
+ delete_collaborator(options: RemoveCollaboratorParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
3384
+ /**
3385
+ * 快速获取仓库可见性
3386
+ * 权限:
3387
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
3388
+ * @param options
3389
+ * - url 仓库URL地址
3390
+ * - owner 仓库拥有者
3391
+ * - repo 仓库名称
3392
+ * url参数和owner、repo参数传入其中的一种
3393
+ * @remarks 优先使用url参数,若url参数不存在则使用owner和repo参数
3394
+ * @returns 仓库可见性,
3395
+ * @example
3396
+ * ```ts
3397
+ * // 公开仓库
3398
+ * const visibility = await repo.get_repo_visibility({url: 'https://github.com/CandriaJS/git-neko-kit'})
3399
+ * -> 'public'
3400
+ * // 私有仓库
3401
+ * const visibility = await repo.get_repo_visibility({url: 'https://github.com/CandriaJS/git-neko-kit'})
3402
+ * -> 'private'
3403
+ * ```
3404
+ */
3405
+ get_repo_visibility(options: GetRepoVisibilityParamType): Promise<GetRepoVisibilityResponseType>;
3406
+ /**
3407
+ * 获取仓库默认分支
3408
+ * 权限:
3409
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
3410
+ * @param options
3411
+ * - owner 仓库拥有者
3412
+ * - repo 仓库名称
3413
+ * @example
3414
+ * ```ts
3415
+ * const defaultBranch = await repo.get_repo_default_branch({owner: CandriaJS, repo: meme-plugin)}
3416
+ * -> 'main'
3417
+ * ```ts
3418
+ */
3419
+ get_repo_default_branch(options: GetRepoDefaultBranchParamType): Promise<GetRepoDefaultBranchResponseType | null>;
3420
+ /**
3421
+ * 获取仓库主要语言
3422
+ * 权限:
3423
+ * - Metadata: Read-only, 如果只获取公开仓库可无需此权限
3424
+ * @param options
3425
+ * - url 仓库URL地址
3426
+ * - owner 仓库拥有者
3427
+ * - repo 仓库名称
3428
+ * url参数和owner、repo参数传入其中的一种
3429
+ * @example
3430
+ * ```ts
3431
+ * const language = await repo.get_repo_language({url: 'URL_ADDRESS.com/CandriaJS/meme-plugin')}
3432
+ * -> 'JavaScript'
3433
+ * ```ts
3434
+ */
3435
+ get_repo_main_language(options: GetRepoMainLanguageParamType): Promise<GetRepoMainLanguageResponseType>;
3436
+ }
3437
+ //#endregion
3438
+ //#region src/models/platform/github/search.d.ts
3439
+ /**
3440
+ * GitHub 搜索管理类
3441
+ *
3442
+ * 提供对GitHub Search的完整管理功能,包括:
3443
+ * - 搜索用户
3444
+ * - 搜索仓库
3445
+ *
3446
+ */
3447
+ declare class Search extends GitHubClient {
3448
+ constructor(base: GitHubClient);
3449
+ /**
3450
+ * 搜索用户
3451
+ *
3452
+ * @param options 搜索参数
3453
+ * - q 搜索关键字
3454
+ * - order 排序顺序
3455
+ * - per_page 每页数量
3456
+ * - page 页码
3457
+ * @returns 搜索结果
3458
+ * @example
3459
+ * ```ts
3460
+ * const users = await search.search_users({ q: 'username', order: 'desc' })
3461
+ * -> {
3462
+ * total_count: 1,
3463
+ * items: [
3464
+ * {
3465
+ * id: 1,
3466
+ * login: 'username',
3467
+ * name: 'username',
3468
+ * email: 'username@example.com',
3469
+ * avatar_url: 'https://avatars.githubusercontent.com/u/1?v=4',
3470
+ * html_url: 'https://github.com/username'
3471
+ * }
3472
+ * ]
3473
+ * }
3474
+ * ```
3475
+ */
3476
+ search_users(options: SearchUsersParamType): Promise<ApiResponseType<SearchUsersResponseType>>;
3477
+ /**
3478
+ * 搜索仓库
3479
+ *
3480
+ * @param options 搜索参数
3481
+ * - q 搜索关键字
3482
+ * - order 排序顺序
3483
+ * - per_page 每页数量
3484
+ * - page 页码
3485
+ * @returns 搜索结果
3486
+ * @example
3487
+ * ```ts
3488
+ * const repos = await search.search_repos({ q: 'repo', order: 'desc' })
3489
+ * -> {
3490
+ * total_count: 1,
3491
+ * items: [
3492
+ * {
3493
+ * id: 1,
3494
+ * owner: 'username',
3495
+ * name: 'repo',
3496
+ * full_name: 'username/repo',
3497
+ * description: 'repo description',
3498
+ * visibility: 'public',
3499
+ * public: true,
3500
+ * private: false,
3501
+ * archived: false,
3502
+ * language: 'JavaScript',
3503
+ * pushed_at: '2021-01-01T00:00:00Z'
3504
+ * }
3505
+ * ]
3506
+ * }
3507
+ * ```
3508
+ */
3509
+ search_repos(options: SearchReposParamType): Promise<ApiResponseType<SearchReposResponseType>>;
3510
+ }
3511
+ //#endregion
3512
+ //#region src/models/platform/github/user.d.ts
3513
+ /**
3514
+ * Base 用户操作类
3515
+ *
3516
+ * 提供对GitHub用户的CRUD操作,包括:
3517
+ * - 获取用户信息
3518
+ * - 关注指定用户
3519
+ */
3520
+ declare class User extends GitHubClient {
3521
+ constructor(base: GitHubClient);
3522
+ /**
3523
+ * 获取指定的用户信息
3524
+ * 不止可以获取用户信息还可以获取组织信息
3525
+ * 权限:无需任何权限
3526
+ * @param options - 用户参数
3527
+ * - username - 用户名或组织名
3528
+ * @example
3529
+ * ```ts
3530
+ * const userInfo = await user.get_user_info({ username: 'username' })
3531
+ * -> 用户信息对象
3532
+ * ```
3533
+ */
3534
+ get_user_info(options: UserInfoParamType): Promise<ApiResponseType<UserInfoResponseType>>;
3535
+ /**
3536
+ * 通过用户id获取用户信息
3537
+ * user_id 不是用户名, 而是github平台上用户的唯一标识符
3538
+ * 权限:无需任何权限
3539
+ * @param options - 用户参数
3540
+ * - user_id: 用户id
3541
+ * @returns 用户信息
3542
+ * @example
3543
+ * ```ts
3544
+ * const userInfo = await user.get_user_info_by_user_id({ user_id: 123456789 })
3545
+ * -> 用户信息对象
3546
+ * ```
3547
+ */
3548
+ get_user_info_by_user_id(options: UserInfoByIdParamType): Promise<ApiResponseType<UserInfoResponseType>>;
3549
+ /**
3550
+ * 通过访问令牌获取用户信息
3551
+ * 权限:无需任何权限
3552
+ * @example
3553
+ * ```ts
3554
+ * const userInfo = await user.get_user_info_by_token()
3555
+ * -> 用户信息对象
3556
+ * ```
3557
+ */
3558
+ get_user_info_by_auth(): Promise<ApiResponseType<UserInfoResponseType>>;
3559
+ /**
3560
+ * 通过访问令牌获取用户信息
3561
+ * 权限:无需任何权限
3562
+ * @deprecated 该方法已过时,请使用get_user_info_by_auth方法牌
3563
+ * ```
3564
+ */
3565
+ get_user_info_by_token(): Promise<ApiResponseType<UserInfoResponseType>>;
3566
+ /**
3567
+ * 获取用户贡献数据
3568
+ * 权限:无需任何权限
3569
+ * @param options - 用户参数
3570
+ * - username: 用户名
3571
+ * @returns 用户贡献数据
3572
+ * @example
3573
+ * ```ts
3574
+ * const contribution = await user.get_user_contribution({ username: 'username' })
3575
+ * ->
3576
+ * {
3577
+ * success: true,
3578
+ * status: 'ok',
3579
+ * statusCode: 200,
3580
+ * msg: '请求成功',
3581
+ * data: { total: 5, contributions: [[{ date: '2023-04-16', count: 5 }]] }
3582
+ * }
3583
+ * ```
3584
+ */
3585
+ get_user_contribution(options: UserNameParamType): Promise<ApiResponseType<ContributionResult>>;
3586
+ /**
3587
+ * 快速获取获取用户id
3588
+ * 权限:无需任何权限
3589
+ * 该方法会自动获取当前用户的id,需要传入token
3590
+ * @returns 用户id
3591
+ * @example
3592
+ * ```ts
3593
+ * const userId = await user.get_user_id()
3594
+ * -> 114514
3595
+ */
3596
+ get_user_id(): Promise<number>;
3597
+ /**
3598
+ * 快速获取获取用户名
3599
+ * 权限:无需任何权限
3600
+ * 该方法会自动获取当前用户的用户名,需要传入token
3601
+ * @returns 用户名
3602
+ * @example
3603
+ * ```ts
3604
+ * const username = await user.get_username()
3605
+ * -> 'loli'
3606
+ * ```
3607
+ */
3608
+ get_username(): Promise<string>;
3609
+ /**
3610
+ * 快速获取获取用户昵称
3611
+ * 该方法会自动获取当前用户的昵称,需要传入token
3612
+ * 权限:无需任何权限
3613
+ * @returns 昵称
3614
+ * @example
3615
+ * ```ts
3616
+ * const nickname = await user.get_nickname()
3617
+ * -> 'loli'
3618
+ * ```
3619
+ */
3620
+ get_nickname(): Promise<string | null>;
3621
+ /**
3622
+ * 快速获取获取用户邮箱
3623
+ * 该方法会自动获取当前用户的邮箱,需要传入token
3624
+ * 权限:无需任何权限
3625
+ * @returns 邮箱
3626
+ * @example
3627
+ * ```ts
3628
+ * const email = await user.get_email()
3629
+ * -> '114514@gmail.com'
3630
+ * ```
3631
+ */
3632
+ get_user_email(): Promise<string | null>;
3633
+ /**
3634
+ * 快速获取获取用户头像地址
3635
+ * 该方法会自动获取当前用户的头像地址,需要传入token
3636
+ * 权限:无需任何权限
3637
+ * @returns 头像地址
3638
+ * @example
3639
+ * ```ts
3640
+ * const avatarUrl = await user.get_avatar_url()
3641
+ * -> 'https://avatars.githubusercontent.com/u/12345678?v=4'
3642
+ * ```
3643
+ */
3644
+ get_avatar_url(): Promise<string>;
3645
+ }
3646
+ //#endregion
3647
+ //#region src/models/platform/github/webhook.d.ts
3648
+ /**
3649
+ * GitHUb WebHook操作类
3650
+ *
3651
+ * 提供对GitHub WebHook的CRUD操作,包括:
3652
+ * - 检查webhook签名是否正确
3653
+ */
3654
+ declare class WebHook extends GitHubClient {
3655
+ /**
3656
+ * 检查WebHook签名是否正确
3657
+ * 权限:无需任何权限
3658
+ * @param options - WebHook参数对象,必须包含以下参数:
3659
+ * - payload: 要验证的签名主体
3660
+ * - signature: 要验证的签名
3661
+ * @returns 验证结果
3662
+ * @example
3663
+ * ```ts
3664
+ * const res = await check_webhook_signature({
3665
+ * payload: 'your_payload',
3666
+ * signature: 'your_signature'
3667
+ * })
3668
+ * ->
3669
+ * {
3670
+ * success: true,
3671
+ * status: 'ok',
3672
+ * msg: '请求成功'
3673
+ * data: {
3674
+ * success: true,
3675
+ * message: '验证成功'
3676
+ * }
3677
+ * }
3678
+ * ```
3679
+ */
3680
+ check_webhook_signature(options: WebHookSignatureParamType): Promise<ApiResponseType<WebHookSignatureResponseType>>;
3681
+ }
3682
+ //#endregion
3683
+ //#region src/models/platform/github/workflow.d.ts
3684
+ /**
3685
+ * GitHub 工作流管理类
3686
+ *
3687
+ * 提供对GitHub Workflow的完整管理功能,包括:
3688
+ * - 仓库工作流信息
3689
+ *
3690
+ */
3691
+ declare class Workflow extends GitHubClient {
3692
+ constructor(base: GitHubClient);
3693
+ /**
3694
+ * 获取仓库工作流信息
3695
+ * 权限:
3696
+ * - 'actions': 'read-only'
3697
+ * @param options 获取工作流信息参数
3698
+ * - owner 仓库拥有者
3699
+ * - repo 仓库名称
3700
+ * - workflow_id 工作流id
3701
+ * @returns 包含工作流信息的响应对象
3702
+ * @example
3703
+ * ```ts
3704
+ * const res = await workflow.get_workflow_info()
3705
+ * -> 工作流信息对象
3706
+ * ```
3707
+ */
3708
+ get_workflow_info(options: WorkflowInfoParamType): Promise<ApiResponseType<WorkflowInfoResponseType>>;
3709
+ /**
3710
+ * 获取仓库工作流列表
3711
+ * 权限:
3712
+ * - 'actions': 'read-only'
3713
+ * @param options 获取工作流列表参数
3714
+ * - owner 仓库拥有者
3715
+ * - repo 仓库名称
3716
+ * - per_page 每页数量
3717
+ * - page 页码
3718
+ * @returns 包含工作流列表的响应对象
3719
+ * @example
3720
+ * ```ts
3721
+ * const res = await workflow.get_repo_workflows_list()
3722
+ * -> 工作流列表对象
3723
+ * ```
3724
+ */
3725
+ get_repo_workflows_list(options: GetRepoWorkflowsList): Promise<ApiResponseType<GetRepoWorkflowsListResponseType>>;
3726
+ /**
3727
+ * 运行仓库工作流
3728
+ * 权限:
3729
+ * - 'actions': 'read-and-write'
3730
+ * @param options 运行工作流参数
3731
+ * - owner 仓库拥有者
3732
+ * - repo 仓库名称
3733
+ * - workflow_id 工作流id
3734
+ * - ref 分支或者标签名称
3735
+ * - inputs 工作流输入参数
3736
+ * @returns 运行工作流结果对象
3737
+ * @example
3738
+ * ```ts
3739
+ * const res = await workflow.run_repo_workflow()
3740
+ * -> 运行工作流结果对象
3741
+ * ```
3742
+ */
3743
+ run_repo_workflow(options: RunRepoWorkflow): Promise<ApiResponseType<RunRepoWorkflowResponseType>>;
3744
+ /**
3745
+ * 启用仓库工作流
3746
+ * 权限:
3747
+ * - 'actions': 'read-and-write'
3748
+ * @param options 启用工作流参数
3749
+ * - owner 仓库拥有者
3750
+ * - repo 仓库名称
3751
+ * - workflow_id 工作流id
3752
+ * @returns 启用工作流结果对象
3753
+ * @example
3754
+ * ```ts
3755
+ * const res = await workflow.enable_repo_workflow()
3756
+ * -> 启用工作流结果对象
3757
+ * ```
3758
+ */
3759
+ enable_repo_workflow(options: EnableRepoWorkflowParamType): Promise<ApiResponseType<EnableRepoWorkflowResponseType>>;
3760
+ /**
3761
+ * 禁用仓库工作流
3762
+ * 权限:
3763
+ * - 'actions': 'read-and-write'
3764
+ * @param options 禁用工作流参数
3765
+ * - owner 仓库拥有者
3766
+ * - repo 仓库名称
3767
+ * - workflow_id 工作流id
3768
+ * @returns 禁用工作流结果对象
3769
+ * @example
3770
+ * ```ts
3771
+ * const res = await workflow.disable_repo_workflow()
3772
+ * -> 禁用工作流结果对象
3773
+ * ```
3774
+ */
3775
+ disable_repo_workflow(options: DisEnableRepoWorkflowParamType): Promise<ApiResponseType<DisEnableRepoWorkflowResponseType>>;
3776
+ /**
3777
+ * 重新运行仓库工作流
3778
+ * 权限:
3779
+ * - 'actions': 'read-and-write'
3780
+ * @param options 重新运行工作流参数
3781
+ * - owner 仓库拥有者
3782
+ * - repo 仓库名称
3783
+ * - job_id 工作流作业id
3784
+ * @returns 重新运行工作流结果对象
3785
+ * @example
3786
+ * ```ts
3787
+ * const res = await workflow.rerun_repo_workflow()
3788
+ * -> 重新运行工作流结果对象
3789
+ * ```
3790
+ */
3791
+ rerun_repo_workflow(options: ReRunRepoWorkflowParamType): Promise<ApiResponseType<ReRunRepoWorkflowResponseType>>;
3792
+ }
3793
+ //#endregion
3794
+ //#region src/models/platform/github/client.d.ts
3795
+ /**
3796
+ * GitHub API 基础服务类,提供与GitHub API交互的核心功能
3797
+ *
3798
+ * 此类作为GitHub API功能的入口点,封装了以下核心能力:
3799
+ * - JWT令牌生成与管理
3800
+ * - 请求代理配置
3801
+ * - 基础HTTP请求方法(GET/POST/PATCH/DELETE/PUT)
3802
+ * - 应用认证管理
3803
+ * - 模块化服务(App/Auth/Commit/Repo/User/WebHook)
3804
+ *
3805
+ * @example
3806
+ * ```ts
3807
+ * const base = new GitHubClient({
3808
+ * APP_ID: 12345,
3809
+ * Private_Key: '-----BEGIN PRIVATE KEY-----...',
3810
+ * Client_ID: 'Iv1.1234567890abcdef',
3811
+ * Client_Secret: 'abcdef1234567890abcdef1234567890abcdef12',
3812
+ * WebHook_Secret: 'webhook_secret'
3813
+ * });
3814
+ * ```
3815
+ */
3816
+ declare class GitHubClient {
3817
+ app: App;
3818
+ auth: Auth;
3819
+ commit: Commit$1;
3820
+ repo: Repo;
3821
+ user: User;
3822
+ webhook: WebHook;
3823
+ issue: Issue;
3824
+ org: Org;
3825
+ pull_request: Pull_Request;
3826
+ workflow: Workflow;
3827
+ search: Search;
3828
+ base_url: string;
3829
+ api_url: string;
3830
+ jwtToken: string;
3831
+ userToken?: string | null;
3832
+ readonly Private_Key?: string | null;
3833
+ readonly Client_ID?: string | null;
3834
+ readonly Client_Secret?: string | null;
3835
+ readonly WebHook_Secret?: string | null;
3836
+ readonly format: boolean;
3837
+ private currentRequestConfig;
3838
+ private proxy?;
3839
+ constructor(options: GitHubClientType);
3840
+ /**
3841
+ * 获取Git平台类型
3842
+ * @returns Git平台类型,如: github,gitee
3843
+ * @example
3844
+ * ```ts
3845
+ * const type = await client.type
3846
+ * -> 'github'
3847
+ * ```
3848
+ */
3849
+ get type(): GitType;
3850
+ /**
3851
+ * 是否是App客户端
3852
+ * @returns 是否是App客户端
3853
+ * @example
3854
+ * ```ts
3855
+ * const isAppClient = await client.is_app_client
3856
+ * -> true
3857
+ * ```
3858
+ */
3859
+ get is_app_client(): boolean;
3860
+ /**
3861
+ * 检查App客户端参数是否完整
3862
+ * @returns
3863
+ */
3864
+ private validateAppClient;
3865
+ /**
3866
+ * 获取App实例
3867
+ * @returns App实例
3868
+ * @example
3869
+ * ```ts
3870
+ * const app = await GitHubClient.get_app()
3871
+ * ```
3872
+ */
3873
+ get_app(): Promise<App>;
3874
+ /**
3875
+ * 获取Auth实例
3876
+ * @returns Auth实例
3877
+ * @example
3878
+ * ```ts
3879
+ * const auth = await GitHubClient.get_auth()
3880
+ * ```
3881
+ */
3882
+ get_auth(): Promise<Auth>;
3883
+ /**
3884
+ * 获取Commit实例
3885
+ * @returns Commit实例
3886
+ * @example
3887
+ * ```ts
3888
+ * const commit = await GitHubClient.get_commit()
3889
+ * ```
3890
+ */
3891
+ get_commit(): Promise<Commit$1>;
3892
+ /**
3893
+ * 获取Issue实例
3894
+ * @returns Issue实例
3895
+ * @example
3896
+ * ```ts
3897
+ * const issue = await GitHubClient.get_issue()
3898
+ * ```
3899
+ */
3900
+ get_issue(): Promise<Issue>;
3901
+ /**
3902
+ * 获取Repo实例
3903
+ * @returns Repo实例
3904
+ * @example
3905
+ * ```ts
3906
+ * const repo = await GitHubClient.get_repo()
3907
+ * ```
3908
+ */
3909
+ get_repo(): Promise<Repo>;
3910
+ /**
3911
+ * 获取User实例
3912
+ * @returns User实例
3913
+ * @example
3914
+ * ```ts
3915
+ * const user = await GitHubClient.get_user()
3916
+ * ```
3917
+ */
3918
+ get_user(): Promise<User>;
3919
+ /**
3920
+ * 获取Org实例
3921
+ * @returns Org实例
3922
+ * @example
3923
+ * ```ts
3924
+ * const org = await GitHubClient.get_org()
3925
+ * ```
3926
+ */
3927
+ get_org(): Promise<Org>;
3928
+ /**
3929
+ * 获取WebHook实例
3930
+ * @returns WebHook实例
3931
+ * @example
3932
+ * ```ts
3933
+ * const webhook = await GitHubClient.get_webhook()
3934
+ * ```
3935
+ */
3936
+ get_webhook(): Promise<WebHook>;
3937
+ /**
3938
+ * 获取Pull_request实例
3939
+ * @returns Pull_request实例
3940
+ * @example
3941
+ * ```ts
3942
+ * const pull_request = await GitHubClient.get_pull_request()
3943
+ * ```
3944
+ */
3945
+ get_pull_request(): Promise<Pull_Request>;
3946
+ /**
3947
+ * 获取Workflow实例
3948
+ * @returns Workflow实例
3949
+ * @example
3950
+ * ```ts
3951
+ * const workflow = await GitHubClient.get_workflow()
3952
+ * ```
3953
+ */
3954
+ get_workflow(): Promise<Workflow>;
3955
+ /**
3956
+ * 获取Search实例
3957
+ * @returns Search实例
3958
+ * @example
3959
+ * ```ts
3960
+ * const search = await GitHubClient.get_search()
3961
+ * ```
3962
+ */
3963
+ get_search(): Promise<Search>;
3964
+ /**
3965
+ * 设置请求代理
3966
+ * @param proxy 代理参数
3967
+ * @example
3968
+ * ```ts
3969
+ * setProxy({
3970
+ * type: 'http',
3971
+ * address: 'http://127.0.0.1:7890'
3972
+ * })
3973
+ * ```
3974
+ */
3975
+ /**
3976
+ * 设置请求代理
3977
+ * @param proxy 代理参数
3978
+ * @example
3979
+ * setProxy({
3980
+ * type: 'http',
3981
+ * address: 'http://127.0.0.1:7890'
3982
+ * })
3983
+ */
3984
+ setProxy(proxy: ProxyParamsType): void;
3985
+ /**
3986
+ * 设置 token
3987
+ * 传入的 token 必须以 ghu_ 或 ghp_ 或 ghs_ 开头,否则会抛出错误
3988
+ * @param token 传入的 token
3989
+ * @example
3990
+ * ```ts
3991
+ * setToken('ghu_xxxx')
3992
+ * ```
3993
+ */
3994
+ setToken(token: string): void;
3995
+ /**
3996
+ * 生成 JWT Token
3997
+ * @param options 生成 JWT 所需的参数
3998
+ * @param options.APP_ID GitHub App ID
3999
+ * @param options.Private_Key 私钥内容
4000
+ * @returns 返回生成的 JWT
4001
+ * @example
4002
+ * ```ts
4003
+ * const jwt = await client.generate_jwt()
4004
+ * -> 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjYxNjEyMjAsImlhdCI6MTYyNjE2MTIyMCwiaXNzIjoiMTIzNDU2Nzg5In0.XxXxXxXxXx
4005
+ * ```
4006
+ */
4007
+ private generate_jwt;
4008
+ /**
4009
+ * 设置当前请求的配置
4010
+ * @protected - 仅在父类与子类中方法中可访问
4011
+ * @param config - 配置对象,包含以下属性:
4012
+ * - url: 请求的URL
4013
+ * - token: 认证令牌
4014
+ * - tokenType: 认证令牌类型,默认为 'Bearer'
4015
+ */
4016
+ protected setRequestConfig(config: RequestConfigType): void;
4017
+ /**
4018
+ * 创建一个新的请求实例
4019
+ * @returns 返回一个新的 Request 实例
4020
+ */
4021
+ private createRequest;
4022
+ /**
4023
+ * Github GET 请求方法
4024
+ * @param path - 请求路径
4025
+ * @param parms - 请求参数
4026
+ * @param customHeaders - 请求头,选项
4027
+ * @returns 请求结果
4028
+ */
4029
+ get(path: string, parms?: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
4030
+ /**
4031
+ * Github POST 请求方法
4032
+ * @param path - 请求路径
4033
+ * @param data - 请求数据
4034
+ * @param customHeaders - 请求头,选项
4035
+ * @returns 请求结果
4036
+ */
4037
+ post(path: string, data: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
4038
+ /**
4039
+ * Github PATCH 请求方法
4040
+ * @param path - 请求路径
4041
+ * @param data - 请求数据
4042
+ * @param params - URL查询参数
4043
+ * @param customHeaders - 请求头,选项
4044
+ * @returns 请求结果
4045
+ */
4046
+ patch(path: string, params: (Record<string, string> | null) | undefined, data: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
4047
+ /**
4048
+ * Github PUT 请求方法
4049
+ * @param path - 请求路径
4050
+ * @param data - 请求数据
4051
+ * @param customHeaders - 请求头,选项
4052
+ * @returns 请求结果
4053
+ */
4054
+ put(path: string, data: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
4055
+ /**
4056
+ * Github DELETE 请求方法
4057
+ * @param path - 请求路径
4058
+ * @param params - URL查询参数
4059
+ * @param data - 请求体数据
4060
+ * @param customHeaders - 请求头,选项
4061
+ * @returns 请求结果
4062
+ */
4063
+ delete(path: string, params?: Record<string, string> | null, data?: any, customHeaders?: Record<string, string>): Promise<ApiResponseType>;
4064
+ }
4065
+ //#endregion
4066
+ //#region src/models/platform/github/app.d.ts
4067
+ /**
4068
+ * GitHub 应用管理类
4069
+ *
4070
+ * 提供对GitHub App的完整管理功能,包括:
4071
+ * - 获取应用基本信息
4072
+ * - 生成应用安装链接
4073
+ * - 生成应用配置链接
4074
+ *
4075
+ */
4076
+ declare class App extends GitHubClient {
4077
+ constructor(base: GitHubClient);
4078
+ /**
4079
+ * 获取应用基本信息
4080
+ * 权限:
4081
+ * - `none` 无
4082
+ * @param options - 应用标识符
4083
+ * @returns 应用基本信息
4084
+ * @example
4085
+ * ```ts
4086
+ * const app = base.get_app()
4087
+ * console.log(app.get_app_info({ app_slug: 'loli' }))
4088
+ * -> app的信息
4089
+ * ```
4090
+ */
4091
+ get_app_info(options: AppInfoParamType): Promise<ApiResponseType<AppInfoResponseType>>;
4092
+ /**
4093
+ * 获取当前 Github App 信息
4094
+ * 权限:
4095
+ * - `none` 此节点仅App Client可用
4096
+ * @returns 返回 Github App 信息
4097
+ * @example
4098
+ * ```ts
4099
+ * const app = base.get_app()
4100
+ * console.log(app.get_app_info_by_auth())
4101
+ * -> app的信息
4102
+ * ```
4103
+ */
4104
+ get_app_info_by_auth(): Promise<ApiResponseType<AppInfoResponseType>>;
4105
+ /**
4106
+ * 获取仓库的应用安装信息
4107
+ * 权限:
4108
+ * - `none` 此节点仅App Client可用
4109
+ * @param options - 仓库安装应用参数对象
4110
+ * - owner 拥有者
4111
+ * - repo 仓库名
4112
+ * @returns 返回应用安装信息
4113
+ * @example
4114
+ * ```ts
4115
+ * console.log(app.get_app_installation_by_repo({owner: 'owner', repo: 'repo'}))
4116
+ * -> 仓库安装应用信息
4117
+ * ```
4118
+ */
4119
+ get_app_installation_by_repo(options: GetAppInfoByRepoParamType): Promise<ApiResponseType<GetAppInfoByRepoResponseType>>;
4120
+ /**
4121
+ * 获取用户的应用安装信息
4122
+ * 权限:
4123
+ * - `none` 此节点仅App Client可用
4124
+ * @param options - 仓库安装应用参数对象
4125
+ * - owner 拥有者
4126
+ * - repo 仓库名
4127
+ * @returns 返回应用安装信息
4128
+ * @example
4129
+ * ```ts
4130
+ * console.log(app.get_app_installation_by_repo({owner: 'owner', repo: 'repo'}))
4131
+ * -> 用户安装应用信息
4132
+ * ```
4133
+ */
4134
+ get_app_installation_by_user(options: GetAppInfoByUserParamType): Promise<ApiResponseType<GetAppInfoByUserResponseType>>;
4135
+ /**
4136
+ * 获取组织的应用安装信息
4137
+ * 权限:
4138
+ * - `none` 此节点仅App Client可用
4139
+ * @param options - 仓库安装应用参数对象
4140
+ * - owner 拥有者
4141
+ * - repo 仓库名
4142
+ * @returns 返回应用安装信息
4143
+ * @example
4144
+ * ```ts
4145
+ * console.log(app.get_app_installation_by_repo({owner: 'owner', repo: 'repo'}))
4146
+ * -> 组织安装应用信息
4147
+ * ```
4148
+ */
4149
+ get_app_installation_by_org(options: GetAppInfoByOrgParamType): Promise<ApiResponseType<GetAppInfoByOrgResponseType>>;
4150
+ /**
4151
+ * 为应用程序创建访问令牌
4152
+ * @param options
4153
+ * - installation_id - 安装 ID
4154
+ * @returns 创建访问令牌对象
4155
+ * @example
4156
+ * ```ts
4157
+ * const accessToken = await app.create_access_token_for_app({ installation_id: 123456 })
4158
+ * -> 创建访问令牌对象
4159
+ * ```
4160
+ */
4161
+ create_access_token_for_app(options: CreateAccessTokenForAppParamType): Promise<ApiResponseType<CreateAccessTokenForAppResponseType>>;
4162
+ /**
4163
+ * 撤销应用程序访问令牌
4164
+ * @returns 撤销应用程序访问令牌
4165
+ * @example
4166
+ * ```ts
4167
+ * const res = await auth.revoke_access_token_for_app()
4168
+ * -> data: { 'success': true, 'message': '喵呜~ 访问令牌撤销成功' }
4169
+ */
4170
+ revoke_access_token_for_app(): Promise<ApiResponseType<RevokeAccessTokenResponseType>>;
4171
+ /**
4172
+ * 生成Github App 安装链接
4173
+ * @param state_id - 随机生成的 state_id,用于验证授权请求的状态,可选,默认不使用
4174
+ * @returns install_link 安装链接,用于跳转 Github 安装页
4175
+ * @example
4176
+ * ```ts
4177
+ * const link = await app.create_install_link('state_id')
4178
+ * -> https://github.com/apps/<app_name>/installations/new?state=<state_id>
4179
+ * ```
4180
+ */
4181
+ create_install_link(state_id?: string): Promise<string>;
4182
+ /**
4183
+ * 生成Github Apps 配置链接
4184
+ * @param state_id - 传入的 state_id, 随机字符串
4185
+ * @returns 返回配置链接对象
4186
+ * @returns config_install_link 配置链接
4187
+ * @example
4188
+ * ```ts
4189
+ * const link = await app.create_config_install_link('state_id')
4190
+ * -> // https://github.com/apps/<app_name>/installations/new?state=<state_id></state_id>
4191
+ * ```
4192
+ */
4193
+ create_config_install_link(state_id?: string): Promise<string>;
4194
+ /**
4195
+ * 快速获取当前 Github App 名称
4196
+ * @returns 返回 Github App 名称
4197
+ * @example
4198
+ * ```ts
4199
+ * console.log(app.get_app_name())
4200
+ * -> 输出AppName
4201
+ * ```
4202
+ */
4203
+ get_app_name(): Promise<string>;
4204
+ /**
4205
+ * 快速判断指定仓库是否安装了当前App 应用
4206
+ * @param options - 仓库安装应用参数对象
4207
+ * - owner 拥有者
4208
+ * - repo 仓库名
4209
+ * @returns 是否安装
4210
+ * @example
4211
+ * ```ts
4212
+ * // 当前App已安装在此仓库
4213
+ * const isInstalled = await app.is_app_inttalled_in_repo({ owner: 'owner', repo: 'repo' })
4214
+ * -> true
4215
+ * // 当前App未安装此仓库
4216
+ * const isInstalled = await app.is_app_inttalled_in_repo({ owner: 'owner', repo: 'repo' })
4217
+ * -> false
4218
+ */
4219
+ is_app_installed_in_repo(options: isAppInstalledInRepo): Promise<boolean>;
4220
+ }
4221
+ declare namespace index_d_exports {
4222
+ export { App, Auth, Commit$1 as Commit, GitHubClient, Issue, Org, Pull_Request, Repo, Search, User, WebHook, Workflow };
4223
+ }
4224
+ //#endregion
4225
+ //#region src/index.d.ts
4226
+ /** 基本客户端 */
4227
+ declare class Client {
4228
+ github: GitHubClient;
4229
+ constructor(options: ClientType);
4230
+ }
4231
+ //#endregion
4232
+ export { AccessCodeType, AccessTokenClentTYpe, AccessTokenPermissionsType, AccessTokenType, AddCollaboratorResponseType, AddMemberParamType, AddMemberResponseType, ApiResponseType, AppClientType, AppInfoParamType, AppInfoResponseType, AppPermissions, AppRepoInfoResponseType, AppUser, BaseProxyType, CheckTokenResponseType, Client, Client as default, ClientType, CloseIssueParamType, CloseIssueResponseType, CollaboratorInfoResponseType, CollaboratorParamType, CollaboratorPermissionType, CommentIdParamType, Commit, CommitInfoCommonParamType, CommitInfoParamType, CommitInfoResponseType, CommitListParamType, CommitListResponseType, CommitStats, ContributionData, ContributionResult, CreateAccessTokenForAppParamType, CreateAccessTokenForAppResponseType, CreateIssueResponseType, CreatePullRequestCommentParamType, CreatePullRequestCommentResponseType, CreatePullRequestParamType, CreatePullRequestResponseType, CreateReleaseParamType, CreateReleaseResponseType, CreateSubIssueParamType, CreateSubIssueResponseType, CreteIssueCommentParamType, CreteIssueCommentResponseType, CreteIssueParamType, DeletePullRequestCommentParamType, DeletePullRequestCommentResponseType, DeleteReleaseParamType, DeleteReleaseResponseType, DiffEntry, DisEnableRepoWorkflowParamType, DisEnableRepoWorkflowResponseType, EnableRepoWorkflowParamType, EnableRepoWorkflowResponseType, GetAppInfoByOrgParamType, GetAppInfoByOrgResponseType, GetAppInfoByRepoParamType, GetAppInfoByRepoResponseType, GetAppInfoByUserParamType, GetAppInfoByUserResponseType, GetCollaboratorListParamType, GetCollaboratorListResponseType, GetOrgMemberInfoParamType, GetOrgMemberInfoResponseType, GetOrgMemberListParamType, GetOrgMemberListResponseType, GetOrgMemberListType, GetPullRequestCommentInfoParamType, GetPullRequestCommentInfoResponseType, GetPullRequestCommentsListParamType, GetPullRequestCommentsListResponseType, GetPullRequestDiffParamType, GetPullRequestDiffResponseType, GetPullRequestFilesListParamType, GetPullRequestFilesListResponseType, GetRepoDefaultBranchParamType, GetRepoDefaultBranchResponseType, GetRepoMainLanguageParamType, GetRepoMainLanguageResponseType, GetRepoVisibilityParamType, GetRepoVisibilityResponseType, GetRepoWorkflowsList, GetRepoWorkflowsListResponseType, GitHubBaseClient, GitHubClient, GitHubClientType, GitInfoListType, GitRepoInfoListOptionsType, GitRepoInfoType, GitRepoType, GitType, GitUser, IssueCommentInfoParamType, IssueCommentInfoResponseType, IssueCommentsListParamType, IssueCommentsListResponseType, IssueInfoParamType, IssueInfoResponseType, IssueLabelType, IssueListResponseType, IssueNumberParamType, IssueUser, LanguageInfo, LockIssueParamType, LockIssueResponseType, MergeMethodType, MergePullRequestParamType, MergePullRequestResponseType, MilestoneType, NpmPackageInfoListOptionsType, NpmPackageInfoListType, NpmPackageInfoType, OpenIssueParamType, OpenIssueResponseType, OrgInfoParamType, OrgInfoResponseType, OrgNameParamType, OrgRepoCreateParamType, OrgRepoCreateResponseType, OrgRepoListParmType, OrgRepoListResponseType, OrgUser, ParentCommit, PkgInfoType, PrRepo, PrUser, ProxyParamsType, ProxyProtocol, ProxyType, ProxyUrlType, PullRequestFilesListType, PullRequestInfoParamType, PullRequestInfoResponseType, PullRequestListParamType, PullRequestListResponseType, PullRequestNumberParamType, ReRunRepoWorkflowParamType, ReRunRepoWorkflowResponseType, ReactionInfoType, RefreshTokenResponseType, RefreshTokenType, ReleaseAssetsType, ReleaseInfoByTagParamType, ReleaseInfoByTagResponseType, ReleaseInfoParamType, ReleaseInfoResponseType, ReleaseLatestParamTypeType, ReleaseLatestResponseType, ReleaseListParamType, ReleaseListResponseType, ReleaseUser, RemoveCollaboratorParamType, RemoveCollaboratorResponseType, RemoveIssueCommentParamType, RemoveIssueCommentResponseType, RemoveOrgMemberParamType, RemoveOrgMemberResponseType, RemoveSubIssueParamType, RemoveSubIssueResponseType, RepoBaseParamType, RepoCommentsListParamType, RepoCommentsListResponseType, RepoInfoParamType, RepoInfoResponseType, RepoIssueListParamType, RepoLanguagesListParamType, RepoLanguagesListResponseType, RepoListBaseParamType, RepoNameParamType, RepoOwnerParamType, RepoParamType, RepoUrlParamType, RepoUser, ReprioritizeSubIssueParamType, ReprioritizeSubIssueResponseType, RequestConfigType, RequestTokenType, ResponseHeadersType, ResponseMsgType, ResponseStatusCodeType, ResponseSuccessType, ResponseType, RevokeAccessTokenResponseType, RoleNameType, RunRepoWorkflow, RunRepoWorkflowResponseType, SearchRepo, SearchReposParamType, SearchReposResponseType, SearchUser, SearchUsersParamType, SearchUsersResponseType, ShaParamType, SubIssueListParamType, SubIssueListResponseType, TokenResponseType, UnLockIssueParamType, UnLockIssueResponseType, UpdateIssueCommentParamType, UpdateIssueCommentResponseType, UpdateIssueParamType, UpdateIssueResponseType, UpdatePullRequestCommentParamType, UpdatePullRequestCommentResponseType, UpdatePullRequestParamType, UpdatePullRequestResponseType, UpdateReleaseParamType, UpdateReleaseResponseType, UserByTokenRepoListParamType, UserIdParamType, UserInfoByIdParamType, UserInfoParamType, UserInfoResponseType, UserNameParamType, UserRepoCreateParamType, UserRepoCreateResponseType, UserRepoListParamType, UserRepoListType, WebHookSignatureParamType, WebHookSignatureResponseType, WorkflowInfoParamType, WorkflowInfoResponseType, WorkflowState, create_state_id, formatParamType, format_date, get_langage_color, get_local_git_repo_info, get_local_git_repos_list, get_local_npm_package_info, get_local_npm_packages_list, get_local_repo_default_branch, get_relative_time, get_remote_repo_default_branch, index_d_exports as github, isAppInstalledInRepo, render_diff, render_markdown, workflowIdParamType };