cloud189-sdk 1.0.9 → 1.0.10-beta.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/dist/types.d.ts DELETED
@@ -1,557 +0,0 @@
1
- import { Store } from './store';
2
- /**
3
- * 账户家庭信息
4
- * @public
5
- */
6
- export interface FamilyListResponse {
7
- familyInfoResp: [
8
- {
9
- /**
10
- * 家庭id
11
- */
12
- familyId: string;
13
- /**
14
- * 家庭名称
15
- */
16
- remarkName: string;
17
- /**
18
- * 类型
19
- */
20
- type: number;
21
- /**
22
- * 用户角色 如果是1 表明当前账户是该账户的主家庭 否则当前账户是其他家庭的成员账户
23
- */
24
- userRole: number;
25
- }
26
- ];
27
- }
28
- /**
29
- * accessToken 结果
30
- * @public
31
- */
32
- export interface AccessTokenResponse {
33
- /**
34
- * accessToken
35
- */
36
- accessToken: string;
37
- /**
38
- * accessToken 的有效期 单位秒
39
- */
40
- expiresIn: number;
41
- }
42
- /**
43
- * 家庭签到任务结果
44
- * @public
45
- */
46
- export interface FamilyUserSignResponse {
47
- /**
48
- * 签到的奖励容量 单位MB
49
- */
50
- bonusSpace: number;
51
- /**
52
- * 签到的家庭id
53
- */
54
- signFamilyId: number;
55
- /**
56
- * 签到的状态
57
- */
58
- signStatus: number;
59
- /**
60
- * 签到的时间
61
- */
62
- signTime: string;
63
- /**
64
- * 签到的用户
65
- */
66
- userId: string;
67
- }
68
- /**
69
- * 文件类型
70
- * @public
71
- */
72
- export declare enum MediaType {
73
- ALL = 0,
74
- IMAGE = 1,
75
- MUSIC = 2,
76
- VIDEO = 3,
77
- TXT = 4
78
- }
79
- /**
80
- * 排序类型
81
- * @public
82
- */
83
- export declare enum OrderByType {
84
- NAME = 1,
85
- SIZE = 2,
86
- LAST_OP_TIME = 3
87
- }
88
- /**
89
- * 分页参数
90
- * @public
91
- */
92
- export interface PageQuery {
93
- /**
94
- * 分页大小 默认60
95
- */
96
- pageSize?: number;
97
- /**
98
- * 页码 默认1
99
- */
100
- pageNum?: number;
101
- /**
102
- * 文件类型
103
- * 0 全部 1 图片 2 视频 3 文档
104
- */
105
- mediaType?: MediaType;
106
- /**
107
- * 文件夹Id
108
- */
109
- folderId?: string;
110
- /**
111
- * 未知参数 5
112
- */
113
- iconOption?: number;
114
- /**
115
- * 排序类型
116
- * 1 文件名称 2 文件大小 3 文件修改时间
117
- */
118
- orderBy?: OrderByType;
119
- /**
120
- * 是否倒序
121
- */
122
- descending?: boolean;
123
- }
124
- /**
125
- * 文件列表API响应数据结构
126
- * @public
127
- */
128
- export interface FileListResponse {
129
- /** 文件列表数据对象 */
130
- fileListAO: FileListAO;
131
- /**
132
- * 最后修订版本号
133
- * 用于增量同步的时间戳或版本标识
134
- */
135
- lastRev: number;
136
- }
137
- /**
138
- * 文件列表数据对象
139
- * @public
140
- */
141
- export interface FileListAO {
142
- /** 文件总数 */
143
- count: number;
144
- /** 文件项列表 */
145
- fileList: FileItem[];
146
- /** 文件夹项列表 */
147
- folderList: FolderItem[];
148
- }
149
- /**
150
- * 文件项详细信息
151
- * @public
152
- */
153
- export interface FileItem {
154
- /** 文件创建时间,格式:YYYY-MM-DD HH:mm:ss */
155
- createDate: string;
156
- /**
157
- * 收藏标签
158
- * 0-未收藏 | 1-已收藏
159
- */
160
- favoriteLabel: number;
161
- /** 文件图标信息 */
162
- icon: {
163
- /** 大尺寸图标URL */
164
- largeUrl: string;
165
- /** 小尺寸图标URL */
166
- smallUrl: string;
167
- };
168
- /** 文件唯一标识ID */
169
- id: string;
170
- /** 最后操作时间,格式:YYYY-MM-DD HH:mm:ss */
171
- lastOpTime: string;
172
- /** 文件MD5哈希值,用于文件校验 */
173
- md5: string;
174
- /**
175
- * 媒体类型
176
- * 1-图片 | 2-视频 | 3-音频 | 4-文档
177
- */
178
- mediaType: number;
179
- /** 文件名 */
180
- name: string;
181
- /**
182
- * 图片方向
183
- * 0-正常 | 1-90° | 2-180° | 3-270°
184
- */
185
- orientation: number;
186
- /** 父目录ID */
187
- parentId: string;
188
- /** 文件版本标识,格式:YYYYMMDDHHmmss */
189
- rev: string;
190
- /** 文件大小(字节) */
191
- size: number;
192
- /**
193
- * 星标标签
194
- * 1-普通 | 2-标星
195
- */
196
- starLabel: number;
197
- }
198
- /**
199
- * 文件夹项详细信息
200
- * @public
201
- */
202
- export interface FolderItem {
203
- /** 文件夹创建时间,格式:YYYY-MM-DD HH:mm:ss */
204
- createDate: string;
205
- /** 文件夹内文件数量 */
206
- fileCount: number;
207
- /** 文件夹唯一标识ID */
208
- id: string;
209
- /** 最后操作时间,格式:YYYY-MM-DD HH:mm:ss */
210
- lastOpTime: string;
211
- /** 文件夹名称 */
212
- name: string;
213
- /** 父目录ID */
214
- parentId: string;
215
- /** 文件夹版本标识,格式:YYYYMMDDHHmmss */
216
- rev: string;
217
- /**
218
- * 星标标签
219
- * 1-普通 | 2-标星
220
- */
221
- starLabel: number;
222
- }
223
- /**
224
- * 家庭请求
225
- * @public
226
- */
227
- export interface FamilyRequest {
228
- familyId: string;
229
- }
230
- /**
231
- * 创建个人文件夹
232
- * @public
233
- */
234
- export interface CreateFolderRequest {
235
- parentFolderId: string;
236
- folderName: string;
237
- }
238
- /**
239
- * 创建家庭文件夹
240
- * @public
241
- */
242
- export interface CreateFamilyFolderRequest extends FamilyRequest, CreateFolderRequest {
243
- }
244
- /**
245
- * 创建个人文件夹
246
- * @public
247
- */
248
- export interface RenameFolderRequest {
249
- folderId: string;
250
- folderName: string;
251
- }
252
- /**
253
- * 创建家庭文件夹
254
- * @public
255
- */
256
- export interface RenameFamilyFolderRequest extends FamilyRequest, RenameFolderRequest {
257
- }
258
- /**
259
- * RsaKey响应
260
- * @public
261
- */
262
- export interface RsaKeyResponse extends RsaKey {
263
- res_code: number;
264
- res_message: string;
265
- }
266
- /**
267
- * 初始化个人上传请求
268
- * @public
269
- */
270
- export interface initMultiUploadRequest {
271
- parentFolderId: string;
272
- fileName: string;
273
- fileSize: number;
274
- sliceSize: number;
275
- fileMd5?: string;
276
- sliceMd5?: string;
277
- }
278
- /**
279
- * 初始化家庭上传请求
280
- * @public
281
- */
282
- export interface initMultiFamilyUploadRequest extends FamilyRequest, initMultiUploadRequest {
283
- }
284
- /**
285
- * 提交个人上传请求
286
- * @public
287
- */
288
- export interface CommitMultiUploadRequest {
289
- fileMd5: string;
290
- sliceMd5: string;
291
- uploadFileId: string;
292
- lazyCheck?: number;
293
- }
294
- /**
295
- * 提交家庭上传请求
296
- * @public
297
- */
298
- export interface CommitMultiFamilyUploadRequest extends FamilyRequest, CommitMultiUploadRequest {
299
- }
300
- /**
301
- * 容量信息
302
- * @public
303
- */
304
- export interface CapacityInfo {
305
- /**
306
- * 总空间 单位KB
307
- */
308
- totalSize: number;
309
- /**
310
- * 已使用空间 单位KB
311
- */
312
- usedSize: number;
313
- /**
314
- * 剩余空间 单位KB
315
- */
316
- freeSize: number;
317
- }
318
- /**
319
- * 账户容量信息
320
- * @public
321
- */
322
- export interface UserSizeInfoResponse {
323
- /**
324
- * 个人容量信息
325
- */
326
- cloudCapacityInfo: CapacityInfo;
327
- /**
328
- * 家庭容量信息
329
- */
330
- familyCapacityInfo: CapacityInfo;
331
- }
332
- /**
333
- * 个人签到结果
334
- * @public
335
- */
336
- export interface UserSignResponse {
337
- /**
338
- * 是否已经签到过
339
- */
340
- isSign: boolean;
341
- /**
342
- * 签到获取的容量奖励 单位MB
343
- */
344
- netdiskBonus: number;
345
- }
346
- /**
347
- * 个人任务执行结果
348
- * @public
349
- */
350
- export interface UserTaskResponse {
351
- /**
352
- * 错误码
353
- */
354
- errorCode: string;
355
- /**
356
- * 奖励容量 单位MB
357
- */
358
- prizeName: string;
359
- }
360
- /**
361
- * @public
362
- */
363
- export interface CacheQuery {
364
- captchaToken: string;
365
- reqId: string;
366
- lt: string;
367
- paramId: string;
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
- }
412
- /**
413
- * 客户端初始化参数
414
- * @public
415
- */
416
- export interface ConfigurationOptions {
417
- /** Login username */
418
- username?: string;
419
- /** Login password */
420
- password?: string;
421
- /** Token store */
422
- token?: Store;
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;
428
- }
429
- /**
430
- * @public
431
- * accessToken 有效期7天,可以通过refreshToken取新的accessToken
432
- */
433
- export interface TokenSession {
434
- res_code: number;
435
- res_message: string;
436
- accessToken: string;
437
- familySessionKey: string;
438
- familySessionSecret: string;
439
- refreshToken: string;
440
- loginName: string;
441
- sessionKey: string;
442
- }
443
- /**
444
- * @public
445
- */
446
- export interface RefreshTokenSession {
447
- expiresIn: number;
448
- accessToken: string;
449
- refreshToken: string;
450
- }
451
- /**
452
- * @public
453
- */
454
- export interface ClientSession {
455
- accessToken: string;
456
- sessionKey: string;
457
- }
458
- /**
459
- * @public
460
- */
461
- export interface RsaKey {
462
- expire: number;
463
- pkId: string;
464
- pubKey: string;
465
- ver: string;
466
- }
467
- /**
468
- * @public
469
- */
470
- export interface UploadResponse {
471
- code: string;
472
- }
473
- /**
474
- * @public
475
- */
476
- export interface UploadInitResponse extends UploadResponse {
477
- data: {
478
- uploadType: number;
479
- uploadHost: string;
480
- uploadFileId: string;
481
- fileDataExists: number;
482
- };
483
- }
484
- /**
485
- * @public
486
- */
487
- export interface UploadCommitResponse extends UploadResponse {
488
- file: {
489
- userFileId: string;
490
- fileName: string;
491
- fileSize: number;
492
- fileMd5: string;
493
- createDate: string;
494
- rev: number;
495
- userId: number;
496
- };
497
- /**
498
- * 是否快传
499
- */
500
- fileDataExists: number;
501
- }
502
- /**
503
- * @public
504
- */
505
- export interface UploadPartsInfoResponse extends UploadResponse {
506
- data: {
507
- uploadFileId: string;
508
- uploadedPartList: string;
509
- };
510
- }
511
- /**
512
- * @public
513
- */
514
- export type PartNumberKey = `partNumber_${number}`;
515
- /**
516
- * @public
517
- */
518
- export interface MultiUploadUrlsResponse extends UploadResponse {
519
- uploadUrls: {
520
- [key: PartNumberKey]: {
521
- requestURL: string;
522
- requestHeader: string;
523
- };
524
- };
525
- }
526
- /**
527
- * @public
528
- */
529
- export interface UploadCallbacks {
530
- onProgress?: (progress: number) => void;
531
- onComplete?: (response: any) => void;
532
- onError?: (error: Error) => void;
533
- }
534
- /**
535
- * @public
536
- */
537
- export type TaskType = 'DELETE' | 'MOVE' | 'COPY';
538
- /**
539
- * @public
540
- */
541
- export interface CreateBatchTaskRequest {
542
- type: TaskType;
543
- taskInfos: [
544
- {
545
- fileId: string;
546
- fileName?: string;
547
- isFolder: number;
548
- srcParentId?: string;
549
- }
550
- ];
551
- targetFolderId?: string;
552
- }
553
- /**
554
- * @public
555
- */
556
- export interface CreateFamilyBatchTaskRequest extends FamilyRequest, CreateBatchTaskRequest {
557
- }
package/dist/types.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QRCodeStatus = exports.OrderByType = exports.MediaType = void 0;
4
- /**
5
- * 文件类型
6
- * @public
7
- */
8
- var MediaType;
9
- (function (MediaType) {
10
- MediaType[MediaType["ALL"] = 0] = "ALL";
11
- MediaType[MediaType["IMAGE"] = 1] = "IMAGE";
12
- MediaType[MediaType["MUSIC"] = 2] = "MUSIC";
13
- MediaType[MediaType["VIDEO"] = 3] = "VIDEO";
14
- MediaType[MediaType["TXT"] = 4] = "TXT";
15
- })(MediaType = exports.MediaType || (exports.MediaType = {}));
16
- /**
17
- * 排序类型
18
- * @public
19
- */
20
- var OrderByType;
21
- (function (OrderByType) {
22
- OrderByType[OrderByType["NAME"] = 1] = "NAME";
23
- OrderByType[OrderByType["SIZE"] = 2] = "SIZE";
24
- OrderByType[OrderByType["LAST_OP_TIME"] = 3] = "LAST_OP_TIME";
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 = {}));
package/dist/util.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { BinaryToTextEncoding } from 'crypto';
2
- export declare const sortParameter: (data: any) => string;
3
- export declare const getSignature: (data: any) => string;
4
- export declare const rsaEncrypt: (publicKey: string, origData: string, encoding?: BinaryToTextEncoding) => string;
5
- export declare const aesECBEncrypt: (data: any, key: string) => string;
6
- export declare const hmacSha1: (data: any, key: any, encoding?: BinaryToTextEncoding) => string;
7
- export declare const hexToBase64: (data: any) => string;
8
- export declare const md5: (data: any) => string;
9
- export declare const randomString: (f: string) => string;
10
- export declare const partSize: (size: any) => number;
11
- export declare const calculateFileAndChunkMD5: (filePath: any, chunkSize?: number) => Promise<{
12
- fileMd5: string;
13
- chunkMd5s: string[];
14
- }>;
15
- export declare const asyncPool: (poolLimit: any, array: any, iteratorFn: any) => Promise<any[]>;