connect-api-cli 1.1.3
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 +396 -0
- package/dist/chunk-3WGV37EN.mjs +1187 -0
- package/dist/chunk-3WGV37EN.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2901 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +1711 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +729 -0
- package/dist/index.d.ts +729 -0
- package/dist/index.js +1227 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
import * as axios from 'axios';
|
|
2
|
+
|
|
3
|
+
interface ConnectRet {
|
|
4
|
+
code: number;
|
|
5
|
+
msg: string;
|
|
6
|
+
}
|
|
7
|
+
interface ConnectRetOnlyResponse {
|
|
8
|
+
ret: ConnectRet;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 认证模式:
|
|
13
|
+
* - client_credentials:API 客户端(client_id + client_secret)
|
|
14
|
+
* - oauth:OAuth 授权码(用户身份,平台类工具)
|
|
15
|
+
* - service_account:Service Account(推荐,本地签 PS256 JWT)
|
|
16
|
+
*/
|
|
17
|
+
type AuthMode = 'client_credentials' | 'oauth' | 'service_account';
|
|
18
|
+
interface TokenResponse {
|
|
19
|
+
access_token?: string;
|
|
20
|
+
expires_in?: number;
|
|
21
|
+
ret?: ConnectRet;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* OAuth 授权码模式下的 token 响应结构(与 HarmonyBot 插件 /access-token/generate 对齐):
|
|
25
|
+
* - accessToken / refreshToken 为驼峰字段
|
|
26
|
+
* - expireTime 单位为秒
|
|
27
|
+
*/
|
|
28
|
+
interface OAuthTokenResponse {
|
|
29
|
+
ret: ConnectRet;
|
|
30
|
+
accessToken: string;
|
|
31
|
+
expireTime: number;
|
|
32
|
+
refreshToken?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* OAuth 刷新 token 的响应结构(与插件 /access-token/refresh 对齐):
|
|
36
|
+
* 刷新接口通常只返回新的 accessToken,refreshToken 沿用旧值
|
|
37
|
+
*/
|
|
38
|
+
interface OAuthRefreshResponse {
|
|
39
|
+
ret: ConnectRet;
|
|
40
|
+
accessToken: string;
|
|
41
|
+
expireTime: number;
|
|
42
|
+
}
|
|
43
|
+
/** AGC 控制台下载的 Service Account 凭据(*_private.json) */
|
|
44
|
+
interface ServiceAccountCredentials {
|
|
45
|
+
key_id: string;
|
|
46
|
+
private_key: string;
|
|
47
|
+
sub_account: string;
|
|
48
|
+
project_id?: string;
|
|
49
|
+
auth_uri?: string;
|
|
50
|
+
token_uri?: string;
|
|
51
|
+
auth_provider_cert_uri?: string;
|
|
52
|
+
client_cert_uri?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare class AuthService {
|
|
56
|
+
/**
|
|
57
|
+
* 获取访问API的Token(service to service,client_credentials 模式)
|
|
58
|
+
*/
|
|
59
|
+
static getToken(): Promise<TokenResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* 使用 Service Account 凭据本地签发 PS256 JWT(可直接作为 Authorization Bearer)。
|
|
62
|
+
* 参见:获取服务端授权 → Service Account 方式。
|
|
63
|
+
*/
|
|
64
|
+
static createServiceAccountJwt(credentials: ServiceAccountCredentials, nowSec?: number): {
|
|
65
|
+
jwt: string;
|
|
66
|
+
expiresIn: number;
|
|
67
|
+
expiresAt: number;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* 拼装 OAuth 授权 URL(含随机 state 防 CSRF)
|
|
71
|
+
*/
|
|
72
|
+
static buildAuthUrl(state: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* 用授权码换取 OAuth token(与插件 /access-token/generate 对齐)
|
|
75
|
+
*/
|
|
76
|
+
static getOAuthToken(code: string, redirectUri: string): Promise<OAuthTokenResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* 用 refreshToken 刷新 OAuth token(与插件 /access-token/refresh 对齐)。
|
|
79
|
+
* 刷新接口只返回新的 accessToken,refreshToken 沿用旧值。
|
|
80
|
+
*/
|
|
81
|
+
static refreshOAuthToken(refreshToken: string): Promise<OAuthRefreshResponse>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface AppIdPair {
|
|
85
|
+
key: string;
|
|
86
|
+
value: string;
|
|
87
|
+
}
|
|
88
|
+
interface AppIdListResponse {
|
|
89
|
+
ret: ConnectRet;
|
|
90
|
+
appids?: AppIdPair[];
|
|
91
|
+
}
|
|
92
|
+
/** 创建应用/元服务 */
|
|
93
|
+
interface CreateAppRequest {
|
|
94
|
+
/** AGC 项目 ID */
|
|
95
|
+
projectId: string;
|
|
96
|
+
/** 应用/元服务名称 */
|
|
97
|
+
appName: string;
|
|
98
|
+
/** 包名;创建应用(installationFree=0)必填,元服务(1)不传 */
|
|
99
|
+
packageName?: string;
|
|
100
|
+
/** 一级分类:2-游戏;13-应用 */
|
|
101
|
+
parentType: 2 | 13;
|
|
102
|
+
/** 0:应用;1:元服务 */
|
|
103
|
+
installationFree: 0 | 1;
|
|
104
|
+
}
|
|
105
|
+
interface CreateAppResponse {
|
|
106
|
+
ret: ConnectRet;
|
|
107
|
+
appId?: string;
|
|
108
|
+
}
|
|
109
|
+
interface AppInfoResponse {
|
|
110
|
+
ret: ConnectRet;
|
|
111
|
+
appInfo?: Record<string, unknown>;
|
|
112
|
+
auditInfo?: Record<string, unknown>;
|
|
113
|
+
languages?: Array<Record<string, unknown>>;
|
|
114
|
+
phasedReleaseInfo?: Record<string, unknown>;
|
|
115
|
+
openTestInfo?: Record<string, unknown>;
|
|
116
|
+
}
|
|
117
|
+
interface GetAppInfoRequest {
|
|
118
|
+
appId: string;
|
|
119
|
+
lang?: string;
|
|
120
|
+
releaseType?: number;
|
|
121
|
+
versionId?: string;
|
|
122
|
+
}
|
|
123
|
+
interface MembersRoleListRequest {
|
|
124
|
+
fromPage: number;
|
|
125
|
+
pageSize: number;
|
|
126
|
+
languageCode: string;
|
|
127
|
+
}
|
|
128
|
+
interface MembersRoleListResponse {
|
|
129
|
+
ret: ConnectRet;
|
|
130
|
+
members?: unknown[];
|
|
131
|
+
developerInfo?: Record<string, unknown>;
|
|
132
|
+
totalCount?: number;
|
|
133
|
+
}
|
|
134
|
+
interface UpdateAppInfoRequest {
|
|
135
|
+
appId: string;
|
|
136
|
+
releaseType?: number;
|
|
137
|
+
releasePhase?: number;
|
|
138
|
+
[key: string]: unknown;
|
|
139
|
+
}
|
|
140
|
+
interface UpdateLanguageInfoRequest {
|
|
141
|
+
appId: string;
|
|
142
|
+
releaseType?: number;
|
|
143
|
+
releasePhase?: number;
|
|
144
|
+
lang: string;
|
|
145
|
+
appName?: string;
|
|
146
|
+
appDesc?: string;
|
|
147
|
+
briefInfo?: string;
|
|
148
|
+
newFeatures?: string;
|
|
149
|
+
[key: string]: unknown;
|
|
150
|
+
}
|
|
151
|
+
interface DeleteLanguageInfoRequest {
|
|
152
|
+
appId: string;
|
|
153
|
+
lang: string;
|
|
154
|
+
releaseType?: number;
|
|
155
|
+
}
|
|
156
|
+
interface UpdateAppFileInfoRequest {
|
|
157
|
+
appId: string;
|
|
158
|
+
releaseType?: number;
|
|
159
|
+
releasePhase?: number;
|
|
160
|
+
[key: string]: unknown;
|
|
161
|
+
}
|
|
162
|
+
interface UpdateAppPackageInfoRequest {
|
|
163
|
+
appId: string;
|
|
164
|
+
fileName: string;
|
|
165
|
+
objectId: string;
|
|
166
|
+
releaseType?: number;
|
|
167
|
+
releasePhase?: number;
|
|
168
|
+
}
|
|
169
|
+
interface UpdateAppPackageInfoResponse {
|
|
170
|
+
ret: ConnectRet;
|
|
171
|
+
packageId?: string;
|
|
172
|
+
}
|
|
173
|
+
interface UpdateReleaseTimeRequest {
|
|
174
|
+
appId: string;
|
|
175
|
+
changeType: number;
|
|
176
|
+
releaseTime?: string;
|
|
177
|
+
releaseType?: number;
|
|
178
|
+
}
|
|
179
|
+
interface UpdatePhasedReleaseRequest {
|
|
180
|
+
appId: string;
|
|
181
|
+
versionId: string;
|
|
182
|
+
releasePhase?: number;
|
|
183
|
+
state?: string;
|
|
184
|
+
description?: string;
|
|
185
|
+
phaseDay?: number;
|
|
186
|
+
[key: string]: unknown;
|
|
187
|
+
}
|
|
188
|
+
interface QueryPackageInfoRequest {
|
|
189
|
+
appId: string;
|
|
190
|
+
packageId: string;
|
|
191
|
+
}
|
|
192
|
+
interface QueryCompileStatusRequest {
|
|
193
|
+
appId: string;
|
|
194
|
+
pkgIds: string;
|
|
195
|
+
}
|
|
196
|
+
interface QueryBriefInfoListRequest {
|
|
197
|
+
appId: string;
|
|
198
|
+
packageName?: string;
|
|
199
|
+
state?: string;
|
|
200
|
+
}
|
|
201
|
+
interface QueryBriefInfoListResponse {
|
|
202
|
+
ret: ConnectRet;
|
|
203
|
+
versionList?: Array<Record<string, unknown>>;
|
|
204
|
+
}
|
|
205
|
+
interface QueryVersionVocRequest {
|
|
206
|
+
appId: string;
|
|
207
|
+
vocId?: string;
|
|
208
|
+
vocDesc?: string;
|
|
209
|
+
pageNo?: number;
|
|
210
|
+
pageSize?: number;
|
|
211
|
+
}
|
|
212
|
+
interface QualificationTaskBody {
|
|
213
|
+
appId: string;
|
|
214
|
+
tagQualInfos: unknown[];
|
|
215
|
+
[key: string]: unknown;
|
|
216
|
+
}
|
|
217
|
+
interface QueryQualificationRequest {
|
|
218
|
+
appId: string;
|
|
219
|
+
tagIds: string;
|
|
220
|
+
}
|
|
221
|
+
interface CancelQualificationRequest {
|
|
222
|
+
appId: string;
|
|
223
|
+
taskId: string;
|
|
224
|
+
}
|
|
225
|
+
interface DeleteQualificationRequest {
|
|
226
|
+
appId: string;
|
|
227
|
+
tagIds: string[];
|
|
228
|
+
}
|
|
229
|
+
interface AgreementBodyRequest {
|
|
230
|
+
appId: string;
|
|
231
|
+
[key: string]: unknown;
|
|
232
|
+
}
|
|
233
|
+
interface ListAgreementRequest {
|
|
234
|
+
appId: string;
|
|
235
|
+
agreementIdList?: string[];
|
|
236
|
+
name?: string;
|
|
237
|
+
status?: number;
|
|
238
|
+
type?: number;
|
|
239
|
+
fromRecCount?: number;
|
|
240
|
+
maxReqCount?: number;
|
|
241
|
+
[key: string]: unknown;
|
|
242
|
+
}
|
|
243
|
+
interface SubmitPrivacyAgreementRequest {
|
|
244
|
+
appId: string;
|
|
245
|
+
id: string;
|
|
246
|
+
requireConfirm?: number;
|
|
247
|
+
}
|
|
248
|
+
interface AgeRatingRequest {
|
|
249
|
+
appId: string;
|
|
250
|
+
releaseType?: number;
|
|
251
|
+
releasePhase?: number;
|
|
252
|
+
[key: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
interface SubmitAppRequest {
|
|
255
|
+
appId: string;
|
|
256
|
+
releaseTime?: string;
|
|
257
|
+
remark?: string;
|
|
258
|
+
releaseType?: number;
|
|
259
|
+
releasePhase?: number;
|
|
260
|
+
phasedReleaseDescription?: string;
|
|
261
|
+
[key: string]: unknown;
|
|
262
|
+
}
|
|
263
|
+
interface CancelReviewRequest {
|
|
264
|
+
appId: string;
|
|
265
|
+
versionId: string;
|
|
266
|
+
}
|
|
267
|
+
interface ShelfOffRequest {
|
|
268
|
+
appId: string;
|
|
269
|
+
reason: string;
|
|
270
|
+
releaseType?: number;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
declare class PublishService {
|
|
274
|
+
/** 查询应用包名对应的 appid */
|
|
275
|
+
static getAppIdList(packageName: string, packageTypes?: string): Promise<AppIdListResponse>;
|
|
276
|
+
/** 创建应用或元服务(projectId 为 query 参数) */
|
|
277
|
+
static createApp(req: CreateAppRequest): Promise<CreateAppResponse>;
|
|
278
|
+
/** 查询团队账号下的成员角色列表 */
|
|
279
|
+
static getMembersRoleList(req: MembersRoleListRequest): Promise<MembersRoleListResponse>;
|
|
280
|
+
/** 查询应用信息 */
|
|
281
|
+
static getAppInfo(appIdOrReq: string | GetAppInfoRequest, lang?: string): Promise<AppInfoResponse>;
|
|
282
|
+
/** 更新应用基本信息 */
|
|
283
|
+
static updateAppInfo(req: UpdateAppInfoRequest): Promise<ConnectRetOnlyResponse>;
|
|
284
|
+
/** 更新应用语言信息 */
|
|
285
|
+
static updateLanguageInfo(req: UpdateLanguageInfoRequest): Promise<ConnectRetOnlyResponse>;
|
|
286
|
+
/** 删除应用语言信息 */
|
|
287
|
+
static deleteLanguageInfo(req: DeleteLanguageInfoRequest): Promise<ConnectRetOnlyResponse>;
|
|
288
|
+
/** 更新应用文件信息(图标/截图/视频等) */
|
|
289
|
+
static updateAppFileInfo(req: UpdateAppFileInfoRequest): Promise<ConnectRetOnlyResponse>;
|
|
290
|
+
/** 更新应用软件包信息(OBS 上传后上报,AGC 控制台才会出现记录) */
|
|
291
|
+
static updateAppPackageInfo(req: UpdateAppPackageInfoRequest): Promise<UpdateAppPackageInfoResponse>;
|
|
292
|
+
/** 更新版本上架时间 */
|
|
293
|
+
static updateReleaseTime(req: UpdateReleaseTimeRequest): Promise<ConnectRetOnlyResponse>;
|
|
294
|
+
/** 更新分阶段发布 */
|
|
295
|
+
static updatePhasedRelease(req: UpdatePhasedReleaseRequest): Promise<ConnectRetOnlyResponse>;
|
|
296
|
+
/** 查询应用软件包信息 */
|
|
297
|
+
static getPackageInfo(req: QueryPackageInfoRequest): Promise<ConnectRetOnlyResponse>;
|
|
298
|
+
/** 查询软件包编译状态 */
|
|
299
|
+
static getCompileStatus(req: QueryCompileStatusRequest): Promise<ConnectRetOnlyResponse>;
|
|
300
|
+
/** 查询应用所有版本类型的版本列表 */
|
|
301
|
+
static queryBriefInfoList(req: QueryBriefInfoListRequest): Promise<QueryBriefInfoListResponse>;
|
|
302
|
+
/** 查询应用未处理的问题工单 */
|
|
303
|
+
static queryVersionVoc(req: QueryVersionVocRequest): Promise<ConnectRetOnlyResponse>;
|
|
304
|
+
/** 查询需要上传的资质文件信息 */
|
|
305
|
+
static queryTagQualDependent(): Promise<ConnectRetOnlyResponse>;
|
|
306
|
+
/** 提交资质审核任务 */
|
|
307
|
+
static submitQualificationReview(req: QualificationTaskBody): Promise<ConnectRetOnlyResponse>;
|
|
308
|
+
/** 查询资质审核任务详情 */
|
|
309
|
+
static getQualificationReview(req: QueryQualificationRequest): Promise<ConnectRetOnlyResponse>;
|
|
310
|
+
/** 修改资质审核任务 */
|
|
311
|
+
static updateQualificationReview(req: QualificationTaskBody): Promise<ConnectRetOnlyResponse>;
|
|
312
|
+
/** 撤销资质审核任务 */
|
|
313
|
+
static cancelQualificationReview(req: CancelQualificationRequest): Promise<ConnectRetOnlyResponse>;
|
|
314
|
+
/** 删除资质审核任务 */
|
|
315
|
+
static deleteQualificationReview(req: DeleteQualificationRequest): Promise<ConnectRetOnlyResponse>;
|
|
316
|
+
/** 新建用户协议 / 隐私政策协议(body.type 区分) */
|
|
317
|
+
static createAgreement(req: AgreementBodyRequest): Promise<ConnectRetOnlyResponse>;
|
|
318
|
+
/** 查询用户协议 / 隐私政策协议列表(body.type 区分) */
|
|
319
|
+
static listAgreements(req: ListAgreementRequest): Promise<ConnectRetOnlyResponse>;
|
|
320
|
+
/** 更新用户协议 / 隐私政策协议 */
|
|
321
|
+
static updateAgreement(req: AgreementBodyRequest): Promise<ConnectRetOnlyResponse>;
|
|
322
|
+
/** 提交隐私政策协议 */
|
|
323
|
+
static submitPrivacyAgreement(req: SubmitPrivacyAgreementRequest): Promise<ConnectRetOnlyResponse>;
|
|
324
|
+
/** 申请年龄分级 */
|
|
325
|
+
static applyAgeRating(req: AgeRatingRequest): Promise<ConnectRetOnlyResponse>;
|
|
326
|
+
/** 提交发布 */
|
|
327
|
+
static submitApp(req: SubmitAppRequest): Promise<ConnectRetOnlyResponse>;
|
|
328
|
+
/** 撤销审核 */
|
|
329
|
+
static cancelReview(req: CancelReviewRequest): Promise<ConnectRetOnlyResponse>;
|
|
330
|
+
/** 下架应用 */
|
|
331
|
+
static shelfOff(req: ShelfOffRequest): Promise<ConnectRetOnlyResponse>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface ProjectAppSummary {
|
|
335
|
+
appId?: string;
|
|
336
|
+
appName?: string;
|
|
337
|
+
packageName?: string;
|
|
338
|
+
[key: string]: unknown;
|
|
339
|
+
}
|
|
340
|
+
interface ProjectInfo {
|
|
341
|
+
projectId: string;
|
|
342
|
+
name?: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
createTime?: number;
|
|
345
|
+
updateTime?: number;
|
|
346
|
+
accessTime?: number;
|
|
347
|
+
siteId?: string;
|
|
348
|
+
enableSites?: string;
|
|
349
|
+
teamId?: string;
|
|
350
|
+
appList?: ProjectAppSummary[];
|
|
351
|
+
downloadKey?: number;
|
|
352
|
+
[key: string]: unknown;
|
|
353
|
+
}
|
|
354
|
+
interface ProjectListResponse {
|
|
355
|
+
ret: ConnectRet;
|
|
356
|
+
totalCount?: number;
|
|
357
|
+
returnCount?: number;
|
|
358
|
+
projectList?: ProjectInfo[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
declare class ProjectService {
|
|
362
|
+
/** 查询团队下的项目列表(Project Management API) */
|
|
363
|
+
static listProjects(): Promise<ProjectListResponse>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
interface CommonUrlInfo {
|
|
367
|
+
url: string;
|
|
368
|
+
method: string;
|
|
369
|
+
headers: Record<string, string>;
|
|
370
|
+
/** 上报软件包时使用;来自获取上传地址接口 */
|
|
371
|
+
objectId?: string;
|
|
372
|
+
}
|
|
373
|
+
interface FilePartUploadInfo {
|
|
374
|
+
url: string;
|
|
375
|
+
method: string;
|
|
376
|
+
headers: Record<string, string>;
|
|
377
|
+
partObjectId?: string;
|
|
378
|
+
}
|
|
379
|
+
interface FilePartInfo {
|
|
380
|
+
length: number;
|
|
381
|
+
sha256?: string;
|
|
382
|
+
}
|
|
383
|
+
interface FilePartComposeInfo {
|
|
384
|
+
partObjectId: string;
|
|
385
|
+
etag: string;
|
|
386
|
+
}
|
|
387
|
+
interface UploadUrlRequest {
|
|
388
|
+
appId: string;
|
|
389
|
+
fileName: string;
|
|
390
|
+
contentLength: number;
|
|
391
|
+
sha256?: string;
|
|
392
|
+
releaseType?: number;
|
|
393
|
+
chineseMainlandFlag?: number;
|
|
394
|
+
}
|
|
395
|
+
interface UploadUrlResponse {
|
|
396
|
+
ret: ConnectRet;
|
|
397
|
+
urlInfo?: CommonUrlInfo;
|
|
398
|
+
objectId?: string;
|
|
399
|
+
}
|
|
400
|
+
interface MultipartInitRequest {
|
|
401
|
+
appId: string;
|
|
402
|
+
fileName: string;
|
|
403
|
+
releaseType?: number;
|
|
404
|
+
chineseMainlandFlag?: number;
|
|
405
|
+
}
|
|
406
|
+
interface MultipartInitResponse {
|
|
407
|
+
ret: ConnectRet;
|
|
408
|
+
objectId?: string;
|
|
409
|
+
nspUploadId?: string;
|
|
410
|
+
nspPartMinSize?: number | string;
|
|
411
|
+
nspPartMaxSize?: number | string;
|
|
412
|
+
}
|
|
413
|
+
interface MultipartPartsRequest {
|
|
414
|
+
objectId: string;
|
|
415
|
+
nspUploadId: string;
|
|
416
|
+
parts: Record<string, FilePartInfo>;
|
|
417
|
+
}
|
|
418
|
+
interface MultipartPartsResponse {
|
|
419
|
+
ret: ConnectRet;
|
|
420
|
+
uploadInfoMap?: Record<string, FilePartUploadInfo>;
|
|
421
|
+
}
|
|
422
|
+
interface MultipartComposeRequest {
|
|
423
|
+
objectId: string;
|
|
424
|
+
nspUploadId: string;
|
|
425
|
+
parts: Record<string, FilePartComposeInfo>;
|
|
426
|
+
}
|
|
427
|
+
interface MultipartComposeResponse {
|
|
428
|
+
ret: ConnectRet;
|
|
429
|
+
}
|
|
430
|
+
interface UploadFileOptions {
|
|
431
|
+
appId: string;
|
|
432
|
+
filePath: string;
|
|
433
|
+
releaseType?: number;
|
|
434
|
+
chineseMainlandFlag?: number;
|
|
435
|
+
}
|
|
436
|
+
/** OBS 上传成功后的对象信息,须再调用更新应用软件包信息才会出现在 AGC */
|
|
437
|
+
interface UploadFileResult {
|
|
438
|
+
fileName: string;
|
|
439
|
+
objectId: string;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
declare class UploadService {
|
|
443
|
+
static getUploadUrl(req: UploadUrlRequest): Promise<UploadUrlResponse>;
|
|
444
|
+
static initMultipart(req: MultipartInitRequest): Promise<MultipartInitResponse>;
|
|
445
|
+
static getMultipartParts(req: MultipartPartsRequest): Promise<MultipartPartsResponse>;
|
|
446
|
+
static composeMultipart(req: MultipartComposeRequest): Promise<MultipartComposeResponse>;
|
|
447
|
+
/**
|
|
448
|
+
* 封装好的上传文件核心流程(支持根据文件大小自动单文件或分片上传)
|
|
449
|
+
* 文件大小 < 5MB 时使用单文件上传,否则使用分片上传。
|
|
450
|
+
* 仅完成 OBS 落盘;HarmonyOS `.app` 还须调用更新应用软件包信息,AGC 控制台才会有记录。
|
|
451
|
+
*/
|
|
452
|
+
static uploadFile(options: UploadFileOptions): Promise<UploadFileResult>;
|
|
453
|
+
/**
|
|
454
|
+
* OBS 预签名 PUT 头:SignedHeaders 含 content-length / host。
|
|
455
|
+
* 必须显式带 Content-Length;Host 交给客户端按 URL 设置,勿原样回传。
|
|
456
|
+
*/
|
|
457
|
+
private static buildObsPutHeaders;
|
|
458
|
+
/**
|
|
459
|
+
* 单文件上传流程
|
|
460
|
+
*/
|
|
461
|
+
private static uploadSingleFile;
|
|
462
|
+
/**
|
|
463
|
+
* 分片上传流程
|
|
464
|
+
*/
|
|
465
|
+
private static uploadMultipartFile;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
interface CertInfo {
|
|
469
|
+
id?: string;
|
|
470
|
+
certName?: string;
|
|
471
|
+
certType?: number;
|
|
472
|
+
createTime?: number;
|
|
473
|
+
expireTime?: number;
|
|
474
|
+
certDownloadUrl?: string;
|
|
475
|
+
}
|
|
476
|
+
interface CertCreateRequest {
|
|
477
|
+
csr: string;
|
|
478
|
+
certName: string;
|
|
479
|
+
certType: number;
|
|
480
|
+
}
|
|
481
|
+
interface CertCreateResponse {
|
|
482
|
+
ret: ConnectRet;
|
|
483
|
+
certInfo?: CertInfo;
|
|
484
|
+
}
|
|
485
|
+
interface CertListRequest {
|
|
486
|
+
certType?: number;
|
|
487
|
+
certIds?: string[];
|
|
488
|
+
}
|
|
489
|
+
interface CertListResponse {
|
|
490
|
+
ret: ConnectRet;
|
|
491
|
+
certList?: CertInfo[];
|
|
492
|
+
}
|
|
493
|
+
interface CertDeleteRequest {
|
|
494
|
+
certIds: string[];
|
|
495
|
+
}
|
|
496
|
+
interface CertDeleteResponse {
|
|
497
|
+
ret: ConnectRet;
|
|
498
|
+
}
|
|
499
|
+
interface AddDeviceInfo {
|
|
500
|
+
deviceName: string;
|
|
501
|
+
udid: string;
|
|
502
|
+
deviceType: number;
|
|
503
|
+
}
|
|
504
|
+
interface AddDeviceResult {
|
|
505
|
+
addDeviceInfo?: AddDeviceInfo;
|
|
506
|
+
result?: ConnectRet;
|
|
507
|
+
}
|
|
508
|
+
interface DeviceInfo {
|
|
509
|
+
id?: string;
|
|
510
|
+
deviceName?: string;
|
|
511
|
+
udid?: string;
|
|
512
|
+
deviceType?: number;
|
|
513
|
+
createTime?: string;
|
|
514
|
+
}
|
|
515
|
+
interface DeviceAddRequest {
|
|
516
|
+
deviceList: AddDeviceInfo[];
|
|
517
|
+
}
|
|
518
|
+
interface DeviceAddResponse {
|
|
519
|
+
ret: ConnectRet;
|
|
520
|
+
successedCount: number;
|
|
521
|
+
failedCount: number;
|
|
522
|
+
failedAddDeviceDetail?: AddDeviceResult[];
|
|
523
|
+
}
|
|
524
|
+
interface DeviceListRequest {
|
|
525
|
+
deviceName?: string;
|
|
526
|
+
fromRecCount?: number;
|
|
527
|
+
maxReqCount?: number;
|
|
528
|
+
order?: number;
|
|
529
|
+
}
|
|
530
|
+
interface DeviceListResponse {
|
|
531
|
+
ret: ConnectRet;
|
|
532
|
+
totalCount: number;
|
|
533
|
+
deviceList?: DeviceInfo[];
|
|
534
|
+
}
|
|
535
|
+
interface DeviceDeleteRequest {
|
|
536
|
+
deviceIdList: string[];
|
|
537
|
+
}
|
|
538
|
+
interface DeviceDeleteResponse {
|
|
539
|
+
ret: ConnectRet;
|
|
540
|
+
}
|
|
541
|
+
interface ProvisionInfo {
|
|
542
|
+
id?: string;
|
|
543
|
+
provisionName?: string;
|
|
544
|
+
provisionType?: number;
|
|
545
|
+
certName?: string;
|
|
546
|
+
deviceList?: DeviceInfo[];
|
|
547
|
+
aclPermissionList?: string[];
|
|
548
|
+
aclPermissionAuditState?: number;
|
|
549
|
+
provisionDownloadUrl?: string;
|
|
550
|
+
updateTime?: number;
|
|
551
|
+
expireTime?: number;
|
|
552
|
+
appId?: string;
|
|
553
|
+
tempFlag?: number;
|
|
554
|
+
}
|
|
555
|
+
interface ProvisionCreateRequest {
|
|
556
|
+
provisionName: string;
|
|
557
|
+
provisionType: number;
|
|
558
|
+
certId: string;
|
|
559
|
+
appId: string;
|
|
560
|
+
deviceIdList?: string[];
|
|
561
|
+
aclPermissionList?: string[];
|
|
562
|
+
}
|
|
563
|
+
interface ProvisionCreateResponse {
|
|
564
|
+
ret: ConnectRet;
|
|
565
|
+
provisionInfo?: ProvisionInfo;
|
|
566
|
+
}
|
|
567
|
+
interface ProvisionListRequest {
|
|
568
|
+
appId: string;
|
|
569
|
+
provisionId?: string;
|
|
570
|
+
fromRecCount?: number;
|
|
571
|
+
maxReqCount?: number;
|
|
572
|
+
}
|
|
573
|
+
interface ProvisionListResponse {
|
|
574
|
+
ret: ConnectRet;
|
|
575
|
+
totalCount?: number;
|
|
576
|
+
provisionList?: ProvisionInfo[];
|
|
577
|
+
}
|
|
578
|
+
interface ProvisionUpdateRequest {
|
|
579
|
+
provisionId: string;
|
|
580
|
+
deviceIdList: string[];
|
|
581
|
+
}
|
|
582
|
+
interface ProvisionUpdateResponse {
|
|
583
|
+
ret: ConnectRet;
|
|
584
|
+
provisionInfo?: ProvisionInfo;
|
|
585
|
+
}
|
|
586
|
+
interface ProvisionDeleteRequest {
|
|
587
|
+
id: string;
|
|
588
|
+
}
|
|
589
|
+
interface ProvisionDeleteResponse {
|
|
590
|
+
ret: ConnectRet;
|
|
591
|
+
}
|
|
592
|
+
interface FingerprintAddRequest {
|
|
593
|
+
appId: string;
|
|
594
|
+
fingerprintList: string[];
|
|
595
|
+
}
|
|
596
|
+
interface FingerprintAddResponse {
|
|
597
|
+
ret: ConnectRet;
|
|
598
|
+
}
|
|
599
|
+
interface FingerprintListRequest {
|
|
600
|
+
appId: string;
|
|
601
|
+
}
|
|
602
|
+
interface FingerprintListResponse {
|
|
603
|
+
ret: ConnectRet;
|
|
604
|
+
fingerprintList: string[];
|
|
605
|
+
}
|
|
606
|
+
interface FingerprintDeleteRequest {
|
|
607
|
+
appId: string;
|
|
608
|
+
fingerprintList: string[];
|
|
609
|
+
}
|
|
610
|
+
interface FingerprintDeleteResponse {
|
|
611
|
+
ret: ConnectRet;
|
|
612
|
+
}
|
|
613
|
+
interface OpenApplyPermissionInfo {
|
|
614
|
+
name: string;
|
|
615
|
+
reason: string;
|
|
616
|
+
}
|
|
617
|
+
interface OpenApplyPermissionStatusInfo {
|
|
618
|
+
name?: string;
|
|
619
|
+
status?: number;
|
|
620
|
+
}
|
|
621
|
+
interface UserPermission {
|
|
622
|
+
aclPermissionList?: string;
|
|
623
|
+
createTime?: number;
|
|
624
|
+
updateTime?: number;
|
|
625
|
+
}
|
|
626
|
+
interface ACLApplyRequest {
|
|
627
|
+
appId: string;
|
|
628
|
+
aclPermissionList: OpenApplyPermissionInfo[];
|
|
629
|
+
attachment?: string;
|
|
630
|
+
}
|
|
631
|
+
interface ACLApplyResponse {
|
|
632
|
+
ret: ConnectRet;
|
|
633
|
+
}
|
|
634
|
+
interface ACLStatusRequest {
|
|
635
|
+
appId: string;
|
|
636
|
+
}
|
|
637
|
+
interface ACLStatusResponse {
|
|
638
|
+
aclPermissionList?: OpenApplyPermissionStatusInfo[];
|
|
639
|
+
}
|
|
640
|
+
interface ACLQueryRequest {
|
|
641
|
+
appId: string;
|
|
642
|
+
}
|
|
643
|
+
interface ACLQueryResponse {
|
|
644
|
+
ret: ConnectRet;
|
|
645
|
+
userPermission?: UserPermission;
|
|
646
|
+
}
|
|
647
|
+
interface ACLEligibleRequest {
|
|
648
|
+
appId: string;
|
|
649
|
+
lang?: string;
|
|
650
|
+
start?: number;
|
|
651
|
+
pageSize?: number;
|
|
652
|
+
}
|
|
653
|
+
interface ACLPermissionInfo {
|
|
654
|
+
id?: string;
|
|
655
|
+
permissionName?: string;
|
|
656
|
+
apl?: string;
|
|
657
|
+
grantType?: string;
|
|
658
|
+
supportDevice?: string[];
|
|
659
|
+
startApiVersion?: string;
|
|
660
|
+
permissionLanguages?: Array<{
|
|
661
|
+
language?: string;
|
|
662
|
+
desc?: string;
|
|
663
|
+
}>;
|
|
664
|
+
}
|
|
665
|
+
interface ACLEligibleResponse {
|
|
666
|
+
ret: ConnectRet;
|
|
667
|
+
totalCount?: number;
|
|
668
|
+
permissionList?: ACLPermissionInfo[];
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
declare class ProvisionService {
|
|
672
|
+
static createCert(req: CertCreateRequest): Promise<CertCreateResponse>;
|
|
673
|
+
static getCertList(req: CertListRequest): Promise<CertListResponse>;
|
|
674
|
+
static deleteCert(req: CertDeleteRequest): Promise<CertDeleteResponse>;
|
|
675
|
+
static addDevice(req: DeviceAddRequest): Promise<DeviceAddResponse>;
|
|
676
|
+
static getDeviceList(req: DeviceListRequest): Promise<DeviceListResponse>;
|
|
677
|
+
static deleteDevice(req: DeviceDeleteRequest): Promise<DeviceDeleteResponse>;
|
|
678
|
+
static createProvision(req: ProvisionCreateRequest): Promise<ProvisionCreateResponse>;
|
|
679
|
+
static getProvisionList(req: ProvisionListRequest): Promise<ProvisionListResponse>;
|
|
680
|
+
static updateProvision(req: ProvisionUpdateRequest): Promise<ProvisionUpdateResponse>;
|
|
681
|
+
static deleteProvision(req: ProvisionDeleteRequest): Promise<ProvisionDeleteResponse>;
|
|
682
|
+
static addFingerprint(req: FingerprintAddRequest): Promise<FingerprintAddResponse>;
|
|
683
|
+
static getFingerprintList(req: FingerprintListRequest): Promise<FingerprintListResponse>;
|
|
684
|
+
static deleteFingerprint(req: FingerprintDeleteRequest): Promise<FingerprintDeleteResponse>;
|
|
685
|
+
/** 查询可申请的 ACL 权限列表 */
|
|
686
|
+
static getEligibleACL(req: ACLEligibleRequest): Promise<ACLEligibleResponse>;
|
|
687
|
+
static applyACL(req: ACLApplyRequest): Promise<ACLApplyResponse>;
|
|
688
|
+
static getACLStatus(req: ACLStatusRequest): Promise<ACLStatusResponse>;
|
|
689
|
+
static getACLQuery(req: ACLQueryRequest): Promise<ACLQueryResponse>;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
declare const agcClient: axios.AxiosInstance;
|
|
693
|
+
|
|
694
|
+
/** OAuth 授权码模式所需的端点与客户端配置 */
|
|
695
|
+
interface OAuthConfig {
|
|
696
|
+
clientId: string;
|
|
697
|
+
authUrl: string;
|
|
698
|
+
tokenUrl: string;
|
|
699
|
+
refreshUrl: string;
|
|
700
|
+
redirectUri: string;
|
|
701
|
+
scope: string;
|
|
702
|
+
}
|
|
703
|
+
interface ServiceAccountConfig {
|
|
704
|
+
/** 凭据 JSON 文件绝对路径 */
|
|
705
|
+
credentialsPath: string;
|
|
706
|
+
credentials: ServiceAccountCredentials;
|
|
707
|
+
}
|
|
708
|
+
interface AgcConfig {
|
|
709
|
+
/**
|
|
710
|
+
* 当前生效的身份标识(用于 token 缓存校验 / status 展示):
|
|
711
|
+
* - client_credentials:AGC_CLIENT_ID
|
|
712
|
+
* - oauth:oauth.clientId
|
|
713
|
+
* - service_account:凭据中的 key_id
|
|
714
|
+
*/
|
|
715
|
+
clientId: string;
|
|
716
|
+
clientSecret: string;
|
|
717
|
+
domain: string;
|
|
718
|
+
authMode: AuthMode;
|
|
719
|
+
oauth: OAuthConfig;
|
|
720
|
+
/**
|
|
721
|
+
* OAuth 模式下多数 Publish/证书等接口需要的 teamId。
|
|
722
|
+
* 来自 AGC_TEAM_ID;未设置时由运行时在仅有一个团队时自动选定。
|
|
723
|
+
*/
|
|
724
|
+
teamId?: string;
|
|
725
|
+
serviceAccount?: ServiceAccountConfig;
|
|
726
|
+
}
|
|
727
|
+
declare function getConfig(): AgcConfig;
|
|
728
|
+
|
|
729
|
+
export { type AgcConfig, type AuthMode, AuthService, type OAuthConfig, ProjectService, ProvisionService, PublishService, type ServiceAccountConfig, UploadService, agcClient, getConfig };
|