@doist/todoist-api-typescript 3.0.3 → 4.0.0-alpha.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 +3 -0
- package/dist/TodoistApi.d.ts +11 -12
- package/dist/TodoistApi.js +98 -75
- package/dist/consts/endpoints.d.ts +3 -3
- package/dist/consts/endpoints.js +7 -10
- package/dist/restClient.js +1 -1
- package/dist/testUtils/testDefaults.d.ts +23 -25
- package/dist/testUtils/testDefaults.js +13 -3
- package/dist/types/entities.d.ts +33 -31
- package/dist/types/entities.js +23 -21
- package/dist/types/requests.d.ts +69 -11
- package/dist/utils/taskConverters.js +20 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
This is the official TypeScript API client for the Todoist REST API.
|
|
4
4
|
|
|
5
|
+
> [!IMPORTANT]
|
|
6
|
+
> This library is currently being migrated from the Todoist REST API to the Todoist Sync API. As a result, parts of the documentation may be outdated. However, the client API remains consistent with the latest stable release, [v3.0.3](https://github.com/Doist/todoist-api-typescript/releases/tag/v3.0.3). Please note that some client methods may return unexpected data or encounter failures during this transition.
|
|
7
|
+
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
7
10
|
```
|
package/dist/TodoistApi.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Task, Project, Label,
|
|
2
|
-
import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, GetSharedLabelsArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/requests';
|
|
1
|
+
import { Task, Project, Label, Section, Comment } from './types/entities';
|
|
2
|
+
import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, GetSharedLabelsArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs, GetProjectsArgs, GetProjectCollaboratorsArgs, GetLabelsArgs, GetLabelsResponse, GetTasksResponse, GetProjectsResponse, GetProjectCollaboratorsResponse, GetSectionsArgs, GetSectionsResponse, GetSharedLabelsResponse, GetCommentsResponse } from './types/requests';
|
|
3
3
|
export declare class TodoistApi {
|
|
4
4
|
authToken: string;
|
|
5
5
|
constructor(authToken: string, baseUrl?: string);
|
|
6
|
-
private restApiBase;
|
|
7
6
|
private syncApiBase;
|
|
8
7
|
getTask(id: string): Promise<Task>;
|
|
9
|
-
getTasks(args?: GetTasksArgs): Promise<
|
|
8
|
+
getTasks(args?: GetTasksArgs): Promise<GetTasksResponse>;
|
|
10
9
|
addTask(args: AddTaskArgs, requestId?: string): Promise<Task>;
|
|
11
10
|
quickAddTask(args: QuickAddTaskArgs): Promise<Task>;
|
|
12
11
|
updateTask(id: string, args: UpdateTaskArgs, requestId?: string): Promise<Task>;
|
|
@@ -14,12 +13,12 @@ export declare class TodoistApi {
|
|
|
14
13
|
reopenTask(id: string, requestId?: string): Promise<boolean>;
|
|
15
14
|
deleteTask(id: string, requestId?: string): Promise<boolean>;
|
|
16
15
|
getProject(id: string): Promise<Project>;
|
|
17
|
-
getProjects(): Promise<
|
|
16
|
+
getProjects(args?: GetProjectsArgs): Promise<GetProjectsResponse>;
|
|
18
17
|
addProject(args: AddProjectArgs, requestId?: string): Promise<Project>;
|
|
19
18
|
updateProject(id: string, args: UpdateProjectArgs, requestId?: string): Promise<Project>;
|
|
20
19
|
deleteProject(id: string, requestId?: string): Promise<boolean>;
|
|
21
|
-
getProjectCollaborators(projectId: string): Promise<
|
|
22
|
-
getSections(
|
|
20
|
+
getProjectCollaborators(projectId: string, args?: GetProjectCollaboratorsArgs): Promise<GetProjectCollaboratorsResponse>;
|
|
21
|
+
getSections(args: GetSectionsArgs): Promise<GetSectionsResponse>;
|
|
23
22
|
getSection(id: string): Promise<Section>;
|
|
24
23
|
addSection(args: AddSectionArgs, requestId?: string): Promise<Section>;
|
|
25
24
|
updateSection(id: string, args: UpdateSectionArgs, requestId?: string): Promise<Section>;
|
|
@@ -31,7 +30,7 @@ export declare class TodoistApi {
|
|
|
31
30
|
/**
|
|
32
31
|
* Fetches the personal labels
|
|
33
32
|
*/
|
|
34
|
-
getLabels(): Promise<
|
|
33
|
+
getLabels(args?: GetLabelsArgs): Promise<GetLabelsResponse>;
|
|
35
34
|
/**
|
|
36
35
|
* Adds a personal label
|
|
37
36
|
*/
|
|
@@ -44,10 +43,10 @@ export declare class TodoistApi {
|
|
|
44
43
|
* Deletes a personal label
|
|
45
44
|
*/
|
|
46
45
|
deleteLabel(id: string, requestId?: string): Promise<boolean>;
|
|
47
|
-
getSharedLabels(args?: GetSharedLabelsArgs): Promise<
|
|
48
|
-
renameSharedLabel(args: RenameSharedLabelArgs): Promise<
|
|
49
|
-
removeSharedLabel(args: RemoveSharedLabelArgs): Promise<
|
|
50
|
-
getComments(args: GetTaskCommentsArgs | GetProjectCommentsArgs): Promise<
|
|
46
|
+
getSharedLabels(args?: GetSharedLabelsArgs): Promise<GetSharedLabelsResponse>;
|
|
47
|
+
renameSharedLabel(args: RenameSharedLabelArgs): Promise<boolean>;
|
|
48
|
+
removeSharedLabel(args: RemoveSharedLabelArgs): Promise<boolean>;
|
|
49
|
+
getComments(args: GetTaskCommentsArgs | GetProjectCommentsArgs): Promise<GetCommentsResponse>;
|
|
51
50
|
getComment(id: string): Promise<Comment>;
|
|
52
51
|
addComment(args: AddCommentArgs, requestId?: string): Promise<Comment>;
|
|
53
52
|
updateComment(id: string, args: UpdateCommentArgs, requestId?: string): Promise<Comment>;
|
package/dist/TodoistApi.js
CHANGED
|
@@ -57,7 +57,6 @@ function generatePath() {
|
|
|
57
57
|
var TodoistApi = /** @class */ (function () {
|
|
58
58
|
function TodoistApi(authToken, baseUrl) {
|
|
59
59
|
this.authToken = authToken;
|
|
60
|
-
this.restApiBase = (0, endpoints_1.getRestBaseUri)(baseUrl);
|
|
61
60
|
this.syncApiBase = (0, endpoints_1.getSyncBaseUri)(baseUrl);
|
|
62
61
|
}
|
|
63
62
|
TodoistApi.prototype.getTask = function (id) {
|
|
@@ -67,7 +66,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
67
66
|
switch (_a.label) {
|
|
68
67
|
case 0:
|
|
69
68
|
runtypes_1.String.check(id);
|
|
70
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
69
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken)];
|
|
71
70
|
case 1:
|
|
72
71
|
response = _a.sent();
|
|
73
72
|
return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
|
|
@@ -76,14 +75,18 @@ var TodoistApi = /** @class */ (function () {
|
|
|
76
75
|
});
|
|
77
76
|
};
|
|
78
77
|
TodoistApi.prototype.getTasks = function (args) {
|
|
78
|
+
if (args === void 0) { args = {}; }
|
|
79
79
|
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
var
|
|
81
|
-
return __generator(this, function (
|
|
82
|
-
switch (
|
|
83
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
80
|
+
var _a, results, nextCursor;
|
|
81
|
+
return __generator(this, function (_b) {
|
|
82
|
+
switch (_b.label) {
|
|
83
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS, this.authToken, args)];
|
|
84
84
|
case 1:
|
|
85
|
-
|
|
86
|
-
return [2 /*return*/,
|
|
85
|
+
_a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
|
|
86
|
+
return [2 /*return*/, {
|
|
87
|
+
results: (0, validators_1.validateTaskArray)(results),
|
|
88
|
+
nextCursor: nextCursor,
|
|
89
|
+
}];
|
|
87
90
|
}
|
|
88
91
|
});
|
|
89
92
|
});
|
|
@@ -93,7 +96,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
93
96
|
var response;
|
|
94
97
|
return __generator(this, function (_a) {
|
|
95
98
|
switch (_a.label) {
|
|
96
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
99
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS, this.authToken, args, requestId)];
|
|
97
100
|
case 1:
|
|
98
101
|
response = _a.sent();
|
|
99
102
|
return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
|
|
@@ -122,7 +125,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
122
125
|
switch (_a.label) {
|
|
123
126
|
case 0:
|
|
124
127
|
runtypes_1.String.check(id);
|
|
125
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
128
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, args, requestId)];
|
|
126
129
|
case 1:
|
|
127
130
|
response = _a.sent();
|
|
128
131
|
return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
|
|
@@ -137,7 +140,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
137
140
|
switch (_a.label) {
|
|
138
141
|
case 0:
|
|
139
142
|
runtypes_1.String.check(id);
|
|
140
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
143
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_CLOSE), this.authToken, undefined, requestId)];
|
|
141
144
|
case 1:
|
|
142
145
|
response = _a.sent();
|
|
143
146
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -152,7 +155,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
152
155
|
switch (_a.label) {
|
|
153
156
|
case 0:
|
|
154
157
|
runtypes_1.String.check(id);
|
|
155
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
158
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_REOPEN), this.authToken, undefined, requestId)];
|
|
156
159
|
case 1:
|
|
157
160
|
response = _a.sent();
|
|
158
161
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -167,7 +170,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
167
170
|
switch (_a.label) {
|
|
168
171
|
case 0:
|
|
169
172
|
runtypes_1.String.check(id);
|
|
170
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.
|
|
173
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, undefined, requestId)];
|
|
171
174
|
case 1:
|
|
172
175
|
response = _a.sent();
|
|
173
176
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -182,7 +185,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
182
185
|
switch (_a.label) {
|
|
183
186
|
case 0:
|
|
184
187
|
runtypes_1.String.check(id);
|
|
185
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
188
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken)];
|
|
186
189
|
case 1:
|
|
187
190
|
response = _a.sent();
|
|
188
191
|
return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
|
|
@@ -190,15 +193,19 @@ var TodoistApi = /** @class */ (function () {
|
|
|
190
193
|
});
|
|
191
194
|
});
|
|
192
195
|
};
|
|
193
|
-
TodoistApi.prototype.getProjects = function () {
|
|
196
|
+
TodoistApi.prototype.getProjects = function (args) {
|
|
197
|
+
if (args === void 0) { args = {}; }
|
|
194
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
195
|
-
var
|
|
196
|
-
return __generator(this, function (
|
|
197
|
-
switch (
|
|
198
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
199
|
+
var _a, results, nextCursor;
|
|
200
|
+
return __generator(this, function (_b) {
|
|
201
|
+
switch (_b.label) {
|
|
202
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS, this.authToken, args)];
|
|
199
203
|
case 1:
|
|
200
|
-
|
|
201
|
-
return [2 /*return*/,
|
|
204
|
+
_a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
|
|
205
|
+
return [2 /*return*/, {
|
|
206
|
+
results: (0, validators_1.validateProjectArray)(results),
|
|
207
|
+
nextCursor: nextCursor,
|
|
208
|
+
}];
|
|
202
209
|
}
|
|
203
210
|
});
|
|
204
211
|
});
|
|
@@ -208,7 +215,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
208
215
|
var response;
|
|
209
216
|
return __generator(this, function (_a) {
|
|
210
217
|
switch (_a.label) {
|
|
211
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
218
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS, this.authToken, args, requestId)];
|
|
212
219
|
case 1:
|
|
213
220
|
response = _a.sent();
|
|
214
221
|
return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
|
|
@@ -223,7 +230,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
223
230
|
switch (_a.label) {
|
|
224
231
|
case 0:
|
|
225
232
|
runtypes_1.String.check(id);
|
|
226
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
233
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, args, requestId)];
|
|
227
234
|
case 1:
|
|
228
235
|
response = _a.sent();
|
|
229
236
|
return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
|
|
@@ -238,7 +245,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
238
245
|
switch (_a.label) {
|
|
239
246
|
case 0:
|
|
240
247
|
runtypes_1.String.check(id);
|
|
241
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.
|
|
248
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, undefined, requestId)];
|
|
242
249
|
case 1:
|
|
243
250
|
response = _a.sent();
|
|
244
251
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -246,30 +253,37 @@ var TodoistApi = /** @class */ (function () {
|
|
|
246
253
|
});
|
|
247
254
|
});
|
|
248
255
|
};
|
|
249
|
-
TodoistApi.prototype.getProjectCollaborators = function (projectId) {
|
|
256
|
+
TodoistApi.prototype.getProjectCollaborators = function (projectId, args) {
|
|
257
|
+
if (args === void 0) { args = {}; }
|
|
250
258
|
return __awaiter(this, void 0, void 0, function () {
|
|
251
|
-
var
|
|
252
|
-
return __generator(this, function (
|
|
253
|
-
switch (
|
|
259
|
+
var _a, results, nextCursor;
|
|
260
|
+
return __generator(this, function (_b) {
|
|
261
|
+
switch (_b.label) {
|
|
254
262
|
case 0:
|
|
255
263
|
runtypes_1.String.check(projectId);
|
|
256
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
264
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, projectId, endpoints_1.ENDPOINT_REST_PROJECT_COLLABORATORS), this.authToken, args)];
|
|
257
265
|
case 1:
|
|
258
|
-
|
|
259
|
-
return [2 /*return*/,
|
|
266
|
+
_a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
|
|
267
|
+
return [2 /*return*/, {
|
|
268
|
+
results: (0, validators_1.validateUserArray)(results),
|
|
269
|
+
nextCursor: nextCursor,
|
|
270
|
+
}];
|
|
260
271
|
}
|
|
261
272
|
});
|
|
262
273
|
});
|
|
263
274
|
};
|
|
264
|
-
TodoistApi.prototype.getSections = function (
|
|
275
|
+
TodoistApi.prototype.getSections = function (args) {
|
|
265
276
|
return __awaiter(this, void 0, void 0, function () {
|
|
266
|
-
var
|
|
267
|
-
return __generator(this, function (
|
|
268
|
-
switch (
|
|
269
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
277
|
+
var _a, results, nextCursor;
|
|
278
|
+
return __generator(this, function (_b) {
|
|
279
|
+
switch (_b.label) {
|
|
280
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_SECTIONS, this.authToken, args)];
|
|
270
281
|
case 1:
|
|
271
|
-
|
|
272
|
-
return [2 /*return*/,
|
|
282
|
+
_a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
|
|
283
|
+
return [2 /*return*/, {
|
|
284
|
+
results: (0, validators_1.validateSectionArray)(results),
|
|
285
|
+
nextCursor: nextCursor,
|
|
286
|
+
}];
|
|
273
287
|
}
|
|
274
288
|
});
|
|
275
289
|
});
|
|
@@ -281,7 +295,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
281
295
|
switch (_a.label) {
|
|
282
296
|
case 0:
|
|
283
297
|
runtypes_1.String.check(id);
|
|
284
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
298
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken)];
|
|
285
299
|
case 1:
|
|
286
300
|
response = _a.sent();
|
|
287
301
|
return [2 /*return*/, (0, validators_1.validateSection)(response.data)];
|
|
@@ -294,7 +308,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
294
308
|
var response;
|
|
295
309
|
return __generator(this, function (_a) {
|
|
296
310
|
switch (_a.label) {
|
|
297
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
311
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_SECTIONS, this.authToken, args, requestId)];
|
|
298
312
|
case 1:
|
|
299
313
|
response = _a.sent();
|
|
300
314
|
return [2 /*return*/, (0, validators_1.validateSection)(response.data)];
|
|
@@ -309,7 +323,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
309
323
|
switch (_a.label) {
|
|
310
324
|
case 0:
|
|
311
325
|
runtypes_1.String.check(id);
|
|
312
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
326
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken, args, requestId)];
|
|
313
327
|
case 1:
|
|
314
328
|
response = _a.sent();
|
|
315
329
|
return [2 /*return*/, (0, validators_1.validateSection)(response.data)];
|
|
@@ -324,7 +338,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
324
338
|
switch (_a.label) {
|
|
325
339
|
case 0:
|
|
326
340
|
runtypes_1.String.check(id);
|
|
327
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.
|
|
341
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken, undefined, requestId)];
|
|
328
342
|
case 1:
|
|
329
343
|
response = _a.sent();
|
|
330
344
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -342,7 +356,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
342
356
|
switch (_a.label) {
|
|
343
357
|
case 0:
|
|
344
358
|
runtypes_1.String.check(id);
|
|
345
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
359
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken)];
|
|
346
360
|
case 1:
|
|
347
361
|
response = _a.sent();
|
|
348
362
|
return [2 /*return*/, (0, validators_1.validateLabel)(response.data)];
|
|
@@ -353,15 +367,19 @@ var TodoistApi = /** @class */ (function () {
|
|
|
353
367
|
/**
|
|
354
368
|
* Fetches the personal labels
|
|
355
369
|
*/
|
|
356
|
-
TodoistApi.prototype.getLabels = function () {
|
|
370
|
+
TodoistApi.prototype.getLabels = function (args) {
|
|
371
|
+
if (args === void 0) { args = {}; }
|
|
357
372
|
return __awaiter(this, void 0, void 0, function () {
|
|
358
|
-
var
|
|
359
|
-
return __generator(this, function (
|
|
360
|
-
switch (
|
|
361
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
373
|
+
var _a, results, nextCursor;
|
|
374
|
+
return __generator(this, function (_b) {
|
|
375
|
+
switch (_b.label) {
|
|
376
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_LABELS, this.authToken, args)];
|
|
362
377
|
case 1:
|
|
363
|
-
|
|
364
|
-
return [2 /*return*/,
|
|
378
|
+
_a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
|
|
379
|
+
return [2 /*return*/, {
|
|
380
|
+
results: (0, validators_1.validateLabelArray)(results),
|
|
381
|
+
nextCursor: nextCursor,
|
|
382
|
+
}];
|
|
365
383
|
}
|
|
366
384
|
});
|
|
367
385
|
});
|
|
@@ -374,7 +392,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
374
392
|
var response;
|
|
375
393
|
return __generator(this, function (_a) {
|
|
376
394
|
switch (_a.label) {
|
|
377
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
395
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_LABELS, this.authToken, args, requestId)];
|
|
378
396
|
case 1:
|
|
379
397
|
response = _a.sent();
|
|
380
398
|
return [2 /*return*/, (0, validators_1.validateLabel)(response.data)];
|
|
@@ -392,7 +410,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
392
410
|
switch (_a.label) {
|
|
393
411
|
case 0:
|
|
394
412
|
runtypes_1.String.check(id);
|
|
395
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
413
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken, args, requestId)];
|
|
396
414
|
case 1:
|
|
397
415
|
response = _a.sent();
|
|
398
416
|
return [2 /*return*/, (0, validators_1.validateLabel)(response.data)];
|
|
@@ -410,7 +428,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
410
428
|
switch (_a.label) {
|
|
411
429
|
case 0:
|
|
412
430
|
runtypes_1.String.check(id);
|
|
413
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.
|
|
431
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken, undefined, requestId)];
|
|
414
432
|
case 1:
|
|
415
433
|
response = _a.sent();
|
|
416
434
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -420,50 +438,55 @@ var TodoistApi = /** @class */ (function () {
|
|
|
420
438
|
};
|
|
421
439
|
TodoistApi.prototype.getSharedLabels = function (args) {
|
|
422
440
|
return __awaiter(this, void 0, void 0, function () {
|
|
423
|
-
var
|
|
424
|
-
return __generator(this, function (
|
|
425
|
-
switch (
|
|
426
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
441
|
+
var _a, results, nextCursor;
|
|
442
|
+
return __generator(this, function (_b) {
|
|
443
|
+
switch (_b.label) {
|
|
444
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED, this.authToken, args)];
|
|
427
445
|
case 1:
|
|
428
|
-
|
|
429
|
-
return [2 /*return*/,
|
|
446
|
+
_a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
|
|
447
|
+
return [2 /*return*/, { results: results, nextCursor: nextCursor }];
|
|
430
448
|
}
|
|
431
449
|
});
|
|
432
450
|
});
|
|
433
451
|
};
|
|
434
452
|
TodoistApi.prototype.renameSharedLabel = function (args) {
|
|
435
453
|
return __awaiter(this, void 0, void 0, function () {
|
|
454
|
+
var response;
|
|
436
455
|
return __generator(this, function (_a) {
|
|
437
456
|
switch (_a.label) {
|
|
438
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
457
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED_RENAME, this.authToken, args)];
|
|
439
458
|
case 1:
|
|
440
|
-
_a.sent();
|
|
441
|
-
return [2 /*return
|
|
459
|
+
response = _a.sent();
|
|
460
|
+
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
442
461
|
}
|
|
443
462
|
});
|
|
444
463
|
});
|
|
445
464
|
};
|
|
446
465
|
TodoistApi.prototype.removeSharedLabel = function (args) {
|
|
447
466
|
return __awaiter(this, void 0, void 0, function () {
|
|
467
|
+
var response;
|
|
448
468
|
return __generator(this, function (_a) {
|
|
449
469
|
switch (_a.label) {
|
|
450
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
470
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED_REMOVE, this.authToken, args)];
|
|
451
471
|
case 1:
|
|
452
|
-
_a.sent();
|
|
453
|
-
return [2 /*return
|
|
472
|
+
response = _a.sent();
|
|
473
|
+
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
454
474
|
}
|
|
455
475
|
});
|
|
456
476
|
});
|
|
457
477
|
};
|
|
458
478
|
TodoistApi.prototype.getComments = function (args) {
|
|
459
479
|
return __awaiter(this, void 0, void 0, function () {
|
|
460
|
-
var
|
|
461
|
-
return __generator(this, function (
|
|
462
|
-
switch (
|
|
463
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
480
|
+
var _a, results, nextCursor;
|
|
481
|
+
return __generator(this, function (_b) {
|
|
482
|
+
switch (_b.label) {
|
|
483
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_COMMENTS, this.authToken, args)];
|
|
464
484
|
case 1:
|
|
465
|
-
|
|
466
|
-
return [2 /*return*/,
|
|
485
|
+
_a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
|
|
486
|
+
return [2 /*return*/, {
|
|
487
|
+
results: (0, validators_1.validateCommentArray)(results),
|
|
488
|
+
nextCursor: nextCursor,
|
|
489
|
+
}];
|
|
467
490
|
}
|
|
468
491
|
});
|
|
469
492
|
});
|
|
@@ -475,7 +498,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
475
498
|
switch (_a.label) {
|
|
476
499
|
case 0:
|
|
477
500
|
runtypes_1.String.check(id);
|
|
478
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.
|
|
501
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken)];
|
|
479
502
|
case 1:
|
|
480
503
|
response = _a.sent();
|
|
481
504
|
return [2 /*return*/, (0, validators_1.validateComment)(response.data)];
|
|
@@ -488,7 +511,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
488
511
|
var response;
|
|
489
512
|
return __generator(this, function (_a) {
|
|
490
513
|
switch (_a.label) {
|
|
491
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
514
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_COMMENTS, this.authToken, args, requestId)];
|
|
492
515
|
case 1:
|
|
493
516
|
response = _a.sent();
|
|
494
517
|
return [2 /*return*/, (0, validators_1.validateComment)(response.data)];
|
|
@@ -503,7 +526,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
503
526
|
switch (_a.label) {
|
|
504
527
|
case 0:
|
|
505
528
|
runtypes_1.String.check(id);
|
|
506
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.
|
|
529
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken, args, requestId)];
|
|
507
530
|
case 1:
|
|
508
531
|
response = _a.sent();
|
|
509
532
|
return [2 /*return*/, (0, validators_1.validateComment)(response.data)];
|
|
@@ -518,7 +541,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
518
541
|
switch (_a.label) {
|
|
519
542
|
case 0:
|
|
520
543
|
runtypes_1.String.check(id);
|
|
521
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.
|
|
544
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken, undefined, requestId)];
|
|
522
545
|
case 1:
|
|
523
546
|
response = _a.sent();
|
|
524
547
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare
|
|
1
|
+
export declare const API_VERSION = "v9.208";
|
|
2
|
+
export declare const API_BASE_URI: string;
|
|
3
3
|
export declare function getSyncBaseUri(domainBase?: string): string;
|
|
4
4
|
export declare function getAuthBaseUri(domainBase?: string): string;
|
|
5
5
|
export declare const ENDPOINT_REST_TASKS = "tasks";
|
|
@@ -13,7 +13,7 @@ export declare const ENDPOINT_REST_COMMENTS = "comments";
|
|
|
13
13
|
export declare const ENDPOINT_REST_TASK_CLOSE = "close";
|
|
14
14
|
export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
|
|
15
15
|
export declare const ENDPOINT_REST_PROJECT_COLLABORATORS = "collaborators";
|
|
16
|
-
export declare const ENDPOINT_SYNC_QUICK_ADD = "quick
|
|
16
|
+
export declare const ENDPOINT_SYNC_QUICK_ADD = "quick";
|
|
17
17
|
export declare const ENDPOINT_AUTHORIZATION = "authorize";
|
|
18
18
|
export declare const ENDPOINT_GET_TOKEN = "access_token";
|
|
19
19
|
export declare const ENDPOINT_REVOKE_TOKEN = "access_tokens/revoke";
|
package/dist/consts/endpoints.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.
|
|
3
|
+
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.API_BASE_URI = exports.API_VERSION = void 0;
|
|
4
4
|
var BASE_URI = 'https://api.todoist.com';
|
|
5
|
-
var API_REST_BASE_URI = '/rest/v2/';
|
|
6
|
-
exports.API_SYNC_BASE_URI = '/sync/v9/';
|
|
7
5
|
var TODOIST_URI = 'https://todoist.com';
|
|
6
|
+
// The API version is not configurable, to ensure
|
|
7
|
+
// compatibility between the API and the client.
|
|
8
|
+
exports.API_VERSION = 'v9.208';
|
|
9
|
+
exports.API_BASE_URI = "/api/".concat(exports.API_VERSION, "/");
|
|
8
10
|
var API_AUTHORIZATION_BASE_URI = '/oauth/';
|
|
9
|
-
function getRestBaseUri(domainBase) {
|
|
10
|
-
if (domainBase === void 0) { domainBase = BASE_URI; }
|
|
11
|
-
return new URL(API_REST_BASE_URI, domainBase).toString();
|
|
12
|
-
}
|
|
13
|
-
exports.getRestBaseUri = getRestBaseUri;
|
|
14
11
|
function getSyncBaseUri(domainBase) {
|
|
15
12
|
if (domainBase === void 0) { domainBase = BASE_URI; }
|
|
16
|
-
return new URL(exports.
|
|
13
|
+
return new URL(exports.API_BASE_URI, domainBase).toString();
|
|
17
14
|
}
|
|
18
15
|
exports.getSyncBaseUri = getSyncBaseUri;
|
|
19
16
|
function getAuthBaseUri(domainBase) {
|
|
@@ -32,7 +29,7 @@ exports.ENDPOINT_REST_COMMENTS = 'comments';
|
|
|
32
29
|
exports.ENDPOINT_REST_TASK_CLOSE = 'close';
|
|
33
30
|
exports.ENDPOINT_REST_TASK_REOPEN = 'reopen';
|
|
34
31
|
exports.ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
|
|
35
|
-
exports.ENDPOINT_SYNC_QUICK_ADD = 'quick
|
|
32
|
+
exports.ENDPOINT_SYNC_QUICK_ADD = 'quick';
|
|
36
33
|
exports.ENDPOINT_AUTHORIZATION = 'authorize';
|
|
37
34
|
exports.ENDPOINT_GET_TOKEN = 'access_token';
|
|
38
35
|
exports.ENDPOINT_REVOKE_TOKEN = 'access_tokens/revoke';
|
package/dist/restClient.js
CHANGED
|
@@ -127,7 +127,7 @@ function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId
|
|
|
127
127
|
case 1:
|
|
128
128
|
_b.trys.push([1, 9, , 10]);
|
|
129
129
|
// Sync api don't allow a request id in the CORS
|
|
130
|
-
if (httpMethod === 'POST' && !requestId && !baseUri.includes(endpoints_1.
|
|
130
|
+
if (httpMethod === 'POST' && !requestId && !baseUri.includes(endpoints_1.API_BASE_URI)) {
|
|
131
131
|
requestId = (0, uuid_1.v4)();
|
|
132
132
|
}
|
|
133
133
|
axiosClient = getAxiosClient(baseUri, apiToken, requestId);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Label, Project, QuickAddTaskResponse, Section, Task, User, Comment, Attachment, Duration } from '../types';
|
|
1
|
+
import { Label, Project, QuickAddTaskResponse, Section, Task, User, Comment, Attachment, Duration, Deadline } from '../types';
|
|
2
2
|
export declare const DEFAULT_AUTH_TOKEN = "AToken";
|
|
3
3
|
export declare const DEFAULT_REQUEST_ID = "ARequestID";
|
|
4
4
|
export declare const INVALID_ENTITY_ID = 1234;
|
|
@@ -6,48 +6,47 @@ export declare const DEFAULT_DUE_DATE: {
|
|
|
6
6
|
isRecurring: boolean;
|
|
7
7
|
string: string;
|
|
8
8
|
date: string;
|
|
9
|
+
lang: string;
|
|
10
|
+
timezone: null;
|
|
9
11
|
};
|
|
10
12
|
export declare const DEFAULT_DURATION: Duration;
|
|
11
|
-
export declare const
|
|
12
|
-
isRecurring: string;
|
|
13
|
-
string: string;
|
|
14
|
-
date: string;
|
|
15
|
-
};
|
|
13
|
+
export declare const DEFAULT_DEADLINE: Deadline;
|
|
16
14
|
export declare const DEFAULT_QUICK_ADD_RESPONSE: QuickAddTaskResponse;
|
|
17
15
|
export declare const DEFAULT_TASK: Task;
|
|
18
16
|
export declare const INVALID_TASK: {
|
|
19
|
-
due:
|
|
20
|
-
isRecurring: string;
|
|
21
|
-
string: string;
|
|
22
|
-
date: string;
|
|
23
|
-
};
|
|
17
|
+
due: string;
|
|
24
18
|
id: string;
|
|
19
|
+
assignerId: string | null;
|
|
20
|
+
assigneeId: string | null;
|
|
21
|
+
projectId: string;
|
|
22
|
+
sectionId: string | null;
|
|
23
|
+
parentId: string | null;
|
|
25
24
|
order: number;
|
|
26
25
|
content: string;
|
|
27
26
|
description: string;
|
|
28
|
-
projectId: string;
|
|
29
27
|
isCompleted: boolean;
|
|
30
28
|
labels: string[];
|
|
31
29
|
priority: number;
|
|
32
30
|
commentCount: number;
|
|
31
|
+
creatorId: string;
|
|
33
32
|
createdAt: string;
|
|
34
33
|
url: string;
|
|
35
|
-
|
|
36
|
-
duration?: {
|
|
34
|
+
duration: {
|
|
37
35
|
amount: number;
|
|
38
36
|
unit: "minute" | "day";
|
|
39
|
-
} | null
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
} | null;
|
|
38
|
+
deadline: {
|
|
39
|
+
date: string;
|
|
40
|
+
lang: string;
|
|
41
|
+
} | null;
|
|
44
42
|
};
|
|
45
43
|
export declare const TASK_WITH_OPTIONALS_AS_NULL: Task;
|
|
46
44
|
export declare const DEFAULT_PROJECT: Project;
|
|
47
45
|
export declare const INVALID_PROJECT: {
|
|
48
46
|
name: number;
|
|
49
47
|
id: string;
|
|
50
|
-
|
|
48
|
+
parentId: string | null;
|
|
49
|
+
order: number | null;
|
|
51
50
|
commentCount: number;
|
|
52
51
|
url: string;
|
|
53
52
|
color: string;
|
|
@@ -56,7 +55,6 @@ export declare const INVALID_PROJECT: {
|
|
|
56
55
|
isInboxProject: boolean;
|
|
57
56
|
isTeamInbox: boolean;
|
|
58
57
|
viewStyle: string;
|
|
59
|
-
parentId?: string | null | undefined;
|
|
60
58
|
};
|
|
61
59
|
export declare const PROJECT_WITH_OPTIONALS_AS_NULL: Project;
|
|
62
60
|
export declare const DEFAULT_SECTION: Section;
|
|
@@ -70,9 +68,9 @@ export declare const DEFAULT_LABEL: Label;
|
|
|
70
68
|
export declare const INVALID_LABEL: {
|
|
71
69
|
isFavorite: string;
|
|
72
70
|
id: string;
|
|
73
|
-
order: number;
|
|
74
|
-
name: string;
|
|
71
|
+
order: number | null;
|
|
75
72
|
color: string;
|
|
73
|
+
name: string;
|
|
76
74
|
};
|
|
77
75
|
export declare const DEFAULT_USER: User;
|
|
78
76
|
export declare const INVALID_USER: {
|
|
@@ -112,10 +110,10 @@ export declare const INVALID_COMMENT: {
|
|
|
112
110
|
title?: string | null | undefined;
|
|
113
111
|
};
|
|
114
112
|
id: string;
|
|
113
|
+
projectId: string | null;
|
|
115
114
|
content: string;
|
|
115
|
+
taskId: string | null;
|
|
116
116
|
postedAt: string;
|
|
117
|
-
taskId?: string | null | undefined;
|
|
118
|
-
projectId?: string | null | undefined;
|
|
119
117
|
};
|
|
120
118
|
export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: Comment;
|
|
121
119
|
export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: Comment;
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.INVALID_COMMENT = exports.DEFAULT_COMMENT = exports.INVALID_ATTACHMENT = exports.DEFAULT_ATTACHMENT = exports.INVALID_USER = exports.DEFAULT_USER = exports.INVALID_LABEL = exports.DEFAULT_LABEL = exports.INVALID_SECTION = exports.DEFAULT_SECTION = exports.PROJECT_WITH_OPTIONALS_AS_NULL = exports.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.TASK_WITH_OPTIONALS_AS_NULL = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_QUICK_ADD_RESPONSE = exports.
|
|
14
|
+
exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.INVALID_COMMENT = exports.DEFAULT_COMMENT = exports.INVALID_ATTACHMENT = exports.DEFAULT_ATTACHMENT = exports.INVALID_USER = exports.DEFAULT_USER = exports.INVALID_LABEL = exports.DEFAULT_LABEL = exports.INVALID_SECTION = exports.DEFAULT_SECTION = exports.PROJECT_WITH_OPTIONALS_AS_NULL = exports.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.TASK_WITH_OPTIONALS_AS_NULL = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_QUICK_ADD_RESPONSE = exports.DEFAULT_DEADLINE = exports.DEFAULT_DURATION = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = void 0;
|
|
15
15
|
var DEFAULT_TASK_ID = '1234';
|
|
16
16
|
var DEFAULT_TASK_CONTENT = 'This is a task';
|
|
17
17
|
var DEFAULT_TASK_DESCRIPTION = 'A description';
|
|
@@ -42,12 +42,17 @@ exports.DEFAULT_DUE_DATE = {
|
|
|
42
42
|
isRecurring: false,
|
|
43
43
|
string: 'a date string',
|
|
44
44
|
date: DEFAULT_DATE,
|
|
45
|
+
lang: 'en',
|
|
46
|
+
timezone: null,
|
|
45
47
|
};
|
|
46
48
|
exports.DEFAULT_DURATION = {
|
|
47
49
|
amount: 10,
|
|
48
50
|
unit: 'minute',
|
|
49
51
|
};
|
|
50
|
-
exports.
|
|
52
|
+
exports.DEFAULT_DEADLINE = {
|
|
53
|
+
date: '2020-09-08',
|
|
54
|
+
lang: 'en',
|
|
55
|
+
};
|
|
51
56
|
exports.DEFAULT_QUICK_ADD_RESPONSE = {
|
|
52
57
|
id: DEFAULT_TASK_ID,
|
|
53
58
|
projectId: DEFAULT_PROJECT_ID,
|
|
@@ -70,6 +75,8 @@ exports.DEFAULT_QUICK_ADD_RESPONSE = {
|
|
|
70
75
|
lang: 'en',
|
|
71
76
|
isRecurring: false,
|
|
72
77
|
},
|
|
78
|
+
deadline: exports.DEFAULT_DEADLINE,
|
|
79
|
+
assignedByUid: DEFAULT_CREATOR,
|
|
73
80
|
};
|
|
74
81
|
exports.DEFAULT_TASK = {
|
|
75
82
|
id: DEFAULT_TASK_ID,
|
|
@@ -86,11 +93,13 @@ exports.DEFAULT_TASK = {
|
|
|
86
93
|
createdAt: DEFAULT_DATE,
|
|
87
94
|
url: 'https://todoist.com/showTask?id=1234',
|
|
88
95
|
due: exports.DEFAULT_DUE_DATE,
|
|
96
|
+
assignerId: DEFAULT_CREATOR,
|
|
89
97
|
assigneeId: DEFAULT_ASSIGNEE,
|
|
90
98
|
creatorId: DEFAULT_CREATOR,
|
|
91
99
|
duration: exports.DEFAULT_DURATION,
|
|
100
|
+
deadline: exports.DEFAULT_DEADLINE,
|
|
92
101
|
};
|
|
93
|
-
exports.INVALID_TASK = __assign(__assign({}, exports.DEFAULT_TASK), { due:
|
|
102
|
+
exports.INVALID_TASK = __assign(__assign({}, exports.DEFAULT_TASK), { due: '2020-01-31' });
|
|
94
103
|
exports.TASK_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_TASK), { due: null, assigneeId: null, assignerId: null, parentId: null, sectionId: null, duration: null });
|
|
95
104
|
exports.DEFAULT_PROJECT = {
|
|
96
105
|
id: DEFAULT_PROJECT_ID,
|
|
@@ -139,6 +148,7 @@ exports.INVALID_ATTACHMENT = __assign(__assign({}, exports.DEFAULT_ATTACHMENT),
|
|
|
139
148
|
exports.DEFAULT_COMMENT = {
|
|
140
149
|
id: DEFAULT_COMMENT_ID,
|
|
141
150
|
content: DEFAULT_COMMENT_CONTENT,
|
|
151
|
+
taskId: null,
|
|
142
152
|
projectId: DEFAULT_PROJECT_ID,
|
|
143
153
|
attachment: exports.DEFAULT_ATTACHMENT,
|
|
144
154
|
postedAt: DEFAULT_DATE,
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -24,20 +24,27 @@ export declare const Duration: Record<{
|
|
|
24
24
|
unit: Union<[Literal<"minute">, Literal<"day">]>;
|
|
25
25
|
}, false>;
|
|
26
26
|
export type Duration = Static<typeof Duration>;
|
|
27
|
-
export declare const
|
|
27
|
+
export declare const Deadline: Record<{
|
|
28
|
+
date: String;
|
|
29
|
+
lang: String;
|
|
30
|
+
}, false>;
|
|
31
|
+
export type Deadline = Static<typeof Deadline>;
|
|
32
|
+
export declare const Task: Record<{
|
|
28
33
|
id: String;
|
|
34
|
+
assignerId: Union<[String, Literal<null>]>;
|
|
35
|
+
assigneeId: Union<[String, Literal<null>]>;
|
|
36
|
+
projectId: String;
|
|
37
|
+
sectionId: Union<[String, Literal<null>]>;
|
|
38
|
+
parentId: Union<[String, Literal<null>]>;
|
|
29
39
|
order: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
30
40
|
content: String;
|
|
31
41
|
description: String;
|
|
32
|
-
projectId: String;
|
|
33
42
|
isCompleted: Boolean;
|
|
34
43
|
labels: Array<String, false>;
|
|
35
44
|
priority: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
36
45
|
commentCount: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
37
|
-
createdAt: String;
|
|
38
|
-
url: String;
|
|
39
46
|
creatorId: String;
|
|
40
|
-
|
|
47
|
+
createdAt: String;
|
|
41
48
|
due: Union<[import("runtypes").Intersect<[Record<{
|
|
42
49
|
isRecurring: Boolean;
|
|
43
50
|
string: String;
|
|
@@ -47,33 +54,33 @@ export declare const Task: import("runtypes").Intersect<[Record<{
|
|
|
47
54
|
timezone: Union<[String, Literal<null>]>;
|
|
48
55
|
lang: Union<[String, Literal<null>]>;
|
|
49
56
|
}, false>]>, Literal<null>]>;
|
|
57
|
+
url: String;
|
|
50
58
|
duration: Union<[Record<{
|
|
51
59
|
amount: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
52
60
|
unit: Union<[Literal<"minute">, Literal<"day">]>;
|
|
53
61
|
}, false>, Literal<null>]>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}, false
|
|
62
|
+
deadline: Union<[Record<{
|
|
63
|
+
date: String;
|
|
64
|
+
lang: String;
|
|
65
|
+
}, false>, Literal<null>]>;
|
|
66
|
+
}, false>;
|
|
59
67
|
export type Task = Static<typeof Task>;
|
|
60
|
-
export declare const Project:
|
|
68
|
+
export declare const Project: Record<{
|
|
61
69
|
id: String;
|
|
62
|
-
|
|
70
|
+
parentId: Union<[String, Literal<null>]>;
|
|
71
|
+
order: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
63
72
|
color: String;
|
|
73
|
+
name: String;
|
|
64
74
|
commentCount: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
65
75
|
isShared: Boolean;
|
|
66
76
|
isFavorite: Boolean;
|
|
67
|
-
url: String;
|
|
68
77
|
isInboxProject: Boolean;
|
|
69
78
|
isTeamInbox: Boolean;
|
|
70
|
-
|
|
79
|
+
url: String;
|
|
71
80
|
viewStyle: String;
|
|
72
|
-
}, false
|
|
73
|
-
parentId: Union<[String, Literal<null>]>;
|
|
74
|
-
}, false>]>;
|
|
81
|
+
}, false>;
|
|
75
82
|
export type Project = Static<typeof Project>;
|
|
76
|
-
export type ProjectViewStyle = 'list' | 'board';
|
|
83
|
+
export type ProjectViewStyle = 'list' | 'board' | 'calendar';
|
|
77
84
|
export declare const Section: Record<{
|
|
78
85
|
id: String;
|
|
79
86
|
order: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
@@ -83,7 +90,7 @@ export declare const Section: Record<{
|
|
|
83
90
|
export type Section = Static<typeof Section>;
|
|
84
91
|
export declare const Label: Record<{
|
|
85
92
|
id: String;
|
|
86
|
-
order: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
93
|
+
order: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
87
94
|
name: String;
|
|
88
95
|
color: String;
|
|
89
96
|
isFavorite: Boolean;
|
|
@@ -105,13 +112,12 @@ export declare const Attachment: import("runtypes").Intersect<[Record<{
|
|
|
105
112
|
title: Union<[String, Literal<null>]>;
|
|
106
113
|
}, false>]>;
|
|
107
114
|
export type Attachment = Static<typeof Attachment>;
|
|
108
|
-
export declare const Comment:
|
|
115
|
+
export declare const Comment: Record<{
|
|
109
116
|
id: String;
|
|
110
|
-
content: String;
|
|
111
|
-
postedAt: String;
|
|
112
|
-
}, false>, Partial<{
|
|
113
117
|
taskId: Union<[String, Literal<null>]>;
|
|
114
118
|
projectId: Union<[String, Literal<null>]>;
|
|
119
|
+
content: String;
|
|
120
|
+
postedAt: String;
|
|
115
121
|
attachment: Union<[import("runtypes").Intersect<[Record<{
|
|
116
122
|
resourceType: String;
|
|
117
123
|
}, false>, Partial<{
|
|
@@ -127,7 +133,7 @@ export declare const Comment: import("runtypes").Intersect<[Record<{
|
|
|
127
133
|
url: Union<[String, Literal<null>]>;
|
|
128
134
|
title: Union<[String, Literal<null>]>;
|
|
129
135
|
}, false>]>, Literal<null>]>;
|
|
130
|
-
}, false
|
|
136
|
+
}, false>;
|
|
131
137
|
export type Comment = Static<typeof Comment>;
|
|
132
138
|
export declare const User: Record<{
|
|
133
139
|
id: String;
|
|
@@ -171,16 +177,12 @@ export type QuickAddTaskResponse = {
|
|
|
171
177
|
parentId: string | null;
|
|
172
178
|
childOrder: number;
|
|
173
179
|
labels: string[];
|
|
180
|
+
assignedByUid: string | null;
|
|
174
181
|
responsibleUid: string | null;
|
|
175
182
|
checked: boolean;
|
|
176
183
|
addedAt: string;
|
|
177
184
|
addedByUid: string | null;
|
|
178
185
|
duration: Duration | null;
|
|
179
|
-
due:
|
|
180
|
-
|
|
181
|
-
timezone: string | null;
|
|
182
|
-
isRecurring: boolean;
|
|
183
|
-
string: string;
|
|
184
|
-
lang: string;
|
|
185
|
-
} | null;
|
|
186
|
+
due: DueDate | null;
|
|
187
|
+
deadline: Deadline | null;
|
|
186
188
|
};
|
package/dist/types/entities.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.User = exports.Comment = exports.Attachment = exports.Label = exports.Section = exports.Project = exports.Task = exports.Duration = exports.DueDate = exports.Int = void 0;
|
|
3
|
+
exports.User = exports.Comment = exports.Attachment = exports.Label = exports.Section = exports.Project = exports.Task = exports.Deadline = exports.Duration = exports.DueDate = exports.Int = void 0;
|
|
4
4
|
var runtypes_1 = require("runtypes");
|
|
5
5
|
exports.Int = runtypes_1.Number.withConstraint(function (n) { return Number.isInteger(n) || "".concat(n, " is not a valid entity id. Should be a string"); });
|
|
6
6
|
exports.DueDate = (0, runtypes_1.Record)({
|
|
@@ -16,42 +16,45 @@ exports.Duration = (0, runtypes_1.Record)({
|
|
|
16
16
|
amount: runtypes_1.Number.withConstraint(function (n) { return n > 0 || 'Value should be greater than zero'; }),
|
|
17
17
|
unit: (0, runtypes_1.Union)((0, runtypes_1.Literal)('minute'), (0, runtypes_1.Literal)('day')),
|
|
18
18
|
});
|
|
19
|
+
exports.Deadline = (0, runtypes_1.Record)({
|
|
20
|
+
date: runtypes_1.String,
|
|
21
|
+
lang: runtypes_1.String,
|
|
22
|
+
});
|
|
19
23
|
exports.Task = (0, runtypes_1.Record)({
|
|
20
24
|
id: runtypes_1.String,
|
|
25
|
+
assignerId: runtypes_1.String.Or(runtypes_1.Null),
|
|
26
|
+
assigneeId: runtypes_1.String.Or(runtypes_1.Null),
|
|
27
|
+
projectId: runtypes_1.String,
|
|
28
|
+
sectionId: runtypes_1.String.Or(runtypes_1.Null),
|
|
29
|
+
parentId: runtypes_1.String.Or(runtypes_1.Null),
|
|
21
30
|
order: exports.Int,
|
|
22
31
|
content: runtypes_1.String,
|
|
23
32
|
description: runtypes_1.String,
|
|
24
|
-
projectId: runtypes_1.String,
|
|
25
33
|
isCompleted: runtypes_1.Boolean,
|
|
26
34
|
labels: (0, runtypes_1.Array)(runtypes_1.String),
|
|
27
35
|
priority: exports.Int,
|
|
28
36
|
commentCount: exports.Int,
|
|
29
|
-
createdAt: runtypes_1.String,
|
|
30
|
-
url: runtypes_1.String,
|
|
31
37
|
creatorId: runtypes_1.String,
|
|
32
|
-
|
|
38
|
+
createdAt: runtypes_1.String,
|
|
33
39
|
due: exports.DueDate.Or(runtypes_1.Null),
|
|
40
|
+
url: runtypes_1.String,
|
|
34
41
|
duration: exports.Duration.Or(runtypes_1.Null),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
parentId: runtypes_1.String.Or(runtypes_1.Null),
|
|
38
|
-
sectionId: runtypes_1.String.Or(runtypes_1.Null),
|
|
39
|
-
}));
|
|
42
|
+
deadline: exports.Deadline.Or(runtypes_1.Null),
|
|
43
|
+
});
|
|
40
44
|
exports.Project = (0, runtypes_1.Record)({
|
|
41
45
|
id: runtypes_1.String,
|
|
42
|
-
|
|
46
|
+
parentId: runtypes_1.String.Or(runtypes_1.Null),
|
|
47
|
+
order: exports.Int.Or(runtypes_1.Null),
|
|
43
48
|
color: runtypes_1.String,
|
|
49
|
+
name: runtypes_1.String,
|
|
44
50
|
commentCount: exports.Int,
|
|
45
51
|
isShared: runtypes_1.Boolean,
|
|
46
52
|
isFavorite: runtypes_1.Boolean,
|
|
47
|
-
url: runtypes_1.String,
|
|
48
53
|
isInboxProject: runtypes_1.Boolean,
|
|
49
54
|
isTeamInbox: runtypes_1.Boolean,
|
|
50
|
-
|
|
55
|
+
url: runtypes_1.String,
|
|
51
56
|
viewStyle: runtypes_1.String,
|
|
52
|
-
})
|
|
53
|
-
parentId: runtypes_1.String.Or(runtypes_1.Null),
|
|
54
|
-
}));
|
|
57
|
+
});
|
|
55
58
|
exports.Section = (0, runtypes_1.Record)({
|
|
56
59
|
id: runtypes_1.String,
|
|
57
60
|
order: exports.Int,
|
|
@@ -60,7 +63,7 @@ exports.Section = (0, runtypes_1.Record)({
|
|
|
60
63
|
});
|
|
61
64
|
exports.Label = (0, runtypes_1.Record)({
|
|
62
65
|
id: runtypes_1.String,
|
|
63
|
-
order: exports.Int,
|
|
66
|
+
order: exports.Int.Or(runtypes_1.Null),
|
|
64
67
|
name: runtypes_1.String,
|
|
65
68
|
color: runtypes_1.String,
|
|
66
69
|
isFavorite: runtypes_1.Boolean,
|
|
@@ -82,13 +85,12 @@ exports.Attachment = (0, runtypes_1.Record)({
|
|
|
82
85
|
}));
|
|
83
86
|
exports.Comment = (0, runtypes_1.Record)({
|
|
84
87
|
id: runtypes_1.String,
|
|
85
|
-
content: runtypes_1.String,
|
|
86
|
-
postedAt: runtypes_1.String,
|
|
87
|
-
}).And((0, runtypes_1.Partial)({
|
|
88
88
|
taskId: runtypes_1.String.Or(runtypes_1.Null),
|
|
89
89
|
projectId: runtypes_1.String.Or(runtypes_1.Null),
|
|
90
|
+
content: runtypes_1.String,
|
|
91
|
+
postedAt: runtypes_1.String,
|
|
90
92
|
attachment: exports.Attachment.Or(runtypes_1.Null),
|
|
91
|
-
})
|
|
93
|
+
});
|
|
92
94
|
exports.User = (0, runtypes_1.Record)({
|
|
93
95
|
id: runtypes_1.String,
|
|
94
96
|
name: runtypes_1.String,
|
package/dist/types/requests.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest';
|
|
2
|
-
import type { Duration, ProjectViewStyle } from './entities';
|
|
2
|
+
import type { Comment, Duration, Label, Project, ProjectViewStyle, Section, Task, User } from './entities';
|
|
3
3
|
export type AddTaskArgs = {
|
|
4
4
|
content: string;
|
|
5
5
|
description?: string;
|
|
@@ -9,9 +9,11 @@ export type AddTaskArgs = {
|
|
|
9
9
|
order?: number;
|
|
10
10
|
labels?: string[];
|
|
11
11
|
priority?: number;
|
|
12
|
-
dueLang?: string;
|
|
13
12
|
assigneeId?: string;
|
|
14
13
|
dueString?: string;
|
|
14
|
+
dueLang?: string;
|
|
15
|
+
deadlineLang?: string;
|
|
16
|
+
deadlineDate?: string;
|
|
15
17
|
} & RequireOneOrNone<{
|
|
16
18
|
dueDate?: string;
|
|
17
19
|
dueDatetime?: string;
|
|
@@ -24,6 +26,7 @@ export type QuickAddTaskArgs = {
|
|
|
24
26
|
note?: string;
|
|
25
27
|
reminder?: string;
|
|
26
28
|
autoReminder?: boolean;
|
|
29
|
+
meta?: boolean;
|
|
27
30
|
};
|
|
28
31
|
export type GetTasksArgs = {
|
|
29
32
|
projectId?: string;
|
|
@@ -32,15 +35,23 @@ export type GetTasksArgs = {
|
|
|
32
35
|
filter?: string;
|
|
33
36
|
lang?: string;
|
|
34
37
|
ids?: string[];
|
|
38
|
+
cursor?: string | null;
|
|
39
|
+
limit?: number;
|
|
40
|
+
};
|
|
41
|
+
export type GetTasksResponse = {
|
|
42
|
+
results: Task[];
|
|
43
|
+
nextCursor: string | null;
|
|
35
44
|
};
|
|
36
45
|
export type UpdateTaskArgs = {
|
|
37
46
|
content?: string;
|
|
38
47
|
description?: string;
|
|
39
48
|
labels?: string[];
|
|
40
49
|
priority?: number;
|
|
50
|
+
dueString?: string;
|
|
41
51
|
dueLang?: string | null;
|
|
42
52
|
assigneeId?: string | null;
|
|
43
|
-
|
|
53
|
+
deadlineDate?: string | null;
|
|
54
|
+
deadlineLang?: string | null;
|
|
44
55
|
} & RequireOneOrNone<{
|
|
45
56
|
dueDate?: string;
|
|
46
57
|
dueDatetime?: string;
|
|
@@ -48,10 +59,18 @@ export type UpdateTaskArgs = {
|
|
|
48
59
|
duration?: Duration['amount'];
|
|
49
60
|
durationUnit?: Duration['unit'];
|
|
50
61
|
}>;
|
|
62
|
+
export type GetProjectsArgs = {
|
|
63
|
+
cursor?: string | null;
|
|
64
|
+
limit?: number;
|
|
65
|
+
};
|
|
66
|
+
export type GetProjectsResponse = {
|
|
67
|
+
results: Project[];
|
|
68
|
+
nextCursor: string | null;
|
|
69
|
+
};
|
|
51
70
|
export type AddProjectArgs = {
|
|
52
71
|
name: string;
|
|
53
72
|
parentId?: string;
|
|
54
|
-
color?: string;
|
|
73
|
+
color?: string | number;
|
|
55
74
|
isFavorite?: boolean;
|
|
56
75
|
viewStyle?: ProjectViewStyle;
|
|
57
76
|
};
|
|
@@ -61,31 +80,64 @@ export type UpdateProjectArgs = {
|
|
|
61
80
|
isFavorite?: boolean;
|
|
62
81
|
viewStyle?: ProjectViewStyle;
|
|
63
82
|
};
|
|
83
|
+
export type GetProjectCollaboratorsArgs = {
|
|
84
|
+
cursor?: string | null;
|
|
85
|
+
limit?: number;
|
|
86
|
+
};
|
|
87
|
+
export type GetProjectCollaboratorsResponse = {
|
|
88
|
+
results: User[];
|
|
89
|
+
nextCursor: string | null;
|
|
90
|
+
};
|
|
91
|
+
export type GetSectionsArgs = {
|
|
92
|
+
projectId: string | null;
|
|
93
|
+
cursor?: string | null;
|
|
94
|
+
limit?: number;
|
|
95
|
+
};
|
|
96
|
+
export type GetSectionsResponse = {
|
|
97
|
+
results: Section[];
|
|
98
|
+
nextCursor: string | null;
|
|
99
|
+
};
|
|
64
100
|
export type AddSectionArgs = {
|
|
65
101
|
name: string;
|
|
66
102
|
projectId: string;
|
|
67
|
-
order?: number;
|
|
103
|
+
order?: number | null;
|
|
68
104
|
};
|
|
69
105
|
export type UpdateSectionArgs = {
|
|
70
106
|
name: string;
|
|
71
107
|
};
|
|
108
|
+
export type GetLabelsArgs = {
|
|
109
|
+
cursor?: string | null;
|
|
110
|
+
limit?: number;
|
|
111
|
+
};
|
|
112
|
+
export type GetLabelsResponse = {
|
|
113
|
+
results: Label[];
|
|
114
|
+
nextCursor: string | null;
|
|
115
|
+
};
|
|
72
116
|
export type AddLabelArgs = {
|
|
73
117
|
name: string;
|
|
74
|
-
order?: number;
|
|
75
|
-
color?: string;
|
|
118
|
+
order?: number | null;
|
|
119
|
+
color?: string | number;
|
|
76
120
|
isFavorite?: boolean;
|
|
77
121
|
};
|
|
78
122
|
export type UpdateLabelArgs = {
|
|
79
123
|
name?: string;
|
|
80
|
-
order?: number;
|
|
124
|
+
order?: number | null;
|
|
81
125
|
color?: string;
|
|
82
126
|
isFavorite?: boolean;
|
|
83
127
|
};
|
|
84
|
-
export type
|
|
128
|
+
export type GetCommentsBaseArgs = {
|
|
129
|
+
cursor?: string | null;
|
|
130
|
+
limit?: number;
|
|
131
|
+
};
|
|
132
|
+
export type GetCommentsResponse = {
|
|
133
|
+
results: Comment[];
|
|
134
|
+
nextCursor: string | null;
|
|
135
|
+
};
|
|
136
|
+
export type GetTaskCommentsArgs = GetCommentsBaseArgs & {
|
|
85
137
|
taskId: string;
|
|
86
138
|
projectId?: never;
|
|
87
139
|
};
|
|
88
|
-
export type GetProjectCommentsArgs = {
|
|
140
|
+
export type GetProjectCommentsArgs = GetCommentsBaseArgs & {
|
|
89
141
|
projectId: string;
|
|
90
142
|
taskId?: never;
|
|
91
143
|
};
|
|
@@ -96,7 +148,7 @@ export type AddCommentArgs = {
|
|
|
96
148
|
fileUrl: string;
|
|
97
149
|
fileType?: string;
|
|
98
150
|
resourceType?: string;
|
|
99
|
-
};
|
|
151
|
+
} | null;
|
|
100
152
|
} & RequireExactlyOne<{
|
|
101
153
|
taskId?: string;
|
|
102
154
|
projectId?: string;
|
|
@@ -106,6 +158,12 @@ export type UpdateCommentArgs = {
|
|
|
106
158
|
};
|
|
107
159
|
export type GetSharedLabelsArgs = {
|
|
108
160
|
omitPersonal?: boolean;
|
|
161
|
+
cursor?: string | null;
|
|
162
|
+
limit?: number;
|
|
163
|
+
};
|
|
164
|
+
export type GetSharedLabelsResponse = {
|
|
165
|
+
results: string[];
|
|
166
|
+
nextCursor: string | null;
|
|
109
167
|
};
|
|
110
168
|
export type RenameSharedLabelArgs = {
|
|
111
169
|
name: string;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.getTaskFromQuickAddResponse = void 0;
|
|
15
4
|
var showTaskEndpoint = 'https://todoist.com/showTask';
|
|
@@ -18,11 +7,27 @@ function getTaskUrlFromQuickAddResponse(responseData) {
|
|
|
18
7
|
}
|
|
19
8
|
function getTaskFromQuickAddResponse(responseData) {
|
|
20
9
|
var _a;
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
var task = {
|
|
11
|
+
id: responseData.id,
|
|
12
|
+
order: responseData.childOrder,
|
|
13
|
+
content: responseData.content,
|
|
14
|
+
description: responseData.description,
|
|
15
|
+
projectId: responseData.projectId,
|
|
16
|
+
sectionId: responseData.sectionId,
|
|
17
|
+
isCompleted: responseData.checked,
|
|
18
|
+
labels: responseData.labels,
|
|
19
|
+
priority: responseData.priority,
|
|
20
|
+
commentCount: 0,
|
|
21
|
+
createdAt: responseData.addedAt,
|
|
22
|
+
url: getTaskUrlFromQuickAddResponse(responseData),
|
|
23
|
+
creatorId: (_a = responseData.addedByUid) !== null && _a !== void 0 ? _a : '',
|
|
24
|
+
parentId: responseData.parentId,
|
|
25
|
+
duration: responseData.duration,
|
|
26
|
+
assignerId: responseData.assignedByUid,
|
|
24
27
|
assigneeId: responseData.responsibleUid,
|
|
25
|
-
|
|
28
|
+
deadline: responseData.deadline,
|
|
29
|
+
due: responseData.due,
|
|
30
|
+
};
|
|
26
31
|
return task;
|
|
27
32
|
}
|
|
28
33
|
exports.getTaskFromQuickAddResponse = getTaskFromQuickAddResponse;
|
package/package.json
CHANGED