-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev-example.ts
57 lines (36 loc) · 2.36 KB
/
dev-example.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import dotenv from 'dotenv';
import Ticktick from '../src/index';
dotenv.config();
async function main() {
const username = process.env.TICK_USERNAME ?? 'your_username';
const password = process.env.TICK_PASSWORD ?? 'your_password';
// const basicTickInstance = new Ticktick({ username, password });
// const chinaTickInstance = new Ticktick({ username, password, customConfigs: { apiUrl: 'https://api.dida365.com/api/v2' } });
const tickInstance = new Ticktick({ username, password, customConfigs: { validateSchema: true } });
// [validateSchema: true] will throw an error on response in case its content dont follow the specified schema, if is that the case
// and you want to contribute to the project please update the schema and send a pull request with it.
// AUTH ======================================================================
await tickInstance.auth.login();
// USER ======================================================================
// console.log(await tickInstance.user.getUserInformation());
// console.log(await tickInstance.user.getUserDailyReminder());
// console.log(await tickInstance.user.getUserSettings());
// TAGS ======================================================================
console.log(await tickInstance.tags.getTags());
// HABITS ====================================================================
// console.log(await tickInstance.habits.getHabits());
// GENERAL ===================================================================
console.log(await tickInstance.data.getUserDataT0());
console.log(await tickInstance.data.getUserDataT1());
// PROJECTS ==================================================================
// const projectId = '6469009e8f08f0358a6b82d7';
console.log(await tickInstance.projects.getProjects());
// console.log(await tickInstance.projects.getProjectSections(projectId));
// TASKS =====================================================================
console.log(await tickInstance.tasks.getCompletedTasks());
// console.log(await tickInstance.tasks.getProjectCompletedTasks(projectId));
// TESTING ===================================================================
// console.log(await tickInstance.customUrl({ route: '/batch/check/0', method: 'GET' }));
// console.log(await tickInstance.customUrl({ route: '/new_secret_route', method: 'GET' }));
}
main();