cloud189-sdk 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CloudAuthClient.d.ts +19 -1
- package/dist/CloudAuthClient.js +84 -0
- package/dist/CloudClient.d.ts +6 -4
- package/dist/CloudClient.js +20 -1
- package/dist/cloud189-sdk.d.ts +889 -0
- package/dist/types.d.ts +50 -3
- package/dist/types.js +16 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Got } from 'got';
|
|
2
|
-
import { RefreshTokenSession, TokenSession, CacheQuery } from './types';
|
|
2
|
+
import { RefreshTokenSession, TokenSession, CacheQuery, QRCodeData, QRCodeStatusResponse, QRLoginOptions } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
@@ -38,4 +38,22 @@ export declare class CloudAuthClient {
|
|
|
38
38
|
* 刷新token
|
|
39
39
|
*/
|
|
40
40
|
refreshToken(refreshToken: string): Promise<RefreshTokenSession>;
|
|
41
|
+
/**
|
|
42
|
+
* Get QR code data for scanning login
|
|
43
|
+
* @returns QR code data including uuid for display
|
|
44
|
+
*/
|
|
45
|
+
getQRCode(): Promise<QRCodeData>;
|
|
46
|
+
/**
|
|
47
|
+
* Check QR code scan status
|
|
48
|
+
* @param qrData - QR code data from getQRCode
|
|
49
|
+
* @returns status and redirectUrl on success
|
|
50
|
+
*/
|
|
51
|
+
checkQRCodeStatus(qrData: QRCodeData): Promise<QRCodeStatusResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* QR code login with polling
|
|
54
|
+
* @param onQRReady - callback invoked with QR code URL for display
|
|
55
|
+
* @param options - polling interval and timeout
|
|
56
|
+
* @returns token session
|
|
57
|
+
*/
|
|
58
|
+
loginByQRCode(onQRReady: (qrUrl: string) => void, options?: QRLoginOptions): Promise<TokenSession>;
|
|
41
59
|
}
|
package/dist/CloudAuthClient.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.CloudAuthClient = void 0;
|
|
|
13
13
|
const got_1 = __importDefault(require("got"));
|
|
14
14
|
const log_1 = require("./log");
|
|
15
15
|
const const_1 = require("./const");
|
|
16
|
+
const types_1 = require("./types");
|
|
16
17
|
const util_1 = require("./util");
|
|
17
18
|
const hook_1 = require("./hook");
|
|
18
19
|
/**
|
|
@@ -160,6 +161,89 @@ class CloudAuthClient {
|
|
|
160
161
|
})
|
|
161
162
|
.json();
|
|
162
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Get QR code data for scanning login
|
|
166
|
+
* @returns QR code data including uuid for display
|
|
167
|
+
*/
|
|
168
|
+
async getQRCode() {
|
|
169
|
+
log_1.logger.debug('getQRCode...');
|
|
170
|
+
const loginForm = await this.getLoginForm();
|
|
171
|
+
const uuidRes = await this.authRequest
|
|
172
|
+
.post(`${const_1.AUTH_URL}/api/logbox/oauth2/getUUID.do`, {
|
|
173
|
+
headers: {
|
|
174
|
+
Referer: const_1.AUTH_URL
|
|
175
|
+
},
|
|
176
|
+
form: { appId: const_1.AppID }
|
|
177
|
+
})
|
|
178
|
+
.json();
|
|
179
|
+
if (!uuidRes.uuid || !uuidRes.encryuuid) {
|
|
180
|
+
throw new Error('Failed to get QR code UUID');
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
uuid: uuidRes.uuid,
|
|
184
|
+
encryuuid: uuidRes.encryuuid,
|
|
185
|
+
reqId: loginForm.reqId,
|
|
186
|
+
lt: loginForm.lt,
|
|
187
|
+
paramId: loginForm.paramId
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Check QR code scan status
|
|
192
|
+
* @param qrData - QR code data from getQRCode
|
|
193
|
+
* @returns status and redirectUrl on success
|
|
194
|
+
*/
|
|
195
|
+
async checkQRCodeStatus(qrData) {
|
|
196
|
+
const now = new Date();
|
|
197
|
+
const pad = (n, len = 2) => String(n).padStart(len, '0');
|
|
198
|
+
const date = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}` +
|
|
199
|
+
`${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}.${pad(now.getMilliseconds(), 3)}`;
|
|
200
|
+
return this.authRequest
|
|
201
|
+
.post(`${const_1.AUTH_URL}/api/logbox/oauth2/qrcodeLoginState.do`, {
|
|
202
|
+
headers: {
|
|
203
|
+
Referer: const_1.AUTH_URL,
|
|
204
|
+
Reqid: qrData.reqId,
|
|
205
|
+
lt: qrData.lt
|
|
206
|
+
},
|
|
207
|
+
form: {
|
|
208
|
+
appId: const_1.AppID,
|
|
209
|
+
clientType: const_1.ClientType,
|
|
210
|
+
returnUrl: const_1.ReturnURL,
|
|
211
|
+
paramId: qrData.paramId,
|
|
212
|
+
uuid: qrData.uuid,
|
|
213
|
+
encryuuid: qrData.encryuuid,
|
|
214
|
+
date,
|
|
215
|
+
timeStamp: Date.now()
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
.json();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* QR code login with polling
|
|
222
|
+
* @param onQRReady - callback invoked with QR code URL for display
|
|
223
|
+
* @param options - polling interval and timeout
|
|
224
|
+
* @returns token session
|
|
225
|
+
*/
|
|
226
|
+
async loginByQRCode(onQRReady, options) {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
log_1.logger.debug('loginByQRCode...');
|
|
229
|
+
const pollInterval = (_a = options === null || options === void 0 ? void 0 : options.pollInterval) !== null && _a !== void 0 ? _a : 3000;
|
|
230
|
+
const timeout = (_b = options === null || options === void 0 ? void 0 : options.timeout) !== null && _b !== void 0 ? _b : 120000;
|
|
231
|
+
const qrData = await this.getQRCode();
|
|
232
|
+
onQRReady(qrData.uuid);
|
|
233
|
+
const deadline = Date.now() + timeout;
|
|
234
|
+
while (Date.now() < deadline) {
|
|
235
|
+
const res = await this.checkQRCodeStatus(qrData);
|
|
236
|
+
if (res.status === types_1.QRCodeStatus.SUCCESS) {
|
|
237
|
+
log_1.logger.debug('QR code login success, getting session...');
|
|
238
|
+
return await this.getSessionForPC({ redirectURL: res.redirectUrl });
|
|
239
|
+
}
|
|
240
|
+
if (res.status === types_1.QRCodeStatus.EXPIRED) {
|
|
241
|
+
throw new Error('QR code expired');
|
|
242
|
+
}
|
|
243
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
244
|
+
}
|
|
245
|
+
throw new Error('QR code login timeout');
|
|
246
|
+
}
|
|
163
247
|
}
|
|
164
248
|
exports.CloudAuthClient = CloudAuthClient;
|
|
165
249
|
_CloudAuthClient_builLoginForm = new WeakMap();
|
package/dist/CloudClient.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export declare class CloudClient {
|
|
|
19
19
|
private sessionKeyPromise;
|
|
20
20
|
private accessTokenPromise;
|
|
21
21
|
private generateRsaKeyPromise;
|
|
22
|
+
private onQRCodeReady?;
|
|
23
|
+
private qrLoginOptions?;
|
|
22
24
|
constructor(_options: ConfigurationOptions);
|
|
23
25
|
getSession(): Promise<import("./types").TokenSession>;
|
|
24
26
|
/**
|
|
@@ -79,7 +81,7 @@ export declare class CloudClient {
|
|
|
79
81
|
* @param renameFolderRequest - 重名文件夹请求
|
|
80
82
|
* @returns
|
|
81
83
|
*/
|
|
82
|
-
renameFolder(renameFolderRequest: RenameFolderRequest | RenameFamilyFolderRequest): import("got").CancelableRequest<unknown>;
|
|
84
|
+
renameFolder(renameFolderRequest: RenameFolderRequest | RenameFamilyFolderRequest): import("got/dist/source").CancelableRequest<unknown>;
|
|
83
85
|
/**
|
|
84
86
|
* 初始化上传
|
|
85
87
|
* @param initMultiUploadRequest - 初始化请求
|
|
@@ -91,7 +93,7 @@ export declare class CloudClient {
|
|
|
91
93
|
* @param commitMultiUploadRequest - 提交请求
|
|
92
94
|
* @returns
|
|
93
95
|
*/
|
|
94
|
-
commitMultiUpload(commitMultiUploadRequest: CommitMultiUploadRequest | CommitMultiFamilyUploadRequest): import("got").CancelableRequest<UploadCommitResponse>;
|
|
96
|
+
commitMultiUpload(commitMultiUploadRequest: CommitMultiUploadRequest | CommitMultiFamilyUploadRequest): import("got/dist/source").CancelableRequest<UploadCommitResponse>;
|
|
95
97
|
/**
|
|
96
98
|
* 检测秒传
|
|
97
99
|
* @param params - 检查参数
|
|
@@ -102,7 +104,7 @@ export declare class CloudClient {
|
|
|
102
104
|
sliceMd5: string;
|
|
103
105
|
uploadFileId: string;
|
|
104
106
|
familyId?: number;
|
|
105
|
-
}): import("got").CancelableRequest<UploadInitResponse>;
|
|
107
|
+
}): import("got/dist/source").CancelableRequest<UploadInitResponse>;
|
|
106
108
|
/**
|
|
107
109
|
* 文件上传
|
|
108
110
|
* @param param - 上传参数
|
|
@@ -157,7 +159,7 @@ export declare class CloudClient {
|
|
|
157
159
|
getFileDownloadUrl(params: {
|
|
158
160
|
fileId: string;
|
|
159
161
|
familyId?: string;
|
|
160
|
-
}): import("got").CancelableRequest<{
|
|
162
|
+
}): import("got/dist/source").CancelableRequest<{
|
|
161
163
|
fileDownloadUrl: string;
|
|
162
164
|
}>;
|
|
163
165
|
}
|
package/dist/CloudClient.js
CHANGED
|
@@ -43,13 +43,18 @@ class CloudClient {
|
|
|
43
43
|
if (options.username && options.password) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
+
if (options.onQRCodeReady) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
46
49
|
log_1.logger.error('valid');
|
|
47
|
-
throw new Error('Please provide username and password or token or ssonCooike !');
|
|
50
|
+
throw new Error('Please provide username and password or token or ssonCooike or onQRCodeReady !');
|
|
48
51
|
});
|
|
49
52
|
__classPrivateFieldGet(this, _CloudClient_valid, "f").call(this, _options);
|
|
50
53
|
this.username = _options.username;
|
|
51
54
|
this.password = _options.password;
|
|
52
55
|
this.ssonCookie = _options.ssonCookie;
|
|
56
|
+
this.onQRCodeReady = _options.onQRCodeReady;
|
|
57
|
+
this.qrLoginOptions = _options.qrLoginOptions;
|
|
53
58
|
this.tokenStore = _options.token || new store_1.MemoryStore();
|
|
54
59
|
this.authClient = new CloudAuthClient_1.CloudAuthClient();
|
|
55
60
|
this.session = {
|
|
@@ -171,6 +176,20 @@ class CloudClient {
|
|
|
171
176
|
log_1.logger.error(e);
|
|
172
177
|
}
|
|
173
178
|
}
|
|
179
|
+
if (this.onQRCodeReady) {
|
|
180
|
+
try {
|
|
181
|
+
const loginToken = await this.authClient.loginByQRCode(this.onQRCodeReady, this.qrLoginOptions);
|
|
182
|
+
await this.tokenStore.update({
|
|
183
|
+
accessToken: loginToken.accessToken,
|
|
184
|
+
refreshToken: loginToken.refreshToken,
|
|
185
|
+
expiresIn: new Date(Date.now() + 6 * 24 * 60 * 60 * 1000).getTime()
|
|
186
|
+
});
|
|
187
|
+
return loginToken;
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
log_1.logger.error(e);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
174
193
|
throw new Error('Can not get session.');
|
|
175
194
|
}
|
|
176
195
|
/**
|
|
@@ -0,0 +1,889 @@
|
|
|
1
|
+
import { CancelableRequest } from 'got/dist/source';
|
|
2
|
+
import { Got } from 'got';
|
|
3
|
+
import { Logger } from '@netdrive-sdk/log';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* accessToken 结果
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare interface AccessTokenResponse {
|
|
10
|
+
/**
|
|
11
|
+
* accessToken
|
|
12
|
+
*/
|
|
13
|
+
accessToken: string;
|
|
14
|
+
/**
|
|
15
|
+
* accessToken 的有效期 单位秒
|
|
16
|
+
*/
|
|
17
|
+
expiresIn: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare interface CacheQuery {
|
|
24
|
+
captchaToken: string;
|
|
25
|
+
reqId: string;
|
|
26
|
+
lt: string;
|
|
27
|
+
paramId: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 容量信息
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare interface CapacityInfo {
|
|
35
|
+
/**
|
|
36
|
+
* 总空间 单位KB
|
|
37
|
+
*/
|
|
38
|
+
totalSize: number;
|
|
39
|
+
/**
|
|
40
|
+
* 已使用空间 单位KB
|
|
41
|
+
*/
|
|
42
|
+
usedSize: number;
|
|
43
|
+
/**
|
|
44
|
+
* 剩余空间 单位KB
|
|
45
|
+
*/
|
|
46
|
+
freeSize: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export declare interface ClientSession {
|
|
53
|
+
accessToken: string;
|
|
54
|
+
sessionKey: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export declare class CloudAuthClient {
|
|
61
|
+
#private;
|
|
62
|
+
readonly authRequest: Got;
|
|
63
|
+
constructor();
|
|
64
|
+
/**
|
|
65
|
+
* 获取加密参数
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
getEncrypt(): Promise<{
|
|
69
|
+
data: {
|
|
70
|
+
pubKey: string;
|
|
71
|
+
pre: string;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
getLoginForm(): Promise<CacheQuery>;
|
|
75
|
+
getSessionForPC(param: {
|
|
76
|
+
redirectURL?: string;
|
|
77
|
+
accessToken?: string;
|
|
78
|
+
}): Promise<TokenSession>;
|
|
79
|
+
/**
|
|
80
|
+
* 用户名密码登录
|
|
81
|
+
* */
|
|
82
|
+
loginByPassword(username: string, password: string): Promise<TokenSession>;
|
|
83
|
+
/**
|
|
84
|
+
* token登录
|
|
85
|
+
*/
|
|
86
|
+
loginByAccessToken(accessToken: string): Promise<TokenSession>;
|
|
87
|
+
/**
|
|
88
|
+
* sso登录
|
|
89
|
+
*/
|
|
90
|
+
loginBySsoCooike(cookie: string): Promise<TokenSession>;
|
|
91
|
+
/**
|
|
92
|
+
* 刷新token
|
|
93
|
+
*/
|
|
94
|
+
refreshToken(refreshToken: string): Promise<RefreshTokenSession>;
|
|
95
|
+
/**
|
|
96
|
+
* Get QR code data for scanning login
|
|
97
|
+
* @returns QR code data including uuid for display
|
|
98
|
+
*/
|
|
99
|
+
getQRCode(): Promise<QRCodeData>;
|
|
100
|
+
/**
|
|
101
|
+
* Check QR code scan status
|
|
102
|
+
* @param qrData - QR code data from getQRCode
|
|
103
|
+
* @returns status and redirectUrl on success
|
|
104
|
+
*/
|
|
105
|
+
checkQRCodeStatus(qrData: QRCodeData): Promise<QRCodeStatusResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* QR code login with polling
|
|
108
|
+
* @param onQRReady - callback invoked with QR code URL for display
|
|
109
|
+
* @param options - polling interval and timeout
|
|
110
|
+
* @returns token session
|
|
111
|
+
*/
|
|
112
|
+
loginByQRCode(onQRReady: (qrUrl: string) => void, options?: QRLoginOptions): Promise<TokenSession>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 天翼网盘客户端
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export declare class CloudClient {
|
|
120
|
+
#private;
|
|
121
|
+
username: string;
|
|
122
|
+
password: string;
|
|
123
|
+
ssonCookie: string;
|
|
124
|
+
tokenStore: Store;
|
|
125
|
+
readonly request: Got;
|
|
126
|
+
readonly authClient: CloudAuthClient;
|
|
127
|
+
readonly session: ClientSession;
|
|
128
|
+
private rsaKey;
|
|
129
|
+
private sessionKeyPromise;
|
|
130
|
+
private accessTokenPromise;
|
|
131
|
+
private generateRsaKeyPromise;
|
|
132
|
+
private onQRCodeReady?;
|
|
133
|
+
private qrLoginOptions?;
|
|
134
|
+
constructor(_options: ConfigurationOptions);
|
|
135
|
+
getSession(): Promise<TokenSession>;
|
|
136
|
+
/**
|
|
137
|
+
* 获取 sessionKey
|
|
138
|
+
* @returns sessionKey
|
|
139
|
+
*/
|
|
140
|
+
getSessionKey(): Promise<string>;
|
|
141
|
+
/**
|
|
142
|
+
* 获取 accessToken
|
|
143
|
+
* @returns accessToken
|
|
144
|
+
*/
|
|
145
|
+
getAccessToken(): Promise<string>;
|
|
146
|
+
/**
|
|
147
|
+
* 获取 RSA key
|
|
148
|
+
* @returns RSAKey
|
|
149
|
+
*/
|
|
150
|
+
generateRsaKey(): Promise<RsaKey>;
|
|
151
|
+
/**
|
|
152
|
+
* 获取用户网盘存储容量信息
|
|
153
|
+
* @returns 账号容量结果
|
|
154
|
+
*/
|
|
155
|
+
getUserSizeInfo(): Promise<UserSizeInfoResponse>;
|
|
156
|
+
/**
|
|
157
|
+
* 个人签到任务
|
|
158
|
+
* @returns 签到结果
|
|
159
|
+
*/
|
|
160
|
+
userSign(): Promise<UserSignResponse>;
|
|
161
|
+
/**
|
|
162
|
+
* 获取家庭信息
|
|
163
|
+
* @returns 家庭列表信息
|
|
164
|
+
*/
|
|
165
|
+
getFamilyList(): Promise<FamilyListResponse>;
|
|
166
|
+
/**
|
|
167
|
+
* 家庭签到任务
|
|
168
|
+
* @param familyId - 家庭id
|
|
169
|
+
* @returns 签到结果
|
|
170
|
+
* @deprecated 已无效
|
|
171
|
+
*/
|
|
172
|
+
familyUserSign(familyId: string): Promise<FamilyUserSignResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* 获取文件列表
|
|
175
|
+
* @param pageQuery - 查询参数
|
|
176
|
+
* @returns
|
|
177
|
+
*/
|
|
178
|
+
getListFiles(pageQuery?: PageQuery, familyId?: string): Promise<FileListResponse>;
|
|
179
|
+
/**
|
|
180
|
+
* 创建文件夹
|
|
181
|
+
* @param createFolderRequest - 创建文件夹请求
|
|
182
|
+
* @returns
|
|
183
|
+
*/
|
|
184
|
+
createFolder(createFolderRequest: CreateFolderRequest | CreateFamilyFolderRequest): Promise<{
|
|
185
|
+
id: string;
|
|
186
|
+
name: string;
|
|
187
|
+
parentId: string;
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* 重命名文件夹
|
|
191
|
+
* @param renameFolderRequest - 重名文件夹请求
|
|
192
|
+
* @returns
|
|
193
|
+
*/
|
|
194
|
+
renameFolder(renameFolderRequest: RenameFolderRequest | RenameFamilyFolderRequest): CancelableRequest<unknown>;
|
|
195
|
+
/**
|
|
196
|
+
* 初始化上传
|
|
197
|
+
* @param initMultiUploadRequest - 初始化请求
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
initMultiUpload(initMultiUploadRequest: initMultiUploadRequest | initMultiFamilyUploadRequest): Promise<UploadInitResponse>;
|
|
201
|
+
/**
|
|
202
|
+
* 提交上传
|
|
203
|
+
* @param commitMultiUploadRequest - 提交请求
|
|
204
|
+
* @returns
|
|
205
|
+
*/
|
|
206
|
+
commitMultiUpload(commitMultiUploadRequest: CommitMultiUploadRequest | CommitMultiFamilyUploadRequest): CancelableRequest<UploadCommitResponse>;
|
|
207
|
+
/**
|
|
208
|
+
* 检测秒传
|
|
209
|
+
* @param params - 检查参数
|
|
210
|
+
* @returns
|
|
211
|
+
*/
|
|
212
|
+
checkTransSecond(params: {
|
|
213
|
+
fileMd5: string;
|
|
214
|
+
sliceMd5: string;
|
|
215
|
+
uploadFileId: string;
|
|
216
|
+
familyId?: number;
|
|
217
|
+
}): CancelableRequest<UploadInitResponse>;
|
|
218
|
+
/**
|
|
219
|
+
* 文件上传
|
|
220
|
+
* @param param - 上传参数
|
|
221
|
+
* @param callbacks - 上传回调
|
|
222
|
+
* @returns
|
|
223
|
+
*/
|
|
224
|
+
upload(param: {
|
|
225
|
+
parentFolderId: string;
|
|
226
|
+
filePath: string;
|
|
227
|
+
familyId?: string;
|
|
228
|
+
}, callbacks?: UploadCallbacks): Promise<{
|
|
229
|
+
fileDataExists: number;
|
|
230
|
+
file: {
|
|
231
|
+
userFileId: string;
|
|
232
|
+
fileName: string;
|
|
233
|
+
fileSize: number;
|
|
234
|
+
fileMd5: string;
|
|
235
|
+
createDate: string;
|
|
236
|
+
rev: number;
|
|
237
|
+
userId: number;
|
|
238
|
+
};
|
|
239
|
+
code: string;
|
|
240
|
+
}>;
|
|
241
|
+
/**
|
|
242
|
+
* 检测任务状态
|
|
243
|
+
* @param type - 任务类型
|
|
244
|
+
* @param taskId - 任务Id
|
|
245
|
+
* @param maxAttempts - 重试次数
|
|
246
|
+
* @param interval - 重试间隔
|
|
247
|
+
* @returns
|
|
248
|
+
*/
|
|
249
|
+
checkTaskStatus(type: string, taskId: string, maxAttempts?: number, interval?: number): Promise<{
|
|
250
|
+
successedFileIdList?: number[];
|
|
251
|
+
taskId: string;
|
|
252
|
+
taskStatus: number;
|
|
253
|
+
}>;
|
|
254
|
+
/**
|
|
255
|
+
* 创建任务
|
|
256
|
+
* @param createBatchTaskRequest - 创建任务参数
|
|
257
|
+
* @returns
|
|
258
|
+
*/
|
|
259
|
+
createBatchTask(createBatchTaskRequest: CreateBatchTaskRequest | CreateFamilyBatchTaskRequest): Promise<{
|
|
260
|
+
successedFileIdList?: number[];
|
|
261
|
+
taskId: string;
|
|
262
|
+
taskStatus: number;
|
|
263
|
+
}>;
|
|
264
|
+
/**
|
|
265
|
+
* 获取文件下载路径
|
|
266
|
+
* @param params - 文件参数
|
|
267
|
+
* @returns
|
|
268
|
+
*/
|
|
269
|
+
getFileDownloadUrl(params: {
|
|
270
|
+
fileId: string;
|
|
271
|
+
familyId?: string;
|
|
272
|
+
}): CancelableRequest< {
|
|
273
|
+
fileDownloadUrl: string;
|
|
274
|
+
}>;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* 提交家庭上传请求
|
|
279
|
+
* @public
|
|
280
|
+
*/
|
|
281
|
+
export declare interface CommitMultiFamilyUploadRequest extends FamilyRequest, CommitMultiUploadRequest {
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* 提交个人上传请求
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
export declare interface CommitMultiUploadRequest {
|
|
289
|
+
fileMd5: string;
|
|
290
|
+
sliceMd5: string;
|
|
291
|
+
uploadFileId: string;
|
|
292
|
+
lazyCheck?: number;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* 客户端初始化参数
|
|
297
|
+
* @public
|
|
298
|
+
*/
|
|
299
|
+
export declare interface ConfigurationOptions {
|
|
300
|
+
/** Login username */
|
|
301
|
+
username?: string;
|
|
302
|
+
/** Login password */
|
|
303
|
+
password?: string;
|
|
304
|
+
/** Token store */
|
|
305
|
+
token?: Store;
|
|
306
|
+
ssonCookie?: string;
|
|
307
|
+
/** Callback invoked with QR code URL when ready for scanning */
|
|
308
|
+
onQRCodeReady?: (qrUrl: string) => void;
|
|
309
|
+
/** QR code login options */
|
|
310
|
+
qrLoginOptions?: QRLoginOptions;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @public
|
|
315
|
+
*/
|
|
316
|
+
export declare interface CreateBatchTaskRequest {
|
|
317
|
+
type: TaskType;
|
|
318
|
+
taskInfos: [
|
|
319
|
+
{
|
|
320
|
+
fileId: string;
|
|
321
|
+
fileName?: string;
|
|
322
|
+
isFolder: number;
|
|
323
|
+
srcParentId?: string;
|
|
324
|
+
}
|
|
325
|
+
];
|
|
326
|
+
targetFolderId?: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* @public
|
|
331
|
+
*/
|
|
332
|
+
export declare interface CreateFamilyBatchTaskRequest extends FamilyRequest, CreateBatchTaskRequest {
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* 创建家庭文件夹
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
export declare interface CreateFamilyFolderRequest extends FamilyRequest, CreateFolderRequest {
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* 创建个人文件夹
|
|
344
|
+
* @public
|
|
345
|
+
*/
|
|
346
|
+
export declare interface CreateFolderRequest {
|
|
347
|
+
parentFolderId: string;
|
|
348
|
+
folderName: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* 账户家庭信息
|
|
353
|
+
* @public
|
|
354
|
+
*/
|
|
355
|
+
export declare interface FamilyListResponse {
|
|
356
|
+
familyInfoResp: [
|
|
357
|
+
{
|
|
358
|
+
/**
|
|
359
|
+
* 家庭id
|
|
360
|
+
*/
|
|
361
|
+
familyId: string;
|
|
362
|
+
/**
|
|
363
|
+
* 家庭名称
|
|
364
|
+
*/
|
|
365
|
+
remarkName: string;
|
|
366
|
+
/**
|
|
367
|
+
* 类型
|
|
368
|
+
*/
|
|
369
|
+
type: number;
|
|
370
|
+
/**
|
|
371
|
+
* 用户角色 如果是1 表明当前账户是该账户的主家庭 否则当前账户是其他家庭的成员账户
|
|
372
|
+
*/
|
|
373
|
+
userRole: number;
|
|
374
|
+
}
|
|
375
|
+
];
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* 家庭请求
|
|
380
|
+
* @public
|
|
381
|
+
*/
|
|
382
|
+
export declare interface FamilyRequest {
|
|
383
|
+
familyId: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* 家庭签到任务结果
|
|
388
|
+
* @public
|
|
389
|
+
*/
|
|
390
|
+
export declare interface FamilyUserSignResponse {
|
|
391
|
+
/**
|
|
392
|
+
* 签到的奖励容量 单位MB
|
|
393
|
+
*/
|
|
394
|
+
bonusSpace: number;
|
|
395
|
+
/**
|
|
396
|
+
* 签到的家庭id
|
|
397
|
+
*/
|
|
398
|
+
signFamilyId: number;
|
|
399
|
+
/**
|
|
400
|
+
* 签到的状态
|
|
401
|
+
*/
|
|
402
|
+
signStatus: number;
|
|
403
|
+
/**
|
|
404
|
+
* 签到的时间
|
|
405
|
+
*/
|
|
406
|
+
signTime: string;
|
|
407
|
+
/**
|
|
408
|
+
* 签到的用户
|
|
409
|
+
*/
|
|
410
|
+
userId: string;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* 文件项详细信息
|
|
415
|
+
* @public
|
|
416
|
+
*/
|
|
417
|
+
export declare interface FileItem {
|
|
418
|
+
/** 文件创建时间,格式:YYYY-MM-DD HH:mm:ss */
|
|
419
|
+
createDate: string;
|
|
420
|
+
/**
|
|
421
|
+
* 收藏标签
|
|
422
|
+
* 0-未收藏 | 1-已收藏
|
|
423
|
+
*/
|
|
424
|
+
favoriteLabel: number;
|
|
425
|
+
/** 文件图标信息 */
|
|
426
|
+
icon: {
|
|
427
|
+
/** 大尺寸图标URL */
|
|
428
|
+
largeUrl: string;
|
|
429
|
+
/** 小尺寸图标URL */
|
|
430
|
+
smallUrl: string;
|
|
431
|
+
};
|
|
432
|
+
/** 文件唯一标识ID */
|
|
433
|
+
id: string;
|
|
434
|
+
/** 最后操作时间,格式:YYYY-MM-DD HH:mm:ss */
|
|
435
|
+
lastOpTime: string;
|
|
436
|
+
/** 文件MD5哈希值,用于文件校验 */
|
|
437
|
+
md5: string;
|
|
438
|
+
/**
|
|
439
|
+
* 媒体类型
|
|
440
|
+
* 1-图片 | 2-视频 | 3-音频 | 4-文档
|
|
441
|
+
*/
|
|
442
|
+
mediaType: number;
|
|
443
|
+
/** 文件名 */
|
|
444
|
+
name: string;
|
|
445
|
+
/**
|
|
446
|
+
* 图片方向
|
|
447
|
+
* 0-正常 | 1-90° | 2-180° | 3-270°
|
|
448
|
+
*/
|
|
449
|
+
orientation: number;
|
|
450
|
+
/** 父目录ID */
|
|
451
|
+
parentId: string;
|
|
452
|
+
/** 文件版本标识,格式:YYYYMMDDHHmmss */
|
|
453
|
+
rev: string;
|
|
454
|
+
/** 文件大小(字节) */
|
|
455
|
+
size: number;
|
|
456
|
+
/**
|
|
457
|
+
* 星标标签
|
|
458
|
+
* 1-普通 | 2-标星
|
|
459
|
+
*/
|
|
460
|
+
starLabel: number;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* 文件列表数据对象
|
|
465
|
+
* @public
|
|
466
|
+
*/
|
|
467
|
+
export declare interface FileListAO {
|
|
468
|
+
/** 文件总数 */
|
|
469
|
+
count: number;
|
|
470
|
+
/** 文件项列表 */
|
|
471
|
+
fileList: FileItem[];
|
|
472
|
+
/** 文件夹项列表 */
|
|
473
|
+
folderList: FolderItem[];
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* 文件列表API响应数据结构
|
|
478
|
+
* @public
|
|
479
|
+
*/
|
|
480
|
+
export declare interface FileListResponse {
|
|
481
|
+
/** 文件列表数据对象 */
|
|
482
|
+
fileListAO: FileListAO;
|
|
483
|
+
/**
|
|
484
|
+
* 最后修订版本号
|
|
485
|
+
* 用于增量同步的时间戳或版本标识
|
|
486
|
+
*/
|
|
487
|
+
lastRev: number;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @public
|
|
492
|
+
*/
|
|
493
|
+
export declare class FileTokenStore extends MemoryStore {
|
|
494
|
+
#private;
|
|
495
|
+
filePath: string;
|
|
496
|
+
constructor(filePath: string);
|
|
497
|
+
private ensureTokenDirectory;
|
|
498
|
+
update(token: {
|
|
499
|
+
accessToken: string;
|
|
500
|
+
refreshToken?: string;
|
|
501
|
+
expiresIn?: number;
|
|
502
|
+
}): Promise<void>;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* 文件夹项详细信息
|
|
507
|
+
* @public
|
|
508
|
+
*/
|
|
509
|
+
export declare interface FolderItem {
|
|
510
|
+
/** 文件夹创建时间,格式:YYYY-MM-DD HH:mm:ss */
|
|
511
|
+
createDate: string;
|
|
512
|
+
/** 文件夹内文件数量 */
|
|
513
|
+
fileCount: number;
|
|
514
|
+
/** 文件夹唯一标识ID */
|
|
515
|
+
id: string;
|
|
516
|
+
/** 最后操作时间,格式:YYYY-MM-DD HH:mm:ss */
|
|
517
|
+
lastOpTime: string;
|
|
518
|
+
/** 文件夹名称 */
|
|
519
|
+
name: string;
|
|
520
|
+
/** 父目录ID */
|
|
521
|
+
parentId: string;
|
|
522
|
+
/** 文件夹版本标识,格式:YYYYMMDDHHmmss */
|
|
523
|
+
rev: string;
|
|
524
|
+
/**
|
|
525
|
+
* 星标标签
|
|
526
|
+
* 1-普通 | 2-标星
|
|
527
|
+
*/
|
|
528
|
+
starLabel: number;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* 初始化家庭上传请求
|
|
533
|
+
* @public
|
|
534
|
+
*/
|
|
535
|
+
export declare interface initMultiFamilyUploadRequest extends FamilyRequest, initMultiUploadRequest {
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* 初始化个人上传请求
|
|
540
|
+
* @public
|
|
541
|
+
*/
|
|
542
|
+
export declare interface initMultiUploadRequest {
|
|
543
|
+
parentFolderId: string;
|
|
544
|
+
fileName: string;
|
|
545
|
+
fileSize: number;
|
|
546
|
+
sliceSize: number;
|
|
547
|
+
fileMd5?: string;
|
|
548
|
+
sliceMd5?: string;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* 日志记录
|
|
553
|
+
* @public
|
|
554
|
+
*/
|
|
555
|
+
export declare const logger: Logger;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* 文件类型
|
|
559
|
+
* @public
|
|
560
|
+
*/
|
|
561
|
+
export declare enum MediaType {
|
|
562
|
+
ALL = 0,
|
|
563
|
+
IMAGE = 1,
|
|
564
|
+
MUSIC = 2,
|
|
565
|
+
VIDEO = 3,
|
|
566
|
+
TXT = 4
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* @public
|
|
571
|
+
*/
|
|
572
|
+
export declare class MemoryStore extends Store {
|
|
573
|
+
store: {
|
|
574
|
+
accessToken: string;
|
|
575
|
+
refreshToken: string;
|
|
576
|
+
expiresIn: number;
|
|
577
|
+
};
|
|
578
|
+
constructor();
|
|
579
|
+
get(): {
|
|
580
|
+
accessToken: string;
|
|
581
|
+
refreshToken: string;
|
|
582
|
+
expiresIn: number;
|
|
583
|
+
};
|
|
584
|
+
update(token: {
|
|
585
|
+
accessToken: string;
|
|
586
|
+
refreshToken?: string;
|
|
587
|
+
expiresIn?: number;
|
|
588
|
+
}): void;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* @public
|
|
593
|
+
*/
|
|
594
|
+
export declare interface MultiUploadUrlsResponse extends UploadResponse {
|
|
595
|
+
uploadUrls: {
|
|
596
|
+
[key: PartNumberKey]: {
|
|
597
|
+
requestURL: string;
|
|
598
|
+
requestHeader: string;
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* 排序类型
|
|
605
|
+
* @public
|
|
606
|
+
*/
|
|
607
|
+
export declare enum OrderByType {
|
|
608
|
+
NAME = 1,
|
|
609
|
+
SIZE = 2,
|
|
610
|
+
LAST_OP_TIME = 3
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* 分页参数
|
|
615
|
+
* @public
|
|
616
|
+
*/
|
|
617
|
+
export declare interface PageQuery {
|
|
618
|
+
/**
|
|
619
|
+
* 分页大小 默认60
|
|
620
|
+
*/
|
|
621
|
+
pageSize?: number;
|
|
622
|
+
/**
|
|
623
|
+
* 页码 默认1
|
|
624
|
+
*/
|
|
625
|
+
pageNum?: number;
|
|
626
|
+
/**
|
|
627
|
+
* 文件类型
|
|
628
|
+
* 0 全部 1 图片 2 视频 3 文档
|
|
629
|
+
*/
|
|
630
|
+
mediaType?: MediaType;
|
|
631
|
+
/**
|
|
632
|
+
* 文件夹Id
|
|
633
|
+
*/
|
|
634
|
+
folderId?: string;
|
|
635
|
+
/**
|
|
636
|
+
* 未知参数 5
|
|
637
|
+
*/
|
|
638
|
+
iconOption?: number;
|
|
639
|
+
/**
|
|
640
|
+
* 排序类型
|
|
641
|
+
* 1 文件名称 2 文件大小 3 文件修改时间
|
|
642
|
+
*/
|
|
643
|
+
orderBy?: OrderByType;
|
|
644
|
+
/**
|
|
645
|
+
* 是否倒序
|
|
646
|
+
*/
|
|
647
|
+
descending?: boolean;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* @public
|
|
652
|
+
*/
|
|
653
|
+
export declare type PartNumberKey = `partNumber_${number}`;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* QR code data returned by getQRCode, used for polling status
|
|
657
|
+
* @public
|
|
658
|
+
*/
|
|
659
|
+
export declare interface QRCodeData {
|
|
660
|
+
uuid: string;
|
|
661
|
+
encryuuid: string;
|
|
662
|
+
reqId: string;
|
|
663
|
+
lt: string;
|
|
664
|
+
paramId: string;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* QR code scan status enum
|
|
669
|
+
* @public
|
|
670
|
+
*/
|
|
671
|
+
export declare enum QRCodeStatus {
|
|
672
|
+
/** Login success */
|
|
673
|
+
SUCCESS = 0,
|
|
674
|
+
/** Waiting for user to scan */
|
|
675
|
+
WAITING = -106,
|
|
676
|
+
/** User scanned, waiting for confirmation on device */
|
|
677
|
+
SCANNED = -11002,
|
|
678
|
+
/** QR code expired */
|
|
679
|
+
EXPIRED = -11001
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* QR code status check response
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
686
|
+
export declare interface QRCodeStatusResponse {
|
|
687
|
+
status: QRCodeStatus | number;
|
|
688
|
+
redirectUrl?: string;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* QR code login options
|
|
693
|
+
* @public
|
|
694
|
+
*/
|
|
695
|
+
export declare interface QRLoginOptions {
|
|
696
|
+
/** Polling interval in ms, default 3000 */
|
|
697
|
+
pollInterval?: number;
|
|
698
|
+
/** Timeout in ms, default 120000 */
|
|
699
|
+
timeout?: number;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
export declare interface RefreshTokenSession {
|
|
706
|
+
expiresIn: number;
|
|
707
|
+
accessToken: string;
|
|
708
|
+
refreshToken: string;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* 创建家庭文件夹
|
|
713
|
+
* @public
|
|
714
|
+
*/
|
|
715
|
+
export declare interface RenameFamilyFolderRequest extends FamilyRequest, RenameFolderRequest {
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* 创建个人文件夹
|
|
720
|
+
* @public
|
|
721
|
+
*/
|
|
722
|
+
export declare interface RenameFolderRequest {
|
|
723
|
+
folderId: string;
|
|
724
|
+
folderName: string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* @public
|
|
729
|
+
*/
|
|
730
|
+
export declare interface RsaKey {
|
|
731
|
+
expire: number;
|
|
732
|
+
pkId: string;
|
|
733
|
+
pubKey: string;
|
|
734
|
+
ver: string;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* RsaKey响应
|
|
739
|
+
* @public
|
|
740
|
+
*/
|
|
741
|
+
export declare interface RsaKeyResponse extends RsaKey {
|
|
742
|
+
res_code: number;
|
|
743
|
+
res_message: string;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* @public
|
|
748
|
+
*/
|
|
749
|
+
export declare abstract class Store {
|
|
750
|
+
constructor();
|
|
751
|
+
abstract get(): {
|
|
752
|
+
accessToken: string;
|
|
753
|
+
refreshToken: string;
|
|
754
|
+
expiresIn: number;
|
|
755
|
+
} | Promise<{
|
|
756
|
+
accessToken: string;
|
|
757
|
+
refreshToken: string;
|
|
758
|
+
expiresIn: number;
|
|
759
|
+
}>;
|
|
760
|
+
abstract update(token: {
|
|
761
|
+
accessToken: string;
|
|
762
|
+
refreshToken?: string;
|
|
763
|
+
expiresIn?: number;
|
|
764
|
+
}): void | Promise<void>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* @public
|
|
769
|
+
*/
|
|
770
|
+
export declare type TaskType = 'DELETE' | 'MOVE' | 'COPY';
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* @public
|
|
774
|
+
* accessToken 有效期7天,可以通过refreshToken取新的accessToken
|
|
775
|
+
*/
|
|
776
|
+
export declare interface TokenSession {
|
|
777
|
+
res_code: number;
|
|
778
|
+
res_message: string;
|
|
779
|
+
accessToken: string;
|
|
780
|
+
familySessionKey: string;
|
|
781
|
+
familySessionSecret: string;
|
|
782
|
+
refreshToken: string;
|
|
783
|
+
loginName: string;
|
|
784
|
+
sessionKey: string;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* @public
|
|
789
|
+
*/
|
|
790
|
+
export declare interface UploadCallbacks {
|
|
791
|
+
onProgress?: (progress: number) => void;
|
|
792
|
+
onComplete?: (response: any) => void;
|
|
793
|
+
onError?: (error: Error) => void;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* @public
|
|
798
|
+
*/
|
|
799
|
+
export declare interface UploadCommitResponse extends UploadResponse {
|
|
800
|
+
file: {
|
|
801
|
+
userFileId: string;
|
|
802
|
+
fileName: string;
|
|
803
|
+
fileSize: number;
|
|
804
|
+
fileMd5: string;
|
|
805
|
+
createDate: string;
|
|
806
|
+
rev: number;
|
|
807
|
+
userId: number;
|
|
808
|
+
};
|
|
809
|
+
/**
|
|
810
|
+
* 是否快传
|
|
811
|
+
*/
|
|
812
|
+
fileDataExists: number;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* @public
|
|
817
|
+
*/
|
|
818
|
+
export declare interface UploadInitResponse extends UploadResponse {
|
|
819
|
+
data: {
|
|
820
|
+
uploadType: number;
|
|
821
|
+
uploadHost: string;
|
|
822
|
+
uploadFileId: string;
|
|
823
|
+
fileDataExists: number;
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* @public
|
|
829
|
+
*/
|
|
830
|
+
export declare interface UploadPartsInfoResponse extends UploadResponse {
|
|
831
|
+
data: {
|
|
832
|
+
uploadFileId: string;
|
|
833
|
+
uploadedPartList: string;
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* @public
|
|
839
|
+
*/
|
|
840
|
+
export declare interface UploadResponse {
|
|
841
|
+
code: string;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* 个人签到结果
|
|
846
|
+
* @public
|
|
847
|
+
*/
|
|
848
|
+
export declare interface UserSignResponse {
|
|
849
|
+
/**
|
|
850
|
+
* 是否已经签到过
|
|
851
|
+
*/
|
|
852
|
+
isSign: boolean;
|
|
853
|
+
/**
|
|
854
|
+
* 签到获取的容量奖励 单位MB
|
|
855
|
+
*/
|
|
856
|
+
netdiskBonus: number;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* 账户容量信息
|
|
861
|
+
* @public
|
|
862
|
+
*/
|
|
863
|
+
export declare interface UserSizeInfoResponse {
|
|
864
|
+
/**
|
|
865
|
+
* 个人容量信息
|
|
866
|
+
*/
|
|
867
|
+
cloudCapacityInfo: CapacityInfo;
|
|
868
|
+
/**
|
|
869
|
+
* 家庭容量信息
|
|
870
|
+
*/
|
|
871
|
+
familyCapacityInfo: CapacityInfo;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* 个人任务执行结果
|
|
876
|
+
* @public
|
|
877
|
+
*/
|
|
878
|
+
export declare interface UserTaskResponse {
|
|
879
|
+
/**
|
|
880
|
+
* 错误码
|
|
881
|
+
*/
|
|
882
|
+
errorCode: string;
|
|
883
|
+
/**
|
|
884
|
+
* 奖励容量 单位MB
|
|
885
|
+
*/
|
|
886
|
+
prizeName: string;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
export { }
|
package/dist/types.d.ts
CHANGED
|
@@ -366,18 +366,65 @@ export interface CacheQuery {
|
|
|
366
366
|
lt: string;
|
|
367
367
|
paramId: string;
|
|
368
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* QR code data returned by getQRCode, used for polling status
|
|
371
|
+
* @public
|
|
372
|
+
*/
|
|
373
|
+
export interface QRCodeData {
|
|
374
|
+
uuid: string;
|
|
375
|
+
encryuuid: string;
|
|
376
|
+
reqId: string;
|
|
377
|
+
lt: string;
|
|
378
|
+
paramId: string;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* QR code scan status enum
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
384
|
+
export declare enum QRCodeStatus {
|
|
385
|
+
/** Login success */
|
|
386
|
+
SUCCESS = 0,
|
|
387
|
+
/** Waiting for user to scan */
|
|
388
|
+
WAITING = -106,
|
|
389
|
+
/** User scanned, waiting for confirmation on device */
|
|
390
|
+
SCANNED = -11002,
|
|
391
|
+
/** QR code expired */
|
|
392
|
+
EXPIRED = -11001
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* QR code status check response
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
398
|
+
export interface QRCodeStatusResponse {
|
|
399
|
+
status: QRCodeStatus | number;
|
|
400
|
+
redirectUrl?: string;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* QR code login options
|
|
404
|
+
* @public
|
|
405
|
+
*/
|
|
406
|
+
export interface QRLoginOptions {
|
|
407
|
+
/** Polling interval in ms, default 3000 */
|
|
408
|
+
pollInterval?: number;
|
|
409
|
+
/** Timeout in ms, default 120000 */
|
|
410
|
+
timeout?: number;
|
|
411
|
+
}
|
|
369
412
|
/**
|
|
370
413
|
* 客户端初始化参数
|
|
371
414
|
* @public
|
|
372
415
|
*/
|
|
373
416
|
export interface ConfigurationOptions {
|
|
374
|
-
/**
|
|
417
|
+
/** Login username */
|
|
375
418
|
username?: string;
|
|
376
|
-
/**
|
|
419
|
+
/** Login password */
|
|
377
420
|
password?: string;
|
|
378
|
-
/**
|
|
421
|
+
/** Token store */
|
|
379
422
|
token?: Store;
|
|
380
423
|
ssonCookie?: string;
|
|
424
|
+
/** Callback invoked with QR code URL when ready for scanning */
|
|
425
|
+
onQRCodeReady?: (qrUrl: string) => void;
|
|
426
|
+
/** QR code login options */
|
|
427
|
+
qrLoginOptions?: QRLoginOptions;
|
|
381
428
|
}
|
|
382
429
|
/**
|
|
383
430
|
* @public
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrderByType = exports.MediaType = void 0;
|
|
3
|
+
exports.QRCodeStatus = exports.OrderByType = exports.MediaType = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 文件类型
|
|
6
6
|
* @public
|
|
@@ -23,3 +23,18 @@ var OrderByType;
|
|
|
23
23
|
OrderByType[OrderByType["SIZE"] = 2] = "SIZE";
|
|
24
24
|
OrderByType[OrderByType["LAST_OP_TIME"] = 3] = "LAST_OP_TIME";
|
|
25
25
|
})(OrderByType = exports.OrderByType || (exports.OrderByType = {}));
|
|
26
|
+
/**
|
|
27
|
+
* QR code scan status enum
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
var QRCodeStatus;
|
|
31
|
+
(function (QRCodeStatus) {
|
|
32
|
+
/** Login success */
|
|
33
|
+
QRCodeStatus[QRCodeStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
34
|
+
/** Waiting for user to scan */
|
|
35
|
+
QRCodeStatus[QRCodeStatus["WAITING"] = -106] = "WAITING";
|
|
36
|
+
/** User scanned, waiting for confirmation on device */
|
|
37
|
+
QRCodeStatus[QRCodeStatus["SCANNED"] = -11002] = "SCANNED";
|
|
38
|
+
/** QR code expired */
|
|
39
|
+
QRCodeStatus[QRCodeStatus["EXPIRED"] = -11001] = "EXPIRED";
|
|
40
|
+
})(QRCodeStatus = exports.QRCodeStatus || (exports.QRCodeStatus = {}));
|