@@ -52,36 +52,71 @@ const Client = new TDSClient(API_TOKEN); //get an api token from your todoist in
5252
5353## API
5454
55- ### Client.create({type}, todoistResource)
55+ ### Client.getAll({type: string})
56+
57+ This method returns an array of Titles/Names (strings) of all objects from the type .
58+
59+ - If no param -> returns all tasks.
60+
61+ ``` js
62+ import TDSClient from " todoist-rest-client" ;
63+
64+ const Client = new TDSClient (API_TOKEN ); // get an api token from your todoist integrations page
65+
66+ Client .getAll (); // ["task 1", "task 2", ...]
67+ Client .getAll ({ type: " task" }); // ["task 1", "task 2", ...]
68+ Client .getAll ({ type: " project" }); // ["Project 1", "Project 2", ...]
69+ ```
70+
71+ ### Client.create({type: string}, todoistResource)
5672
5773This method allows creating todoist resources (tasks, projects, ...).
58- If no params are given, it creates a _ No_Content_ task in the inbox.
59- If given type param, creates default todoistResourceType.
74+
75+ - If no params are given -> creates a _ No_Content_ task in the ` Inbox ` .
76+ - If only given type param -> creates default todoistResourceType.
6077
6178``` js
6279// Creating a todoist resource
6380import TDSClient from " todoist-rest-client" ;
6481
6582const Client = new TDSClient (API_TOKEN ); // get an api token from your todoist integrations page
6683
67- Client .create ({ type: " task" });
84+ Client .create (); // creates a _NO_CONTENT_ task in the inbox
85+ Client .create ({ type: " task" }); // creates a _NO_CONTENT_ task in the inbox
86+ Client .create ({ type: " project" }); // creates a _NO_NAME_ project
87+ Client .create ({ type: " project" }, projectObject); // creates a project with the data given in the object
6888```
6989
90+ See [ resources] ( #Todoist-Resources )
91+
7092## Todoist Resources
7193
72- Todoist resources are classes that allow you to easyly create resource objects for todoist.
94+ Todoist resources are classes that allow you to easyly create resource objects for Todoist.
95+ Todoist resources are:
96+
97+ - Task
98+ - Project
99+
73100They can be imported directly from the package:
74101
75102``` js
76- import {Task , Project } from " todoist-rest-client" ;
103+ import TDSClient , {Task , Project } from " todoist-rest-client" ;
77104
105+ // Create the resource objects
78106const myTask = new Task ({... .});
79107const myProject = new Project ({... .});
108+
109+ // Then use them to create the resource in the server...
110+ const myClient = new TDSCLient (API_TOKEN );
111+
112+ myClient .create ({type: " project" }, myProject);
113+ myClient .create ({type: " task" }, myTask);
114+
80115```
81116
82117### Task
83118
84- Tasks are the basic pieces of todoist . Each task has a lot of properties: content, date, priority...
119+ Tasks are the basic pieces of Todoist . Each task has a lot of properties: content, date, priority...
85120
86121### Project
87122
0 commit comments