Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit a8af770

Browse files
committed
implemented getAllJSON method
1 parent a02fc93 commit a8af770

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

core/TDSClient.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ export default class TDSClient {
1818
return await TypeManager.getAll();
1919
}
2020

21+
/**
22+
* Method for getting all todoist resources from one type (task, project, etc.) in an array with JSON content
23+
* The resource type is given by params
24+
*/
25+
async getAllJSON({ type = "task" } = {}) {
26+
const TypeManager = new IManager(type, this.headers);
27+
return await TypeManager.getAllJSON();
28+
}
29+
2130
/**
2231
* Method for getting today tasks
2332
*/
@@ -26,6 +35,16 @@ export default class TDSClient {
2635
return await TypeManager.getToday();
2736
}
2837

38+
/** 🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈Implement thiss"""🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈🎈
39+
* Method for find a todoist resource by type (task, project, etc.) using its ID.
40+
* The resource type is given by params.
41+
* Returns the name/content of the resource specified
42+
*/
43+
async findByID({ type = "task", id } = {}) {
44+
const TypeManager = new IManager(type, this.headers);
45+
return await TypeManager.findById(id);
46+
}
47+
2948
/**
3049
* Method for creating todoist resources (task, project, etc.). The resource type ond object are given by params.
3150
* If no params, creates a NO_CONTENT task

core/managers/ProjectsManager.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export default class ProjectsManager {
2424
});
2525
return arrayProjects;
2626
}
27+
28+
/**
29+
* returns an array with all projects JSON info
30+
*/
31+
async getAllJSON() {
32+
return await getAllJson(this.headers);
33+
}
2734
}
2835

2936
async function getAllJson(headers) {

core/managers/TasksManager.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export default class TasksManager {
2424
return arrayTasks;
2525
}
2626

27+
/**
28+
* returns an array with all tasks JSON info
29+
*/
30+
async getAllJSON() {
31+
return await getAllJson(this.headers);
32+
}
33+
2734
/**
2835
* returns an array with all today tasks
2936
*/

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
## Working on
44

55
- New resources: Projects & Sections !!
6-
- New general functions:
6+
- New general functions:
77
- Find by ID
8+
- Get JSONs => implementing methods for getting JSON (not content/name arrays)
89

910
## License
1011

0 commit comments

Comments
 (0)