@candriajs/git-neko-kit 0.7.7 → 0.8.1
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/README.md +46 -8
- package/dist/exports/axios.d.ts +3 -0
- package/dist/exports/dayjs.cjs +1 -0
- package/dist/exports/dayjs.d.ts +1 -0
- package/dist/exports/dayjs.mjs +1 -0
- package/dist/exports/lodash.cjs +1 -0
- package/dist/exports/lodash.d.ts +1 -0
- package/dist/exports/lodash.mjs +1 -0
- package/dist/exports/simple-git.cjs +1 -0
- package/dist/exports/simple-git.d.ts +2 -0
- package/dist/exports/simple-git.mjs +1 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +993 -450
- package/dist/index.mjs +6 -6
- package/dist/root.cjs +1 -1
- package/dist/root.mjs +1 -1
- package/package.json +17 -1
package/dist/index.d.ts
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
import { RawAxiosResponseHeaders, AxiosResponseHeaders } from 'axios';
|
2
|
+
import { ExecException, exec } from 'child_process';
|
3
|
+
|
1
4
|
/** 代理地址类型 */
|
2
5
|
type ProxyUrlType = string;
|
3
6
|
/** 代理类型 */
|
4
7
|
type ProxyType = 'reverse' | 'common';
|
5
8
|
/** Git类型 */
|
6
|
-
type
|
9
|
+
type GitType = 'github' | 'gitee' | 'gitcode';
|
7
10
|
/**
|
8
11
|
* 通用代理配置
|
9
12
|
*/
|
@@ -64,7 +67,7 @@ type RequestTokenType = 'Bearer' | 'Basic';
|
|
64
67
|
interface RequestConfigType {
|
65
68
|
/** 请求地址 */
|
66
69
|
url?: string;
|
67
|
-
/**
|
70
|
+
/** 访问令牌令牌 */
|
68
71
|
token?: string | null;
|
69
72
|
/** 令牌类型,默认为 Bearer,即使用 Bearer 令牌 */
|
70
73
|
tokenType?: RequestTokenType;
|
@@ -77,7 +80,7 @@ type ResponseStatusCodeType = number;
|
|
77
80
|
/** 消息响应类型 */
|
78
81
|
type ResponseMsgType = string;
|
79
82
|
/** 响应头类型 */
|
80
|
-
type ResponseHeadersType =
|
83
|
+
type ResponseHeadersType = RawAxiosResponseHeaders | AxiosResponseHeaders;
|
81
84
|
/** 响应类型 */
|
82
85
|
interface ResponseType<D = any> {
|
83
86
|
success: ResponseSuccessType;
|
@@ -112,6 +115,34 @@ interface ContributionResult {
|
|
112
115
|
*/
|
113
116
|
contributions: ContributionData[][];
|
114
117
|
}
|
118
|
+
/**
|
119
|
+
* 执行 shell 命令返回类型
|
120
|
+
*/
|
121
|
+
interface ExecType {
|
122
|
+
/** 是否执行成功 */
|
123
|
+
status: boolean;
|
124
|
+
/** 错误对象,如果命令执行失败则包含错误信息 */
|
125
|
+
error: ExecException | null;
|
126
|
+
/** 标准错误输出 */
|
127
|
+
stderr: string;
|
128
|
+
/** 标准输出 */
|
129
|
+
stdout: string;
|
130
|
+
}
|
131
|
+
/**
|
132
|
+
* 执行 shell 命令返回类型泛型
|
133
|
+
*/
|
134
|
+
type ExecReturn<K extends boolean> = K extends true ? boolean : ExecType;
|
135
|
+
/**
|
136
|
+
* 执行 shell 命令参数
|
137
|
+
*/
|
138
|
+
type ExecOptions<T extends boolean> = Parameters<typeof exec>[1] & {
|
139
|
+
/** 是否打印日志 默认不打印 */
|
140
|
+
log?: boolean;
|
141
|
+
/** 是否只返回布尔值 表示命令是否成功执行 优先级比抛错误高 */
|
142
|
+
booleanResult?: T;
|
143
|
+
/** 是否去除日志中的换行符 默认不去除 */
|
144
|
+
trim?: boolean;
|
145
|
+
};
|
115
146
|
|
116
147
|
interface AccessTokenType {
|
117
148
|
/** 访问令牌 */
|
@@ -129,7 +160,7 @@ interface UserNameParamType {
|
|
129
160
|
/** 用户名 */
|
130
161
|
username: string;
|
131
162
|
}
|
132
|
-
interface
|
163
|
+
interface OrgNameParamType {
|
133
164
|
/** 组织登录名 */
|
134
165
|
org: string;
|
135
166
|
}
|
@@ -175,26 +206,47 @@ type RepoParamType = RepoBaseParamType | RepoUrlParamType;
|
|
175
206
|
/**
|
176
207
|
* 议题参数
|
177
208
|
*/
|
178
|
-
interface
|
209
|
+
interface IssueNumberParamType {
|
179
210
|
/** 问题id */
|
180
|
-
|
211
|
+
issue_number: number | string;
|
181
212
|
}
|
182
|
-
/**
|
213
|
+
/**
|
214
|
+
* 拉取请求ID参数
|
215
|
+
*/
|
216
|
+
interface PullRequestNumberParamType {
|
217
|
+
/** 拉取请求id */
|
218
|
+
pr_number: number;
|
219
|
+
}
|
220
|
+
interface CommentIdParamType {
|
221
|
+
/** 评论id */
|
222
|
+
comment_id: number | string;
|
223
|
+
}
|
224
|
+
/** App 客户端类型 */
|
183
225
|
interface AppClientType {
|
184
226
|
/** App Client ID */
|
185
|
-
Client_ID
|
227
|
+
Client_ID?: string | null;
|
186
228
|
/** App Client Secret */
|
187
|
-
Client_Secret
|
229
|
+
Client_Secret?: string | null;
|
188
230
|
/** 私钥内容 */
|
189
|
-
Private_Key
|
231
|
+
Private_Key?: string | null;
|
190
232
|
/** WebHook Secret */
|
191
|
-
WebHook_Secret
|
192
|
-
|
193
|
-
|
233
|
+
WebHook_Secret?: string | null;
|
234
|
+
}
|
235
|
+
/** 访问令牌客户端类型 */
|
236
|
+
interface AccessTokenClentTYpe {
|
237
|
+
/** 访问令牌 */
|
238
|
+
access_token?: string | null;
|
194
239
|
}
|
195
240
|
|
241
|
+
/** GitHub客户端类型 */
|
242
|
+
type GitHubBaseClient = AppClientType | AccessTokenClentTYpe;
|
243
|
+
type GitHubClientType = GitHubBaseClient & {
|
244
|
+
/** 是否格式化 */
|
245
|
+
readonly format?: formatParamType['format'];
|
246
|
+
};
|
247
|
+
/** 客户端类型 */
|
196
248
|
interface ClientType {
|
197
|
-
github:
|
249
|
+
github: GitHubClientType;
|
198
250
|
}
|
199
251
|
|
200
252
|
/** 用户信息参数类型 */
|
@@ -379,8 +431,6 @@ interface CheckTokenResponseType {
|
|
379
431
|
interface CommitInfoCommonParamType {
|
380
432
|
/** 提交SHA */
|
381
433
|
sha?: ShaParamType['sha'];
|
382
|
-
/** 是否格式化消息和日期 */
|
383
|
-
format?: formatParamType['format'];
|
384
434
|
}
|
385
435
|
/** Git提交用户信息 */
|
386
436
|
interface GitUser extends Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'> {
|
@@ -486,8 +536,6 @@ type CommitListParamType = RepoParamType & {
|
|
486
536
|
per_page?: number;
|
487
537
|
/** 要获取的结果页码,默认: 1 */
|
488
538
|
page?: number;
|
489
|
-
/** 是否格式化消息和日期 */
|
490
|
-
format?: formatParamType['format'];
|
491
539
|
};
|
492
540
|
/** 提交列表响应类型 */
|
493
541
|
type CommitListResponseType = CommitInfoResponseType[];
|
@@ -511,8 +559,8 @@ interface MilestoneType {
|
|
511
559
|
url: string;
|
512
560
|
/** 里程碑编号 */
|
513
561
|
number: number;
|
514
|
-
/** 里程碑状态: open/closed
|
515
|
-
state:
|
562
|
+
/** 里程碑状态: open/closed */
|
563
|
+
state: 'open' | 'closed';
|
516
564
|
/** 里程碑标题 */
|
517
565
|
title: string;
|
518
566
|
/** 里程碑描述 */
|
@@ -531,14 +579,11 @@ interface MilestoneType {
|
|
531
579
|
due_on: string | null;
|
532
580
|
}
|
533
581
|
/** 议题信息参数类型 */
|
534
|
-
type IssueInfoParamType = RepoBaseParamType &
|
535
|
-
/** 议题ID */
|
536
|
-
issue_number: IssueIdParamType['issue_id'];
|
537
|
-
};
|
582
|
+
type IssueInfoParamType = RepoBaseParamType & IssueNumberParamType;
|
538
583
|
/** 议题详情响应类型 */
|
539
584
|
interface IssueInfoResponseType {
|
540
585
|
/** 议题ID */
|
541
|
-
id:
|
586
|
+
id: IssueNumberParamType['issue_number'];
|
542
587
|
/** 议题HTML页面URL */
|
543
588
|
html_url: string;
|
544
589
|
/** 议题编号 */
|
@@ -674,7 +719,7 @@ type CreateIssueResponseType = IssueInfoResponseType;
|
|
674
719
|
/** 更新议题参数类型 */
|
675
720
|
interface UpdateIssueParamType extends Omit<CreteIssueParamType, 'title' | 'type'> {
|
676
721
|
/** 问题ID */
|
677
|
-
issue_number:
|
722
|
+
issue_number: IssueNumberParamType['issue_number'];
|
678
723
|
/** 问题的名称 */
|
679
724
|
title?: string | null;
|
680
725
|
/** 问题的内容 */
|
@@ -685,10 +730,7 @@ interface UpdateIssueParamType extends Omit<CreteIssueParamType, 'title' | 'type
|
|
685
730
|
/** 更新议题响应类型 */
|
686
731
|
type UpdateIssueResponseType = IssueInfoResponseType;
|
687
732
|
/** 打开议题参数类型 */
|
688
|
-
|
689
|
-
/** 议题ID */
|
690
|
-
issue_number: IssueIdParamType['issue_id'];
|
691
|
-
}
|
733
|
+
type OpenIssueParamType = RepoBaseParamType & IssueNumberParamType;
|
692
734
|
/** 打开议题响应类型 */
|
693
735
|
type OpenIssueResponseType = IssueInfoResponseType;
|
694
736
|
/** 关闭议题参数类型 */
|
@@ -698,7 +740,7 @@ type CloseIssueResponseType = IssueInfoResponseType;
|
|
698
740
|
/** 锁定议题参数类型 */
|
699
741
|
interface LockIssueParamType extends RepoBaseParamType {
|
700
742
|
/** 议题ID */
|
701
|
-
issue_number:
|
743
|
+
issue_number: IssueNumberParamType['issue_number'];
|
702
744
|
/**
|
703
745
|
* 锁定原因
|
704
746
|
* 可以是以下之一:
|
@@ -812,7 +854,7 @@ type IssueCommentListResponseType = IssueCommentInfoResponseType[];
|
|
812
854
|
/** 创建议题评论参数类型 */
|
813
855
|
interface CreteIssueCommentParamType extends RepoBaseParamType {
|
814
856
|
/** 议题ID */
|
815
|
-
issue_number:
|
857
|
+
issue_number: IssueNumberParamType['issue_number'];
|
816
858
|
/** 评论内容 */
|
817
859
|
body: string;
|
818
860
|
}
|
@@ -838,7 +880,7 @@ interface RemoveIssueCommentResponseType {
|
|
838
880
|
/** 获取子议题列表参数类型 */
|
839
881
|
interface SubIssueListParamType extends RepoBaseParamType {
|
840
882
|
/** 议题ID */
|
841
|
-
issue_number:
|
883
|
+
issue_number: IssueNumberParamType['issue_number'];
|
842
884
|
/**
|
843
885
|
* 每页结果数量
|
844
886
|
* @default 30
|
@@ -855,9 +897,9 @@ type SubIssueListResponseType = IssueInfoResponseType[];
|
|
855
897
|
/** 添加子议题参数类型 */
|
856
898
|
interface AddSubIssueParamType extends RepoBaseParamType {
|
857
899
|
/** 议题ID */
|
858
|
-
issue_number:
|
900
|
+
issue_number: IssueNumberParamType['issue_number'];
|
859
901
|
/** * 子议题ID */
|
860
|
-
sub_issue_id:
|
902
|
+
sub_issue_id: IssueNumberParamType['issue_number'];
|
861
903
|
/** * 是否替换父议题 */
|
862
904
|
replace_parent: boolean;
|
863
905
|
}
|
@@ -866,160 +908,32 @@ type AddSubIssueResponseType = IssueInfoResponseType;
|
|
866
908
|
/** 删除子议题参数类型 */
|
867
909
|
interface RemoveSubIssueParamType extends RepoBaseParamType {
|
868
910
|
/** 议题ID */
|
869
|
-
issue_number:
|
911
|
+
issue_number: IssueNumberParamType['issue_number'];
|
870
912
|
/** 子议题ID */
|
871
|
-
sub_issue_id:
|
913
|
+
sub_issue_id: IssueNumberParamType['issue_number'];
|
872
914
|
}
|
873
915
|
/** 删除子议题响应类型 */
|
874
916
|
type RemoveSubIssueResponseType = IssueInfoResponseType;
|
875
917
|
/** 重新确定子议题优先级参数类型 */
|
876
918
|
interface ReprioritizeSubIssueParamType extends RepoBaseParamType {
|
877
919
|
/** 议题ID */
|
878
|
-
issue_number:
|
920
|
+
issue_number: IssueNumberParamType['issue_number'];
|
879
921
|
/** 子议题ID */
|
880
|
-
sub_issue_id:
|
922
|
+
sub_issue_id: IssueNumberParamType['issue_number'];
|
881
923
|
/**
|
882
924
|
* 要优先排序的子问题的 ID(与 before_id 互斥,只能指定其中一个)
|
883
925
|
* 在此 ID 之后放置子问题
|
884
926
|
*/
|
885
|
-
after_id?:
|
927
|
+
after_id?: IssueNumberParamType['issue_number'];
|
886
928
|
/**
|
887
929
|
* 要优先排序的子问题的 ID(与 after_id 互斥,只能指定其中一个)
|
888
930
|
* 在此 ID 之前放置子问题
|
889
931
|
*/
|
890
|
-
before_id?:
|
932
|
+
before_id?: IssueNumberParamType['issue_number'];
|
891
933
|
}
|
892
934
|
/** 重新确定子议题优先级响应类型 */
|
893
935
|
type ReprioritizeSubIssueResponseType = IssueInfoResponseType;
|
894
936
|
|
895
|
-
/** 组织信息参数类型 */
|
896
|
-
interface OrgInfoParamType {
|
897
|
-
/** 组织名称 */
|
898
|
-
org: string;
|
899
|
-
}
|
900
|
-
/** 组织信息响应类型 */
|
901
|
-
interface OrgInfoResponseType {
|
902
|
-
/** 组织ID */
|
903
|
-
id: number;
|
904
|
-
/** 组织名称 */
|
905
|
-
login: string;
|
906
|
-
/** 组织描述 */
|
907
|
-
name: string;
|
908
|
-
/** 组织头像 */
|
909
|
-
avatar_url: string;
|
910
|
-
/** 组织描述 */
|
911
|
-
description: string;
|
912
|
-
/** 组织地址 */
|
913
|
-
html_url: string;
|
914
|
-
}
|
915
|
-
|
916
|
-
type ReleaseUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'>;
|
917
|
-
/** 反应信息类型 */
|
918
|
-
interface ReactionInfoType {
|
919
|
-
/** 反应 API URL */
|
920
|
-
url: string;
|
921
|
-
/** 总反应数 */
|
922
|
-
total_count: number;
|
923
|
-
/** 👍 反应数 */
|
924
|
-
'+1': number;
|
925
|
-
/** 👎 反应数 */
|
926
|
-
'-1': number;
|
927
|
-
/** 😄 反应数 */
|
928
|
-
laugh: number;
|
929
|
-
/** 😕 反应数 */
|
930
|
-
confused: number;
|
931
|
-
/** ❤️ 反应数 */
|
932
|
-
heart: number;
|
933
|
-
/** 🎉 反应数 */
|
934
|
-
hooray: number;
|
935
|
-
/** 👀 反应数 */
|
936
|
-
eyes: number;
|
937
|
-
/** 🚀 反应数 */
|
938
|
-
rocket: number;
|
939
|
-
}
|
940
|
-
/** 发布资源类型 */
|
941
|
-
interface ReleaseAssetsType {
|
942
|
-
/** 资源 URL */
|
943
|
-
url: string;
|
944
|
-
/** 资源下载 URL */
|
945
|
-
browser_download_url: string;
|
946
|
-
}
|
947
|
-
/** 获取Release信息参数类型 */
|
948
|
-
type ReleaseInfoParamType = RepoBaseParamType & {
|
949
|
-
/** 发布ID */
|
950
|
-
release_id: number;
|
951
|
-
};
|
952
|
-
/** 获Release信息响应类型 */
|
953
|
-
interface ReleaseInfoResponseType {
|
954
|
-
/**
|
955
|
-
* 发布版本的 ID
|
956
|
-
* 该字段在gitcode平台为null
|
957
|
-
*/
|
958
|
-
id: number | null;
|
959
|
-
/** 标签名称 */
|
960
|
-
tag_name: string;
|
961
|
-
/** 目标分支或提交 */
|
962
|
-
target_commitish: string;
|
963
|
-
/** 发布版本名称 */
|
964
|
-
name: string | null;
|
965
|
-
/** 发布说明 */
|
966
|
-
body: string | null;
|
967
|
-
/** 是否为预发布版本 */
|
968
|
-
prerelease: boolean;
|
969
|
-
/** 发布者信息 */
|
970
|
-
author: ReleaseUser;
|
971
|
-
/** 发布资源列表 */
|
972
|
-
assets: Array<ReleaseAssetsType>;
|
973
|
-
/** 发布时间 */
|
974
|
-
created_at: string;
|
975
|
-
}
|
976
|
-
/** 获取最新Release参数类型 */
|
977
|
-
type ReleaseLatestParamTypeType = RepoBaseParamType;
|
978
|
-
/** 获取最新Release响应类型 */
|
979
|
-
type ReleaseLatestResponseType = ReleaseInfoResponseType;
|
980
|
-
/** 通过Tag获取Release信息参数类型 */
|
981
|
-
type ReleaseInfoByTagParamType = RepoBaseParamType & {
|
982
|
-
/** 标签名称 */
|
983
|
-
tag: string;
|
984
|
-
};
|
985
|
-
/** 通过Tag获取Release信息响应类型 */
|
986
|
-
type ReleaseInfoByTagResponseType = ReleaseInfoResponseType;
|
987
|
-
/** 获取Release列表参数类型 */
|
988
|
-
type ReleaseListParamType = RepoBaseParamType & {
|
989
|
-
/** 每页数量 */
|
990
|
-
per_page?: number;
|
991
|
-
/** 页码 */
|
992
|
-
page?: number;
|
993
|
-
};
|
994
|
-
/** 获取Release列表响应类型 */
|
995
|
-
type ReleaseListResponseType = Array<ReleaseInfoResponseType>;
|
996
|
-
/** 创建Release参数类型 */
|
997
|
-
type CreateReleaseParamType = RepoBaseParamType & {
|
998
|
-
/** 标签名称 */
|
999
|
-
tag_name: string;
|
1000
|
-
/** 目标分支或提交 */
|
1001
|
-
target_commitish: string;
|
1002
|
-
/** 发布版本名称 */
|
1003
|
-
name: string;
|
1004
|
-
/** 发布说明 */
|
1005
|
-
body: string;
|
1006
|
-
/** 是否为预发布版本 */
|
1007
|
-
prerelease: boolean;
|
1008
|
-
};
|
1009
|
-
/** 获取Release列表参数类型 */
|
1010
|
-
type CreateReleaseResponseType = ReleaseInfoResponseType;
|
1011
|
-
/** 更新Release参数类型 */
|
1012
|
-
type UpdateReleaseParamType = CreateReleaseParamType;
|
1013
|
-
/** 更新Release响应类型 */
|
1014
|
-
type UpdateReleaseResponseType = ReleaseInfoResponseType;
|
1015
|
-
/** 删除Release参数类型 */
|
1016
|
-
type DeleteReleaseParamType = ReleaseInfoParamType;
|
1017
|
-
/** 删除Release响应类型 */
|
1018
|
-
interface DeleteReleaseResponseType {
|
1019
|
-
/** 删除信息 */
|
1020
|
-
info: string;
|
1021
|
-
}
|
1022
|
-
|
1023
937
|
/** 仓库所有者参数类型 */
|
1024
938
|
type RepoUser = Omit<UserInfoResponseType, 'followers' | 'following' | 'blog' | 'bio' | 'public_repos'>;
|
1025
939
|
/** 仓库列表参数类型 */
|
@@ -1040,112 +954,9 @@ interface UserByTokenRepoListParamType extends RepoListBaseParamType {
|
|
1040
954
|
affiliation?: 'owner' | 'collaborator' | 'organization_member';
|
1041
955
|
/** 类型,可选all, owner, member, 默认为 all */
|
1042
956
|
type?: 'all' | 'owner' | 'member';
|
1043
|
-
/** 是否格式化日期 */
|
1044
|
-
format?: formatParamType['format'];
|
1045
957
|
}
|
1046
958
|
/** 仓库信息请求参数 */
|
1047
|
-
type RepoInfoParamType = RepoBaseParamType
|
1048
|
-
/** 是否格式化日期 */
|
1049
|
-
format?: formatParamType['format'];
|
1050
|
-
};
|
1051
|
-
/** 许可证信息 */
|
1052
|
-
interface License {
|
1053
|
-
/** * 许可证的键,例如 'mit' */
|
1054
|
-
key: string;
|
1055
|
-
/** * 许可证的名称,例如 'MIT License' */
|
1056
|
-
name: string;
|
1057
|
-
/** * 许可证的 SPDX ID,例如 'MIT' */
|
1058
|
-
spdx_id: string;
|
1059
|
-
/** * 许可证的 URL 地址 */
|
1060
|
-
url: string | null;
|
1061
|
-
/** * 许可证的 HTML URL */
|
1062
|
-
html_url?: string;
|
1063
|
-
/** * 许可证的节点 ID */
|
1064
|
-
node_id: string;
|
1065
|
-
}
|
1066
|
-
/** 仓库行为准则 */
|
1067
|
-
interface CodeOfConduct {
|
1068
|
-
/** * 行为准则的键 */
|
1069
|
-
key: string;
|
1070
|
-
/** * 行为准则的名称 */
|
1071
|
-
name: string;
|
1072
|
-
/** * 行为准则的 URL */
|
1073
|
-
url: string;
|
1074
|
-
/** * 行为准则的主体 */
|
1075
|
-
body?: string;
|
1076
|
-
/** * 行为准则的 HTML URL */
|
1077
|
-
html_url: string | null;
|
1078
|
-
}
|
1079
|
-
/** 仓库高级安全状态 */
|
1080
|
-
interface SecurityAnalysisAdvancedSecurity {
|
1081
|
-
/** * 高级安全状态 */
|
1082
|
-
status: string;
|
1083
|
-
}
|
1084
|
-
/** Dependabot 安全更新状态 */
|
1085
|
-
interface SecurityAnalysisDependabotSecurityUpdates {
|
1086
|
-
/** * Dependabot 安全更新状态 */
|
1087
|
-
status: string;
|
1088
|
-
}
|
1089
|
-
/** 秘钥扫描状态 */
|
1090
|
-
interface SecurityAnalysisSecretScanning {
|
1091
|
-
/** * 秘钥扫描状态 */
|
1092
|
-
status: string;
|
1093
|
-
}
|
1094
|
-
/** 秘钥扫描推送保护状态 */
|
1095
|
-
interface SecurityAnalysisSecretScanningPushProtection {
|
1096
|
-
/** * 秘钥扫描推送保护状态 */
|
1097
|
-
status: string;
|
1098
|
-
}
|
1099
|
-
/** 仓库安全和分析设置 */
|
1100
|
-
interface SecurityAndAnalysis {
|
1101
|
-
/** * 高级安全设置 */
|
1102
|
-
advanced_security?: SecurityAnalysisAdvancedSecurity;
|
1103
|
-
/** * Dependabot 安全更新设置 */
|
1104
|
-
dependabot_security_updates?: SecurityAnalysisDependabotSecurityUpdates;
|
1105
|
-
/** * 秘钥扫描设置 */
|
1106
|
-
secret_scanning?: SecurityAnalysisSecretScanning;
|
1107
|
-
/** * 秘钥扫描推送保护设置 */
|
1108
|
-
secret_scanning_push_protection?: SecurityAnalysisSecretScanningPushProtection;
|
1109
|
-
}
|
1110
|
-
/** 仓库的权限信息 */
|
1111
|
-
interface Permissions {
|
1112
|
-
/** * 管理员权限 */
|
1113
|
-
admin: boolean;
|
1114
|
-
/** * 推送权限 */
|
1115
|
-
push: boolean;
|
1116
|
-
/** * 拉取权限 */
|
1117
|
-
pull: boolean;
|
1118
|
-
/** * 维护权限 */
|
1119
|
-
maintain?: boolean;
|
1120
|
-
/** * 分类权限 */
|
1121
|
-
triage?: boolean;
|
1122
|
-
}
|
1123
|
-
/**
|
1124
|
-
* 合并提交标题的格式选项
|
1125
|
-
* - PR_TITLE: 使用 Pull Request 标题作为合并提交标题
|
1126
|
-
* - MERGE_MESSAGE: 使用默认的合并消息格式作为标题
|
1127
|
-
*/
|
1128
|
-
type MergeCommitTitle = 'PR_TITLE' | 'MERGE_MESSAGE';
|
1129
|
-
/**
|
1130
|
-
* 合并提交消息的格式选项
|
1131
|
-
* - PR_BODY: 使用 Pull Request 正文作为合并提交消息
|
1132
|
-
* - PR_TITLE: 使用 Pull Request 标题作为合并提交消息
|
1133
|
-
* - BLANK: 留空合并提交消息
|
1134
|
-
*/
|
1135
|
-
type MergeCommitMessage = 'PR_BODY' | 'PR_TITLE' | 'BLANK';
|
1136
|
-
/**
|
1137
|
-
* Squash 合并提交标题的格式选项
|
1138
|
-
* - PR_TITLE: 使用 Pull Request 标题作为 Squash 合并提交标题
|
1139
|
-
* - COMMIT_OR_PR_TITLE: 使用提交信息或 Pull Request 标题作为标题
|
1140
|
-
*/
|
1141
|
-
type SquashMergeCommitTitle = 'PR_TITLE' | 'COMMIT_OR_PR_TITLE';
|
1142
|
-
/**
|
1143
|
-
* Squash 合并提交消息的格式选项
|
1144
|
-
* - PR_BODY: 使用 Pull Request 正文作为 Squash 合并提交消息
|
1145
|
-
* - COMMIT_MESSAGES: 使用所有提交信息作为 Squash 合并提交消息
|
1146
|
-
* - BLANK: 留空 Squash 合并提交消息
|
1147
|
-
*/
|
1148
|
-
type SquashMergeCommitMessage = 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';
|
959
|
+
type RepoInfoParamType = RepoBaseParamType;
|
1149
960
|
/** * 仓库信息 */
|
1150
961
|
interface RepoInfoResponseType {
|
1151
962
|
/** * 仓库的唯一 ID */
|
@@ -1197,8 +1008,6 @@ interface OrgRepoListParmType extends RepoListBaseParamType {
|
|
1197
1008
|
org: string;
|
1198
1009
|
/** 类型,可选all, public, private, forks, sources, member, 默认为 all */
|
1199
1010
|
type?: 'all' | 'public' | 'private' | 'forks' | 'sources' | 'member';
|
1200
|
-
/** 是否格式化日期 */
|
1201
|
-
format?: formatParamType['format'];
|
1202
1011
|
}
|
1203
1012
|
/**
|
1204
1013
|
* 组织仓库列表响应类型
|
@@ -1206,7 +1015,7 @@ interface OrgRepoListParmType extends RepoListBaseParamType {
|
|
1206
1015
|
*/
|
1207
1016
|
type OrgRepoListResponseType = RepoInfoResponseType[];
|
1208
1017
|
/** 创建组织仓库请求参数 */
|
1209
|
-
interface OrgRepoCreateParamType extends
|
1018
|
+
interface OrgRepoCreateParamType extends OrgNameParamType {
|
1210
1019
|
/** 仓库名称 */
|
1211
1020
|
name: string;
|
1212
1021
|
/** 仓库描述 */
|
@@ -1217,57 +1026,23 @@ interface OrgRepoCreateParamType extends RepoOwnerParamType {
|
|
1217
1026
|
visibility?: 'public' | 'private';
|
1218
1027
|
/** 是否开启议题issue */
|
1219
1028
|
has_issues?: boolean;
|
1220
|
-
/** 是否开启项目project */
|
1221
|
-
has_projects?: boolean;
|
1222
1029
|
/** 是否开启wiki */
|
1223
1030
|
has_wiki?: boolean;
|
1224
|
-
/** 是否开启下载 */
|
1225
|
-
has_downloads?: boolean;
|
1226
|
-
/** 是否设置为模板仓库 */
|
1227
|
-
is_template?: boolean;
|
1228
|
-
/** 仓库团队id, 这仅在组织中创建仓库时有效。 */
|
1229
|
-
team_id?: number;
|
1230
1031
|
/** 仓库自动初始化 */
|
1231
1032
|
auto_init?: boolean;
|
1232
|
-
/** 仓库的gitignore模板 */
|
1233
|
-
gitignore_template?: string;
|
1234
|
-
/** 仓库的license模板 */
|
1235
|
-
license_template?: string;
|
1236
|
-
/** 是否允许合并提交 */
|
1237
|
-
allow_squash_merge?: boolean;
|
1238
|
-
/** 是否允许变基合并提交 */
|
1239
|
-
allow_merge_commit?: boolean;
|
1240
|
-
/** 是否允许重新基础合并提交 */
|
1241
|
-
allow_rebase_merge?: boolean;
|
1242
|
-
/** 是否允许自动合并 */
|
1243
|
-
allow_auto_merge?: boolean;
|
1244
|
-
/** 是否删除分支后合并 */
|
1245
|
-
delete_branch_on_merge?: boolean;
|
1246
|
-
/** 合并提交标题格式 */
|
1247
|
-
squash_merge_commit_title?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE';
|
1248
|
-
/** 合并提交消息格式 */
|
1249
|
-
squash_merge_commit_message?: 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';
|
1250
|
-
/** 合并提交标题格式 */
|
1251
|
-
merge_commit_title?: 'PR_TITLE' | 'MERGE_MESSAGE';
|
1252
|
-
/** 合并提交消息格式 */
|
1253
|
-
merge_commit_message?: 'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK';
|
1254
|
-
/** 新存储库的自定义属性 */
|
1255
|
-
custom_properties?: {
|
1256
|
-
[key: string]: string;
|
1257
|
-
};
|
1258
|
-
/** 是否格式化日期 */
|
1259
|
-
format?: formatParamType['format'];
|
1260
1033
|
}
|
1261
1034
|
/** 创建组织仓库响应类型 */
|
1262
1035
|
type OrgRepoCreateResponseType = RepoInfoResponseType;
|
1036
|
+
/** 创建用户仓库参数类型 */
|
1037
|
+
type UserRepoCreateParamType = Omit<OrgRepoCreateParamType, 'org'> & RepoOwnerParamType;
|
1038
|
+
/** 创建用户仓库响应类型 */
|
1039
|
+
type UserRepoCreateResponseType = RepoInfoResponseType;
|
1263
1040
|
/** 用户仓库列表参数类型 */
|
1264
1041
|
interface UserRepoListParamType extends RepoListBaseParamType {
|
1265
1042
|
/** 用户名 */
|
1266
1043
|
username: string;
|
1267
1044
|
/** 类型,可选all, owner, member, 默认为 all */
|
1268
1045
|
type?: 'all' | 'owner' | 'member';
|
1269
|
-
/** 是否格式化日期 */
|
1270
|
-
format?: formatParamType['format'];
|
1271
1046
|
}
|
1272
1047
|
/** 用户仓库列表类型 */
|
1273
1048
|
type UserRepoListType = Array<RepoInfoResponseType & {
|
@@ -1292,22 +1067,18 @@ interface RepoLanguagesListResponseType {
|
|
1292
1067
|
/** 仓库的语言统计信息列表 */
|
1293
1068
|
languages: LanguageInfo[];
|
1294
1069
|
}
|
1295
|
-
/**
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
/**
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
}
|
1070
|
+
/** 获取仓库可见性参数类型 */
|
1071
|
+
type GetRepoVisibilityParamType = RepoBaseParamType;
|
1072
|
+
/** 获取仓库可见性响应类型 */
|
1073
|
+
type GetRepoVisibilityResponseType = RepoInfoResponseType['visibility'];
|
1074
|
+
/** 获取仓库默认分支参数类型 */
|
1075
|
+
type GetRepoDefaultBranchParamType = RepoBaseParamType;
|
1076
|
+
/** 获取仓库默认分支响应类型 */
|
1077
|
+
type GetRepoDefaultBranchResponseType = RepoInfoResponseType['default_branch'];
|
1078
|
+
/** 获取仓库主要语言参数类型 */
|
1079
|
+
type GetRepoMainLanguageParamType = RepoBaseParamType;
|
1306
1080
|
/** 仓库主要语言响应类型 */
|
1307
|
-
|
1308
|
-
/** * 仓库的主要语言 */
|
1309
|
-
language: RepoInfoResponseType['language'];
|
1310
|
-
}
|
1081
|
+
type GetRepoMainLanguageResponseType = RepoInfoResponseType['language'];
|
1311
1082
|
/** 协作者参数类型 */
|
1312
1083
|
type CollaboratorParamType = RepoInfoParamType & UserNameParamType & {
|
1313
1084
|
/**
|
@@ -1319,8 +1090,6 @@ type CollaboratorParamType = RepoInfoParamType & UserNameParamType & {
|
|
1319
1090
|
* admin - 拥有仓库的完全控制权,包括更改设置和删除仓库。
|
1320
1091
|
*/
|
1321
1092
|
permission?: string;
|
1322
|
-
/** 是否格式化日期 */
|
1323
|
-
format?: formatParamType['format'];
|
1324
1093
|
};
|
1325
1094
|
/** 邀请协作者响应类型 */
|
1326
1095
|
interface AddCollaboratorResponseType {
|
@@ -1330,8 +1099,6 @@ interface AddCollaboratorResponseType {
|
|
1330
1099
|
login: string;
|
1331
1100
|
/** 被邀请者的别名 */
|
1332
1101
|
name: string | null;
|
1333
|
-
/** 被邀请者的头像URL */
|
1334
|
-
avatar_url: string;
|
1335
1102
|
/** 仓库的地址 */
|
1336
1103
|
html_url: string;
|
1337
1104
|
/** 被邀请者的权限 */
|
@@ -1360,41 +1127,475 @@ type CollaboratorListParamType = RepoInfoParamType & {
|
|
1360
1127
|
/** 页码 */
|
1361
1128
|
page?: number;
|
1362
1129
|
};
|
1363
|
-
/** 协作者信息类型 */
|
1364
|
-
interface CollaboratorInfoResponseType {
|
1365
|
-
/** 协作者id */
|
1366
|
-
id: number;
|
1367
|
-
/** 协作者登录名 */
|
1368
|
-
login: string;
|
1369
|
-
/** 头像URL */
|
1370
|
-
avatar_url: string;
|
1371
|
-
/** 协作者邮箱 */
|
1372
|
-
email: string | null;
|
1373
|
-
/** 协作者姓名 */
|
1374
|
-
name: string | null;
|
1375
|
-
/** 权限设置 */
|
1376
|
-
permissions: {
|
1377
|
-
/** 拉取权限 */
|
1378
|
-
pull: boolean;
|
1379
|
-
/** 分类权限 */
|
1380
|
-
triage: boolean;
|
1381
|
-
/** 推送权限 */
|
1382
|
-
push: boolean;
|
1383
|
-
/** 维护权限 */
|
1384
|
-
maintain: boolean;
|
1385
|
-
/** 管理权限 */
|
1386
|
-
admin: boolean;
|
1387
|
-
};
|
1388
|
-
/** 角色名称 */
|
1389
|
-
role_name: string;
|
1390
|
-
}
|
1391
|
-
/** 协作者列表响应类型 */
|
1392
|
-
type CollaboratorListResponseType = CollaboratorInfoResponseType[];
|
1393
|
-
/** 移除协作者参数类型 */
|
1394
|
-
type RemoveCollaboratorParamType = RepoBaseParamType & UserNameParamType;
|
1395
|
-
/** 移除协作者响应类型 */
|
1396
|
-
interface RemoveCollaboratorResponseType {
|
1397
|
-
/** 状态信息 */
|
1130
|
+
/** 协作者信息类型 */
|
1131
|
+
interface CollaboratorInfoResponseType {
|
1132
|
+
/** 协作者id */
|
1133
|
+
id: number;
|
1134
|
+
/** 协作者登录名 */
|
1135
|
+
login: string;
|
1136
|
+
/** 头像URL */
|
1137
|
+
avatar_url: string;
|
1138
|
+
/** 协作者邮箱 */
|
1139
|
+
email: string | null;
|
1140
|
+
/** 协作者姓名 */
|
1141
|
+
name: string | null;
|
1142
|
+
/** 权限设置 */
|
1143
|
+
permissions: {
|
1144
|
+
/** 拉取权限 */
|
1145
|
+
pull: boolean;
|
1146
|
+
/** 分类权限 */
|
1147
|
+
triage: boolean;
|
1148
|
+
/** 推送权限 */
|
1149
|
+
push: boolean;
|
1150
|
+
/** 维护权限 */
|
1151
|
+
maintain: boolean;
|
1152
|
+
/** 管理权限 */
|
1153
|
+
admin: boolean;
|
1154
|
+
};
|
1155
|
+
/** 角色名称 */
|
1156
|
+
role_name: string;
|
1157
|
+
}
|
1158
|
+
/** 协作者列表响应类型 */
|
1159
|
+
type CollaboratorListResponseType = CollaboratorInfoResponseType[];
|
1160
|
+
/** 移除协作者参数类型 */
|
1161
|
+
type RemoveCollaboratorParamType = RepoBaseParamType & UserNameParamType;
|
1162
|
+
/** 移除协作者响应类型 */
|
1163
|
+
interface RemoveCollaboratorResponseType {
|
1164
|
+
/** 状态信息 */
|
1165
|
+
info: string;
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
/** 组织信息参数类型 */
|
1169
|
+
type OrgInfoParamType = OrgNameParamType;
|
1170
|
+
/** 组织信息响应类型 */
|
1171
|
+
interface OrgInfoResponseType {
|
1172
|
+
/** 组织ID */
|
1173
|
+
id: number;
|
1174
|
+
/** 组织名称 */
|
1175
|
+
login: string;
|
1176
|
+
/** 组织描述 */
|
1177
|
+
name: string;
|
1178
|
+
/** 组织头像 */
|
1179
|
+
avatar_url: string;
|
1180
|
+
/** 组织描述 */
|
1181
|
+
description: string;
|
1182
|
+
/** 组织地址 */
|
1183
|
+
html_url: string;
|
1184
|
+
}
|
1185
|
+
/** 添加组织成员参数类型 */
|
1186
|
+
interface AddMemberParamType extends OrgNameParamType, UserNameParamType {
|
1187
|
+
/**
|
1188
|
+
* 角色
|
1189
|
+
* @default 'member'
|
1190
|
+
*/
|
1191
|
+
role?: 'admin' | 'member';
|
1192
|
+
}
|
1193
|
+
/** 添加组织成员响应类型 */
|
1194
|
+
interface AddMemberResponseType extends Omit<AddCollaboratorResponseType, 'permissions' | 'html_url'> {
|
1195
|
+
/** 组织地址 */
|
1196
|
+
html_url: string;
|
1197
|
+
/** 角色 */
|
1198
|
+
role: 'admin' | 'member';
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
type PrUser = Pick<UserInfoResponseType, 'id' | 'login' | 'name' | 'avatar_url' | 'html_url'>;
|
1202
|
+
type PrRepo = Pick<RepoInfoResponseType, 'id' | 'owner' | 'name' | 'full_name'>;
|
1203
|
+
/** 拉取请求信息参数类型 */
|
1204
|
+
type PullRequestInfoParamType = PullRequestNumberParamType & RepoBaseParamType;
|
1205
|
+
/** 拉取请求信息响应类型 */
|
1206
|
+
interface PullRequestInfoResponseType {
|
1207
|
+
/** 拉取请求的id */
|
1208
|
+
id: number;
|
1209
|
+
/** 拉取请求的URL */
|
1210
|
+
html_url: string;
|
1211
|
+
/** 拉取请求的编号 */
|
1212
|
+
number: number;
|
1213
|
+
/** 拉取请求的状态 (open/closed) */
|
1214
|
+
state: 'open' | 'closed';
|
1215
|
+
/** 是否被锁定 */
|
1216
|
+
locked: boolean;
|
1217
|
+
/** 拉取请求的标题 */
|
1218
|
+
title: string;
|
1219
|
+
/** 拉取请求的描述 */
|
1220
|
+
body: string | null;
|
1221
|
+
/** 是否为草稿PR */
|
1222
|
+
draft: boolean;
|
1223
|
+
/** 创建时间 */
|
1224
|
+
created_at: string;
|
1225
|
+
/** 更新时间 */
|
1226
|
+
updated_at: string;
|
1227
|
+
/** 关闭时间 */
|
1228
|
+
closed_at: string | null;
|
1229
|
+
/** 合并时间 */
|
1230
|
+
merged_at: string | null;
|
1231
|
+
/** PR作者 */
|
1232
|
+
user: PrUser;
|
1233
|
+
base: {
|
1234
|
+
label: string;
|
1235
|
+
ref: string;
|
1236
|
+
sha: string;
|
1237
|
+
user: PrUser;
|
1238
|
+
repo: PrRepo;
|
1239
|
+
};
|
1240
|
+
/** PR的源分支信息 */
|
1241
|
+
head: {
|
1242
|
+
label: string;
|
1243
|
+
ref: string;
|
1244
|
+
sha: string;
|
1245
|
+
user: PrUser;
|
1246
|
+
repo: PrRepo;
|
1247
|
+
};
|
1248
|
+
/** 指派人 */
|
1249
|
+
assignee: PrUser | null;
|
1250
|
+
/** 指派人列表 */
|
1251
|
+
assignees: Array<PrUser> | null;
|
1252
|
+
/** 里程碑 */
|
1253
|
+
milestone: MilestoneType | null;
|
1254
|
+
/** 标签列表 */
|
1255
|
+
labels: Array<IssueLabelType>;
|
1256
|
+
/** 提交数量 */
|
1257
|
+
commits: number;
|
1258
|
+
/** 新增行数 */
|
1259
|
+
additions: number;
|
1260
|
+
/** 删除行数 */
|
1261
|
+
deletions: number;
|
1262
|
+
/** 更改的文件数 */
|
1263
|
+
changed_files: number;
|
1264
|
+
}
|
1265
|
+
/** 拉取请求列表参数类型 */
|
1266
|
+
interface PullRequestListParamType extends RepoBaseParamType {
|
1267
|
+
/**
|
1268
|
+
* 拉取请求状态
|
1269
|
+
* @default "open"
|
1270
|
+
* - open: 打开的拉取请求
|
1271
|
+
* - closed: 已关闭的拉取请求
|
1272
|
+
* - all: 所有拉取请求
|
1273
|
+
*/
|
1274
|
+
state?: 'open' | 'closed' | 'all';
|
1275
|
+
/**
|
1276
|
+
* 基础分支名称
|
1277
|
+
* 用于筛选指定目标分支的拉取请求
|
1278
|
+
* @example "main"
|
1279
|
+
*/
|
1280
|
+
base?: string;
|
1281
|
+
/**
|
1282
|
+
* 排序依据
|
1283
|
+
* @default "created"
|
1284
|
+
* - created: 按创建时间排序
|
1285
|
+
* - updated: 按更新时间排序
|
1286
|
+
*/
|
1287
|
+
sort?: 'created' | 'updated';
|
1288
|
+
/**
|
1289
|
+
* 排序方向
|
1290
|
+
* @default "desc"
|
1291
|
+
* - asc: 升序
|
1292
|
+
* - desc: 降序
|
1293
|
+
*/
|
1294
|
+
direction?: 'asc' | 'desc';
|
1295
|
+
/**
|
1296
|
+
* 每页结果数量
|
1297
|
+
* @default "30"
|
1298
|
+
* @remarks 取值范围:1-100
|
1299
|
+
*/
|
1300
|
+
per_page?: string;
|
1301
|
+
/**
|
1302
|
+
* 页码
|
1303
|
+
* @default "1"
|
1304
|
+
* @remarks 必须大于等于1
|
1305
|
+
*/
|
1306
|
+
page?: string;
|
1307
|
+
}
|
1308
|
+
/** 拉取请求列表响应类型 */
|
1309
|
+
type PullRequestListResponseType = Array<PullRequestInfoResponseType>;
|
1310
|
+
/** 使用issue填充拉取提交标题与内容 */
|
1311
|
+
type WithIssue = {
|
1312
|
+
/** 拉取请求标题 */
|
1313
|
+
title?: never;
|
1314
|
+
/** 拉取请求描述 */
|
1315
|
+
body?: never;
|
1316
|
+
/**
|
1317
|
+
* 关联的议题
|
1318
|
+
* Pull Request的标题和内容可以根据指定的Issue Id自动填充
|
1319
|
+
*/
|
1320
|
+
issue: string | number;
|
1321
|
+
};
|
1322
|
+
/** 不使用issue填充拉取提交标题与内容 */
|
1323
|
+
type WithoutIssue = {
|
1324
|
+
/** 拉取请求标题 */
|
1325
|
+
title: string;
|
1326
|
+
/** 拉取请求描述 */
|
1327
|
+
body?: string;
|
1328
|
+
/**
|
1329
|
+
* 关联的议题
|
1330
|
+
* Pull Request的标题和内容可以根据指定的Issue Id自动填充
|
1331
|
+
*/
|
1332
|
+
issue?: never;
|
1333
|
+
};
|
1334
|
+
/** 创建拉取提交参数类型 */
|
1335
|
+
type CreatePullRequestParamType = RepoBaseParamType & (WithIssue | WithoutIssue) & {
|
1336
|
+
/** 拉取请求源分支 */
|
1337
|
+
head: string;
|
1338
|
+
/**
|
1339
|
+
* 拉取请求源仓库
|
1340
|
+
* 。如果两个存储库都由同一组织拥有,则跨存储库拉取请求需要此字段
|
1341
|
+
* */
|
1342
|
+
head_repo?: string;
|
1343
|
+
/** 拉取请求目标分支 */
|
1344
|
+
base: string;
|
1345
|
+
/** 是否为草稿 */
|
1346
|
+
draft?: boolean;
|
1347
|
+
};
|
1348
|
+
/** 创建拉取请求响应类型 */
|
1349
|
+
type CreatePullRequestResponseType = PullRequestInfoResponseType;
|
1350
|
+
/** 更新拉取请求参数类型 */
|
1351
|
+
interface UpdatePullRequestParamType extends RepoBaseParamType, PullRequestNumberParamType {
|
1352
|
+
/** 拉取请求标题 */
|
1353
|
+
title?: string;
|
1354
|
+
/** 拉取请求内容 */
|
1355
|
+
body?: string;
|
1356
|
+
/** 拉取请求状态 */
|
1357
|
+
state?: 'open' | 'closed';
|
1358
|
+
}
|
1359
|
+
/** 更新拉取请求响应类型 */
|
1360
|
+
type UpdatePullRequestResponseType = PullRequestInfoResponseType;
|
1361
|
+
/**
|
1362
|
+
* 合并拉取请求方式类型
|
1363
|
+
* merge: 合并提交
|
1364
|
+
* squash: 压缩提交
|
1365
|
+
* rebase: 变基提交
|
1366
|
+
*/
|
1367
|
+
type MergeMethodType = 'merge' | 'squash' | 'rebase';
|
1368
|
+
/** 合并拉取请求参数类型 */
|
1369
|
+
interface MergePullRequestParamType extends RepoBaseParamType, PullRequestNumberParamType {
|
1370
|
+
/** 拉取请求合并提交信息 */
|
1371
|
+
commit_title?: string;
|
1372
|
+
/** 拉取请求合并提交信息 */
|
1373
|
+
commit_message?: string;
|
1374
|
+
/**
|
1375
|
+
* 拉取请求合并SHA值
|
1376
|
+
* 拉取请求头部必须匹配的 SHA 才能允许合并
|
1377
|
+
* */
|
1378
|
+
sha?: string;
|
1379
|
+
/**
|
1380
|
+
* 拉取请求合并方式
|
1381
|
+
* @default merge
|
1382
|
+
* merge: 合并提交
|
1383
|
+
* squash: 压缩提交
|
1384
|
+
* rebase: 变基提交
|
1385
|
+
* */
|
1386
|
+
merge_method?: MergeMethodType;
|
1387
|
+
}
|
1388
|
+
/**
|
1389
|
+
* 合并拉取请求响应类型
|
1390
|
+
* 对应 GitHub API 返回的 Pull Request Merge Result 结构
|
1391
|
+
*/
|
1392
|
+
interface MergePullRequestResponseType {
|
1393
|
+
/**
|
1394
|
+
* 合并后的提交 SHA 值
|
1395
|
+
* 表示合并操作生成的提交哈希
|
1396
|
+
*/
|
1397
|
+
sha: string;
|
1398
|
+
/**
|
1399
|
+
* 是否成功合并
|
1400
|
+
* - true: 成功合并
|
1401
|
+
* - false: 合并失败或冲突
|
1402
|
+
*/
|
1403
|
+
merged: boolean;
|
1404
|
+
/**
|
1405
|
+
* 合并结果描述信息
|
1406
|
+
* 包含成功或失败的具体原因
|
1407
|
+
*/
|
1408
|
+
message: string;
|
1409
|
+
}
|
1410
|
+
/** 文件列表类型 */
|
1411
|
+
interface PullRequestFilesListType {
|
1412
|
+
/** 文件的SHA值 */
|
1413
|
+
sha: string;
|
1414
|
+
/** 文件路径 */
|
1415
|
+
filename: string;
|
1416
|
+
/** 文件状态 */
|
1417
|
+
status: 'added' | 'removed' | 'modified' | 'renamed' | 'changed' | 'unchanged';
|
1418
|
+
/** 文件添加行数 */
|
1419
|
+
additions: number;
|
1420
|
+
/** 文件删除行数 */
|
1421
|
+
deletions: number;
|
1422
|
+
/** 文件修改行数 */
|
1423
|
+
changes: number;
|
1424
|
+
/** 文件的blob SHA值 */
|
1425
|
+
blob_url: string;
|
1426
|
+
/** 文件的raw URL */
|
1427
|
+
raw_url: string;
|
1428
|
+
/** 文件的patch内容, 也就是diff差异内容 */
|
1429
|
+
patch: string;
|
1430
|
+
}
|
1431
|
+
/** 获取拉取请求文件列表参数类型 */
|
1432
|
+
interface GetPullRequestFilesListParamType extends RepoBaseParamType, PullRequestNumberParamType {
|
1433
|
+
/** 每页结果数量 */
|
1434
|
+
per_page?: string;
|
1435
|
+
/** 页码 */
|
1436
|
+
page?: string;
|
1437
|
+
}
|
1438
|
+
/** 获取拉取请求文件列表响应类型 */
|
1439
|
+
type GetPullRequestFilesListResponseType = Array<PullRequestFilesListType>;
|
1440
|
+
/** 获取拉取请求评论信息参数类型 */
|
1441
|
+
type GetPullRequestCommentInfoParamType = RepoBaseParamType & CommentIdParamType;
|
1442
|
+
/** 获取拉取请求评论信息响应类型 */
|
1443
|
+
interface GetPullRequestCommentInfoResponseType {
|
1444
|
+
/** 评论ID */
|
1445
|
+
id: CommentIdParamType['comment_id'];
|
1446
|
+
/** 评论内容 */
|
1447
|
+
body: string;
|
1448
|
+
/** 评论用户 */
|
1449
|
+
user: PrUser;
|
1450
|
+
/** 评论创建时间 */
|
1451
|
+
created_at: string;
|
1452
|
+
/** 评论更新时间 */
|
1453
|
+
updated_at: string;
|
1454
|
+
}
|
1455
|
+
/** 获取拉取请求评论列表参数类型 */
|
1456
|
+
interface GetPullRequestCommentsListParamType extends RepoBaseParamType, PullRequestNumberParamType {
|
1457
|
+
direction: 'asc' | 'desc';
|
1458
|
+
/** 每页结果数量 */
|
1459
|
+
per_page?: string;
|
1460
|
+
/** 页码 */
|
1461
|
+
page?: string;
|
1462
|
+
}
|
1463
|
+
/** 获取拉取请求评论列表响应类型 */
|
1464
|
+
type GetPullRequestCommentsListResponseType = Array<GetPullRequestCommentInfoResponseType>;
|
1465
|
+
/** 创建拉取请求评论参数类型 */
|
1466
|
+
interface CreatePullRequestCommentParamType extends RepoBaseParamType, PullRequestNumberParamType {
|
1467
|
+
/** 评论内容 */
|
1468
|
+
body: string;
|
1469
|
+
}
|
1470
|
+
/** 创建拉取请求评论响应类型 */
|
1471
|
+
interface CreatePullRequestCommentResponseType {
|
1472
|
+
/** 评论id */
|
1473
|
+
id: CommentIdParamType['comment_id'];
|
1474
|
+
/** 评论内容 */
|
1475
|
+
body: string;
|
1476
|
+
}
|
1477
|
+
/** 更新拉取请求评论参数类型 */
|
1478
|
+
interface UpdatePullRequestCommentParamType extends RepoBaseParamType, CommentIdParamType {
|
1479
|
+
/** 评论内容 */
|
1480
|
+
body: string;
|
1481
|
+
}
|
1482
|
+
/** 更新拉取请求评论响应类型 */
|
1483
|
+
interface UpdatePullRequestCommentResponseType {
|
1484
|
+
/** 是否评论成功 */
|
1485
|
+
success: boolean;
|
1486
|
+
}
|
1487
|
+
/** 删除拉取请求评论参数类型 */
|
1488
|
+
type DeletePullRequestCommentParamType = RepoBaseParamType & CommentIdParamType;
|
1489
|
+
/** 删除拉取请求评论响应类型 */
|
1490
|
+
interface DeletePullRequestCommentResponseType {
|
1491
|
+
/** 是否删除成功 */
|
1492
|
+
success: boolean;
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
type ReleaseUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'>;
|
1496
|
+
/** 反应信息类型 */
|
1497
|
+
interface ReactionInfoType {
|
1498
|
+
/** 反应 API URL */
|
1499
|
+
url: string;
|
1500
|
+
/** 总反应数 */
|
1501
|
+
total_count: number;
|
1502
|
+
/** 👍 反应数 */
|
1503
|
+
'+1': number;
|
1504
|
+
/** 👎 反应数 */
|
1505
|
+
'-1': number;
|
1506
|
+
/** 😄 反应数 */
|
1507
|
+
laugh: number;
|
1508
|
+
/** 😕 反应数 */
|
1509
|
+
confused: number;
|
1510
|
+
/** ❤️ 反应数 */
|
1511
|
+
heart: number;
|
1512
|
+
/** 🎉 反应数 */
|
1513
|
+
hooray: number;
|
1514
|
+
/** 👀 反应数 */
|
1515
|
+
eyes: number;
|
1516
|
+
/** 🚀 反应数 */
|
1517
|
+
rocket: number;
|
1518
|
+
}
|
1519
|
+
/** 发布资源类型 */
|
1520
|
+
interface ReleaseAssetsType {
|
1521
|
+
/** 资源 URL */
|
1522
|
+
url: string;
|
1523
|
+
/** 资源下载 URL */
|
1524
|
+
browser_download_url: string;
|
1525
|
+
}
|
1526
|
+
/** 获取Release信息参数类型 */
|
1527
|
+
type ReleaseInfoParamType = RepoBaseParamType & {
|
1528
|
+
/** 发布ID */
|
1529
|
+
release_id: number;
|
1530
|
+
};
|
1531
|
+
/** 获Release信息响应类型 */
|
1532
|
+
interface ReleaseInfoResponseType {
|
1533
|
+
/**
|
1534
|
+
* 发布版本的 ID
|
1535
|
+
* 该字段在gitcode平台为null
|
1536
|
+
*/
|
1537
|
+
id: number | null;
|
1538
|
+
/** 标签名称 */
|
1539
|
+
tag_name: string;
|
1540
|
+
/** 目标分支或提交 */
|
1541
|
+
target_commitish: string;
|
1542
|
+
/** 发布版本名称 */
|
1543
|
+
name: string | null;
|
1544
|
+
/** 发布说明 */
|
1545
|
+
body: string | null;
|
1546
|
+
/** 是否为预发布版本 */
|
1547
|
+
prerelease: boolean;
|
1548
|
+
/** 发布者信息 */
|
1549
|
+
author: ReleaseUser;
|
1550
|
+
/** 发布资源列表 */
|
1551
|
+
assets: Array<ReleaseAssetsType>;
|
1552
|
+
/** 发布时间 */
|
1553
|
+
created_at: string;
|
1554
|
+
}
|
1555
|
+
/** 获取最新Release参数类型 */
|
1556
|
+
type ReleaseLatestParamTypeType = RepoBaseParamType;
|
1557
|
+
/** 获取最新Release响应类型 */
|
1558
|
+
type ReleaseLatestResponseType = ReleaseInfoResponseType;
|
1559
|
+
/** 通过Tag获取Release信息参数类型 */
|
1560
|
+
type ReleaseInfoByTagParamType = RepoBaseParamType & {
|
1561
|
+
/** 标签名称 */
|
1562
|
+
tag: string;
|
1563
|
+
};
|
1564
|
+
/** 通过Tag获取Release信息响应类型 */
|
1565
|
+
type ReleaseInfoByTagResponseType = ReleaseInfoResponseType;
|
1566
|
+
/** 获取Release列表参数类型 */
|
1567
|
+
type ReleaseListParamType = RepoBaseParamType & {
|
1568
|
+
/** 每页数量 */
|
1569
|
+
per_page?: number;
|
1570
|
+
/** 页码 */
|
1571
|
+
page?: number;
|
1572
|
+
};
|
1573
|
+
/** 获取Release列表响应类型 */
|
1574
|
+
type ReleaseListResponseType = Array<ReleaseInfoResponseType>;
|
1575
|
+
/** 创建Release参数类型 */
|
1576
|
+
type CreateReleaseParamType = RepoBaseParamType & {
|
1577
|
+
/** 标签名称 */
|
1578
|
+
tag_name: string;
|
1579
|
+
/** 目标分支或提交 */
|
1580
|
+
target_commitish: string;
|
1581
|
+
/** 发布版本名称 */
|
1582
|
+
name: string;
|
1583
|
+
/** 发布说明 */
|
1584
|
+
body: string;
|
1585
|
+
/** 是否为预发布版本 */
|
1586
|
+
prerelease: boolean;
|
1587
|
+
};
|
1588
|
+
/** 获取Release列表参数类型 */
|
1589
|
+
type CreateReleaseResponseType = ReleaseInfoResponseType;
|
1590
|
+
/** 更新Release参数类型 */
|
1591
|
+
type UpdateReleaseParamType = CreateReleaseParamType;
|
1592
|
+
/** 更新Release响应类型 */
|
1593
|
+
type UpdateReleaseResponseType = ReleaseInfoResponseType;
|
1594
|
+
/** 删除Release参数类型 */
|
1595
|
+
type DeleteReleaseParamType = ReleaseInfoParamType;
|
1596
|
+
/** 删除Release响应类型 */
|
1597
|
+
interface DeleteReleaseResponseType {
|
1598
|
+
/** 删除信息 */
|
1398
1599
|
info: string;
|
1399
1600
|
}
|
1400
1601
|
|
@@ -1436,6 +1637,26 @@ declare function formatDate(dateString: string, locale?: string, format?: string
|
|
1436
1637
|
* ```
|
1437
1638
|
*/
|
1438
1639
|
declare function get_relative_time(dateString: string, locale?: string): Promise<string>;
|
1640
|
+
/**
|
1641
|
+
* 获取本地仓库的默认分支
|
1642
|
+
* @param local_path - 本地仓库路径
|
1643
|
+
* @returns 默认分支名称
|
1644
|
+
* @example
|
1645
|
+
* ```ts
|
1646
|
+
* console.log(await get_local_repo_default_branch('/path/to/repo')) // 输出 'main'
|
1647
|
+
* ```
|
1648
|
+
*/
|
1649
|
+
declare function get_local_repo_default_branch(local_path: string): Promise<string>;
|
1650
|
+
/**
|
1651
|
+
* 获取远程仓库的默认分支
|
1652
|
+
* @param remote_url - 远程仓库URL
|
1653
|
+
* @returns 默认分支名称
|
1654
|
+
* @example
|
1655
|
+
* ```ts
|
1656
|
+
* console.log(await get_remote_repo_default_branch('https://github.com/CandriaJS/git-neko-kit')) // 输出 'main'
|
1657
|
+
* ```
|
1658
|
+
*/
|
1659
|
+
declare function get_remote_repo_default_branch(remote_url: string): Promise<string>;
|
1439
1660
|
/**
|
1440
1661
|
* 根据语言名称获取对应的颜色值
|
1441
1662
|
* @param language - 语言名称
|
@@ -1466,8 +1687,6 @@ declare function create_state_id(): Promise<string>;
|
|
1466
1687
|
* - 检查访问令牌状态
|
1467
1688
|
* - 刷新访问令牌
|
1468
1689
|
*
|
1469
|
-
* @class Auth
|
1470
|
-
* @extends Base GitHub基础操作类
|
1471
1690
|
*/
|
1472
1691
|
declare class Auth extends GitHubClient {
|
1473
1692
|
constructor(base: GitHubClient);
|
@@ -1538,7 +1757,6 @@ declare class Commit extends GitHubClient {
|
|
1538
1757
|
* - url 仓库URL地址
|
1539
1758
|
* - owner 仓库拥有者
|
1540
1759
|
* - sha 提交的SHA值,如果不提供,则默认获取仓库的默认分支的最新提交信息
|
1541
|
-
* - format - 可选,是否格式化提交信息, 默认为false
|
1542
1760
|
* @returns 提交信息
|
1543
1761
|
* @example
|
1544
1762
|
* ```ts
|
@@ -1572,7 +1790,7 @@ declare class Commit extends GitHubClient {
|
|
1572
1790
|
}
|
1573
1791
|
|
1574
1792
|
/**
|
1575
|
-
* GitHub Issue 处理类,提供
|
1793
|
+
* GitHub Issue 处理类,提供Issue相关操作功能
|
1576
1794
|
*
|
1577
1795
|
* 提供完整的GitHub Issue管理,包括:
|
1578
1796
|
* - 获取Issue列表
|
@@ -1587,7 +1805,7 @@ declare class Commit extends GitHubClient {
|
|
1587
1805
|
declare class Issue extends GitHubClient {
|
1588
1806
|
constructor(base: GitHubClient);
|
1589
1807
|
/**
|
1590
|
-
*
|
1808
|
+
* 获取议题详情
|
1591
1809
|
* 权限:
|
1592
1810
|
* - Issues: Read-only
|
1593
1811
|
* @param options 请求参数列表
|
@@ -1604,7 +1822,7 @@ declare class Issue extends GitHubClient {
|
|
1604
1822
|
*/
|
1605
1823
|
get_issue_info(options: IssueInfoParamType): Promise<ApiResponseType<IssueInfoResponseType>>;
|
1606
1824
|
/**
|
1607
|
-
*
|
1825
|
+
* 获取仓库的议题列表
|
1608
1826
|
* 权限:
|
1609
1827
|
* - Issues:Read-only
|
1610
1828
|
* @param options 请求参数列表
|
@@ -1632,7 +1850,7 @@ declare class Issue extends GitHubClient {
|
|
1632
1850
|
*/
|
1633
1851
|
get_issues_list(options: RepoIssueListParamType): Promise<ApiResponseType<IssueListResponseType>>;
|
1634
1852
|
/**
|
1635
|
-
*
|
1853
|
+
* 创建一个议题
|
1636
1854
|
* 权限:
|
1637
1855
|
* - Issues: Write
|
1638
1856
|
* @param options 发送Issue的参数对象
|
@@ -1654,7 +1872,7 @@ declare class Issue extends GitHubClient {
|
|
1654
1872
|
*/
|
1655
1873
|
create_issue(options: CreteIssueParamType): Promise<ApiResponseType<CreateIssueResponseType>>;
|
1656
1874
|
/**
|
1657
|
-
*
|
1875
|
+
* 更新一个议题
|
1658
1876
|
* 权限:
|
1659
1877
|
* - Issues: Write
|
1660
1878
|
* - Pull requests: Write
|
@@ -1679,7 +1897,7 @@ declare class Issue extends GitHubClient {
|
|
1679
1897
|
*/
|
1680
1898
|
update_issue(options: UpdateIssueParamType): Promise<ApiResponseType<UpdateIssueResponseType>>;
|
1681
1899
|
/**
|
1682
|
-
*
|
1900
|
+
* 重新打开一个议题
|
1683
1901
|
* 权限:
|
1684
1902
|
* - Issues: Write
|
1685
1903
|
* - Pull requests: Write
|
@@ -1707,7 +1925,7 @@ declare class Issue extends GitHubClient {
|
|
1707
1925
|
*/
|
1708
1926
|
reopen_issue(options: OpenIssueParamType): Promise<ApiResponseType<OpenIssueResponseType>>;
|
1709
1927
|
/**
|
1710
|
-
*
|
1928
|
+
* 关闭一个议题
|
1711
1929
|
* 权限:
|
1712
1930
|
* - Issues: Write
|
1713
1931
|
* - Pull requests: Write
|
@@ -1727,7 +1945,7 @@ declare class Issue extends GitHubClient {
|
|
1727
1945
|
*/
|
1728
1946
|
close_issue(options: CloseIssueParamType): Promise<ApiResponseType<CloseIssueResponseType>>;
|
1729
1947
|
/**
|
1730
|
-
*
|
1948
|
+
* 锁定一个议题
|
1731
1949
|
* 仅GitHub平台可用
|
1732
1950
|
* 权限:
|
1733
1951
|
* - Issues: Write
|
@@ -1748,7 +1966,7 @@ declare class Issue extends GitHubClient {
|
|
1748
1966
|
*/
|
1749
1967
|
lock_issue(options: LockIssueParamType): Promise<ApiResponseType<LockIssueResponseType>>;
|
1750
1968
|
/**
|
1751
|
-
*
|
1969
|
+
* 解锁一个议题
|
1752
1970
|
* 仅GitHub平台可用
|
1753
1971
|
* 权限:
|
1754
1972
|
* - Issues: Write
|
@@ -1768,7 +1986,7 @@ declare class Issue extends GitHubClient {
|
|
1768
1986
|
*/
|
1769
1987
|
unlock_issue(options: UnLockIssueParamType): Promise<ApiResponseType<UnLockIssueResponseType>>;
|
1770
1988
|
/**
|
1771
|
-
*
|
1989
|
+
* 获取一个仓库下议题的评论列表
|
1772
1990
|
* 权限:
|
1773
1991
|
* - Issues: Read-only
|
1774
1992
|
* - Pull requests: Read-only
|
@@ -1789,9 +2007,9 @@ declare class Issue extends GitHubClient {
|
|
1789
2007
|
* console.log(res) // { data: IssueCommentListResponseType[] }
|
1790
2008
|
* ```
|
1791
2009
|
*/
|
1792
|
-
|
2010
|
+
get_repo_comments_list(options: RepoCommentListParamType): Promise<ApiResponseType<RepoCommentListResponseType>>;
|
1793
2011
|
/**
|
1794
|
-
*
|
2012
|
+
* 获取一个议题下的评论列表
|
1795
2013
|
* 权限:
|
1796
2014
|
* - Issues: Read-only
|
1797
2015
|
* - Pull requests: Read-only
|
@@ -1813,7 +2031,7 @@ declare class Issue extends GitHubClient {
|
|
1813
2031
|
*/
|
1814
2032
|
get_issue_comments_list(options: IssueCommentListParamType): Promise<ApiResponseType<IssueCommentListResponseType>>;
|
1815
2033
|
/**
|
1816
|
-
*
|
2034
|
+
* 获取议题评论信息
|
1817
2035
|
* 权限:
|
1818
2036
|
* - Issues: Read-only
|
1819
2037
|
* - Pull requests: Read-only
|
@@ -1832,7 +2050,7 @@ declare class Issue extends GitHubClient {
|
|
1832
2050
|
*/
|
1833
2051
|
get_issue_comment_info(options: IssueCommentInfoParamType): Promise<ApiResponseType<IssueCommentInfoResponseType>>;
|
1834
2052
|
/**
|
1835
|
-
*
|
2053
|
+
* 创建一个议题评论
|
1836
2054
|
* 权限:
|
1837
2055
|
* - Issues: Write
|
1838
2056
|
* - Pull requests: Write
|
@@ -1852,7 +2070,7 @@ declare class Issue extends GitHubClient {
|
|
1852
2070
|
*/
|
1853
2071
|
create_issue_comment(options: CreteIssueCommentParamType): Promise<ApiResponseType<CreteIssueCommentResponseType>>;
|
1854
2072
|
/**
|
1855
|
-
*
|
2073
|
+
* 更新议题评论信息
|
1856
2074
|
* 权限:
|
1857
2075
|
* - Issues: Write
|
1858
2076
|
* - Pull requests: Write
|
@@ -1872,7 +2090,7 @@ declare class Issue extends GitHubClient {
|
|
1872
2090
|
*/
|
1873
2091
|
update_issue_comment(options: UpdateIssueCommentParamType): Promise<ApiResponseType<UpdateIssueCommentResponseType>>;
|
1874
2092
|
/**
|
1875
|
-
*
|
2093
|
+
* 删除议题评论信息
|
1876
2094
|
* 权限:
|
1877
2095
|
* - Issues: Write
|
1878
2096
|
* - Pull requests: Write
|
@@ -1891,7 +2109,7 @@ declare class Issue extends GitHubClient {
|
|
1891
2109
|
*/
|
1892
2110
|
remove_issue_comment(options: RemoveIssueCommentParamType): Promise<ApiResponseType<RemoveCollaboratorResponseType>>;
|
1893
2111
|
/**
|
1894
|
-
*
|
2112
|
+
* 删除议题评论信息
|
1895
2113
|
* 权限:
|
1896
2114
|
* - Issues: Write
|
1897
2115
|
* - Pull requests: Write
|
@@ -1995,7 +2213,7 @@ declare class Issue extends GitHubClient {
|
|
1995
2213
|
}
|
1996
2214
|
|
1997
2215
|
/**
|
1998
|
-
*
|
2216
|
+
* Github 组织操作类
|
1999
2217
|
*
|
2000
2218
|
* 提供对GitHub组织的CRUD操作,包括:
|
2001
2219
|
* - 获取组织信息
|
@@ -2005,7 +2223,7 @@ declare class Org extends GitHubClient {
|
|
2005
2223
|
/**
|
2006
2224
|
* 获取组织信息
|
2007
2225
|
* 权限:
|
2008
|
-
* -
|
2226
|
+
* - Metadata Read-only , 如果获取公开组织可无需此权限
|
2009
2227
|
* @param options 组织参数
|
2010
2228
|
* - org 组织名称
|
2011
2229
|
* @returns 组织信息
|
@@ -2016,6 +2234,263 @@ declare class Org extends GitHubClient {
|
|
2016
2234
|
* ```
|
2017
2235
|
*/
|
2018
2236
|
get_org_info(options: OrgInfoParamType): Promise<ApiResponseType<OrgInfoResponseType>>;
|
2237
|
+
/**
|
2238
|
+
* 添加组织成员
|
2239
|
+
* 权限:
|
2240
|
+
* - Members Read-And_Write
|
2241
|
+
* @param options 组织参数
|
2242
|
+
* - org 组织名称
|
2243
|
+
* - username 成员名称
|
2244
|
+
* @returns 成员信息
|
2245
|
+
* @example
|
2246
|
+
* ```ts
|
2247
|
+
* const orgInfo = await org.add_member({ org: 'org', username: 'username' })
|
2248
|
+
* console.log(orgInfo)
|
2249
|
+
* ```
|
2250
|
+
*/
|
2251
|
+
add_member(options: AddMemberParamType): Promise<ApiResponseType<AddMemberResponseType>>;
|
2252
|
+
}
|
2253
|
+
|
2254
|
+
/**
|
2255
|
+
* GitHub pull_request类
|
2256
|
+
*
|
2257
|
+
* 提供完整的GitHub pull_request管理,包括
|
2258
|
+
* - 获取pull_request列表
|
2259
|
+
* - 获取pull_request详情
|
2260
|
+
*
|
2261
|
+
* @class Auth
|
2262
|
+
* @extends GitHubClient GitHub基础操作类
|
2263
|
+
*/
|
2264
|
+
declare class Pull_Request extends GitHubClient {
|
2265
|
+
constructor(base: GitHubClient);
|
2266
|
+
/**
|
2267
|
+
* 获取拉取请求详情
|
2268
|
+
* 权限:
|
2269
|
+
* - Pull requests: Read-And-Wirte
|
2270
|
+
* - Contents: Read-And-Wirte
|
2271
|
+
* @param options 请求参数列表
|
2272
|
+
* - owner 仓库拥有者
|
2273
|
+
* - repo 仓库名称
|
2274
|
+
* - pr_number Pr编号
|
2275
|
+
* @returns 包含pull_request信息的响应对象
|
2276
|
+
* @example
|
2277
|
+
* ```ts
|
2278
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2279
|
+
* const res = await pull_request.get_pull_request_info({ owner: 'owner', repo:'repo', pr_number:1 })
|
2280
|
+
* console.log(res) // { data: PullRequestInfoResponseType }
|
2281
|
+
* ```
|
2282
|
+
*/
|
2283
|
+
get_pull_request_info(options: PullRequestInfoParamType): Promise<ApiResponseType<PullRequestInfoResponseType>>;
|
2284
|
+
/**
|
2285
|
+
* 获取拉取请求列表
|
2286
|
+
* 权限:
|
2287
|
+
* - Pull requests: Read-Only
|
2288
|
+
* @param options 请求参数列表
|
2289
|
+
* - owner 仓库拥有者
|
2290
|
+
* - repo 仓库名称
|
2291
|
+
* - pr_number Pr编号
|
2292
|
+
* - state 状态
|
2293
|
+
* - base 基准分支
|
2294
|
+
* - sort 排序
|
2295
|
+
* - direction 排序方向
|
2296
|
+
* - per_page 每页数量
|
2297
|
+
* - page 页码
|
2298
|
+
* @returns 包含pull_request信息的响应对象
|
2299
|
+
* @example
|
2300
|
+
* ```ts
|
2301
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2302
|
+
* const res = await pull_request.get_get_pull_request_list({ owner: 'owner', repo:'repo' })
|
2303
|
+
* console.log(res) // { data: PullRequestListResponseType }
|
2304
|
+
* ```
|
2305
|
+
*/
|
2306
|
+
get_get_pull_request_list(options: PullRequestListParamType): Promise<ApiResponseType<PullRequestListResponseType>>;
|
2307
|
+
/**
|
2308
|
+
* 创建一个拉取请求
|
2309
|
+
* 权限:
|
2310
|
+
* - Pull requests: Read-And-Write
|
2311
|
+
* @param options 请求参数列表
|
2312
|
+
* - owner 仓库拥有者
|
2313
|
+
* - repo 仓库名称
|
2314
|
+
* - title 标题
|
2315
|
+
* - body 内容
|
2316
|
+
* - issue 关联的议题
|
2317
|
+
* title和body与issue参数传入其中一种,当传入issue参数时,title和body参数将自动填充
|
2318
|
+
* - head 拉取请求源分支
|
2319
|
+
* - head_repo 拉取请求源仓库, 如果两个存储库都由同一组织拥有,则跨存储库拉取请求需要此字段
|
2320
|
+
* - base 拉取请求目标分支
|
2321
|
+
* - draft 是否为草稿
|
2322
|
+
* @returns 包含pull_request信息的响应对象
|
2323
|
+
* @example
|
2324
|
+
* ```ts
|
2325
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2326
|
+
* const res = await pull_request.create_pull_requestt({ owner: 'owner', repo:'repo', issue: 1, head: 'head', base: 'base' })
|
2327
|
+
* console.log(res) // { data: CreatePullRequestResponseType }
|
2328
|
+
*/
|
2329
|
+
create_pull_request(options: CreatePullRequestParamType): Promise<ApiResponseType<CreatePullRequestResponseType>>;
|
2330
|
+
/**
|
2331
|
+
* 更新一个拉取请求
|
2332
|
+
* 权限:
|
2333
|
+
* - Pull requests: Read-And-Write
|
2334
|
+
* @param options 请求参数列表
|
2335
|
+
* - owner 仓库拥有者
|
2336
|
+
* - repo 仓库名称
|
2337
|
+
* - title 标题
|
2338
|
+
* - body 内容
|
2339
|
+
* - state 状态
|
2340
|
+
* @returns 包含pull_request信息的响应对象
|
2341
|
+
* @example
|
2342
|
+
* ```ts
|
2343
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2344
|
+
* const res = await pull_request.create_pull_requestt({ owner: 'owner', repo:'repo', pr_number:1, state:'open' })
|
2345
|
+
* console.log(res) // { data: CreatePullRequestResponseType }
|
2346
|
+
*/
|
2347
|
+
update_pull_request(options: UpdatePullRequestParamType): Promise<ApiResponseType<UpdatePullRequestResponseType>>;
|
2348
|
+
/**
|
2349
|
+
* 合并拉取请求
|
2350
|
+
* 权限:
|
2351
|
+
* - Pull requests: Read-And-Write
|
2352
|
+
* @param options 请求参数列表
|
2353
|
+
* - owner 仓库拥有者
|
2354
|
+
* - repo 仓库名称
|
2355
|
+
* - pr_number 拉取请求编号
|
2356
|
+
* - commit_title 合并提交标题
|
2357
|
+
* - commit_message 合并提交信息
|
2358
|
+
* - sha 拉取请求头部必须匹配的 SHA 才能允许合并
|
2359
|
+
* - merge_method 拉取请求合并方式, 默认为 merge
|
2360
|
+
* @returns 包含pull_request信息的响应对象
|
2361
|
+
* @example
|
2362
|
+
* ```ts
|
2363
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2364
|
+
* const res = await pull_request.merge_pull_request({ owner: 'owner', repo:'repo', pr_number:1 })
|
2365
|
+
* console.log(res) // { data: CreatePullRequestResponseType }
|
2366
|
+
* ```
|
2367
|
+
*/
|
2368
|
+
merge_pull_request(options: MergePullRequestParamType): Promise<ApiResponseType<MergePullRequestResponseType>>;
|
2369
|
+
/**
|
2370
|
+
* 获取拉取请求文件列表
|
2371
|
+
* 权限:
|
2372
|
+
* - Pull requests: Read-And-Write
|
2373
|
+
* @param options 请求参数列表
|
2374
|
+
* - owner 仓库拥有者
|
2375
|
+
* - repo 仓库名称
|
2376
|
+
* - pr_number 拉取请求编号
|
2377
|
+
* - per_page 每页结果数量
|
2378
|
+
* - page 页码
|
2379
|
+
* @returns 包含拉取请求文件列表的响应对象
|
2380
|
+
* @example
|
2381
|
+
* ```ts
|
2382
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2383
|
+
* const res = await pull_request.get_pull_request_files_list({ owner: 'owner', repo:'repo', pr_number:1 })
|
2384
|
+
* console.log(res) // { data: GetPullRequestFilesListResponseType }
|
2385
|
+
* ```
|
2386
|
+
*/
|
2387
|
+
get_pull_request_files_list(options: GetPullRequestFilesListParamType): Promise<ApiResponseType<GetPullRequestFilesListResponseType>>;
|
2388
|
+
/**
|
2389
|
+
* 获取拉取请求评论信息
|
2390
|
+
* 权限:
|
2391
|
+
* - Pull requests: Read-And-Write
|
2392
|
+
* @param options 请求参数列表
|
2393
|
+
* - owner 仓库拥有者
|
2394
|
+
* - repo 仓库名称
|
2395
|
+
* - comment_id 评论ID
|
2396
|
+
* @returns 包含拉取请求指定的评论id的信息
|
2397
|
+
* @example
|
2398
|
+
* ```ts
|
2399
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2400
|
+
* const res = await pull_request.get_pull_request_comment_info({ owner: 'owner', repo:'repo', comment_id:1 })
|
2401
|
+
* console.log(res) // { data: GetPullRequestCommentInfoResponseType }
|
2402
|
+
* ```
|
2403
|
+
*/
|
2404
|
+
get_pull_request_comment_info(options: GetPullRequestCommentInfoParamType): Promise<ApiResponseType<GetPullRequestCommentInfoResponseType>>;
|
2405
|
+
/**
|
2406
|
+
* 获取拉取请求评论列表
|
2407
|
+
* 权限:
|
2408
|
+
* - Pull requests: Read-And-Write
|
2409
|
+
* @param options 请求参数列表
|
2410
|
+
* - owner 仓库拥有者
|
2411
|
+
* - repo 仓库名称
|
2412
|
+
* - pr_number 拉取请求编号
|
2413
|
+
* - direction 排序方向
|
2414
|
+
* - per_page 每页结果数量
|
2415
|
+
* - page 页码
|
2416
|
+
* @returns 包含拉取请求评论列表响应信息列表
|
2417
|
+
* @example
|
2418
|
+
* ```ts
|
2419
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2420
|
+
* const res = await pull_request.get_pull_request_comments_list({ owner: 'owner', repo:'repo', pr_number:1 })
|
2421
|
+
* console.log(res) // { data: GetPullRequestCommentsListResponseType }
|
2422
|
+
* ```
|
2423
|
+
*/
|
2424
|
+
get_pull_request_comments_list(options: GetPullRequestCommentsListParamType): Promise<ApiResponseType<GetPullRequestCommentsListResponseType>>;
|
2425
|
+
/**
|
2426
|
+
* 创建拉取请求评论
|
2427
|
+
* 权限:
|
2428
|
+
* - Pull requests: Read-And-Write
|
2429
|
+
* @param options 请求参数列表
|
2430
|
+
* - owner 仓库拥有者
|
2431
|
+
* - repo 仓库名称
|
2432
|
+
* - pr_number 拉取请求编号
|
2433
|
+
* - body 评论内容
|
2434
|
+
* @returns 包含创建拉取请求评论响应信息
|
2435
|
+
* @example
|
2436
|
+
* ```ts
|
2437
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2438
|
+
* const res = await pull_request.create_pull_request_comment({ owner: 'owner', repo:'repo', pr_number:1, body: 'loli' })
|
2439
|
+
* console.log(res) // { data: CreatePullRequestCommentResponseType }
|
2440
|
+
* ```
|
2441
|
+
*/
|
2442
|
+
create_pull_request_comment(options: CreatePullRequestCommentParamType): Promise<ApiResponseType<CreatePullRequestCommentResponseType>>;
|
2443
|
+
/**
|
2444
|
+
* 更新拉取请求评论
|
2445
|
+
* 权限:
|
2446
|
+
* - Pull requests: Read-And-Write
|
2447
|
+
* @param options 请求参数列表
|
2448
|
+
* - owner 仓库拥有者
|
2449
|
+
* - repo 仓库名称
|
2450
|
+
* - comment_id 评论ID
|
2451
|
+
* - body 评论内容
|
2452
|
+
* @returns 包含更新拉取请求评论响应信息
|
2453
|
+
* @example
|
2454
|
+
* ```ts
|
2455
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2456
|
+
* const res = await pull_request.update_pull_request_comment({ owner: 'owner', repo:'repo', comment_id:1, body: 'loli' })
|
2457
|
+
* console.log(res) // { data: CreatePullRequestCommentResponseType }
|
2458
|
+
* ```
|
2459
|
+
*/
|
2460
|
+
update_pull_request_comment(options: UpdatePullRequestCommentParamType): Promise<ApiResponseType<UpdatePullRequestCommentResponseType>>;
|
2461
|
+
/**
|
2462
|
+
* 删除拉取请求评论
|
2463
|
+
* @deprecated 请使用update_issue_comment方法
|
2464
|
+
* 权限:
|
2465
|
+
* - Pull requests: Read-And-Write
|
2466
|
+
* @param options - 删除拉取请求评论参数对象
|
2467
|
+
* @returns 删除结果
|
2468
|
+
* @example
|
2469
|
+
* ```ts
|
2470
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2471
|
+
* const res = await pull_request. public async edit_pull_request_comment (
|
2472
|
+
({ owner: 'owner', repo:'repo', comment_id:1, body: 'loli' })
|
2473
|
+
* console.log(res) // { data: CreatePullRequestCommentResponseType }
|
2474
|
+
* ```
|
2475
|
+
*/
|
2476
|
+
edit_pull_request_comment(options: UpdatePullRequestCommentParamType): Promise<ApiResponseType<UpdatePullRequestCommentResponseType>>;
|
2477
|
+
/**
|
2478
|
+
* 删除拉取请求评论
|
2479
|
+
* 权限:
|
2480
|
+
* - Pull requests: Read-And-Write
|
2481
|
+
* @param options 请求参数列表
|
2482
|
+
* - owner 仓库拥有者
|
2483
|
+
* - repo 仓库名称
|
2484
|
+
* - comment_id 评论ID
|
2485
|
+
* @returns 包含更新拉取请求评论响应信息
|
2486
|
+
* @example
|
2487
|
+
* ```ts
|
2488
|
+
* const pull_request = get_pull_request() // 获取pull_request实例
|
2489
|
+
* const res = await pull_request.delete_pull_request_comment({ owner: 'owner', repo:'repo', comment_id: 1 })
|
2490
|
+
* console.log(res) // { data: DeletePullRequestCommentResponseType }
|
2491
|
+
* ```
|
2492
|
+
*/
|
2493
|
+
delete_pull_request_comment(options: DeletePullRequestCommentParamType): Promise<ApiResponseType<DeletePullRequestCommentResponseType>>;
|
2019
2494
|
}
|
2020
2495
|
|
2021
2496
|
/**
|
@@ -2087,50 +2562,78 @@ declare class Repo extends GitHubClient {
|
|
2087
2562
|
* 权限:
|
2088
2563
|
* - Metadata: Read-only, 如果只获取公开仓库可无需此权限
|
2089
2564
|
* @param options - 仓库信息参数对象,必须包含以下两种组合之一:
|
2090
|
-
* -
|
2091
|
-
* -
|
2092
|
-
* - options.repo 仓库名称
|
2093
|
-
* url参数和owner、repo参数传入其中的一种
|
2565
|
+
* - owner 仓库拥有者
|
2566
|
+
* - repo 仓库名称
|
2094
2567
|
* @example
|
2095
2568
|
* ```ts
|
2096
|
-
* const repo = await repo.get_repo_info({
|
2569
|
+
* const repo = await repo.get_repo_info({ owner: 'owner', repo: 'repo' })
|
2097
2570
|
* console.log(repo)
|
2098
2571
|
* ```
|
2099
2572
|
*/
|
2100
2573
|
get_repo_info(options: RepoInfoParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
|
2574
|
+
/**
|
2575
|
+
* 获取仓库语言列表
|
2576
|
+
* 权限:
|
2577
|
+
* - Metadata: Read-only, 如果只获取公开仓库可无需此权限
|
2578
|
+
* @param options - 仓库信息参数对象,必须包含以下两种组合之一:
|
2579
|
+
* - owner 仓库拥有者
|
2580
|
+
* - repo 仓库名称
|
2581
|
+
* @example
|
2582
|
+
* ```ts
|
2583
|
+
* const repo = await repo.get_repo_languages_list({ owner: 'owner', repo: 'repo' })
|
2584
|
+
* console.log(repo)
|
2585
|
+
* ```
|
2586
|
+
*/
|
2101
2587
|
get_repo_languages_list(options: RepoLanguagesListParamType): Promise<ApiResponseType<RepoLanguagesListResponseType>>;
|
2102
2588
|
/**
|
2103
2589
|
* 创建组织仓库
|
2104
2590
|
* 权限:
|
2105
2591
|
* - Administration: Read and write
|
2106
2592
|
* @param options 创建组织仓库参数
|
2107
|
-
* -
|
2593
|
+
* - org: 组织名称
|
2108
2594
|
* - name: 仓库名称
|
2109
2595
|
* - description: 仓库描述
|
2110
2596
|
* - homepage: 仓库主页URL
|
2111
2597
|
* - visibility: 仓库可见性,可选值:'public' | 'private', 默认值:'public'
|
2112
2598
|
* - has_issues: 是否启用issues功能, 默认值:true
|
2113
|
-
* - has_projects: 是否启用projects功能, 默认值:true
|
2114
2599
|
* - has_wiki: 是否启用wiki功能, 默认值:true
|
2115
|
-
* - has_downloads: 是否启用下载功能 默认值:true
|
2116
|
-
* - is_template: 是否设置为模板仓库 默认值:false
|
2117
|
-
* - team_id: 关联团队ID(组织仓库专用)
|
2118
2600
|
* - auto_init: 是否自动初始化仓库 默认值:false
|
2119
|
-
* - gitignore_template: gitignore模板名称(需配合auto_init使用)
|
2120
|
-
* - license_template: license模板名称(需配合auto_init使用)
|
2121
|
-
* - allow_squash_merge: 是否允许squash merge, 默认值:true
|
2122
|
-
* - allow_merge_commit: 是否允许普通合并, 默认值:true
|
2123
|
-
* - allow_rebase_merge: 是否允许rebase合并 默认值:true
|
2124
|
-
* - allow_auto_merge: 是否允许自动合并 默认值:false
|
2125
|
-
* - delete_branch_on_merge: 合并后是否自动删除分支 默认值:false
|
2126
|
-
* - squash_merge_commit_title: squash合并提交标题格式 默认值:'PR_TITLE'
|
2127
|
-
* - squash_merge_commit_message: squash合并提交信息格式 默认值:'PR_BODY'
|
2128
|
-
* - merge_commit_title: 合并提交标题格式 默认值:'PR_TITLE'
|
2129
|
-
* - merge_commit_message: 合并提交信息格式 默认值:'PR_BODY'
|
2130
|
-
* - custom_properties: 自定义键值对属性
|
2131
2601
|
* @returns 返回创建成功的仓库信息
|
2132
2602
|
*/
|
2133
2603
|
create_org_repo(options: OrgRepoCreateParamType): Promise<ApiResponseType<OrgRepoCreateResponseType>>;
|
2604
|
+
/**
|
2605
|
+
* 创建用户仓库
|
2606
|
+
* 权限:
|
2607
|
+
* - Administration: Read and write
|
2608
|
+
* @param options 创建组织仓库参数
|
2609
|
+
* - owner: 仓库拥有者,用户名称
|
2610
|
+
* - name: 仓库名称
|
2611
|
+
* - description: 仓库描述
|
2612
|
+
* - homepage: 仓库主页URL
|
2613
|
+
* - visibility: 仓库可见性,可选值:'public' | 'private', 默认值:'public'
|
2614
|
+
* - has_issues: 是否启用issues功能, 默认值:true
|
2615
|
+
* - has_wiki: 是否启用wiki功能, 默认值:true
|
2616
|
+
* - auto_init: 是否自动初始化仓库 默认值:false
|
2617
|
+
* @returns 返回创建成功的仓库信息
|
2618
|
+
*/
|
2619
|
+
create_user_repo(options: UserRepoCreateParamType): Promise<ApiResponseType<UserRepoCreateResponseType>>;
|
2620
|
+
/**
|
2621
|
+
* 创建用户仓库
|
2622
|
+
* @deprecated 请使用create_user_repo方法
|
2623
|
+
* 权限:
|
2624
|
+
* - Administration: Read and write
|
2625
|
+
* @param options 创建组织仓库参数
|
2626
|
+
* - owner: 仓库拥有者,用户名称
|
2627
|
+
* - name: 仓库名称
|
2628
|
+
* - description: 仓库描述
|
2629
|
+
* - homepage: 仓库主页URL
|
2630
|
+
* - visibility: 仓库可见性,可选值:'public' | 'private', 默认值:'public'
|
2631
|
+
* - has_issues: 是否启用issues功能, 默认值:true
|
2632
|
+
* - has_wiki: 是否启用wiki功能, 默认值:true
|
2633
|
+
* - auto_init: 是否自动初始化仓库 默认值:false
|
2634
|
+
* @returns 返回创建成功的仓库信息
|
2635
|
+
*/
|
2636
|
+
create_repo(options: UserRepoCreateParamType): Promise<ApiResponseType<RepoInfoResponseType>>;
|
2134
2637
|
/**
|
2135
2638
|
* 获取协作者列表
|
2136
2639
|
* 权限:
|
@@ -2231,23 +2734,21 @@ declare class Repo extends GitHubClient {
|
|
2231
2734
|
* console.log(visibility) // 输出 public 或 private
|
2232
2735
|
* ```
|
2233
2736
|
*/
|
2234
|
-
get_repo_visibility(options:
|
2737
|
+
get_repo_visibility(options: GetRepoVisibilityParamType): Promise<GetRepoVisibilityResponseType>;
|
2235
2738
|
/**
|
2236
2739
|
* 获取仓库默认分支
|
2237
2740
|
* 权限:
|
2238
2741
|
* - Metadata: Read-only, 如果只获取公开仓库可无需此权限
|
2239
2742
|
* @param options
|
2240
|
-
* - url 仓库URL地址
|
2241
2743
|
* - owner 仓库拥有者
|
2242
2744
|
* - repo 仓库名称
|
2243
|
-
* url参数和owner、repo参数传入其中的一种
|
2244
2745
|
* @example
|
2245
2746
|
* ```ts
|
2246
|
-
* const defaultBranch = await repo.get_repo_default_branch({
|
2747
|
+
* const defaultBranch = await repo.get_repo_default_branch({owner: CandriaJS, repo: meme-plugin)}
|
2247
2748
|
* console.log(defaultBranch) // 输出 main
|
2248
2749
|
* ```ts
|
2249
2750
|
*/
|
2250
|
-
get_repo_default_branch(options:
|
2751
|
+
get_repo_default_branch(options: GetRepoDefaultBranchParamType): Promise<GetRepoDefaultBranchResponseType | null>;
|
2251
2752
|
/**
|
2252
2753
|
* 获取仓库主要语言
|
2253
2754
|
* 权限:
|
@@ -2263,7 +2764,7 @@ declare class Repo extends GitHubClient {
|
|
2263
2764
|
* console.log(language) // 输出 JavaScript
|
2264
2765
|
* ```ts
|
2265
2766
|
*/
|
2266
|
-
get_repo_main_language(options:
|
2767
|
+
get_repo_main_language(options: GetRepoMainLanguageParamType): Promise<GetRepoMainLanguageResponseType>;
|
2267
2768
|
}
|
2268
2769
|
|
2269
2770
|
/**
|
@@ -2305,28 +2806,24 @@ declare class User extends GitHubClient {
|
|
2305
2806
|
/**
|
2306
2807
|
* 通过访问令牌获取用户信息
|
2307
2808
|
* 权限:无需任何权限
|
2308
|
-
* @param options - 访问令牌配置参数对象
|
2309
|
-
* - access_token - 访问令牌
|
2310
2809
|
* @example
|
2311
2810
|
* ```ts
|
2312
|
-
* const userInfo = await user.get_user_info_by_token(
|
2811
|
+
* const userInfo = await user.get_user_info_by_token()
|
2313
2812
|
* console.log(userInfo)
|
2314
2813
|
* ```
|
2315
2814
|
*/
|
2316
|
-
get_user_info_by_auth(
|
2815
|
+
get_user_info_by_auth(): Promise<ApiResponseType<UserInfoResponseType>>;
|
2317
2816
|
/**
|
2318
2817
|
* 通过访问令牌获取用户信息
|
2319
2818
|
* 权限:无需任何权限
|
2320
|
-
* @deprecated 该方法已过时,请使用get_user_info_by_auth
|
2321
|
-
* @param options - 访问令牌配置参数对象
|
2322
|
-
* - access_token - 访问令牌
|
2819
|
+
* @deprecated 该方法已过时,请使用get_user_info_by_auth方法牌
|
2323
2820
|
* @example
|
2324
2821
|
* ```ts
|
2325
|
-
* const userInfo = await user.get_user_info_by_token(
|
2822
|
+
* const userInfo = await user.get_user_info_by_token()
|
2326
2823
|
* console.log(userInfo)
|
2327
2824
|
* ```
|
2328
2825
|
*/
|
2329
|
-
get_user_info_by_token(
|
2826
|
+
get_user_info_by_token(): Promise<ApiResponseType<UserInfoResponseType>>;
|
2330
2827
|
/**
|
2331
2828
|
* 获取用户贡献数据
|
2332
2829
|
* 权限:无需任何权限
|
@@ -2403,7 +2900,7 @@ declare class User extends GitHubClient {
|
|
2403
2900
|
}
|
2404
2901
|
|
2405
2902
|
/**
|
2406
|
-
*
|
2903
|
+
* GitHUb WebHook操作类
|
2407
2904
|
*
|
2408
2905
|
* 提供对GitHub WebHook的CRUD操作,包括:
|
2409
2906
|
* - 检查webhook签名是否正确
|
@@ -2436,13 +2933,13 @@ declare class WebHook extends GitHubClient {
|
|
2436
2933
|
* 此类作为GitHub API功能的入口点,封装了以下核心能力:
|
2437
2934
|
* - JWT令牌生成与管理
|
2438
2935
|
* - 请求代理配置
|
2439
|
-
* - 基础HTTP请求方法(GET/POST)
|
2936
|
+
* - 基础HTTP请求方法(GET/POST/PATCH/DELETE/PUT)
|
2440
2937
|
* - 应用认证管理
|
2441
2938
|
* - 模块化服务(App/Auth/Commit/Repo/User/WebHook)
|
2442
2939
|
*
|
2443
2940
|
* @example
|
2444
2941
|
* ```ts
|
2445
|
-
* const base = new
|
2942
|
+
* const base = new GitHubClient({
|
2446
2943
|
* APP_ID: 12345,
|
2447
2944
|
* Private_Key: '-----BEGIN PRIVATE KEY-----...',
|
2448
2945
|
* Client_ID: 'Iv1.1234567890abcdef',
|
@@ -2460,24 +2957,35 @@ declare class GitHubClient {
|
|
2460
2957
|
webhook: WebHook;
|
2461
2958
|
issue: Issue;
|
2462
2959
|
org: Org;
|
2463
|
-
|
2464
|
-
|
2960
|
+
pull_request: Pull_Request;
|
2961
|
+
base_url: string;
|
2962
|
+
api_url: string;
|
2465
2963
|
jwtToken: string;
|
2466
|
-
userToken
|
2964
|
+
userToken?: string | null;
|
2965
|
+
readonly Private_Key?: string | null;
|
2966
|
+
readonly Client_ID?: string | null;
|
2967
|
+
readonly Client_Secret?: string | null;
|
2968
|
+
readonly WebHook_Secret?: string | null;
|
2467
2969
|
readonly format: boolean;
|
2468
|
-
readonly Private_Key: string;
|
2469
|
-
readonly Client_ID: string;
|
2470
|
-
readonly Client_Secret: string;
|
2471
|
-
readonly WebHook_Secret: string;
|
2472
2970
|
private currentRequestConfig;
|
2473
2971
|
private proxy?;
|
2474
|
-
constructor(options:
|
2972
|
+
constructor(options: GitHubClientType);
|
2973
|
+
/**
|
2974
|
+
* 获取Git平台类型
|
2975
|
+
* @returns Git平台类型,如: github,gitee
|
2976
|
+
*/
|
2977
|
+
get type(): GitType;
|
2978
|
+
/**
|
2979
|
+
* 是否是App客户端
|
2980
|
+
*/
|
2981
|
+
get is_app_client(): boolean;
|
2982
|
+
private validateAppClient;
|
2475
2983
|
/**
|
2476
2984
|
* 获取App实例
|
2477
2985
|
* @returns App实例
|
2478
2986
|
* @example
|
2479
2987
|
* ```ts
|
2480
|
-
* const app = await
|
2988
|
+
* const app = await GitHubClient.get_app()
|
2481
2989
|
* ```
|
2482
2990
|
*/
|
2483
2991
|
get_app(): Promise<App>;
|
@@ -2486,7 +2994,7 @@ declare class GitHubClient {
|
|
2486
2994
|
* @returns Auth实例
|
2487
2995
|
* @example
|
2488
2996
|
* ```ts
|
2489
|
-
* const auth = await
|
2997
|
+
* const auth = await GitHubClient.get_auth()
|
2490
2998
|
* ```
|
2491
2999
|
*/
|
2492
3000
|
get_auth(): Promise<Auth>;
|
@@ -2495,7 +3003,7 @@ declare class GitHubClient {
|
|
2495
3003
|
* @returns Commit实例
|
2496
3004
|
* @example
|
2497
3005
|
* ```ts
|
2498
|
-
* const commit = await
|
3006
|
+
* const commit = await GitHubClient.get_commit()
|
2499
3007
|
* ```
|
2500
3008
|
*/
|
2501
3009
|
get_commit(): Promise<Commit>;
|
@@ -2504,7 +3012,7 @@ declare class GitHubClient {
|
|
2504
3012
|
* @returns Issue实例
|
2505
3013
|
* @example
|
2506
3014
|
* ```ts
|
2507
|
-
* const issue = await
|
3015
|
+
* const issue = await GitHubClient.get_issue()
|
2508
3016
|
* ```
|
2509
3017
|
*/
|
2510
3018
|
get_issue(): Promise<Issue>;
|
@@ -2513,7 +3021,7 @@ declare class GitHubClient {
|
|
2513
3021
|
* @returns Repo实例
|
2514
3022
|
* @example
|
2515
3023
|
* ```ts
|
2516
|
-
* const repo = await
|
3024
|
+
* const repo = await GitHubClient.get_repo()
|
2517
3025
|
* ```
|
2518
3026
|
*/
|
2519
3027
|
get_repo(): Promise<Repo>;
|
@@ -2522,7 +3030,7 @@ declare class GitHubClient {
|
|
2522
3030
|
* @returns User实例
|
2523
3031
|
* @example
|
2524
3032
|
* ```ts
|
2525
|
-
* const user = await
|
3033
|
+
* const user = await GitHubClient.get_user()
|
2526
3034
|
* ```
|
2527
3035
|
*/
|
2528
3036
|
get_user(): Promise<User>;
|
@@ -2531,7 +3039,7 @@ declare class GitHubClient {
|
|
2531
3039
|
* @returns Org实例
|
2532
3040
|
* @example
|
2533
3041
|
* ```ts
|
2534
|
-
* const org = await
|
3042
|
+
* const org = await GitHubClient.get_org()
|
2535
3043
|
* ```
|
2536
3044
|
*/
|
2537
3045
|
get_org(): Promise<Org>;
|
@@ -2540,10 +3048,19 @@ declare class GitHubClient {
|
|
2540
3048
|
* @returns WebHook实例
|
2541
3049
|
* @example
|
2542
3050
|
* ```ts
|
2543
|
-
* const webhook = await
|
3051
|
+
* const webhook = await GitHubClient.get_webhook()
|
2544
3052
|
* ```
|
2545
3053
|
*/
|
2546
3054
|
get_webhook(): Promise<WebHook>;
|
3055
|
+
/**
|
3056
|
+
* 获取Pull_request实例
|
3057
|
+
* @returns Pull_request实例
|
3058
|
+
* @example
|
3059
|
+
* ```ts
|
3060
|
+
* const pull_request = await GitHubClient.get_pull_request()
|
3061
|
+
* ```
|
3062
|
+
*/
|
3063
|
+
get_pull_request(): Promise<Pull_Request>;
|
2547
3064
|
/**
|
2548
3065
|
* 设置请求代理
|
2549
3066
|
* @param proxy 代理参数
|
@@ -2558,14 +3075,14 @@ declare class GitHubClient {
|
|
2558
3075
|
setProxy(proxy: ProxyParamsType): void;
|
2559
3076
|
/**
|
2560
3077
|
* 设置 token
|
2561
|
-
* 传入的 token 必须以 ghu_ 开头,否则会抛出错误
|
3078
|
+
* 传入的 token 必须以 ghu_ 或ghp_开头,否则会抛出错误
|
2562
3079
|
* @param token 传入的 token
|
2563
3080
|
* @example
|
2564
3081
|
* ```ts
|
2565
3082
|
* setToken('ghu_xxxx')
|
2566
3083
|
* ```
|
2567
3084
|
*/
|
2568
|
-
setToken(token: string):
|
3085
|
+
setToken(token: string): void;
|
2569
3086
|
/**
|
2570
3087
|
* 生成 JWT Token
|
2571
3088
|
* @param options 生成 JWT 所需的参数
|
@@ -2643,9 +3160,18 @@ declare class GitHubClient {
|
|
2643
3160
|
*/
|
2644
3161
|
declare class App extends GitHubClient {
|
2645
3162
|
constructor(base: GitHubClient);
|
3163
|
+
/**
|
3164
|
+
* 获取应用基本信息
|
3165
|
+
* 权限:
|
3166
|
+
* - `none` 此节点仅App Client可用
|
3167
|
+
* @param options - 应用标识符
|
3168
|
+
* @returns 应用基本信息
|
3169
|
+
*/
|
2646
3170
|
get_app_info(options: AppInfoParamType): Promise<ApiResponseType<AppInfoResponseType>>;
|
2647
3171
|
/**
|
2648
3172
|
* 获取当前 Github App 信息
|
3173
|
+
* 权限:
|
3174
|
+
* - `none` 此节点仅App Client可用
|
2649
3175
|
* @returns 返回 Github App 信息
|
2650
3176
|
* @example
|
2651
3177
|
* ```ts
|
@@ -2656,6 +3182,8 @@ declare class App extends GitHubClient {
|
|
2656
3182
|
private get_app_info_by_auth;
|
2657
3183
|
/**
|
2658
3184
|
* 获取仓库的应用安装信息
|
3185
|
+
* 权限:
|
3186
|
+
* - `none` 此节点仅App Client可用
|
2659
3187
|
* @param options - 仓库安装应用参数对象
|
2660
3188
|
* - owner 拥有者
|
2661
3189
|
* - repo 仓库名
|
@@ -2699,6 +3227,19 @@ declare class App extends GitHubClient {
|
|
2699
3227
|
* ```
|
2700
3228
|
*/
|
2701
3229
|
get_app_name(): Promise<string>;
|
3230
|
+
/**
|
3231
|
+
* 快速判断指定仓库是否安装了当前App 应用
|
3232
|
+
* @param options - 仓库安装应用参数对象
|
3233
|
+
* - owner 拥有者
|
3234
|
+
* - repo 仓库名
|
3235
|
+
* @returns 是否安装
|
3236
|
+
* @example
|
3237
|
+
* ```ts
|
3238
|
+
* const isInstalled = await app.is_app_inttalled_in_repo({ owner: 'owner', repo: 'repo' })
|
3239
|
+
* console.log(isInstalled) // 输出是否安装
|
3240
|
+
* ·
|
3241
|
+
*/
|
3242
|
+
is_app_installed_in_repo(options: RepoBaseParamType): Promise<boolean>;
|
2702
3243
|
}
|
2703
3244
|
|
2704
3245
|
type index_App = App;
|
@@ -2713,6 +3254,8 @@ type index_Issue = Issue;
|
|
2713
3254
|
declare const index_Issue: typeof Issue;
|
2714
3255
|
type index_Org = Org;
|
2715
3256
|
declare const index_Org: typeof Org;
|
3257
|
+
type index_Pull_Request = Pull_Request;
|
3258
|
+
declare const index_Pull_Request: typeof Pull_Request;
|
2716
3259
|
type index_Repo = Repo;
|
2717
3260
|
declare const index_Repo: typeof Repo;
|
2718
3261
|
type index_User = User;
|
@@ -2720,7 +3263,7 @@ declare const index_User: typeof User;
|
|
2720
3263
|
type index_WebHook = WebHook;
|
2721
3264
|
declare const index_WebHook: typeof WebHook;
|
2722
3265
|
declare namespace index {
|
2723
|
-
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_Repo as Repo, index_User as User, index_WebHook as WebHook };
|
3266
|
+
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 };
|
2724
3267
|
}
|
2725
3268
|
|
2726
3269
|
/** 基本客户端 */
|
@@ -2729,4 +3272,4 @@ declare class Client {
|
|
2729
3272
|
constructor(options: ClientType);
|
2730
3273
|
}
|
2731
3274
|
|
2732
|
-
export { type AccessCodeType, type AccessTokenType, type AddCollaboratorResponseType, type
|
3275
|
+
export { type AccessCodeType, type AccessTokenClentTYpe, type AccessTokenType, type AddCollaboratorResponseType, type AddMemberParamType, type AddMemberResponseType, type AddSubIssueParamType, type AddSubIssueResponseType, 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 CollaboratorListParamType, type CollaboratorListResponseType, type CollaboratorParamType, 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 CreateIssueResponseType, type CreatePullRequestCommentParamType, type CreatePullRequestCommentResponseType, type CreatePullRequestParamType, type CreatePullRequestResponseType, type CreateReleaseParamType, type CreateReleaseResponseType, type CreteIssueCommentParamType, type CreteIssueCommentResponseType, type CreteIssueParamType, type DeletePullRequestCommentParamType, type DeletePullRequestCommentResponseType, type DeleteReleaseParamType, type DeleteReleaseResponseType, type DiffEntry, type ExecOptions, type ExecReturn, type ExecType, 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 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 UserInfoByAuthParamType, 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, formatDate, type formatParamType, get_langage_color, get_local_repo_default_branch, get_relative_time, get_remote_repo_default_branch, index as github };
|