@candriajs/git-neko-kit 0.8.6 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,28 +1,4 @@
1
1
  import { RawAxiosResponseHeaders, AxiosResponseHeaders } from 'axios';
2
- import { ExecException, exec } from 'child_process';
3
-
4
- /**
5
- * 获取本地仓库的默认分支
6
- * @param local_path - 本地仓库路径
7
- * @returns 默认分支名称
8
- * @example
9
- * ```ts
10
- * console.log(await get_local_repo_default_branch('/path/to/repo'))
11
- * -> 'main'
12
- * ```
13
- */
14
- declare function get_local_repo_default_branch(local_path: string): Promise<string>;
15
- /**
16
- * 获取远程仓库的默认分支
17
- * @param remote_url - 远程仓库URL
18
- * @returns 默认分支名称
19
- * @example
20
- * ```ts
21
- * console.log(await get_remote_repo_default_branch('https://github.com/CandriaJS/git-neko-kit'))
22
- * -> 'main'
23
- * ```
24
- */
25
- declare function get_remote_repo_default_branch(remote_url: string): Promise<string>;
26
2
 
27
3
  /** 代理地址类型 */
28
4
  type ProxyUrlType = string;
@@ -32,55 +8,67 @@ type ProxyUrlType = string;
32
8
  * - original: 原始代理
33
9
  * - common: 通用代理
34
10
  */
35
- type ProxyType = 'reverse' | 'original' | 'common';
11
+ declare enum ProxyType {
12
+ /** 反向代理 */
13
+ Reverse = "reverse",
14
+ /** 原始代理 */
15
+ Original = "original",
16
+ /** 通用代理 */
17
+ Common = "common"
18
+ }
36
19
  /** Git类型 */
37
20
  type GitType = 'github' | 'gitee' | 'gitcode';
38
- /**
39
- * 通用代理配置
40
- */
41
- interface CommonProxyType {
42
- type: 'common';
43
- /** 代理基础地址 */
44
- address: ProxyUrlType;
45
- }
46
- /**
47
- * 反向代理配置
48
- */
49
- interface ReverseProxyType {
50
- type: 'reverse';
51
- /** 代理基础地址 */
52
- address: ProxyUrlType;
53
- }
54
- /**
55
- * HTTP 代理配置
56
- */
57
- interface HttpProxyType {
58
- type: 'http';
59
- address: ProxyUrlType;
21
+ /** 代理协议类型 */
22
+ declare enum ProxyProtocol {
23
+ /** HTTP */
24
+ HTTP = "http",
25
+ /** HTTPS */
26
+ HTTPS = "https",
27
+ /** SOCKS */
28
+ SOCKS = "socks",
29
+ /** SOCKS5 */
30
+ SOCKS5 = "socks5"
60
31
  }
61
32
  /**
62
- * HTTPS 代理配置
33
+ * 基本代理配置
34
+ * @typeparam T - 代理类型或协议类型
63
35
  */
64
- interface HttpsProxyType {
65
- type: 'https';
36
+ interface BaseProxyType<T extends ProxyType | ProxyProtocol> {
37
+ type: T;
66
38
  address: ProxyUrlType;
67
39
  }
68
- /**
69
- * SOCKS5 代理配置
70
- */
71
- interface SocksProxyType {
72
- type: 'socks';
73
- address: ProxyUrlType;
40
+ /** 代理配置参数类型 */
41
+ type ProxyParamsType = BaseProxyType<ProxyProtocol.HTTP> | BaseProxyType<ProxyProtocol.HTTPS> | BaseProxyType<ProxyProtocol.SOCKS> | BaseProxyType<ProxyProtocol.SOCKS5> | BaseProxyType<ProxyType.Common> | BaseProxyType<ProxyType.Reverse>;
42
+
43
+ /** 本地Git仓库信息 */
44
+ interface LocalGitInfoType {
45
+ /** 文件夹名称 */
46
+ name: string;
47
+ /** 文件夹路径 */
48
+ path: string;
49
+ /**
50
+ * git地址,原始地址可能是反代的地址
51
+ * */
52
+ url: string;
53
+ /**
54
+ * 仓库地址, 这个是经过处理的,保证是不经过任何代理地址的地址
55
+ * */
56
+ html_url: string;
57
+ /** 仓库名称 */
58
+ owner: string;
59
+ /** 仓库名称 */
60
+ repo: string;
74
61
  }
75
- /**
76
- * SOCKS5 代理配置
77
- */
78
- interface Socks5ProxyType {
79
- type: 'socks5';
80
- address: ProxyUrlType;
62
+ /** 获取本地路径的Git仓库信息列表 */
63
+ type LocalGitInfoListType = Array<LocalGitInfoType>;
64
+ interface LocalGitInfoListOptionsType {
65
+ /** 是否递归查找 */
66
+ loop?: boolean;
67
+ /** 递归最大深度 */
68
+ maxDepth?: number;
69
+ /** 忽略目录 */
70
+ dir?: string[];
81
71
  }
82
- /** 代理配置参数类型 */
83
- type ProxyParamsType = HttpProxyType | HttpsProxyType | SocksProxyType | Socks5ProxyType | CommonProxyType | ReverseProxyType;
84
72
 
85
73
  interface PkgInfoType {
86
74
  /** 包名 */
@@ -122,6 +110,14 @@ interface ApiResponseType<D = any> extends Omit<ResponseType<D>, 'headers'> {
122
110
  status: 'ok' | 'error';
123
111
  }
124
112
 
113
+ interface GitRepoType {
114
+ /** 仓库的地址 */
115
+ html_url: string;
116
+ /** 仓库的拥有者 */
117
+ owner: string;
118
+ /** 仓库的名称 */
119
+ repo: string;
120
+ }
125
121
  /**
126
122
  * 单日贡献数据
127
123
  */
@@ -143,34 +139,6 @@ interface ContributionResult {
143
139
  */
144
140
  contributions: ContributionData[][];
145
141
  }
146
- /**
147
- * 执行 shell 命令返回类型
148
- */
149
- interface ExecType {
150
- /** 是否执行成功 */
151
- status: boolean;
152
- /** 错误对象,如果命令执行失败则包含错误信息 */
153
- error: ExecException | null;
154
- /** 标准错误输出 */
155
- stderr: string;
156
- /** 标准输出 */
157
- stdout: string;
158
- }
159
- /**
160
- * 执行 shell 命令返回类型泛型
161
- */
162
- type ExecReturn<K extends boolean> = K extends true ? boolean : ExecType;
163
- /**
164
- * 执行 shell 命令参数
165
- */
166
- type ExecOptions<T extends boolean> = Parameters<typeof exec>[1] & {
167
- /** 是否打印日志 默认不打印 */
168
- log?: boolean;
169
- /** 是否只返回布尔值 表示命令是否成功执行 优先级比抛错误高 */
170
- booleanResult?: T;
171
- /** 是否去除日志中的换行符 默认不去除 */
172
- trim?: boolean;
173
- };
174
142
 
175
143
  interface AccessTokenType {
176
144
  /** 访问令牌 */
@@ -245,6 +213,23 @@ interface PullRequestNumberParamType {
245
213
  /** 拉取请求id */
246
214
  pr_number: number;
247
215
  }
216
+ /**
217
+ * 工作流参数
218
+ */
219
+ interface workflowIdParamType {
220
+ /** 工作流id */
221
+ workflow_id: number | string;
222
+ }
223
+ /**
224
+ * 角色名称参数
225
+ * - 角色名称
226
+ * @default 'member'
227
+ * - admin 管理员
228
+ * - member 成员
229
+ */
230
+ interface RoleNameType {
231
+ role: 'admin' | 'member';
232
+ }
248
233
  interface CommentIdParamType {
249
234
  /** 评论id */
250
235
  comment_id: number | string;
@@ -274,6 +259,7 @@ type GitHubClientType = GitHubBaseClient & {
274
259
  };
275
260
  /** 客户端类型 */
276
261
  interface ClientType {
262
+ /** GitHub客户端 */
277
263
  github: GitHubClientType;
278
264
  }
279
265
 
@@ -313,8 +299,116 @@ interface UserInfoResponseType {
313
299
  following: number;
314
300
  }
315
301
 
302
+ interface CommitInfoCommonParamType {
303
+ /** 提交SHA */
304
+ sha?: ShaParamType['sha'];
305
+ }
306
+ /** Git提交用户信息 */
307
+ interface GitUser extends Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'> {
308
+ /** 日期字符串 */
309
+ date: string;
310
+ }
311
+ interface Commit$1 {
312
+ /** 提交的URL */
313
+ url: string;
314
+ /** 提交作者信息 */
315
+ author: GitUser;
316
+ /** 提交者信息 */
317
+ committer: GitUser;
318
+ /** 提交信息 */
319
+ message: string;
320
+ /**
321
+ * 提交标题
322
+ * 仅在开启格式化消息时返回
323
+ * @example "feat: add new feature"
324
+ */
325
+ title?: string;
326
+ /** 提交正文
327
+ * 仅在开启格式化消息时返回
328
+ * @example "- add new feature"
329
+ */
330
+ body?: string | null;
331
+ /** 提交树信息 */
332
+ tree: {
333
+ /** 树对象的SHA */
334
+ sha: string;
335
+ /** 树对象的URL */
336
+ url: string;
337
+ };
338
+ }
339
+ interface DiffEntry {
340
+ /** 文件SHA */
341
+ sha: string;
342
+ /** 文件名 */
343
+ filename: string;
344
+ /** 文件状态 */
345
+ status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied' | 'changed' | 'unchanged';
346
+ /** 新增行数 */
347
+ additions: number;
348
+ /** 删除行数 */
349
+ deletions: number;
350
+ /** 总变更行数 */
351
+ changes: number;
352
+ /** 文件blob URL */
353
+ blob_url: string;
354
+ /** 文件原始URL */
355
+ raw_url: string;
356
+ }
357
+ interface CommitStats {
358
+ /** 新增行数 */
359
+ additions: number;
360
+ /** 删除行数 */
361
+ deletions: number;
362
+ /** 总变更行数 */
363
+ total: number;
364
+ }
365
+ interface ParentCommit {
366
+ /** 父提交SHA */
367
+ sha: string;
368
+ /** 父提交URL */
369
+ url: string;
370
+ }
371
+ /** 提交参数类型 */
372
+ type CommitInfoParamType = RepoParamType & CommitInfoCommonParamType;
373
+ /** 提交信息响应类型 */
374
+ interface CommitInfoResponseType {
375
+ /** HTML URL */
376
+ html_url: string;
377
+ /** 提交SHA */
378
+ sha: string;
379
+ /** 评论URL */
380
+ comments_url: string;
381
+ /** 提交信息 */
382
+ commit: Commit$1;
383
+ /** 父提交列表 */
384
+ parents: ParentCommit[];
385
+ /** 提交统计信息 */
386
+ stats: CommitStats;
387
+ /** 变更文件列表 */
388
+ files: DiffEntry[];
389
+ }
390
+ /** 提交列表参数类型 */
391
+ type CommitListParamType = RepoParamType & {
392
+ /** SHA 或分支名称,用于指定从哪里开始列出提交 */
393
+ sha?: ShaParamType['sha'];
394
+ /** 仅返回包含此文件路径的提交 */
395
+ path?: string;
396
+ /** GitHub 用户名或电子邮件地址,用于按提交作者筛选 */
397
+ author?: string;
398
+ /** ISO 8601 格式的时间戳 (YYYY-MM-DDTHH:MM:SSZ),仅显示此时间之后更新的结果 */
399
+ since?: string;
400
+ /** ISO 8601 格式的时间戳 (YYYY-MM-DDTHH:MM:SSZ),仅返回此时间之前的提交 */
401
+ until?: string;
402
+ /** 每页的结果数(最多 100),默认: 30 */
403
+ per_page?: number;
404
+ /** 要获取的结果页码,默认: 1 */
405
+ page?: number;
406
+ };
407
+ /** 提交列表响应类型 */
408
+ type CommitListResponseType = CommitInfoResponseType[];
409
+
316
410
  /** 仓库所有者参数类型 */
317
- type RepoUser = Omit<UserInfoResponseType, 'followers' | 'following' | 'blog' | 'bio' | 'public_repos'>;
411
+ type RepoUser = Omit<UserInfoResponseType, 'followers' | 'following' | 'blog' | 'bio' | 'public_repos' | 'email'>;
318
412
  /** 仓库列表参数类型 */
319
413
  interface RepoListBaseParamType {
320
414
  /** 排序方式,可选created, updated, pushed, full_name, 默认为 full_name */
@@ -531,8 +625,10 @@ type GetCollaboratorListResponseType = CollaboratorInfoResponseType[];
531
625
  type RemoveCollaboratorParamType = RepoBaseParamType & UserNameParamType;
532
626
  /** 移除协作者响应类型 */
533
627
  interface RemoveCollaboratorResponseType {
628
+ /** 是否移除成功 */
629
+ success: boolean;
534
630
  /** 状态信息 */
535
- info: string;
631
+ message: string;
536
632
  }
537
633
 
538
634
  type AppUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'>;
@@ -744,7 +840,7 @@ interface CreateAccessTokenForAppParamType {
744
840
  interface CreateAccessTokenForAppResponseType {
745
841
  /** 访问令牌 */
746
842
  token: string;
747
- /** 访问令牌过期时间 */
843
+ /** 访问令牌过期时间, UTC 时间格式 */
748
844
  expires_at: string;
749
845
  /** 访问令牌权限 */
750
846
  permissions: Record<string, string>;
@@ -758,15 +854,17 @@ interface RevokeAccessTokenResponseType {
758
854
  /** 是否撤销成功 */
759
855
  success: boolean;
760
856
  /** 撤销结果信息 */
761
- info: string;
857
+ message: string;
762
858
  }
859
+ /** 判断应用程序是否安装在仓库中参数类型 */
860
+ type isAppInstalledInRepo = RepoBaseParamType;
763
861
 
764
862
  /** Github 授权令牌接口返回类型 */
765
863
  interface TokenResponseType {
766
864
  /** 是否成功刷新 */
767
865
  success: boolean;
768
866
  /** 获取访问令牌信息 */
769
- info: string;
867
+ message: string;
770
868
  /** 用户访问令牌, 格式为 ghu_ 开头 */
771
869
  access_token: string;
772
870
  /** access_token 过期前的秒数,默认值为 28800(8小时) */
@@ -785,7 +883,7 @@ interface RefreshTokenResponseType {
785
883
  /** 是否成功刷新 */
786
884
  success: boolean;
787
885
  /** 获取刷新令牌信息 */
788
- info: string;
886
+ message: string;
789
887
  /** 用户访问令牌,格式为 ghu_ 开头 */
790
888
  access_token: string;
791
889
  /** access_token 过期前的秒数,默认值为 28800(8小时) */
@@ -804,120 +902,99 @@ interface CheckTokenResponseType {
804
902
  /** 令牌是否有效 */
805
903
  success: boolean;
806
904
  /** 状态信息 */
807
- info: string;
905
+ message: string;
808
906
  }
809
907
 
810
- interface CommitInfoCommonParamType {
811
- /** 提交SHA */
812
- sha?: ShaParamType['sha'];
908
+ /** 工作流状态 */
909
+ declare const enum WorkflowState {
910
+ /** 工作流已激活 */
911
+ Active = "active",
912
+ /** 工作流已删除 */
913
+ Deleted = "deleted",
914
+ /** for仓库未启用工作流 */
915
+ DisabledFork = "disabled_fork",
916
+ /** 工作流已禁用(因为超过30天未使用) */
917
+ DisabledInactivity = "disabled_inactivity",
918
+ /** 工作流已禁用(手动) */
919
+ DisabledManually = "disabled_manually"
920
+ }
921
+ /** 工作流信息参数类型 */
922
+ type WorkflowInfoParamType = RepoBaseParamType & workflowIdParamType;
923
+ /** 工作流信息响应类型 */
924
+ interface WorkflowInfoResponseType {
925
+ /** 工作流id */
926
+ id: number;
927
+ /** 工作流所属仓库的URL */
928
+ html_url: string;
929
+ /** 工作流名称 */
930
+ name: string;
931
+ /** 工作流文件路径 */
932
+ path: string;
933
+ /** 工作流状态 */
934
+ state: WorkflowState;
935
+ /** 工作流创建时间 */
936
+ created_at: string;
937
+ /** 工作流更新时间 */
938
+ updated_at: string;
813
939
  }
814
- /** Git提交用户信息 */
815
- interface GitUser extends Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'> {
816
- /** 日期字符串 */
817
- date: string;
940
+ /** 获取仓库工作流列表参数类型 */
941
+ interface GetRepoWorkflowsList extends RepoBaseParamType {
942
+ /** 每页数量 */
943
+ per_page?: number;
944
+ /** 页码 */
945
+ page?: number;
818
946
  }
819
- /**
820
- * 验证信息类型
821
- * 这个只有GitHub平台返回
822
- */
823
- interface Commit$1 {
824
- /** 提交的URL */
825
- url: string;
826
- /** 提交作者信息 */
827
- author: GitUser;
828
- /** 提交者信息 */
829
- committer: GitUser;
830
- /** 提交信息 */
947
+ /** 获取仓库工作流列表响应类型 */
948
+ interface GetRepoWorkflowsListResponseType {
949
+ /** 总数 */
950
+ total: number;
951
+ /** 工作流列表 */
952
+ workflows: WorkflowInfoResponseType[];
953
+ }
954
+ /** 运行仓库工作流参数类型 */
955
+ interface RunRepoWorkflow extends WorkflowInfoParamType {
956
+ /** 分支或者标签名称 */
957
+ ref: string;
958
+ /** 工作流输入参数, 该参数最多10个 */
959
+ inputs?: Record<string, string | number>;
960
+ }
961
+ /** 运行仓库工作流响应类型 */
962
+ interface RunRepoWorkflowResponseType {
963
+ /** 是否成功 */
964
+ success: boolean;
965
+ /** 运行状态信息 */
831
966
  message: string;
832
- /**
833
- * 提交标题
834
- * 仅在开启格式化消息时返回
835
- * @example "feat: add new feature"
836
- */
837
- title?: string;
838
- /** 提交正文
839
- * 仅在开启格式化消息时返回
840
- * @example "- add new feature"
841
- */
842
- body?: string | null;
843
- /** 提交树信息 */
844
- tree: {
845
- /** 树对象的SHA */
846
- sha: string;
847
- /** 树对象的URL */
848
- url: string;
849
- };
850
967
  }
851
- interface DiffEntry {
852
- /** 文件SHA */
853
- sha: string;
854
- /** 文件名 */
855
- filename: string;
856
- /** 文件状态 */
857
- status: 'added' | 'removed' | 'modified' | 'renamed' | 'copied' | 'changed' | 'unchanged';
858
- /** 新增行数 */
859
- additions: number;
860
- /** 删除行数 */
861
- deletions: number;
862
- /** 总变更行数 */
863
- changes: number;
864
- /** 文件blob URL */
865
- blob_url: string;
866
- /** 文件原始URL */
867
- raw_url: string;
968
+ /** 启用仓库工作流参数类型 */
969
+ type EnableRepoWorkflowParamType = WorkflowInfoParamType;
970
+ /** 启用仓库工作流响应类型 */
971
+ interface EnableRepoWorkflowResponseType {
972
+ /** 是否成功 */
973
+ success: boolean;
974
+ /** 启用状态信息 */
975
+ message: string;
868
976
  }
869
- interface CommitStats {
870
- /** 新增行数 */
871
- additions: number;
872
- /** 删除行数 */
873
- deletions: number;
874
- /** 总变更行数 */
875
- total: number;
977
+ /** 禁用仓库工作流参数类型 */
978
+ type DisEnableRepoWorkflowParamType = WorkflowInfoParamType;
979
+ /** 禁用仓库工作流响应类型 */
980
+ interface DisEnableRepoWorkflowResponseType {
981
+ /** 是否成功 */
982
+ success: boolean;
983
+ /** 禁用状态信息 */
984
+ message: string;
876
985
  }
877
- interface ParentCommit {
878
- /** 父提交SHA */
879
- sha: string;
880
- /** 父提交URL */
881
- url: string;
986
+ /** 重新运行仓库工作流参数类型 */
987
+ interface ReRunRepoWorkflowParamType extends Omit<WorkflowInfoParamType, 'workflow_id'> {
988
+ /** 工作流作业id */
989
+ job_id: number;
882
990
  }
883
- /** 提交参数类型 */
884
- type CommitInfoParamType = RepoParamType & CommitInfoCommonParamType;
885
- /** 提交信息响应类型 */
886
- interface CommitInfoResponseType {
887
- /** HTML URL */
888
- html_url: string;
889
- /** 提交SHA */
890
- sha: string;
891
- /** 评论URL */
892
- comments_url: string;
893
- /** 提交信息 */
894
- commit: Commit$1;
895
- /** 父提交列表 */
896
- parents: ParentCommit[];
897
- /** 提交统计信息 */
898
- stats: CommitStats;
899
- /** 变更文件列表 */
900
- files: DiffEntry[];
991
+ /** 重新运行仓库工作流响应类型 */
992
+ interface ReRunRepoWorkflowResponseType {
993
+ /** 是否成功重新运行仓库工作流 */
994
+ success: boolean;
995
+ /** 重新运行状态信息 */
996
+ message: string;
901
997
  }
902
- /** 提交列表参数类型 */
903
- type CommitListParamType = RepoParamType & {
904
- /** SHA 或分支名称,用于指定从哪里开始列出提交 */
905
- sha?: ShaParamType['sha'];
906
- /** 仅返回包含此文件路径的提交 */
907
- path?: string;
908
- /** GitHub 用户名或电子邮件地址,用于按提交作者筛选 */
909
- author?: string;
910
- /** ISO 8601 格式的时间戳 (YYYY-MM-DDTHH:MM:SSZ),仅显示此时间之后更新的结果 */
911
- since?: string;
912
- /** ISO 8601 格式的时间戳 (YYYY-MM-DDTHH:MM:SSZ),仅返回此时间之前的提交 */
913
- until?: string;
914
- /** 每页的结果数(最多 100),默认: 30 */
915
- per_page?: number;
916
- /** 要获取的结果页码,默认: 1 */
917
- page?: number;
918
- };
919
- /** 提交列表响应类型 */
920
- type CommitListResponseType = CommitInfoResponseType[];
921
998
 
922
999
  /** 议题用户信息响应类型 */
923
1000
  type IssueUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos' | 'type'>;
@@ -967,12 +1044,8 @@ interface IssueInfoResponseType {
967
1044
  html_url: string;
968
1045
  /** 议题编号 */
969
1046
  number: number;
970
- /** 评论数 */
971
- comments: number;
972
1047
  /** 议题状态: open/closed */
973
1048
  state: string;
974
- /** 状态原因: completed/reopened/not_planned/null */
975
- state_reason: string | null;
976
1049
  /** 议题标题 */
977
1050
  title: string;
978
1051
  /** 议题正文内容 */
@@ -1005,7 +1078,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1005
1078
  /**
1006
1079
  * 里程碑筛选
1007
1080
  * @default *
1008
- * @enum {string | number}
1009
1081
  * - 传入数字时:按里程碑编号筛选
1010
1082
  * - 传入 "*":接受任何里程碑的议题
1011
1083
  * - 传入 "none":返回没有里程碑的议题
@@ -1014,7 +1086,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1014
1086
  /**
1015
1087
  * 议题状态
1016
1088
  * @default "open"
1017
- * @enum {string}
1018
1089
  * - open: 打开的议题
1019
1090
  * - closed: 关闭的议题
1020
1091
  * - all: 所有议题
@@ -1046,7 +1117,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1046
1117
  /**
1047
1118
  * 排序方式
1048
1119
  * @default "created"
1049
- * @enum {string}
1050
1120
  * - created: 按创建时间排序
1051
1121
  * - updated: 按更新时间排序
1052
1122
  * - comments: 按评论数排序
@@ -1055,7 +1125,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1055
1125
  /**
1056
1126
  * 排序方向
1057
1127
  * @default "desc"
1058
- * @enum {string}
1059
1128
  * - asc: 升序
1060
1129
  * - desc: 降序
1061
1130
  */
@@ -1133,13 +1202,20 @@ interface LockIssueParamType extends RepoBaseParamType {
1133
1202
  }
1134
1203
  /** 锁定议题响应类型 */
1135
1204
  interface LockIssueResponseType {
1205
+ /** 是否成功锁定 */
1206
+ success: boolean;
1136
1207
  /** 锁定状态信息 */
1137
- info: string;
1208
+ message: string;
1138
1209
  }
1139
1210
  /** 解锁议题参数类型 */
1140
1211
  type UnLockIssueParamType = Omit<LockIssueParamType, 'lock_reason'>;
1141
1212
  /** 解锁议题响应类型 */
1142
- type UnLockIssueResponseType = LockIssueResponseType;
1213
+ interface UnLockIssueResponseType {
1214
+ /** 是否成功解锁 */
1215
+ success: LockIssueResponseType['success'];
1216
+ /** 解锁状态信息 */
1217
+ message: LockIssueResponseType['message'];
1218
+ }
1143
1219
  /** 议题评论信息参数类型 */
1144
1220
  interface IssueCommentInfoParamType extends RepoBaseParamType {
1145
1221
  /** 评论id,评论唯一标识符 */
@@ -1161,12 +1237,11 @@ interface IssueCommentInfoResponseType {
1161
1237
  updated_at: string;
1162
1238
  }
1163
1239
  /** 仓库评论列表参数类型 */
1164
- interface RepoCommentListParamType extends RepoBaseParamType {
1240
+ interface RepoCommentsListParamType extends RepoBaseParamType {
1165
1241
  /**
1166
1242
  * 排序依据
1167
1243
  * 用于指定结果的排序属性
1168
1244
  * @default created
1169
- * @enum {string}
1170
1245
  * - created: 按创建时间排序
1171
1246
  * - updated: 按更新时间排序
1172
1247
  */
@@ -1176,7 +1251,6 @@ interface RepoCommentListParamType extends RepoBaseParamType {
1176
1251
  * 指定结果的排序方向
1177
1252
  * 注意:如果没有指定 sort 参数,此参数将被忽略
1178
1253
  * @default desc 当 sort 参数存在时
1179
- * @enum {string}
1180
1254
  * - asc: 升序
1181
1255
  * - desc: 降序
1182
1256
  */
@@ -1204,9 +1278,9 @@ interface RepoCommentListParamType extends RepoBaseParamType {
1204
1278
  page?: number;
1205
1279
  }
1206
1280
  /** 仓库评论列表响应类型 */
1207
- type RepoCommentListResponseType = IssueCommentInfoResponseType[];
1281
+ type RepoCommentsListResponseType = IssueCommentInfoResponseType[];
1208
1282
  /** 议题评论列表参数类型 */
1209
- interface IssueCommentListParamType extends RepoBaseParamType {
1283
+ interface IssueCommentsListParamType extends RepoBaseParamType {
1210
1284
  /** 议题ID */
1211
1285
  issue_number: number;
1212
1286
  /**
@@ -1230,7 +1304,7 @@ interface IssueCommentListParamType extends RepoBaseParamType {
1230
1304
  page?: number;
1231
1305
  }
1232
1306
  /** 议题评论列表响应类型 */
1233
- type IssueCommentListResponseType = IssueCommentInfoResponseType[];
1307
+ type IssueCommentsListResponseType = IssueCommentInfoResponseType[];
1234
1308
  /** 创建议题评论参数类型 */
1235
1309
  interface CreteIssueCommentParamType extends RepoBaseParamType {
1236
1310
  /** 议题ID */
@@ -1254,8 +1328,10 @@ interface RemoveIssueCommentParamType extends RepoBaseParamType {
1254
1328
  }
1255
1329
  /** 删除议题评论响应类型 */
1256
1330
  interface RemoveIssueCommentResponseType {
1331
+ /** 是否成功删除议题 */
1332
+ success: boolean;
1257
1333
  /** 删除状态信息 */
1258
- info: string;
1334
+ message: string;
1259
1335
  }
1260
1336
  /** 获取子议题列表参数类型 */
1261
1337
  interface SubIssueListParamType extends RepoBaseParamType {
@@ -1335,16 +1411,15 @@ interface OrgInfoResponseType {
1335
1411
  interface AddMemberParamType extends OrgNameParamType, UserNameParamType {
1336
1412
  /**
1337
1413
  * 角色
1338
- * @default 'member'
1339
1414
  */
1340
- role?: 'admin' | 'member';
1415
+ role?: RoleNameType['role'];
1341
1416
  }
1342
1417
  /** 添加组织成员响应类型 */
1343
1418
  interface AddMemberResponseType extends Omit<AddCollaboratorResponseType, 'permissions' | 'html_url'> {
1344
1419
  /** 组织地址 */
1345
1420
  html_url: string;
1346
1421
  /** 角色 */
1347
- role: 'admin' | 'member';
1422
+ role: RoleNameType['role'];
1348
1423
  }
1349
1424
 
1350
1425
  type PrUser = Pick<UserInfoResponseType, 'id' | 'login' | 'name' | 'avatar_url' | 'html_url'>;
@@ -1360,7 +1435,7 @@ interface PullRequestInfoResponseType {
1360
1435
  /** 拉取请求的编号 */
1361
1436
  number: number;
1362
1437
  /** 拉取请求的状态 (open/closed) */
1363
- state: 'open' | 'closed';
1438
+ state: 'open' | 'closed' | 'merged';
1364
1439
  /** 是否被锁定 */
1365
1440
  locked: boolean;
1366
1441
  /** 拉取请求的标题 */
@@ -1372,7 +1447,7 @@ interface PullRequestInfoResponseType {
1372
1447
  /** 创建时间 */
1373
1448
  created_at: string;
1374
1449
  /** 更新时间 */
1375
- updated_at: string;
1450
+ updated_at: string | null;
1376
1451
  /** 关闭时间 */
1377
1452
  closed_at: string | null;
1378
1453
  /** 合并时间 */
@@ -1641,8 +1716,10 @@ interface UpdatePullRequestCommentParamType extends RepoBaseParamType, CommentId
1641
1716
  }
1642
1717
  /** 更新拉取请求评论响应类型 */
1643
1718
  interface UpdatePullRequestCommentResponseType {
1644
- /** 是否评论成功 */
1719
+ /** 是否更新评论信息成功 */
1645
1720
  success: boolean;
1721
+ /** 更新评论状态信息 */
1722
+ message: string;
1646
1723
  }
1647
1724
  /** 删除拉取请求评论参数类型 */
1648
1725
  type DeletePullRequestCommentParamType = RepoBaseParamType & CommentIdParamType;
@@ -1650,9 +1727,11 @@ type DeletePullRequestCommentParamType = RepoBaseParamType & CommentIdParamType;
1650
1727
  interface DeletePullRequestCommentResponseType {
1651
1728
  /** 是否删除成功 */
1652
1729
  success: boolean;
1730
+ /** 删除状态信息 */
1731
+ message: string;
1653
1732
  }
1654
1733
 
1655
- type ReleaseUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'>;
1734
+ type ReleaseUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos' | 'email'>;
1656
1735
  /** 反应信息类型 */
1657
1736
  interface ReactionInfoType {
1658
1737
  /** 反应 API URL */
@@ -1755,8 +1834,47 @@ type UpdateReleaseResponseType = ReleaseInfoResponseType;
1755
1834
  type DeleteReleaseParamType = ReleaseInfoParamType;
1756
1835
  /** 删除Release响应类型 */
1757
1836
  interface DeleteReleaseResponseType {
1758
- /** 删除信息 */
1759
- info: string;
1837
+ /** 是否删除成功 */
1838
+ success: boolean;
1839
+ /** 删除状态信息 */
1840
+ message: string;
1841
+ }
1842
+
1843
+ type SearchUser = Pick<UserInfoResponseType, 'id' | 'login' | 'name' | 'avatar_url' | 'html_url' | 'email'>;
1844
+ type SearchRepo = Pick<RepoInfoResponseType, 'id' | 'owner' | 'name' | 'full_name' | 'description' | 'visibility' | 'public' | 'private' | 'archived' | 'language' | 'pushed_at'>;
1845
+ /** 搜索用户参数列表 */
1846
+ interface SearchUsersParamType {
1847
+ /** 搜索关键字 */
1848
+ q: string;
1849
+ /** 排序顺序 */
1850
+ order: 'desc' | 'asc';
1851
+ /** 每页数量 */
1852
+ per_page?: number;
1853
+ /** 页码 */
1854
+ page?: number;
1855
+ }
1856
+ /** 搜索用户响应列表 */
1857
+ interface SearchUsersResponseType {
1858
+ /** 搜索结果数量 */
1859
+ total_count: number;
1860
+ /** 用户列表 */
1861
+ items: Array<SearchUser>;
1862
+ }
1863
+ interface SearchReposParamType {
1864
+ /** 搜索关键字 */
1865
+ q: string;
1866
+ /** 排序顺序 */
1867
+ order: 'desc' | 'asc';
1868
+ /** 每页数量 */
1869
+ per_page?: number;
1870
+ /** 页码 */
1871
+ page?: number;
1872
+ }
1873
+ interface SearchReposResponseType {
1874
+ /** 搜索结果数量 */
1875
+ total_count: number;
1876
+ /** 用户列表 */
1877
+ items: Array<SearchRepo>;
1760
1878
  }
1761
1879
 
1762
1880
  interface WebHookSignatureParamType {
@@ -1769,9 +1887,79 @@ interface WebHookSignatureResponseType {
1769
1887
  /** 是否验证成功 */
1770
1888
  success: boolean;
1771
1889
  /** 验证信息 */
1772
- info: string;
1890
+ message: string;
1773
1891
  }
1774
1892
 
1893
+ /**
1894
+ * 获取本地 Git 仓库信息
1895
+ * @description 获取本地 Git 仓库信息,返回仓库名称、仓库路径、仓库地址等信息
1896
+ * @param local_path - 本地仓库路径
1897
+ * @returns Git 仓库信息
1898
+ * @example
1899
+ * ```ts
1900
+ * const info = await get_local_git_repo_info('D:/project/repo')
1901
+ * console.log(info)
1902
+ * -> {
1903
+ * name: 'repo',
1904
+ * path: 'D:/project/repo',
1905
+ * url: 'https://github.com/owner/repo.git',
1906
+ * html_url: 'https://github.com/owner/repo',
1907
+ * owner: 'owner',
1908
+ * repo: 'repo'
1909
+ * }
1910
+ * ```
1911
+ */
1912
+ declare function get_local_git_repo_info(local_path: string): Promise<LocalGitInfoType | null>;
1913
+ /**
1914
+ * 获取本地仓库信息列表
1915
+ * @param local_path 本地仓库路径
1916
+ * @param options 配置项
1917
+ * - loop 是否递归查找
1918
+ * - maxDepth 递归最大深度
1919
+ * - dir 忽略的文件夹名称列表
1920
+ * @returns
1921
+ * @example
1922
+ * ```ts
1923
+ * // 无数据
1924
+ * const res = await get_local_git_repo_list('D:\\project\\GitHub', { loop: true, maxDepth: 5, dir: ['node_modules'] })
1925
+ * -> []
1926
+ * // 有数据
1927
+ * const res = await get_local_git_repo_list('D:\\project\\GitHub', { loop: true, maxDepth: 5, dir: ['node_modules'] })
1928
+ * -> [
1929
+ * {
1930
+ * "name": "GitHub",
1931
+ * "path": "D:\\project\\GitHub\\GitHub",
1932
+ * "url": "https://github.com/GitHub/GitHub.git",
1933
+ * "html_url": "https://github.com/GitHub/GitHub",
1934
+ * "owner": "GitHub",
1935
+ * "repo": "GitHub"
1936
+ * }
1937
+ * ]
1938
+ */
1939
+ declare function get_local_git_repo_list(local_path: string, options?: LocalGitInfoListOptionsType): Promise<LocalGitInfoListType>;
1940
+ /**
1941
+ * 获取本地仓库的默认分支
1942
+ * @param local_path - 本地仓库路径
1943
+ * @returns 默认分支名称
1944
+ * @example
1945
+ * ```ts
1946
+ * console.log(await get_local_repo_default_branch('/path/to/repo'))
1947
+ * -> 'main'
1948
+ * ```
1949
+ */
1950
+ declare function get_local_repo_default_branch(local_path: string): Promise<string>;
1951
+ /**
1952
+ * 获取远程仓库的默认分支
1953
+ * @param remote_url - 远程仓库URL
1954
+ * @returns 默认分支名称
1955
+ * @example
1956
+ * ```ts
1957
+ * console.log(await get_remote_repo_default_branch('https://github.com/CandriaJS/git-neko-kit'))
1958
+ * -> 'main'
1959
+ * ```
1960
+ */
1961
+ declare function get_remote_repo_default_branch(remote_url: string): Promise<string>;
1962
+
1775
1963
  /**
1776
1964
  * 格式化日期
1777
1965
  * @param dateString - 日期字符串
@@ -2142,7 +2330,7 @@ declare class Issue extends GitHubClient {
2142
2330
  * -> 议题评论对象列表
2143
2331
  * ```
2144
2332
  */
2145
- get_repo_comments_list(options: RepoCommentListParamType): Promise<ApiResponseType<RepoCommentListResponseType>>;
2333
+ get_repo_comments_list(options: RepoCommentsListParamType): Promise<ApiResponseType<RepoCommentsListResponseType>>;
2146
2334
  /**
2147
2335
  * 获取一个议题下的评论列表
2148
2336
  * 权限:
@@ -2163,7 +2351,7 @@ declare class Issue extends GitHubClient {
2163
2351
  * -> 议题评论对象列表
2164
2352
  * ```
2165
2353
  */
2166
- get_issue_comments_list(options: IssueCommentListParamType): Promise<ApiResponseType<IssueCommentListResponseType>>;
2354
+ get_issue_comments_list(options: IssueCommentsListParamType): Promise<ApiResponseType<IssueCommentsListResponseType>>;
2167
2355
  /**
2168
2356
  * 获取议题评论信息
2169
2357
  * 权限:
@@ -2238,7 +2426,7 @@ declare class Issue extends GitHubClient {
2238
2426
  * -> 删除议题评论对象
2239
2427
  * ```
2240
2428
  */
2241
- remove_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2429
+ remove_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveIssueCommentResponseType>>;
2242
2430
  /**
2243
2431
  * 删除议题评论信息
2244
2432
  * 权限:
@@ -2247,7 +2435,7 @@ declare class Issue extends GitHubClient {
2247
2435
  * 需以上权限之一
2248
2436
  * @deprecated 请使用 remove_issue_comment 方法代替
2249
2437
  */
2250
- delete_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
2438
+ delete_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveIssueCommentResponseType>>;
2251
2439
  /**
2252
2440
  * 获取子议题列表
2253
2441
  * @github
@@ -2642,7 +2830,7 @@ declare class Repo extends GitHubClient {
2642
2830
  */
2643
2831
  get_org_repos_list(options: OrgRepoListParmType): Promise<ApiResponseType<OrgRepoListResponseType>>;
2644
2832
  /**
2645
- * 查询仓库详细信息
2833
+ * 通过授权用户查询仓库列表
2646
2834
  * 权限: Metadata - read-only , 如果获取公开仓库可无需此权限
2647
2835
  * @param options - 请求参数对象
2648
2836
  * - type - 仓库类型,可选值:可选all, public, private
@@ -2893,6 +3081,79 @@ declare class Repo extends GitHubClient {
2893
3081
  get_repo_main_language(options: GetRepoMainLanguageParamType): Promise<GetRepoMainLanguageResponseType>;
2894
3082
  }
2895
3083
 
3084
+ /**
3085
+ * GitHub 搜索管理类
3086
+ *
3087
+ * 提供对GitHub Search的完整管理功能,包括:
3088
+ * - 搜索用户
3089
+ * - 搜索仓库
3090
+ *
3091
+ */
3092
+ declare class Search extends GitHubClient {
3093
+ constructor(base: GitHubClient);
3094
+ /**
3095
+ * 搜索用户
3096
+ *
3097
+ * @param options 搜索参数
3098
+ * - q 搜索关键字
3099
+ * - order 排序顺序
3100
+ * - per_page 每页数量
3101
+ * - page 页码
3102
+ * @returns 搜索结果
3103
+ * @example
3104
+ * ```ts
3105
+ * const users = await search.search_users({ q: 'username', order: 'desc' })
3106
+ * -> {
3107
+ * total_count: 1,
3108
+ * items: [
3109
+ * {
3110
+ * id: 1,
3111
+ * login: 'username',
3112
+ * name: 'username',
3113
+ * email: 'username@example.com',
3114
+ * avatar_url: 'https://avatars.githubusercontent.com/u/1?v=4',
3115
+ * html_url: 'https://github.com/username'
3116
+ * }
3117
+ * ]
3118
+ * }
3119
+ * ```
3120
+ */
3121
+ search_users(options: SearchUsersParamType): Promise<ApiResponseType<SearchUsersResponseType>>;
3122
+ /**
3123
+ * 搜索仓库
3124
+ *
3125
+ * @param options 搜索参数
3126
+ * - q 搜索关键字
3127
+ * - order 排序顺序
3128
+ * - per_page 每页数量
3129
+ * - page 页码
3130
+ * @returns 搜索结果
3131
+ * @example
3132
+ * ```ts
3133
+ * const repos = await search.search_repos({ q: 'repo', order: 'desc' })
3134
+ * -> {
3135
+ * total_count: 1,
3136
+ * items: [
3137
+ * {
3138
+ * id: 1,
3139
+ * owner: 'username',
3140
+ * name: 'repo',
3141
+ * full_name: 'username/repo',
3142
+ * description: 'repo description',
3143
+ * visibility: 'public',
3144
+ * public: true,
3145
+ * private: false,
3146
+ * archived: false,
3147
+ * language: 'JavaScript',
3148
+ * pushed_at: '2021-01-01T00:00:00Z'
3149
+ * }
3150
+ * ]
3151
+ * }
3152
+ * ```
3153
+ */
3154
+ search_repos(options: SearchReposParamType): Promise<ApiResponseType<SearchReposResponseType>>;
3155
+ }
3156
+
2896
3157
  /**
2897
3158
  * Base 用户操作类
2898
3159
  *
@@ -3034,7 +3295,6 @@ declare class User extends GitHubClient {
3034
3295
  * - 检查webhook签名是否正确
3035
3296
  */
3036
3297
  declare class WebHook extends GitHubClient {
3037
- constructor(base: GitHubClient);
3038
3298
  /**
3039
3299
  * 检查WebHook签名是否正确
3040
3300
  * 权限:无需任何权限
@@ -3045,7 +3305,6 @@ declare class WebHook extends GitHubClient {
3045
3305
  * @example
3046
3306
  * ```ts
3047
3307
  * const res = await check_webhook_signature({
3048
- * secret: 'your_secret',
3049
3308
  * payload: 'your_payload',
3050
3309
  * signature: 'your_signature'
3051
3310
  * })
@@ -3056,7 +3315,7 @@ declare class WebHook extends GitHubClient {
3056
3315
  * msg: '请求成功'
3057
3316
  * data: {
3058
3317
  * success: true,
3059
- * info: '验证成功'
3318
+ * message: '验证成功'
3060
3319
  * }
3061
3320
  * }
3062
3321
  * ```
@@ -3064,6 +3323,116 @@ declare class WebHook extends GitHubClient {
3064
3323
  check_webhook_signature(options: WebHookSignatureParamType): Promise<ApiResponseType<WebHookSignatureResponseType>>;
3065
3324
  }
3066
3325
 
3326
+ /**
3327
+ * GitHub 工作流管理类
3328
+ *
3329
+ * 提供对GitHub Workflow的完整管理功能,包括:
3330
+ * - 仓库工作流信息
3331
+ *
3332
+ */
3333
+ declare class Workflow extends GitHubClient {
3334
+ constructor(base: GitHubClient);
3335
+ /**
3336
+ * 获取仓库工作流信息
3337
+ * 权限:
3338
+ * - 'actions': 'read-only'
3339
+ * @param options 获取工作流信息参数
3340
+ * - owner 仓库拥有者
3341
+ * - repo 仓库名称
3342
+ * - workflow_id 工作流id
3343
+ * @returns 包含工作流信息的响应对象
3344
+ * @example
3345
+ * ```ts
3346
+ * const res = await workflow.get_workflow_info()
3347
+ * -> 工作流信息对象
3348
+ * ```
3349
+ */
3350
+ get_workflow_info(options: WorkflowInfoParamType): Promise<ApiResponseType<WorkflowInfoResponseType>>;
3351
+ /**
3352
+ * 获取仓库工作流列表
3353
+ * 权限:
3354
+ * - 'actions': 'read-only'
3355
+ * @param options 获取工作流列表参数
3356
+ * - owner 仓库拥有者
3357
+ * - repo 仓库名称
3358
+ * - per_page 每页数量
3359
+ * - page 页码
3360
+ * @returns 包含工作流列表的响应对象
3361
+ * @example
3362
+ * ```ts
3363
+ * const res = await workflow.get_repo_workflows_list()
3364
+ * -> 工作流列表对象
3365
+ * ```
3366
+ */
3367
+ get_repo_workflows_list(options: GetRepoWorkflowsList): Promise<ApiResponseType<GetRepoWorkflowsListResponseType>>;
3368
+ /**
3369
+ * 运行仓库工作流
3370
+ * 权限:
3371
+ * - 'actions': 'read-and-write'
3372
+ * @param options 运行工作流参数
3373
+ * - owner 仓库拥有者
3374
+ * - repo 仓库名称
3375
+ * - workflow_id 工作流id
3376
+ * - ref 分支或者标签名称
3377
+ * - inputs 工作流输入参数
3378
+ * @returns 运行工作流结果对象
3379
+ * @example
3380
+ * ```ts
3381
+ * const res = await workflow.run_repo_workflow()
3382
+ * -> 运行工作流结果对象
3383
+ * ```
3384
+ */
3385
+ run_repo_workflow(options: RunRepoWorkflow): Promise<ApiResponseType<RunRepoWorkflowResponseType>>;
3386
+ /**
3387
+ * 启用仓库工作流
3388
+ * 权限:
3389
+ * - 'actions': 'read-and-write'
3390
+ * @param options 启用工作流参数
3391
+ * - owner 仓库拥有者
3392
+ * - repo 仓库名称
3393
+ * - workflow_id 工作流id
3394
+ * @returns 启用工作流结果对象
3395
+ * @example
3396
+ * ```ts
3397
+ * const res = await workflow.enable_repo_workflow()
3398
+ * -> 启用工作流结果对象
3399
+ * ```
3400
+ */
3401
+ enable_repo_workflow(options: EnableRepoWorkflowParamType): Promise<ApiResponseType<EnableRepoWorkflowResponseType>>;
3402
+ /**
3403
+ * 禁用仓库工作流
3404
+ * 权限:
3405
+ * - 'actions': 'read-and-write'
3406
+ * @param options 禁用工作流参数
3407
+ * - owner 仓库拥有者
3408
+ * - repo 仓库名称
3409
+ * - workflow_id 工作流id
3410
+ * @returns 禁用工作流结果对象
3411
+ * @example
3412
+ * ```ts
3413
+ * const res = await workflow.disable_repo_workflow()
3414
+ * -> 禁用工作流结果对象
3415
+ * ```
3416
+ */
3417
+ disable_repo_workflow(options: DisEnableRepoWorkflowParamType): Promise<ApiResponseType<DisEnableRepoWorkflowResponseType>>;
3418
+ /**
3419
+ * 重新运行仓库工作流
3420
+ * 权限:
3421
+ * - 'actions': 'read-and-write'
3422
+ * @param options 重新运行工作流参数
3423
+ * - owner 仓库拥有者
3424
+ * - repo 仓库名称
3425
+ * - job_id 工作流作业id
3426
+ * @returns 重新运行工作流结果对象
3427
+ * @example
3428
+ * ```ts
3429
+ * const res = await workflow.rerun_repo_workflow()
3430
+ * -> 重新运行工作流结果对象
3431
+ * ```
3432
+ */
3433
+ rerun_repo_workflow(options: ReRunRepoWorkflowParamType): Promise<ApiResponseType<ReRunRepoWorkflowResponseType>>;
3434
+ }
3435
+
3067
3436
  /**
3068
3437
  * GitHub API 基础服务类,提供与GitHub API交互的核心功能
3069
3438
  *
@@ -3095,6 +3464,8 @@ declare class GitHubClient {
3095
3464
  issue: Issue;
3096
3465
  org: Org;
3097
3466
  pull_request: Pull_Request;
3467
+ workflow: Workflow;
3468
+ search: Search;
3098
3469
  base_url: string;
3099
3470
  api_url: string;
3100
3471
  jwtToken: string;
@@ -3110,12 +3481,27 @@ declare class GitHubClient {
3110
3481
  /**
3111
3482
  * 获取Git平台类型
3112
3483
  * @returns Git平台类型,如: github,gitee
3484
+ * @example
3485
+ * ```ts
3486
+ * const type = await client.type
3487
+ * -> 'github'
3488
+ * ```
3113
3489
  */
3114
3490
  get type(): GitType;
3115
3491
  /**
3116
3492
  * 是否是App客户端
3493
+ * @returns 是否是App客户端
3494
+ * @example
3495
+ * ```ts
3496
+ * const isAppClient = await client.is_app_client
3497
+ * -> true
3498
+ * ```
3117
3499
  */
3118
3500
  get is_app_client(): boolean;
3501
+ /**
3502
+ * 检查App客户端参数是否完整
3503
+ * @returns
3504
+ */
3119
3505
  private validateAppClient;
3120
3506
  /**
3121
3507
  * 获取App实例
@@ -3198,6 +3584,24 @@ declare class GitHubClient {
3198
3584
  * ```
3199
3585
  */
3200
3586
  get_pull_request(): Promise<Pull_Request>;
3587
+ /**
3588
+ * 获取Workflow实例
3589
+ * @returns Workflow实例
3590
+ * @example
3591
+ * ```ts
3592
+ * const workflow = await GitHubClient.get_workflow()
3593
+ * ```
3594
+ */
3595
+ get_workflow(): Promise<Workflow>;
3596
+ /**
3597
+ * 获取Search实例
3598
+ * @returns Search实例
3599
+ * @example
3600
+ * ```ts
3601
+ * const search = await GitHubClient.get_search()
3602
+ * ```
3603
+ */
3604
+ get_search(): Promise<Search>;
3201
3605
  /**
3202
3606
  * 设置请求代理
3203
3607
  * @param proxy 代理参数
@@ -3209,10 +3613,19 @@ declare class GitHubClient {
3209
3613
  * })
3210
3614
  * ```
3211
3615
  */
3616
+ /**
3617
+ * 设置请求代理
3618
+ * @param proxy 代理参数
3619
+ * @example
3620
+ * setProxy({
3621
+ * type: 'http',
3622
+ * address: 'http://127.0.0.1:7890'
3623
+ * })
3624
+ */
3212
3625
  setProxy(proxy: ProxyParamsType): void;
3213
3626
  /**
3214
3627
  * 设置 token
3215
- * 传入的 token 必须以 ghu_ 或ghp_开头,否则会抛出错误
3628
+ * 传入的 token 必须以 ghu_ 或 ghp_ 或 ghs_ 开头,否则会抛出错误
3216
3629
  * @param token 传入的 token
3217
3630
  * @example
3218
3631
  * ```ts
@@ -3233,9 +3646,14 @@ declare class GitHubClient {
3233
3646
  * ```
3234
3647
  */
3235
3648
  private generate_jwt;
3649
+ /**
3650
+ * 获取当前请求的配置
3651
+ * @returns 当前请求的配置对象
3652
+ */
3653
+ private getCurrentRequestConfig;
3236
3654
  /**
3237
3655
  * 设置当前请求的配置
3238
- * @protected - 仅在类内部访问
3656
+ * @protected - 仅在父类与子类中方法中可访问
3239
3657
  * @param config - 配置对象,包含以下属性:
3240
3658
  * - url: 请求的URL
3241
3659
  * - token: 认证令牌
@@ -3386,6 +3804,14 @@ declare class App extends GitHubClient {
3386
3804
  * ```
3387
3805
  */
3388
3806
  create_access_token_for_app(options: CreateAccessTokenForAppParamType): Promise<ApiResponseType<CreateAccessTokenForAppResponseType>>;
3807
+ /**
3808
+ * 撤销应用程序访问令牌
3809
+ * @returns 撤销应用程序访问令牌
3810
+ * @example
3811
+ * ```ts
3812
+ * const res = await auth.revoke_access_token_for_app()
3813
+ * -> data: { 'success': true, 'message': '喵呜~ 访问令牌撤销成功' }
3814
+ */
3389
3815
  revoke_access_token_for_app(): Promise<ApiResponseType<RevokeAccessTokenResponseType>>;
3390
3816
  /**
3391
3817
  * 生成Github App 安装链接
@@ -3435,7 +3861,7 @@ declare class App extends GitHubClient {
3435
3861
  * const isInstalled = await app.is_app_inttalled_in_repo({ owner: 'owner', repo: 'repo' })
3436
3862
  * -> false
3437
3863
  */
3438
- is_app_installed_in_repo(options: RepoBaseParamType): Promise<boolean>;
3864
+ is_app_installed_in_repo(options: isAppInstalledInRepo): Promise<boolean>;
3439
3865
  }
3440
3866
 
3441
3867
  type index_App = App;
@@ -3454,12 +3880,16 @@ type index_Pull_Request = Pull_Request;
3454
3880
  declare const index_Pull_Request: typeof Pull_Request;
3455
3881
  type index_Repo = Repo;
3456
3882
  declare const index_Repo: typeof Repo;
3883
+ type index_Search = Search;
3884
+ declare const index_Search: typeof Search;
3457
3885
  type index_User = User;
3458
3886
  declare const index_User: typeof User;
3459
3887
  type index_WebHook = WebHook;
3460
3888
  declare const index_WebHook: typeof WebHook;
3889
+ type index_Workflow = Workflow;
3890
+ declare const index_Workflow: typeof Workflow;
3461
3891
  declare namespace index {
3462
- export { index_App as App, index_Auth as Auth, index_Commit as Commit, index_GitHubClient as GitHubClient, index_Issue as Issue, index_Org as Org, index_Pull_Request as Pull_Request, index_Repo as Repo, index_User as User, index_WebHook as WebHook };
3892
+ export { index_App as App, index_Auth as Auth, index_Commit as Commit, index_GitHubClient as GitHubClient, index_Issue as Issue, index_Org as Org, index_Pull_Request as Pull_Request, index_Repo as Repo, index_Search as Search, index_User as User, index_WebHook as WebHook, index_Workflow as Workflow };
3463
3893
  }
3464
3894
 
3465
3895
  /** 基本客户端 */
@@ -3468,4 +3898,4 @@ declare class Client {
3468
3898
  constructor(options: ClientType);
3469
3899
  }
3470
3900
 
3471
- export { type AccessCodeType, type AccessTokenClentTYpe, type AccessTokenPermissionsType, type AccessTokenType, type AddCollaboratorResponseType, type AddMemberParamType, type AddMemberResponseType, type ApiResponseType, type AppClientType, type AppInfoParamType, type AppInfoResponseType, type AppPermissions, type AppRepoInfoResponseType, type AppUser, type CheckTokenResponseType, Client, type ClientType, type CloseIssueParamType, type CloseIssueResponseType, type CollaboratorInfoResponseType, type CollaboratorParamType, type CollaboratorPermissionType, type CommentIdParamType, type Commit$1 as Commit, type CommitInfoCommonParamType, type CommitInfoParamType, type CommitInfoResponseType, type CommitListParamType, type CommitListResponseType, type CommitStats, type CommonProxyType, type ContributionData, type ContributionResult, type CreateAccessTokenForAppParamType, type CreateAccessTokenForAppResponseType, type CreateIssueResponseType, type CreatePullRequestCommentParamType, type CreatePullRequestCommentResponseType, type CreatePullRequestParamType, type CreatePullRequestResponseType, type CreateReleaseParamType, type CreateReleaseResponseType, type CreateSubIssueParamType, type CreateSubIssueResponseType, type CreteIssueCommentParamType, type CreteIssueCommentResponseType, type CreteIssueParamType, type DeletePullRequestCommentParamType, type DeletePullRequestCommentResponseType, type DeleteReleaseParamType, type DeleteReleaseResponseType, type DiffEntry, type ExecOptions, type ExecReturn, type ExecType, type GetAppInfoByOrgParamType, type GetAppInfoByOrgResponseType, type GetAppInfoByRepoParamType, type GetAppInfoByRepoResponseType, type GetAppInfoByUserParamType, type GetAppInfoByUserResponseType, type GetCollaboratorListParamType, type GetCollaboratorListResponseType, type GetPullRequestCommentInfoParamType, type GetPullRequestCommentInfoResponseType, type GetPullRequestCommentsListParamType, type GetPullRequestCommentsListResponseType, type GetPullRequestFilesListParamType, type GetPullRequestFilesListResponseType, type GetRepoDefaultBranchParamType, type GetRepoDefaultBranchResponseType, type GetRepoMainLanguageParamType, type GetRepoMainLanguageResponseType, type GetRepoVisibilityParamType, type GetRepoVisibilityResponseType, type GitHubBaseClient, GitHubClient, type GitHubClientType, type GitType, type GitUser, type HttpProxyType, type HttpsProxyType, type IssueCommentInfoParamType, type IssueCommentInfoResponseType, type IssueCommentListParamType, type IssueCommentListResponseType, type IssueInfoParamType, type IssueInfoResponseType, type IssueLabelType, type IssueListResponseType, type IssueNumberParamType, type IssueUser, type LanguageInfo, type LockIssueParamType, type LockIssueResponseType, type MergeMethodType, type MergePullRequestParamType, type MergePullRequestResponseType, type MilestoneType, type OpenIssueParamType, type OpenIssueResponseType, type OrgInfoParamType, type OrgInfoResponseType, type OrgNameParamType, type OrgRepoCreateParamType, type OrgRepoCreateResponseType, type OrgRepoListParmType, type OrgRepoListResponseType, type ParentCommit, type PkgInfoType, type PrRepo, type PrUser, type ProxyParamsType, type ProxyType, type ProxyUrlType, type PullRequestFilesListType, type PullRequestInfoParamType, type PullRequestInfoResponseType, type PullRequestListParamType, type PullRequestListResponseType, type PullRequestNumberParamType, type ReactionInfoType, type RefreshTokenResponseType, type RefreshTokenType, type ReleaseAssetsType, type ReleaseInfoByTagParamType, type ReleaseInfoByTagResponseType, type ReleaseInfoParamType, type ReleaseInfoResponseType, type ReleaseLatestParamTypeType, type ReleaseLatestResponseType, type ReleaseListParamType, type ReleaseListResponseType, type ReleaseUser, type RemoveCollaboratorParamType, type RemoveCollaboratorResponseType, type RemoveIssueCommentParamType, type RemoveIssueCommentResponseType, type RemoveSubIssueParamType, type RemoveSubIssueResponseType, type RepoBaseParamType, type RepoCommentListParamType, type RepoCommentListResponseType, type RepoInfoParamType, type RepoInfoResponseType, type RepoIssueListParamType, type RepoLanguagesListParamType, type RepoLanguagesListResponseType, type RepoListBaseParamType, type RepoNameParamType, type RepoOwnerParamType, type RepoParamType, type RepoUrlParamType, type RepoUser, type ReprioritizeSubIssueParamType, type ReprioritizeSubIssueResponseType, type RequestConfigType, type RequestTokenType, type ResponseHeadersType, type ResponseMsgType, type ResponseStatusCodeType, type ResponseSuccessType, type ResponseType, type ReverseProxyType, type RevokeAccessTokenResponseType, type ShaParamType, type Socks5ProxyType, type SocksProxyType, type SubIssueListParamType, type SubIssueListResponseType, type TokenResponseType, type UnLockIssueParamType, type UnLockIssueResponseType, type UpdateIssueCommentParamType, type UpdateIssueCommentResponseType, type UpdateIssueParamType, type UpdateIssueResponseType, type UpdatePullRequestCommentParamType, type UpdatePullRequestCommentResponseType, type UpdatePullRequestParamType, type UpdatePullRequestResponseType, type UpdateReleaseParamType, type UpdateReleaseResponseType, type UserByTokenRepoListParamType, type UserIdParamType, type UserInfoByIdParamType, type UserInfoParamType, type UserInfoResponseType, type UserNameParamType, type UserRepoCreateParamType, type UserRepoCreateResponseType, type UserRepoListParamType, type UserRepoListType, type WebHookSignatureParamType, type WebHookSignatureResponseType, create_state_id, Client as default, type formatParamType, format_date, get_langage_color, get_local_repo_default_branch, get_relative_time, get_remote_repo_default_branch, index as github };
3901
+ export { type AccessCodeType, type AccessTokenClentTYpe, type AccessTokenPermissionsType, type AccessTokenType, type AddCollaboratorResponseType, type AddMemberParamType, type AddMemberResponseType, type ApiResponseType, type AppClientType, type AppInfoParamType, type AppInfoResponseType, type AppPermissions, type AppRepoInfoResponseType, type AppUser, type BaseProxyType, type CheckTokenResponseType, Client, type ClientType, type CloseIssueParamType, type CloseIssueResponseType, type CollaboratorInfoResponseType, type CollaboratorParamType, type CollaboratorPermissionType, type CommentIdParamType, type Commit$1 as Commit, type CommitInfoCommonParamType, type CommitInfoParamType, type CommitInfoResponseType, type CommitListParamType, type CommitListResponseType, type CommitStats, type ContributionData, type ContributionResult, type CreateAccessTokenForAppParamType, type CreateAccessTokenForAppResponseType, type CreateIssueResponseType, type CreatePullRequestCommentParamType, type CreatePullRequestCommentResponseType, type CreatePullRequestParamType, type CreatePullRequestResponseType, type CreateReleaseParamType, type CreateReleaseResponseType, type CreateSubIssueParamType, type CreateSubIssueResponseType, type CreteIssueCommentParamType, type CreteIssueCommentResponseType, type CreteIssueParamType, type DeletePullRequestCommentParamType, type DeletePullRequestCommentResponseType, type DeleteReleaseParamType, type DeleteReleaseResponseType, type DiffEntry, type DisEnableRepoWorkflowParamType, type DisEnableRepoWorkflowResponseType, type EnableRepoWorkflowParamType, type EnableRepoWorkflowResponseType, type GetAppInfoByOrgParamType, type GetAppInfoByOrgResponseType, type GetAppInfoByRepoParamType, type GetAppInfoByRepoResponseType, type GetAppInfoByUserParamType, type GetAppInfoByUserResponseType, type GetCollaboratorListParamType, type GetCollaboratorListResponseType, type GetPullRequestCommentInfoParamType, type GetPullRequestCommentInfoResponseType, type GetPullRequestCommentsListParamType, type GetPullRequestCommentsListResponseType, type GetPullRequestFilesListParamType, type GetPullRequestFilesListResponseType, type GetRepoDefaultBranchParamType, type GetRepoDefaultBranchResponseType, type GetRepoMainLanguageParamType, type GetRepoMainLanguageResponseType, type GetRepoVisibilityParamType, type GetRepoVisibilityResponseType, type GetRepoWorkflowsList, type GetRepoWorkflowsListResponseType, type GitHubBaseClient, GitHubClient, type GitHubClientType, type GitRepoType, type GitType, type GitUser, type IssueCommentInfoParamType, type IssueCommentInfoResponseType, type IssueCommentsListParamType, type IssueCommentsListResponseType, type IssueInfoParamType, type IssueInfoResponseType, type IssueLabelType, type IssueListResponseType, type IssueNumberParamType, type IssueUser, type LanguageInfo, type LocalGitInfoListOptionsType, type LocalGitInfoListType, type LocalGitInfoType, type LockIssueParamType, type LockIssueResponseType, type MergeMethodType, type MergePullRequestParamType, type MergePullRequestResponseType, type MilestoneType, type OpenIssueParamType, type OpenIssueResponseType, type OrgInfoParamType, type OrgInfoResponseType, type OrgNameParamType, type OrgRepoCreateParamType, type OrgRepoCreateResponseType, type OrgRepoListParmType, type OrgRepoListResponseType, type ParentCommit, type PkgInfoType, type PrRepo, type PrUser, type ProxyParamsType, ProxyProtocol, ProxyType, type ProxyUrlType, type PullRequestFilesListType, type PullRequestInfoParamType, type PullRequestInfoResponseType, type PullRequestListParamType, type PullRequestListResponseType, type PullRequestNumberParamType, type ReRunRepoWorkflowParamType, type ReRunRepoWorkflowResponseType, type ReactionInfoType, type RefreshTokenResponseType, type RefreshTokenType, type ReleaseAssetsType, type ReleaseInfoByTagParamType, type ReleaseInfoByTagResponseType, type ReleaseInfoParamType, type ReleaseInfoResponseType, type ReleaseLatestParamTypeType, type ReleaseLatestResponseType, type ReleaseListParamType, type ReleaseListResponseType, type ReleaseUser, type RemoveCollaboratorParamType, type RemoveCollaboratorResponseType, type RemoveIssueCommentParamType, type RemoveIssueCommentResponseType, type RemoveSubIssueParamType, type RemoveSubIssueResponseType, type RepoBaseParamType, type RepoCommentsListParamType, type RepoCommentsListResponseType, type RepoInfoParamType, type RepoInfoResponseType, type RepoIssueListParamType, type RepoLanguagesListParamType, type RepoLanguagesListResponseType, type RepoListBaseParamType, type RepoNameParamType, type RepoOwnerParamType, type RepoParamType, type RepoUrlParamType, type RepoUser, type ReprioritizeSubIssueParamType, type ReprioritizeSubIssueResponseType, type RequestConfigType, type RequestTokenType, type ResponseHeadersType, type ResponseMsgType, type ResponseStatusCodeType, type ResponseSuccessType, type ResponseType, type RevokeAccessTokenResponseType, type RoleNameType, type RunRepoWorkflow, type RunRepoWorkflowResponseType, type SearchRepo, type SearchReposParamType, type SearchReposResponseType, type SearchUser, type SearchUsersParamType, type SearchUsersResponseType, type ShaParamType, type SubIssueListParamType, type SubIssueListResponseType, type TokenResponseType, type UnLockIssueParamType, type UnLockIssueResponseType, type UpdateIssueCommentParamType, type UpdateIssueCommentResponseType, type UpdateIssueParamType, type UpdateIssueResponseType, type UpdatePullRequestCommentParamType, type UpdatePullRequestCommentResponseType, type UpdatePullRequestParamType, type UpdatePullRequestResponseType, type UpdateReleaseParamType, type UpdateReleaseResponseType, type UserByTokenRepoListParamType, type UserIdParamType, type UserInfoByIdParamType, type UserInfoParamType, type UserInfoResponseType, type UserNameParamType, type UserRepoCreateParamType, type UserRepoCreateResponseType, type UserRepoListParamType, type UserRepoListType, type WebHookSignatureParamType, type WebHookSignatureResponseType, type WorkflowInfoParamType, type WorkflowInfoResponseType, WorkflowState, create_state_id, Client as default, type formatParamType, format_date, get_langage_color, get_local_git_repo_info, get_local_git_repo_list, get_local_repo_default_branch, get_relative_time, get_remote_repo_default_branch, index as github, type isAppInstalledInRepo, type workflowIdParamType };