cloud189-sdk 1.0.0 → 1.0.2
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 +51 -1
- package/dist/CloudClient.d.ts +1 -9
- package/dist/CloudClient.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,51 @@
|
|
|
1
|
-
# cloud189-sdk
|
|
1
|
+
# cloud189-sdk
|
|
2
|
+
|
|
3
|
+
## 安装依赖
|
|
4
|
+
``` bash
|
|
5
|
+
npm i cloud189-sdk
|
|
6
|
+
```
|
|
7
|
+
或者
|
|
8
|
+
``` bash
|
|
9
|
+
yarn add cloud189-sdk
|
|
10
|
+
```
|
|
11
|
+
## 测试代码
|
|
12
|
+
``` javascript
|
|
13
|
+
const { CloudClient } = require("cloud189-sdk");
|
|
14
|
+
|
|
15
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
16
|
+
(async () => {
|
|
17
|
+
const client = new CloudClient(
|
|
18
|
+
'your username',
|
|
19
|
+
'your password'
|
|
20
|
+
);
|
|
21
|
+
await client.login();
|
|
22
|
+
const t1 = await client.userSign();
|
|
23
|
+
console.log(t1);
|
|
24
|
+
await delay(5000);
|
|
25
|
+
const t2 = await client.taskSign();
|
|
26
|
+
console.log(t2);
|
|
27
|
+
await delay(5000);
|
|
28
|
+
const t3 = await client.taskPhoto();
|
|
29
|
+
console.log(t3);
|
|
30
|
+
await delay(5000);
|
|
31
|
+
const t4 = await client.taskKJ();
|
|
32
|
+
await delay(5000);
|
|
33
|
+
console.log(t4);
|
|
34
|
+
const { familyInfoResp } = await client.getFamilyList();
|
|
35
|
+
console.log(familyInfoResp);
|
|
36
|
+
if (familyInfoResp) {
|
|
37
|
+
for (let index = 0; index < familyInfoResp.length; index += 1) {
|
|
38
|
+
const { familyId } = familyInfoResp[index];
|
|
39
|
+
try {
|
|
40
|
+
const res = await client.familyUserSign(familyId);
|
|
41
|
+
console.log(res);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
console.error(e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const info = await client.getUserSizeInfo();
|
|
48
|
+
console.log(info);
|
|
49
|
+
})();
|
|
50
|
+
``
|
|
51
|
+
```
|
package/dist/CloudClient.d.ts
CHANGED
|
@@ -26,14 +26,6 @@ interface FamilyUserSignResponse extends APIResponse {
|
|
|
26
26
|
signTime: string;
|
|
27
27
|
userId: string;
|
|
28
28
|
}
|
|
29
|
-
interface UserSizeInfoResponse extends APIResponse {
|
|
30
|
-
cloudCapacityInfo: {
|
|
31
|
-
totalSize: number;
|
|
32
|
-
};
|
|
33
|
-
familyCapacityInfo: {
|
|
34
|
-
totalSize: number;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
29
|
interface UserSignResponse {
|
|
38
30
|
isSign: boolean;
|
|
39
31
|
netdiskBonus: number;
|
|
@@ -60,7 +52,7 @@ declare class CloudClient {
|
|
|
60
52
|
* */
|
|
61
53
|
login: () => Promise<any>;
|
|
62
54
|
fetchAPI: (task: any) => Promise<any>;
|
|
63
|
-
getUserSizeInfo: () => Promise<
|
|
55
|
+
getUserSizeInfo: () => Promise<any>;
|
|
64
56
|
userSign: () => Promise<UserSignResponse>;
|
|
65
57
|
taskSign: () => Promise<TaskResponse>;
|
|
66
58
|
taskPhoto: () => Promise<TaskResponse>;
|
package/dist/CloudClient.js
CHANGED
|
@@ -150,7 +150,12 @@ class CloudClient {
|
|
|
150
150
|
};
|
|
151
151
|
this.getUserSizeInfo = () => {
|
|
152
152
|
return got_1.default
|
|
153
|
-
.get("https://cloud.189.cn/api/portal/getUserSizeInfo.action"
|
|
153
|
+
.get("https://cloud.189.cn/api/portal/getUserSizeInfo.action", {
|
|
154
|
+
headers: {
|
|
155
|
+
Accept: "application/json;charset=UTF-8",
|
|
156
|
+
},
|
|
157
|
+
cookieJar,
|
|
158
|
+
})
|
|
154
159
|
.json();
|
|
155
160
|
};
|
|
156
161
|
this.userSign = () => {
|
|
@@ -160,7 +165,7 @@ class CloudClient {
|
|
|
160
165
|
return this.fetchAPI("https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN");
|
|
161
166
|
};
|
|
162
167
|
this.taskPhoto = () => {
|
|
163
|
-
return this.fetchAPI("https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=
|
|
168
|
+
return this.fetchAPI("https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN");
|
|
164
169
|
};
|
|
165
170
|
this.taskKJ = () => {
|
|
166
171
|
return this.fetchAPI("https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&activityId=ACT_SIGNIN");
|