@doist/todoist-api-typescript 1.7.0 → 2.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 +1 -1
- package/dist/TodoistApi.d.ts +37 -19
- package/dist/TodoistApi.js +94 -42
- package/dist/consts/endpoints.d.ts +3 -0
- package/dist/consts/endpoints.js +6 -3
- package/dist/testUtils/testDefaults.d.ts +57 -50
- package/dist/testUtils/testDefaults.js +36 -25
- package/dist/types/entities.d.ts +72 -69
- package/dist/types/entities.js +46 -44
- package/dist/types/requests.d.ts +31 -21
- package/dist/utils/colors.d.ts +2 -1
- package/dist/utils/colors.js +8 -3
- package/dist/utils/taskConverters.js +5 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ api.getTasks()
|
|
|
24
24
|
|
|
25
25
|
### Documentation
|
|
26
26
|
|
|
27
|
-
For more detailed reference documentation, have a look at the [API documentation with TypeScript examples](https://developer.todoist.com/rest/
|
|
27
|
+
For more detailed reference documentation, have a look at the [API documentation with TypeScript examples](https://developer.todoist.com/rest/v2/?javascript).
|
|
28
28
|
|
|
29
29
|
## Development and Testing
|
|
30
30
|
|
package/dist/TodoistApi.d.ts
CHANGED
|
@@ -1,37 +1,55 @@
|
|
|
1
1
|
import { Task, Project, Label, User, Section, Comment } from './types/entities';
|
|
2
|
-
import { AddLabelArgs, AddProjectArgs, AddSectionArgs, AddProjectCommentArgs, AddTaskArgs, AddTaskCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs } from './types/requests';
|
|
2
|
+
import { AddLabelArgs, AddProjectArgs, AddSectionArgs, AddProjectCommentArgs, AddTaskArgs, AddTaskCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/requests';
|
|
3
3
|
export declare class TodoistApi {
|
|
4
4
|
authToken: string;
|
|
5
5
|
constructor(authToken: string, baseUrl?: string);
|
|
6
6
|
private restApiBase;
|
|
7
7
|
private syncApiBase;
|
|
8
|
-
getTask(id:
|
|
8
|
+
getTask(id: string): Promise<Task>;
|
|
9
9
|
getTasks(args?: GetTasksArgs): Promise<Task[]>;
|
|
10
10
|
addTask(args: AddTaskArgs, requestId?: string): Promise<Task>;
|
|
11
11
|
quickAddTask(args: QuickAddTaskArgs): Promise<Task>;
|
|
12
|
-
updateTask(id:
|
|
13
|
-
closeTask(id:
|
|
14
|
-
reopenTask(id:
|
|
15
|
-
deleteTask(id:
|
|
16
|
-
getProject(id:
|
|
12
|
+
updateTask(id: string, args: UpdateTaskArgs, requestId?: string): Promise<Task>;
|
|
13
|
+
closeTask(id: string, requestId?: string): Promise<boolean>;
|
|
14
|
+
reopenTask(id: string, requestId?: string): Promise<boolean>;
|
|
15
|
+
deleteTask(id: string, requestId?: string): Promise<boolean>;
|
|
16
|
+
getProject(id: string): Promise<Project>;
|
|
17
17
|
getProjects(): Promise<Project[]>;
|
|
18
18
|
addProject(args: AddProjectArgs, requestId?: string): Promise<Project>;
|
|
19
|
-
updateProject(id:
|
|
20
|
-
deleteProject(id:
|
|
21
|
-
getProjectCollaborators(projectId:
|
|
19
|
+
updateProject(id: string, args: UpdateProjectArgs, requestId?: string): Promise<Project>;
|
|
20
|
+
deleteProject(id: string, requestId?: string): Promise<boolean>;
|
|
21
|
+
getProjectCollaborators(projectId: string): Promise<User[]>;
|
|
22
22
|
getSections(projectId?: number): Promise<Section[]>;
|
|
23
|
-
getSection(id:
|
|
23
|
+
getSection(id: string): Promise<Section>;
|
|
24
24
|
addSection(args: AddSectionArgs, requestId?: string): Promise<Section>;
|
|
25
|
-
updateSection(id:
|
|
26
|
-
deleteSection(id:
|
|
27
|
-
|
|
25
|
+
updateSection(id: string, args: UpdateSectionArgs, requestId?: string): Promise<Section>;
|
|
26
|
+
deleteSection(id: string, requestId?: string): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Fetches a personal label
|
|
29
|
+
*/
|
|
30
|
+
getLabel(id: string): Promise<Label>;
|
|
31
|
+
/**
|
|
32
|
+
* Fetches the personal labels
|
|
33
|
+
*/
|
|
28
34
|
getLabels(): Promise<Label[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Adds a personal label
|
|
37
|
+
*/
|
|
29
38
|
addLabel(args: AddLabelArgs, requestId?: string): Promise<Label>;
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Updates a personal label
|
|
41
|
+
*/
|
|
42
|
+
updateLabel(id: string, args: UpdateLabelArgs, requestId?: string): Promise<Label>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a personal label
|
|
45
|
+
*/
|
|
46
|
+
deleteLabel(id: string, requestId?: string): Promise<boolean>;
|
|
47
|
+
getSharedLabels(): Promise<string[]>;
|
|
48
|
+
renameSharedLabel(args: RenameSharedLabelArgs): Promise<void>;
|
|
49
|
+
removeSharedLabel(args: RemoveSharedLabelArgs): Promise<void>;
|
|
32
50
|
getComments(args: GetTaskCommentsArgs | GetProjectCommentsArgs): Promise<Comment[]>;
|
|
33
|
-
getComment(id:
|
|
51
|
+
getComment(id: string): Promise<Comment>;
|
|
34
52
|
addComment(args: AddTaskCommentArgs | AddProjectCommentArgs, requestId?: string): Promise<Comment>;
|
|
35
|
-
updateComment(id:
|
|
36
|
-
deleteComment(id:
|
|
53
|
+
updateComment(id: string, args: UpdateCommentArgs, requestId?: string): Promise<Comment>;
|
|
54
|
+
deleteComment(id: string, requestId?: string): Promise<boolean>;
|
|
37
55
|
}
|
package/dist/TodoistApi.js
CHANGED
|
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.TodoistApi = void 0;
|
|
40
|
-
var
|
|
40
|
+
var runtypes_1 = require("runtypes");
|
|
41
41
|
var restClient_1 = require("./restClient");
|
|
42
42
|
var taskConverters_1 = require("./utils/taskConverters");
|
|
43
43
|
var endpoints_1 = require("./consts/endpoints");
|
|
@@ -66,8 +66,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
66
66
|
return __generator(this, function (_a) {
|
|
67
67
|
switch (_a.label) {
|
|
68
68
|
case 0:
|
|
69
|
-
|
|
70
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS,
|
|
69
|
+
runtypes_1.String.check(id);
|
|
70
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken)];
|
|
71
71
|
case 1:
|
|
72
72
|
response = _a.sent();
|
|
73
73
|
return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
|
|
@@ -121,11 +121,11 @@ var TodoistApi = /** @class */ (function () {
|
|
|
121
121
|
return __generator(this, function (_a) {
|
|
122
122
|
switch (_a.label) {
|
|
123
123
|
case 0:
|
|
124
|
-
|
|
125
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS,
|
|
124
|
+
runtypes_1.String.check(id);
|
|
125
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, args, requestId)];
|
|
126
126
|
case 1:
|
|
127
127
|
response = _a.sent();
|
|
128
|
-
return [2 /*return*/, (0,
|
|
128
|
+
return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
});
|
|
@@ -136,8 +136,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
136
136
|
return __generator(this, function (_a) {
|
|
137
137
|
switch (_a.label) {
|
|
138
138
|
case 0:
|
|
139
|
-
|
|
140
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS,
|
|
139
|
+
runtypes_1.String.check(id);
|
|
140
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_CLOSE), this.authToken, undefined, requestId)];
|
|
141
141
|
case 1:
|
|
142
142
|
response = _a.sent();
|
|
143
143
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -151,8 +151,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
151
151
|
return __generator(this, function (_a) {
|
|
152
152
|
switch (_a.label) {
|
|
153
153
|
case 0:
|
|
154
|
-
|
|
155
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS,
|
|
154
|
+
runtypes_1.String.check(id);
|
|
155
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_REOPEN), this.authToken, undefined, requestId)];
|
|
156
156
|
case 1:
|
|
157
157
|
response = _a.sent();
|
|
158
158
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -166,8 +166,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
166
166
|
return __generator(this, function (_a) {
|
|
167
167
|
switch (_a.label) {
|
|
168
168
|
case 0:
|
|
169
|
-
|
|
170
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS,
|
|
169
|
+
runtypes_1.String.check(id);
|
|
170
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, undefined, requestId)];
|
|
171
171
|
case 1:
|
|
172
172
|
response = _a.sent();
|
|
173
173
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -181,8 +181,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
181
181
|
return __generator(this, function (_a) {
|
|
182
182
|
switch (_a.label) {
|
|
183
183
|
case 0:
|
|
184
|
-
|
|
185
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS,
|
|
184
|
+
runtypes_1.String.check(id);
|
|
185
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken)];
|
|
186
186
|
case 1:
|
|
187
187
|
response = _a.sent();
|
|
188
188
|
return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
|
|
@@ -222,11 +222,11 @@ var TodoistApi = /** @class */ (function () {
|
|
|
222
222
|
return __generator(this, function (_a) {
|
|
223
223
|
switch (_a.label) {
|
|
224
224
|
case 0:
|
|
225
|
-
|
|
226
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS,
|
|
225
|
+
runtypes_1.String.check(id);
|
|
226
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, args, requestId)];
|
|
227
227
|
case 1:
|
|
228
228
|
response = _a.sent();
|
|
229
|
-
return [2 /*return*/, (0,
|
|
229
|
+
return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
232
|
});
|
|
@@ -237,8 +237,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
237
237
|
return __generator(this, function (_a) {
|
|
238
238
|
switch (_a.label) {
|
|
239
239
|
case 0:
|
|
240
|
-
|
|
241
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS,
|
|
240
|
+
runtypes_1.String.check(id);
|
|
241
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, requestId)];
|
|
242
242
|
case 1:
|
|
243
243
|
response = _a.sent();
|
|
244
244
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -252,8 +252,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
252
252
|
return __generator(this, function (_a) {
|
|
253
253
|
switch (_a.label) {
|
|
254
254
|
case 0:
|
|
255
|
-
|
|
256
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS,
|
|
255
|
+
runtypes_1.String.check(projectId);
|
|
256
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, projectId, endpoints_1.ENDPOINT_REST_PROJECT_COLLABORATORS), this.authToken)];
|
|
257
257
|
case 1:
|
|
258
258
|
response = _a.sent();
|
|
259
259
|
return [2 /*return*/, (0, validators_1.validateUserArray)(response.data)];
|
|
@@ -280,8 +280,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
280
280
|
return __generator(this, function (_a) {
|
|
281
281
|
switch (_a.label) {
|
|
282
282
|
case 0:
|
|
283
|
-
|
|
284
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS,
|
|
283
|
+
runtypes_1.String.check(id);
|
|
284
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken)];
|
|
285
285
|
case 1:
|
|
286
286
|
response = _a.sent();
|
|
287
287
|
return [2 /*return*/, (0, validators_1.validateSection)(response.data)];
|
|
@@ -308,11 +308,11 @@ var TodoistApi = /** @class */ (function () {
|
|
|
308
308
|
return __generator(this, function (_a) {
|
|
309
309
|
switch (_a.label) {
|
|
310
310
|
case 0:
|
|
311
|
-
|
|
312
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS,
|
|
311
|
+
runtypes_1.String.check(id);
|
|
312
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken, args, requestId)];
|
|
313
313
|
case 1:
|
|
314
314
|
response = _a.sent();
|
|
315
|
-
return [2 /*return*/, (0,
|
|
315
|
+
return [2 /*return*/, (0, validators_1.validateSection)(response.data)];
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
318
|
});
|
|
@@ -323,8 +323,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
323
323
|
return __generator(this, function (_a) {
|
|
324
324
|
switch (_a.label) {
|
|
325
325
|
case 0:
|
|
326
|
-
|
|
327
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS,
|
|
326
|
+
runtypes_1.String.check(id);
|
|
327
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken, undefined, requestId)];
|
|
328
328
|
case 1:
|
|
329
329
|
response = _a.sent();
|
|
330
330
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -332,14 +332,17 @@ var TodoistApi = /** @class */ (function () {
|
|
|
332
332
|
});
|
|
333
333
|
});
|
|
334
334
|
};
|
|
335
|
+
/**
|
|
336
|
+
* Fetches a personal label
|
|
337
|
+
*/
|
|
335
338
|
TodoistApi.prototype.getLabel = function (id) {
|
|
336
339
|
return __awaiter(this, void 0, void 0, function () {
|
|
337
340
|
var response;
|
|
338
341
|
return __generator(this, function (_a) {
|
|
339
342
|
switch (_a.label) {
|
|
340
343
|
case 0:
|
|
341
|
-
|
|
342
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS,
|
|
344
|
+
runtypes_1.String.check(id);
|
|
345
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken)];
|
|
343
346
|
case 1:
|
|
344
347
|
response = _a.sent();
|
|
345
348
|
return [2 /*return*/, (0, validators_1.validateLabel)(response.data)];
|
|
@@ -347,6 +350,9 @@ var TodoistApi = /** @class */ (function () {
|
|
|
347
350
|
});
|
|
348
351
|
});
|
|
349
352
|
};
|
|
353
|
+
/**
|
|
354
|
+
* Fetches the personal labels
|
|
355
|
+
*/
|
|
350
356
|
TodoistApi.prototype.getLabels = function () {
|
|
351
357
|
return __awaiter(this, void 0, void 0, function () {
|
|
352
358
|
var response;
|
|
@@ -360,6 +366,9 @@ var TodoistApi = /** @class */ (function () {
|
|
|
360
366
|
});
|
|
361
367
|
});
|
|
362
368
|
};
|
|
369
|
+
/**
|
|
370
|
+
* Adds a personal label
|
|
371
|
+
*/
|
|
363
372
|
TodoistApi.prototype.addLabel = function (args, requestId) {
|
|
364
373
|
return __awaiter(this, void 0, void 0, function () {
|
|
365
374
|
var response;
|
|
@@ -373,29 +382,35 @@ var TodoistApi = /** @class */ (function () {
|
|
|
373
382
|
});
|
|
374
383
|
});
|
|
375
384
|
};
|
|
385
|
+
/**
|
|
386
|
+
* Updates a personal label
|
|
387
|
+
*/
|
|
376
388
|
TodoistApi.prototype.updateLabel = function (id, args, requestId) {
|
|
377
389
|
return __awaiter(this, void 0, void 0, function () {
|
|
378
390
|
var response;
|
|
379
391
|
return __generator(this, function (_a) {
|
|
380
392
|
switch (_a.label) {
|
|
381
393
|
case 0:
|
|
382
|
-
|
|
383
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS,
|
|
394
|
+
runtypes_1.String.check(id);
|
|
395
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken, args, requestId)];
|
|
384
396
|
case 1:
|
|
385
397
|
response = _a.sent();
|
|
386
|
-
return [2 /*return*/, (0,
|
|
398
|
+
return [2 /*return*/, (0, validators_1.validateLabel)(response.data)];
|
|
387
399
|
}
|
|
388
400
|
});
|
|
389
401
|
});
|
|
390
402
|
};
|
|
403
|
+
/**
|
|
404
|
+
* Deletes a personal label
|
|
405
|
+
*/
|
|
391
406
|
TodoistApi.prototype.deleteLabel = function (id, requestId) {
|
|
392
407
|
return __awaiter(this, void 0, void 0, function () {
|
|
393
408
|
var response;
|
|
394
409
|
return __generator(this, function (_a) {
|
|
395
410
|
switch (_a.label) {
|
|
396
411
|
case 0:
|
|
397
|
-
|
|
398
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS,
|
|
412
|
+
runtypes_1.String.check(id);
|
|
413
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken, undefined, requestId)];
|
|
399
414
|
case 1:
|
|
400
415
|
response = _a.sent();
|
|
401
416
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -403,6 +418,43 @@ var TodoistApi = /** @class */ (function () {
|
|
|
403
418
|
});
|
|
404
419
|
});
|
|
405
420
|
};
|
|
421
|
+
TodoistApi.prototype.getSharedLabels = function () {
|
|
422
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
423
|
+
var response;
|
|
424
|
+
return __generator(this, function (_a) {
|
|
425
|
+
switch (_a.label) {
|
|
426
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED, this.authToken)];
|
|
427
|
+
case 1:
|
|
428
|
+
response = _a.sent();
|
|
429
|
+
return [2 /*return*/, response.data];
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
TodoistApi.prototype.renameSharedLabel = function (args) {
|
|
435
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
436
|
+
return __generator(this, function (_a) {
|
|
437
|
+
switch (_a.label) {
|
|
438
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED_RENAME, this.authToken, args)];
|
|
439
|
+
case 1:
|
|
440
|
+
_a.sent();
|
|
441
|
+
return [2 /*return*/];
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
TodoistApi.prototype.removeSharedLabel = function (args) {
|
|
447
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
448
|
+
return __generator(this, function (_a) {
|
|
449
|
+
switch (_a.label) {
|
|
450
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED_REMOVE, this.authToken, args)];
|
|
451
|
+
case 1:
|
|
452
|
+
_a.sent();
|
|
453
|
+
return [2 /*return*/];
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
};
|
|
406
458
|
TodoistApi.prototype.getComments = function (args) {
|
|
407
459
|
return __awaiter(this, void 0, void 0, function () {
|
|
408
460
|
var response;
|
|
@@ -422,8 +474,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
422
474
|
return __generator(this, function (_a) {
|
|
423
475
|
switch (_a.label) {
|
|
424
476
|
case 0:
|
|
425
|
-
|
|
426
|
-
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS,
|
|
477
|
+
runtypes_1.String.check(id);
|
|
478
|
+
return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken)];
|
|
427
479
|
case 1:
|
|
428
480
|
response = _a.sent();
|
|
429
481
|
return [2 /*return*/, (0, validators_1.validateComment)(response.data)];
|
|
@@ -450,11 +502,11 @@ var TodoistApi = /** @class */ (function () {
|
|
|
450
502
|
return __generator(this, function (_a) {
|
|
451
503
|
switch (_a.label) {
|
|
452
504
|
case 0:
|
|
453
|
-
|
|
454
|
-
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS,
|
|
505
|
+
runtypes_1.String.check(id);
|
|
506
|
+
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken, args, requestId)];
|
|
455
507
|
case 1:
|
|
456
508
|
response = _a.sent();
|
|
457
|
-
return [2 /*return*/, (0,
|
|
509
|
+
return [2 /*return*/, (0, validators_1.validateComment)(response.data)];
|
|
458
510
|
}
|
|
459
511
|
});
|
|
460
512
|
});
|
|
@@ -465,8 +517,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
465
517
|
return __generator(this, function (_a) {
|
|
466
518
|
switch (_a.label) {
|
|
467
519
|
case 0:
|
|
468
|
-
|
|
469
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS,
|
|
520
|
+
runtypes_1.String.check(id);
|
|
521
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken, undefined, requestId)];
|
|
470
522
|
case 1:
|
|
471
523
|
response = _a.sent();
|
|
472
524
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -5,6 +5,9 @@ export declare const ENDPOINT_REST_TASKS = "tasks";
|
|
|
5
5
|
export declare const ENDPOINT_REST_PROJECTS = "projects";
|
|
6
6
|
export declare const ENDPOINT_REST_SECTIONS = "sections";
|
|
7
7
|
export declare const ENDPOINT_REST_LABELS = "labels";
|
|
8
|
+
export declare const ENDPOINT_REST_LABELS_SHARED: string;
|
|
9
|
+
export declare const ENDPOINT_REST_LABELS_SHARED_RENAME: string;
|
|
10
|
+
export declare const ENDPOINT_REST_LABELS_SHARED_REMOVE: string;
|
|
8
11
|
export declare const ENDPOINT_REST_COMMENTS = "comments";
|
|
9
12
|
export declare const ENDPOINT_REST_TASK_CLOSE = "close";
|
|
10
13
|
export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
|
package/dist/consts/endpoints.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.getRestBaseUri = void 0;
|
|
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.getRestBaseUri = void 0;
|
|
4
4
|
var BASE_URI = 'https://api.todoist.com';
|
|
5
|
-
var API_REST_BASE_URI = '/rest/
|
|
6
|
-
var API_SYNC_BASE_URI = '/sync/
|
|
5
|
+
var API_REST_BASE_URI = '/rest/v2/';
|
|
6
|
+
var API_SYNC_BASE_URI = '/sync/v9/';
|
|
7
7
|
var TODOIST_URI = 'https://todoist.com';
|
|
8
8
|
var API_AUTHORIZATION_BASE_URI = '/oauth/';
|
|
9
9
|
function getRestBaseUri(domainBase) {
|
|
@@ -25,6 +25,9 @@ exports.ENDPOINT_REST_TASKS = 'tasks';
|
|
|
25
25
|
exports.ENDPOINT_REST_PROJECTS = 'projects';
|
|
26
26
|
exports.ENDPOINT_REST_SECTIONS = 'sections';
|
|
27
27
|
exports.ENDPOINT_REST_LABELS = 'labels';
|
|
28
|
+
exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS + '/shared';
|
|
29
|
+
exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED + '/rename';
|
|
30
|
+
exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED + '/remove';
|
|
28
31
|
exports.ENDPOINT_REST_COMMENTS = 'comments';
|
|
29
32
|
exports.ENDPOINT_REST_TASK_CLOSE = 'close';
|
|
30
33
|
exports.ENDPOINT_REST_TASK_REOPEN = 'reopen';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Label, Project, QuickAddTaskResponse, Section, Task, User, Comment, Attachment } from '../types';
|
|
2
2
|
export declare const DEFAULT_AUTH_TOKEN = "AToken";
|
|
3
3
|
export declare const DEFAULT_REQUEST_ID = "ARequestID";
|
|
4
|
-
export declare const INVALID_ENTITY_ID
|
|
4
|
+
export declare const INVALID_ENTITY_ID = 1234;
|
|
5
5
|
export declare const DEFAULT_DUE_DATE: {
|
|
6
|
-
|
|
6
|
+
isRecurring: boolean;
|
|
7
7
|
string: string;
|
|
8
8
|
date: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const INVALID_DUE_DATE: {
|
|
11
|
-
|
|
11
|
+
isRecurring: string;
|
|
12
12
|
string: string;
|
|
13
13
|
date: string;
|
|
14
14
|
};
|
|
@@ -16,95 +16,102 @@ export declare const DEFAULT_QUICK_ADD_RESPONSE: QuickAddTaskResponse;
|
|
|
16
16
|
export declare const DEFAULT_TASK: Task;
|
|
17
17
|
export declare const INVALID_TASK: {
|
|
18
18
|
due: {
|
|
19
|
-
|
|
19
|
+
isRecurring: string;
|
|
20
20
|
string: string;
|
|
21
21
|
date: string;
|
|
22
22
|
};
|
|
23
|
-
id:
|
|
23
|
+
id: string;
|
|
24
24
|
order: number;
|
|
25
25
|
content: string;
|
|
26
26
|
description: string;
|
|
27
|
-
projectId:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
labelIds: number[];
|
|
27
|
+
projectId: string;
|
|
28
|
+
isCompleted: boolean;
|
|
29
|
+
labels: string[];
|
|
31
30
|
priority: number;
|
|
32
31
|
commentCount: number;
|
|
33
|
-
|
|
32
|
+
createdAt: string;
|
|
34
33
|
url: string;
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
creatorId: string;
|
|
35
|
+
assigneeId?: string | null | undefined;
|
|
36
|
+
assignerId?: string | null | undefined;
|
|
37
|
+
parentId?: string | null | undefined;
|
|
38
|
+
sectionId?: string | null | undefined;
|
|
37
39
|
};
|
|
40
|
+
export declare const TASK_WITH_OPTIONALS_AS_NULL: Task;
|
|
38
41
|
export declare const DEFAULT_PROJECT: Project;
|
|
39
42
|
export declare const INVALID_PROJECT: {
|
|
40
43
|
name: number;
|
|
41
|
-
id:
|
|
44
|
+
id: string;
|
|
45
|
+
order: number;
|
|
42
46
|
commentCount: number;
|
|
43
47
|
url: string;
|
|
44
|
-
color:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
syncId?: number | undefined;
|
|
48
|
+
color: string;
|
|
49
|
+
isShared: boolean;
|
|
50
|
+
isFavorite: boolean;
|
|
51
|
+
isInboxProject: boolean;
|
|
52
|
+
isTeamInbox: boolean;
|
|
53
|
+
viewStyle: string;
|
|
54
|
+
parentId?: string | null | undefined;
|
|
52
55
|
};
|
|
56
|
+
export declare const PROJECT_WITH_OPTIONALS_AS_NULL: Project;
|
|
53
57
|
export declare const DEFAULT_SECTION: Section;
|
|
54
58
|
export declare const INVALID_SECTION: {
|
|
55
59
|
projectId: undefined;
|
|
56
|
-
id:
|
|
60
|
+
id: string;
|
|
57
61
|
order: number;
|
|
58
62
|
name: string;
|
|
59
63
|
};
|
|
60
64
|
export declare const DEFAULT_LABEL: Label;
|
|
61
65
|
export declare const INVALID_LABEL: {
|
|
62
|
-
|
|
63
|
-
id:
|
|
66
|
+
isFavorite: string;
|
|
67
|
+
id: string;
|
|
64
68
|
order: number;
|
|
65
69
|
name: string;
|
|
66
|
-
color:
|
|
70
|
+
color: string;
|
|
67
71
|
};
|
|
68
72
|
export declare const DEFAULT_USER: User;
|
|
69
73
|
export declare const INVALID_USER: {
|
|
70
74
|
email: undefined;
|
|
71
|
-
id:
|
|
75
|
+
id: string;
|
|
72
76
|
name: string;
|
|
73
77
|
};
|
|
74
78
|
export declare const DEFAULT_ATTACHMENT: Attachment;
|
|
75
79
|
export declare const INVALID_ATTACHMENT: {
|
|
76
80
|
uploadState: string;
|
|
77
81
|
resourceType: string;
|
|
78
|
-
fileName?: string | undefined;
|
|
79
|
-
fileSize?: number | undefined;
|
|
80
|
-
fileType?: string | undefined;
|
|
81
|
-
fileUrl?: string | undefined;
|
|
82
|
-
fileDuration?: number | undefined;
|
|
83
|
-
image?: string | undefined;
|
|
84
|
-
imageWidth?: number | undefined;
|
|
85
|
-
imageHeight?: number | undefined;
|
|
86
|
-
url?: string | undefined;
|
|
87
|
-
title?: string | undefined;
|
|
82
|
+
fileName?: string | null | undefined;
|
|
83
|
+
fileSize?: number | null | undefined;
|
|
84
|
+
fileType?: string | null | undefined;
|
|
85
|
+
fileUrl?: string | null | undefined;
|
|
86
|
+
fileDuration?: number | null | undefined;
|
|
87
|
+
image?: string | null | undefined;
|
|
88
|
+
imageWidth?: number | null | undefined;
|
|
89
|
+
imageHeight?: number | null | undefined;
|
|
90
|
+
url?: string | null | undefined;
|
|
91
|
+
title?: string | null | undefined;
|
|
88
92
|
};
|
|
89
93
|
export declare const DEFAULT_COMMENT: Comment;
|
|
90
94
|
export declare const INVALID_COMMENT: {
|
|
91
95
|
attachment: {
|
|
92
96
|
uploadState: string;
|
|
93
97
|
resourceType: string;
|
|
94
|
-
fileName?: string | undefined;
|
|
95
|
-
fileSize?: number | undefined;
|
|
96
|
-
fileType?: string | undefined;
|
|
97
|
-
fileUrl?: string | undefined;
|
|
98
|
-
fileDuration?: number | undefined;
|
|
99
|
-
image?: string | undefined;
|
|
100
|
-
imageWidth?: number | undefined;
|
|
101
|
-
imageHeight?: number | undefined;
|
|
102
|
-
url?: string | undefined;
|
|
103
|
-
title?: string | undefined;
|
|
98
|
+
fileName?: string | null | undefined;
|
|
99
|
+
fileSize?: number | null | undefined;
|
|
100
|
+
fileType?: string | null | undefined;
|
|
101
|
+
fileUrl?: string | null | undefined;
|
|
102
|
+
fileDuration?: number | null | undefined;
|
|
103
|
+
image?: string | null | undefined;
|
|
104
|
+
imageWidth?: number | null | undefined;
|
|
105
|
+
imageHeight?: number | null | undefined;
|
|
106
|
+
url?: string | null | undefined;
|
|
107
|
+
title?: string | null | undefined;
|
|
104
108
|
};
|
|
105
|
-
id:
|
|
109
|
+
id: string;
|
|
106
110
|
content: string;
|
|
107
|
-
|
|
108
|
-
taskId?:
|
|
109
|
-
projectId?:
|
|
111
|
+
postedAt: string;
|
|
112
|
+
taskId?: string | null | undefined;
|
|
113
|
+
projectId?: string | null | undefined;
|
|
110
114
|
};
|
|
115
|
+
export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: Comment;
|
|
116
|
+
export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: Comment;
|
|
117
|
+
export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: Comment;
|
|
@@ -11,37 +11,39 @@ 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.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.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_QUICK_ADD_RESPONSE = exports.INVALID_DUE_DATE = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = void 0;
|
|
15
|
-
var DEFAULT_TASK_ID = 1234;
|
|
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.INVALID_DUE_DATE = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = void 0;
|
|
15
|
+
var DEFAULT_TASK_ID = '1234';
|
|
16
16
|
var DEFAULT_TASK_CONTENT = 'This is a task';
|
|
17
17
|
var DEFAULT_TASK_DESCRIPTION = 'A description';
|
|
18
18
|
var DEFAULT_TASK_PRIORITY = 1;
|
|
19
19
|
var DEFAULT_ORDER = 3;
|
|
20
|
-
var DEFAULT_PROJECT_ID = 123;
|
|
20
|
+
var DEFAULT_PROJECT_ID = '123';
|
|
21
21
|
var DEFAULT_PROJECT_NAME = 'This is a project';
|
|
22
|
-
var
|
|
22
|
+
var DEFAULT_PROJECT_VIEW_STYLE = 'list';
|
|
23
|
+
var DEFAULT_LABEL_ID = '456';
|
|
23
24
|
var DEFAULT_LABEL_NAME = 'This is a label';
|
|
24
|
-
var DEFAULT_SECTION_ID = 456;
|
|
25
|
+
var DEFAULT_SECTION_ID = '456';
|
|
25
26
|
var DEFAULT_SECTION_NAME = 'This is a section';
|
|
26
|
-
var DEFAULT_PARENT_ID = 5678;
|
|
27
|
-
var DEFAULT_ASSIGNEE = 1234;
|
|
27
|
+
var DEFAULT_PARENT_ID = '5678';
|
|
28
|
+
var DEFAULT_ASSIGNEE = '1234';
|
|
29
|
+
var DEFAULT_CREATOR = '1234';
|
|
28
30
|
var DEFAULT_DATE = '2020-09-08T12:00:00Z';
|
|
29
|
-
var DEFAULT_ENTITY_COLOR =
|
|
30
|
-
var DEFAULT_LABELS = [
|
|
31
|
-
var DEFAULT_USER_ID = 5;
|
|
31
|
+
var DEFAULT_ENTITY_COLOR = 'berry_red';
|
|
32
|
+
var DEFAULT_LABELS = ['personal', 'work', 'hobby'];
|
|
33
|
+
var DEFAULT_USER_ID = '5';
|
|
32
34
|
var DEFAULT_USER_NAME = 'A User';
|
|
33
35
|
var DEFAULT_USER_EMAIL = 'atestuser@doist.com';
|
|
34
|
-
var DEFAULT_COMMENT_ID = 4;
|
|
36
|
+
var DEFAULT_COMMENT_ID = '4';
|
|
35
37
|
var DEFAULT_COMMENT_CONTENT = 'A comment';
|
|
36
38
|
exports.DEFAULT_AUTH_TOKEN = 'AToken';
|
|
37
39
|
exports.DEFAULT_REQUEST_ID = 'ARequestID';
|
|
38
|
-
exports.INVALID_ENTITY_ID =
|
|
40
|
+
exports.INVALID_ENTITY_ID = 1234;
|
|
39
41
|
exports.DEFAULT_DUE_DATE = {
|
|
40
|
-
|
|
42
|
+
isRecurring: false,
|
|
41
43
|
string: 'a date string',
|
|
42
44
|
date: DEFAULT_DATE,
|
|
43
45
|
};
|
|
44
|
-
exports.INVALID_DUE_DATE = __assign(__assign({}, exports.DEFAULT_DUE_DATE), {
|
|
46
|
+
exports.INVALID_DUE_DATE = __assign(__assign({}, exports.DEFAULT_DUE_DATE), { isRecurring: 'false' });
|
|
45
47
|
exports.DEFAULT_QUICK_ADD_RESPONSE = {
|
|
46
48
|
id: DEFAULT_TASK_ID,
|
|
47
49
|
projectId: DEFAULT_PROJECT_ID,
|
|
@@ -54,8 +56,8 @@ exports.DEFAULT_QUICK_ADD_RESPONSE = {
|
|
|
54
56
|
labels: DEFAULT_LABELS,
|
|
55
57
|
responsibleUid: DEFAULT_ASSIGNEE,
|
|
56
58
|
checked: 0,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
added_at: DEFAULT_DATE,
|
|
60
|
+
added_by_uid: DEFAULT_CREATOR,
|
|
59
61
|
due: {
|
|
60
62
|
date: DEFAULT_DATE,
|
|
61
63
|
timezone: null,
|
|
@@ -72,16 +74,18 @@ exports.DEFAULT_TASK = {
|
|
|
72
74
|
description: DEFAULT_TASK_DESCRIPTION,
|
|
73
75
|
projectId: DEFAULT_PROJECT_ID,
|
|
74
76
|
sectionId: DEFAULT_SECTION_ID,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
isCompleted: false,
|
|
78
|
+
labels: DEFAULT_LABELS,
|
|
77
79
|
priority: DEFAULT_TASK_PRIORITY,
|
|
78
80
|
commentCount: 0,
|
|
79
|
-
|
|
81
|
+
createdAt: DEFAULT_DATE,
|
|
80
82
|
url: 'https://todoist.com/showTask?id=1234',
|
|
81
83
|
due: exports.DEFAULT_DUE_DATE,
|
|
82
|
-
|
|
84
|
+
assigneeId: DEFAULT_ASSIGNEE,
|
|
85
|
+
creatorId: DEFAULT_CREATOR,
|
|
83
86
|
};
|
|
84
87
|
exports.INVALID_TASK = __assign(__assign({}, exports.DEFAULT_TASK), { due: exports.INVALID_DUE_DATE });
|
|
88
|
+
exports.TASK_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_TASK), { due: null, assigneeId: null, assignerId: null, parentId: null, sectionId: null });
|
|
85
89
|
exports.DEFAULT_PROJECT = {
|
|
86
90
|
id: DEFAULT_PROJECT_ID,
|
|
87
91
|
name: DEFAULT_PROJECT_NAME,
|
|
@@ -89,11 +93,15 @@ exports.DEFAULT_PROJECT = {
|
|
|
89
93
|
order: DEFAULT_ORDER,
|
|
90
94
|
parentId: DEFAULT_PROJECT_ID,
|
|
91
95
|
commentCount: 0,
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
isFavorite: false,
|
|
97
|
+
isShared: false,
|
|
98
|
+
isInboxProject: false,
|
|
99
|
+
isTeamInbox: false,
|
|
100
|
+
viewStyle: DEFAULT_PROJECT_VIEW_STYLE,
|
|
94
101
|
url: "https://todoist.com/showProject?id=123",
|
|
95
102
|
};
|
|
96
103
|
exports.INVALID_PROJECT = __assign(__assign({}, exports.DEFAULT_PROJECT), { name: 123 });
|
|
104
|
+
exports.PROJECT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_PROJECT), { parentId: null });
|
|
97
105
|
exports.DEFAULT_SECTION = {
|
|
98
106
|
id: DEFAULT_SECTION_ID,
|
|
99
107
|
name: DEFAULT_SECTION_NAME,
|
|
@@ -106,9 +114,9 @@ exports.DEFAULT_LABEL = {
|
|
|
106
114
|
name: DEFAULT_LABEL_NAME,
|
|
107
115
|
color: DEFAULT_ENTITY_COLOR,
|
|
108
116
|
order: DEFAULT_ORDER,
|
|
109
|
-
|
|
117
|
+
isFavorite: false,
|
|
110
118
|
};
|
|
111
|
-
exports.INVALID_LABEL = __assign(__assign({}, exports.DEFAULT_LABEL), {
|
|
119
|
+
exports.INVALID_LABEL = __assign(__assign({}, exports.DEFAULT_LABEL), { isFavorite: 'true' });
|
|
112
120
|
exports.DEFAULT_USER = {
|
|
113
121
|
id: DEFAULT_USER_ID,
|
|
114
122
|
name: DEFAULT_USER_NAME,
|
|
@@ -127,6 +135,9 @@ exports.DEFAULT_COMMENT = {
|
|
|
127
135
|
content: DEFAULT_COMMENT_CONTENT,
|
|
128
136
|
projectId: DEFAULT_PROJECT_ID,
|
|
129
137
|
attachment: exports.DEFAULT_ATTACHMENT,
|
|
130
|
-
|
|
138
|
+
postedAt: DEFAULT_DATE,
|
|
131
139
|
};
|
|
132
140
|
exports.INVALID_COMMENT = __assign(__assign({}, exports.DEFAULT_COMMENT), { attachment: exports.INVALID_ATTACHMENT });
|
|
141
|
+
exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = __assign(__assign({}, exports.DEFAULT_COMMENT), { projectId: null, attachment: null });
|
|
142
|
+
exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_COMMENT), { attachment: __assign(__assign({}, exports.DEFAULT_ATTACHMENT), { fileName: null, fileSize: null, fileType: null, fileDuration: null, uploadState: null, image: null, imageWidth: null, imageHeight: null, url: null, title: null }) });
|
|
143
|
+
exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = __assign(__assign({}, exports.DEFAULT_COMMENT), { taskId: null, attachment: null });
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Boolean, Number as NumberRunType, String, Array, Record, Static, Partial, Literal, Union } from 'runtypes';
|
|
2
2
|
export declare const Int: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
3
3
|
export declare type TodoistEntity = {
|
|
4
|
-
id:
|
|
4
|
+
id: string;
|
|
5
5
|
};
|
|
6
6
|
export declare type OrderedEntity = TodoistEntity & {
|
|
7
7
|
order: number;
|
|
@@ -10,135 +10,138 @@ export declare type EntityInHierarchy = OrderedEntity & {
|
|
|
10
10
|
parentId?: number;
|
|
11
11
|
};
|
|
12
12
|
export declare const DueDate: import("runtypes").Intersect<[Record<{
|
|
13
|
-
|
|
13
|
+
isRecurring: Boolean;
|
|
14
14
|
string: String;
|
|
15
15
|
date: String;
|
|
16
16
|
}, false>, Partial<{
|
|
17
|
-
datetime: String
|
|
18
|
-
timezone: String
|
|
17
|
+
datetime: Union<[String, Literal<null>]>;
|
|
18
|
+
timezone: Union<[String, Literal<null>]>;
|
|
19
19
|
}, false>]>;
|
|
20
20
|
export declare type DueDate = Static<typeof DueDate>;
|
|
21
21
|
export declare const Task: import("runtypes").Intersect<[Record<{
|
|
22
|
-
id:
|
|
22
|
+
id: String;
|
|
23
23
|
order: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
24
24
|
content: String;
|
|
25
25
|
description: String;
|
|
26
|
-
projectId:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
labelIds: Array<import("runtypes").Constraint<NumberRunType, number, unknown>, false>;
|
|
26
|
+
projectId: String;
|
|
27
|
+
isCompleted: Boolean;
|
|
28
|
+
labels: Array<String, false>;
|
|
30
29
|
priority: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
31
30
|
commentCount: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
32
|
-
|
|
31
|
+
createdAt: String;
|
|
33
32
|
url: String;
|
|
33
|
+
creatorId: String;
|
|
34
34
|
}, false>, Partial<{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
recurring: Boolean;
|
|
35
|
+
due: Union<[import("runtypes").Intersect<[Record<{
|
|
36
|
+
isRecurring: Boolean;
|
|
38
37
|
string: String;
|
|
39
38
|
date: String;
|
|
40
39
|
}, false>, Partial<{
|
|
41
|
-
datetime: String
|
|
42
|
-
timezone: String
|
|
43
|
-
}, false>]>;
|
|
44
|
-
|
|
40
|
+
datetime: Union<[String, Literal<null>]>;
|
|
41
|
+
timezone: Union<[String, Literal<null>]>;
|
|
42
|
+
}, false>]>, Literal<null>]>;
|
|
43
|
+
assigneeId: Union<[String, Literal<null>]>;
|
|
44
|
+
assignerId: Union<[String, Literal<null>]>;
|
|
45
|
+
parentId: Union<[String, Literal<null>]>;
|
|
46
|
+
sectionId: Union<[String, Literal<null>]>;
|
|
45
47
|
}, false>]>;
|
|
46
48
|
export declare type Task = Static<typeof Task>;
|
|
47
49
|
export declare const Project: import("runtypes").Intersect<[Record<{
|
|
48
|
-
id:
|
|
50
|
+
id: String;
|
|
49
51
|
name: String;
|
|
50
|
-
color:
|
|
52
|
+
color: String;
|
|
51
53
|
commentCount: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
isShared: Boolean;
|
|
55
|
+
isFavorite: Boolean;
|
|
54
56
|
url: String;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
isInboxProject: Boolean;
|
|
58
|
+
isTeamInbox: Boolean;
|
|
57
59
|
order: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
viewStyle: String;
|
|
61
|
+
}, false>, Partial<{
|
|
62
|
+
parentId: Union<[String, Literal<null>]>;
|
|
61
63
|
}, false>]>;
|
|
62
64
|
export declare type Project = Static<typeof Project>;
|
|
63
65
|
export declare const Section: Record<{
|
|
64
|
-
id:
|
|
66
|
+
id: String;
|
|
65
67
|
order: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
66
68
|
name: String;
|
|
67
|
-
projectId:
|
|
69
|
+
projectId: String;
|
|
68
70
|
}, false>;
|
|
69
71
|
export declare type Section = Static<typeof Section>;
|
|
70
72
|
export declare const Label: Record<{
|
|
71
|
-
id:
|
|
73
|
+
id: String;
|
|
72
74
|
order: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
73
75
|
name: String;
|
|
74
|
-
color:
|
|
75
|
-
|
|
76
|
+
color: String;
|
|
77
|
+
isFavorite: Boolean;
|
|
76
78
|
}, false>;
|
|
77
79
|
export declare type Label = Static<typeof Label>;
|
|
78
80
|
export declare const Attachment: import("runtypes").Intersect<[Record<{
|
|
79
81
|
resourceType: String;
|
|
80
82
|
}, false>, Partial<{
|
|
81
|
-
fileName: String
|
|
82
|
-
fileSize: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
83
|
-
fileType: String
|
|
84
|
-
fileUrl: String
|
|
85
|
-
fileDuration: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
86
|
-
uploadState: Union<[Literal<"pending">, Literal<"completed">]>;
|
|
87
|
-
image: String
|
|
88
|
-
imageWidth: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
89
|
-
imageHeight: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
90
|
-
url: String
|
|
91
|
-
title: String
|
|
83
|
+
fileName: Union<[String, Literal<null>]>;
|
|
84
|
+
fileSize: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
85
|
+
fileType: Union<[String, Literal<null>]>;
|
|
86
|
+
fileUrl: Union<[String, Literal<null>]>;
|
|
87
|
+
fileDuration: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
88
|
+
uploadState: Union<[Union<[Literal<"pending">, Literal<"completed">]>, Literal<null>]>;
|
|
89
|
+
image: Union<[String, Literal<null>]>;
|
|
90
|
+
imageWidth: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
91
|
+
imageHeight: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
92
|
+
url: Union<[String, Literal<null>]>;
|
|
93
|
+
title: Union<[String, Literal<null>]>;
|
|
92
94
|
}, false>]>;
|
|
93
95
|
export declare type Attachment = Static<typeof Attachment>;
|
|
94
96
|
export declare const Comment: import("runtypes").Intersect<[Record<{
|
|
95
|
-
id:
|
|
97
|
+
id: String;
|
|
96
98
|
content: String;
|
|
97
|
-
|
|
99
|
+
postedAt: String;
|
|
98
100
|
}, false>, Partial<{
|
|
99
|
-
taskId:
|
|
100
|
-
projectId:
|
|
101
|
-
attachment: import("runtypes").Intersect<[Record<{
|
|
101
|
+
taskId: Union<[String, Literal<null>]>;
|
|
102
|
+
projectId: Union<[String, Literal<null>]>;
|
|
103
|
+
attachment: Union<[import("runtypes").Intersect<[Record<{
|
|
102
104
|
resourceType: String;
|
|
103
105
|
}, false>, Partial<{
|
|
104
|
-
fileName: String
|
|
105
|
-
fileSize: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
106
|
-
fileType: String
|
|
107
|
-
fileUrl: String
|
|
108
|
-
fileDuration: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
109
|
-
uploadState: Union<[Literal<"pending">, Literal<"completed">]>;
|
|
110
|
-
image: String
|
|
111
|
-
imageWidth: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
112
|
-
imageHeight: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
113
|
-
url: String
|
|
114
|
-
title: String
|
|
115
|
-
}, false>]>;
|
|
106
|
+
fileName: Union<[String, Literal<null>]>;
|
|
107
|
+
fileSize: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
108
|
+
fileType: Union<[String, Literal<null>]>;
|
|
109
|
+
fileUrl: Union<[String, Literal<null>]>;
|
|
110
|
+
fileDuration: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
111
|
+
uploadState: Union<[Union<[Literal<"pending">, Literal<"completed">]>, Literal<null>]>;
|
|
112
|
+
image: Union<[String, Literal<null>]>;
|
|
113
|
+
imageWidth: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
114
|
+
imageHeight: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
|
|
115
|
+
url: Union<[String, Literal<null>]>;
|
|
116
|
+
title: Union<[String, Literal<null>]>;
|
|
117
|
+
}, false>]>, Literal<null>]>;
|
|
116
118
|
}, false>]>;
|
|
117
119
|
export declare type Comment = Static<typeof Comment>;
|
|
118
120
|
export declare const User: Record<{
|
|
119
|
-
id:
|
|
121
|
+
id: String;
|
|
120
122
|
name: String;
|
|
121
123
|
email: String;
|
|
122
124
|
}, false>;
|
|
123
125
|
export declare type User = Static<typeof User>;
|
|
124
|
-
export declare type Color =
|
|
126
|
+
export declare type Color = {
|
|
127
|
+
id: number;
|
|
125
128
|
name: string;
|
|
126
129
|
value: string;
|
|
127
130
|
};
|
|
128
131
|
export declare type QuickAddTaskResponse = {
|
|
129
|
-
id:
|
|
130
|
-
projectId:
|
|
132
|
+
id: string;
|
|
133
|
+
projectId: string;
|
|
131
134
|
content: string;
|
|
132
135
|
description: string;
|
|
133
136
|
priority: number;
|
|
134
|
-
sectionId:
|
|
135
|
-
parentId:
|
|
137
|
+
sectionId: string | null;
|
|
138
|
+
parentId: string | null;
|
|
136
139
|
childOrder: number;
|
|
137
|
-
labels:
|
|
138
|
-
responsibleUid:
|
|
140
|
+
labels: string[];
|
|
141
|
+
responsibleUid: string | null;
|
|
139
142
|
checked: number;
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
added_at: string;
|
|
144
|
+
added_by_uid: string | null;
|
|
142
145
|
due: {
|
|
143
146
|
date: string;
|
|
144
147
|
timezone: string | null;
|
package/dist/types/entities.js
CHANGED
|
@@ -2,87 +2,89 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.User = exports.Comment = exports.Attachment = exports.Label = exports.Section = exports.Project = exports.Task = exports.DueDate = exports.Int = void 0;
|
|
4
4
|
var runtypes_1 = require("runtypes");
|
|
5
|
-
exports.Int = runtypes_1.Number.withConstraint(function (n) { return Number.isInteger(n) || "".concat(n, " is not a valid entity id. Should be
|
|
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)({
|
|
7
|
-
|
|
7
|
+
isRecurring: runtypes_1.Boolean,
|
|
8
8
|
string: runtypes_1.String,
|
|
9
9
|
date: runtypes_1.String,
|
|
10
10
|
}).And((0, runtypes_1.Partial)({
|
|
11
|
-
datetime: runtypes_1.String,
|
|
12
|
-
timezone: runtypes_1.String,
|
|
11
|
+
datetime: runtypes_1.String.Or(runtypes_1.Null),
|
|
12
|
+
timezone: runtypes_1.String.Or(runtypes_1.Null),
|
|
13
13
|
}));
|
|
14
14
|
exports.Task = (0, runtypes_1.Record)({
|
|
15
|
-
id:
|
|
15
|
+
id: runtypes_1.String,
|
|
16
16
|
order: exports.Int,
|
|
17
17
|
content: runtypes_1.String,
|
|
18
18
|
description: runtypes_1.String,
|
|
19
|
-
projectId:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
labelIds: (0, runtypes_1.Array)(exports.Int),
|
|
19
|
+
projectId: runtypes_1.String,
|
|
20
|
+
isCompleted: runtypes_1.Boolean,
|
|
21
|
+
labels: (0, runtypes_1.Array)(runtypes_1.String),
|
|
23
22
|
priority: exports.Int,
|
|
24
23
|
commentCount: exports.Int,
|
|
25
|
-
|
|
24
|
+
createdAt: runtypes_1.String,
|
|
26
25
|
url: runtypes_1.String,
|
|
26
|
+
creatorId: runtypes_1.String,
|
|
27
27
|
}).And((0, runtypes_1.Partial)({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
due: exports.DueDate.Or(runtypes_1.Null),
|
|
29
|
+
assigneeId: runtypes_1.String.Or(runtypes_1.Null),
|
|
30
|
+
assignerId: runtypes_1.String.Or(runtypes_1.Null),
|
|
31
|
+
parentId: runtypes_1.String.Or(runtypes_1.Null),
|
|
32
|
+
sectionId: runtypes_1.String.Or(runtypes_1.Null),
|
|
31
33
|
}));
|
|
32
34
|
exports.Project = (0, runtypes_1.Record)({
|
|
33
|
-
id:
|
|
35
|
+
id: runtypes_1.String,
|
|
34
36
|
name: runtypes_1.String,
|
|
35
|
-
color:
|
|
37
|
+
color: runtypes_1.String,
|
|
36
38
|
commentCount: exports.Int,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
isShared: runtypes_1.Boolean,
|
|
40
|
+
isFavorite: runtypes_1.Boolean,
|
|
39
41
|
url: runtypes_1.String,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
isInboxProject: runtypes_1.Boolean,
|
|
43
|
+
isTeamInbox: runtypes_1.Boolean,
|
|
42
44
|
order: exports.Int,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
viewStyle: runtypes_1.String,
|
|
46
|
+
}).And((0, runtypes_1.Partial)({
|
|
47
|
+
parentId: runtypes_1.String.Or(runtypes_1.Null),
|
|
46
48
|
}));
|
|
47
49
|
exports.Section = (0, runtypes_1.Record)({
|
|
48
|
-
id:
|
|
50
|
+
id: runtypes_1.String,
|
|
49
51
|
order: exports.Int,
|
|
50
52
|
name: runtypes_1.String,
|
|
51
|
-
projectId:
|
|
53
|
+
projectId: runtypes_1.String,
|
|
52
54
|
});
|
|
53
55
|
exports.Label = (0, runtypes_1.Record)({
|
|
54
|
-
id:
|
|
56
|
+
id: runtypes_1.String,
|
|
55
57
|
order: exports.Int,
|
|
56
58
|
name: runtypes_1.String,
|
|
57
|
-
color:
|
|
58
|
-
|
|
59
|
+
color: runtypes_1.String,
|
|
60
|
+
isFavorite: runtypes_1.Boolean,
|
|
59
61
|
});
|
|
60
62
|
exports.Attachment = (0, runtypes_1.Record)({
|
|
61
63
|
resourceType: runtypes_1.String,
|
|
62
64
|
}).And((0, runtypes_1.Partial)({
|
|
63
|
-
fileName: runtypes_1.String,
|
|
64
|
-
fileSize: exports.Int,
|
|
65
|
-
fileType: runtypes_1.String,
|
|
66
|
-
fileUrl: runtypes_1.String,
|
|
67
|
-
fileDuration: exports.Int,
|
|
68
|
-
uploadState: (0, runtypes_1.Union)((0, runtypes_1.Literal)('pending'), (0, runtypes_1.Literal)('completed')),
|
|
69
|
-
image: runtypes_1.String,
|
|
70
|
-
imageWidth: exports.Int,
|
|
71
|
-
imageHeight: exports.Int,
|
|
72
|
-
url: runtypes_1.String,
|
|
73
|
-
title: runtypes_1.String,
|
|
65
|
+
fileName: runtypes_1.String.Or(runtypes_1.Null),
|
|
66
|
+
fileSize: exports.Int.Or(runtypes_1.Null),
|
|
67
|
+
fileType: runtypes_1.String.Or(runtypes_1.Null),
|
|
68
|
+
fileUrl: runtypes_1.String.Or(runtypes_1.Null),
|
|
69
|
+
fileDuration: exports.Int.Or(runtypes_1.Null),
|
|
70
|
+
uploadState: (0, runtypes_1.Union)((0, runtypes_1.Literal)('pending'), (0, runtypes_1.Literal)('completed')).Or(runtypes_1.Null),
|
|
71
|
+
image: runtypes_1.String.Or(runtypes_1.Null),
|
|
72
|
+
imageWidth: exports.Int.Or(runtypes_1.Null),
|
|
73
|
+
imageHeight: exports.Int.Or(runtypes_1.Null),
|
|
74
|
+
url: runtypes_1.String.Or(runtypes_1.Null),
|
|
75
|
+
title: runtypes_1.String.Or(runtypes_1.Null),
|
|
74
76
|
}));
|
|
75
77
|
exports.Comment = (0, runtypes_1.Record)({
|
|
76
|
-
id:
|
|
78
|
+
id: runtypes_1.String,
|
|
77
79
|
content: runtypes_1.String,
|
|
78
|
-
|
|
80
|
+
postedAt: runtypes_1.String,
|
|
79
81
|
}).And((0, runtypes_1.Partial)({
|
|
80
|
-
taskId:
|
|
81
|
-
projectId:
|
|
82
|
-
attachment: exports.Attachment,
|
|
82
|
+
taskId: runtypes_1.String.Or(runtypes_1.Null),
|
|
83
|
+
projectId: runtypes_1.String.Or(runtypes_1.Null),
|
|
84
|
+
attachment: exports.Attachment.Or(runtypes_1.Null),
|
|
83
85
|
}));
|
|
84
86
|
exports.User = (0, runtypes_1.Record)({
|
|
85
|
-
id:
|
|
87
|
+
id: runtypes_1.String,
|
|
86
88
|
name: runtypes_1.String,
|
|
87
89
|
email: runtypes_1.String,
|
|
88
90
|
});
|
package/dist/types/requests.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export declare type AddTaskArgs = {
|
|
2
2
|
content: string;
|
|
3
3
|
description?: string;
|
|
4
|
-
projectId?:
|
|
5
|
-
sectionId?:
|
|
6
|
-
parentId?:
|
|
4
|
+
projectId?: string;
|
|
5
|
+
sectionId?: string;
|
|
6
|
+
parentId?: string;
|
|
7
7
|
order?: number;
|
|
8
|
-
|
|
8
|
+
labels?: string[];
|
|
9
9
|
priority?: number;
|
|
10
10
|
dueString?: string;
|
|
11
11
|
dueLang?: string;
|
|
12
12
|
dueDate?: string;
|
|
13
13
|
dueDatetime?: string;
|
|
14
|
-
|
|
14
|
+
assigneeId?: string;
|
|
15
15
|
};
|
|
16
16
|
export declare type QuickAddTaskArgs = {
|
|
17
17
|
text: string;
|
|
@@ -20,38 +20,41 @@ export declare type QuickAddTaskArgs = {
|
|
|
20
20
|
autoReminder?: boolean;
|
|
21
21
|
};
|
|
22
22
|
export declare type GetTasksArgs = {
|
|
23
|
-
projectId?:
|
|
24
|
-
sectionId?:
|
|
25
|
-
|
|
23
|
+
projectId?: string;
|
|
24
|
+
sectionId?: string;
|
|
25
|
+
label?: string;
|
|
26
26
|
filter?: string;
|
|
27
27
|
lang?: string;
|
|
28
|
-
ids?:
|
|
28
|
+
ids?: string[];
|
|
29
29
|
};
|
|
30
30
|
export declare type UpdateTaskArgs = {
|
|
31
31
|
content?: string;
|
|
32
32
|
description?: string;
|
|
33
|
-
|
|
33
|
+
labels?: string[];
|
|
34
34
|
priority?: number;
|
|
35
35
|
dueString?: string;
|
|
36
36
|
dueLang?: string;
|
|
37
37
|
dueDate?: string;
|
|
38
38
|
dueDatetime?: string;
|
|
39
|
-
|
|
39
|
+
assigneeId?: string;
|
|
40
40
|
};
|
|
41
|
+
export declare type ProjectViewStyle = 'list' | 'board';
|
|
41
42
|
export declare type AddProjectArgs = {
|
|
42
43
|
name: string;
|
|
43
|
-
parentId?:
|
|
44
|
+
parentId?: string;
|
|
44
45
|
color?: number;
|
|
45
|
-
|
|
46
|
+
isFavorite?: boolean;
|
|
47
|
+
viewStyle?: ProjectViewStyle;
|
|
46
48
|
};
|
|
47
49
|
export declare type UpdateProjectArgs = {
|
|
48
50
|
name?: string;
|
|
49
51
|
color?: number;
|
|
50
|
-
|
|
52
|
+
isFavorite?: boolean;
|
|
53
|
+
viewStyle?: ProjectViewStyle;
|
|
51
54
|
};
|
|
52
55
|
export declare type AddSectionArgs = {
|
|
53
56
|
name: string;
|
|
54
|
-
projectId:
|
|
57
|
+
projectId: string;
|
|
55
58
|
order?: number;
|
|
56
59
|
};
|
|
57
60
|
export declare type UpdateSectionArgs = {
|
|
@@ -61,20 +64,20 @@ export declare type AddLabelArgs = {
|
|
|
61
64
|
name: string;
|
|
62
65
|
order?: number;
|
|
63
66
|
color?: number;
|
|
64
|
-
|
|
67
|
+
isFavorite?: boolean;
|
|
65
68
|
};
|
|
66
69
|
export declare type UpdateLabelArgs = {
|
|
67
70
|
name?: string;
|
|
68
71
|
order?: number;
|
|
69
72
|
color?: number;
|
|
70
|
-
|
|
73
|
+
isFavorite?: boolean;
|
|
71
74
|
};
|
|
72
75
|
export declare type GetTaskCommentsArgs = {
|
|
73
|
-
taskId:
|
|
76
|
+
taskId: string;
|
|
74
77
|
projectId?: never;
|
|
75
78
|
};
|
|
76
79
|
export declare type GetProjectCommentsArgs = {
|
|
77
|
-
projectId:
|
|
80
|
+
projectId: string;
|
|
78
81
|
taskId?: never;
|
|
79
82
|
};
|
|
80
83
|
declare type AddCommentArgs = {
|
|
@@ -87,14 +90,21 @@ declare type AddCommentArgs = {
|
|
|
87
90
|
};
|
|
88
91
|
};
|
|
89
92
|
export declare type AddTaskCommentArgs = AddCommentArgs & {
|
|
90
|
-
taskId:
|
|
93
|
+
taskId: string;
|
|
91
94
|
projectId?: never;
|
|
92
95
|
};
|
|
93
96
|
export declare type AddProjectCommentArgs = AddCommentArgs & {
|
|
94
|
-
projectId:
|
|
97
|
+
projectId: string;
|
|
95
98
|
taskId?: never;
|
|
96
99
|
};
|
|
97
100
|
export declare type UpdateCommentArgs = {
|
|
98
101
|
content: string;
|
|
99
102
|
};
|
|
103
|
+
export declare type RenameSharedLabelArgs = {
|
|
104
|
+
name: string;
|
|
105
|
+
newName: string;
|
|
106
|
+
};
|
|
107
|
+
export declare type RemoveSharedLabelArgs = {
|
|
108
|
+
name: string;
|
|
109
|
+
};
|
|
100
110
|
export {};
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export declare const charcoal: Color;
|
|
|
20
20
|
export declare const gray: Color;
|
|
21
21
|
export declare const taupe: Color;
|
|
22
22
|
export declare const colors: Color[];
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function getColorById(colorId: number): Color;
|
|
24
|
+
export declare function getColorByName(colorName: string): Color;
|
package/dist/utils/colors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getColorByName = exports.getColorById = exports.colors = exports.taupe = exports.gray = exports.charcoal = exports.salmon = exports.magenta = exports.lavender = exports.violet = exports.grape = exports.blue = exports.lightBlue = exports.skyBlue = exports.turquoise = exports.mintGreen = exports.green = exports.limeGreen = exports.oliveGreen = exports.yellow = exports.orange = exports.red = exports.berryRed = void 0;
|
|
4
4
|
exports.berryRed = { name: 'Berry Red', id: 30, value: '#b8255f' };
|
|
5
5
|
exports.red = { name: 'Red', id: 31, value: '#db4035' };
|
|
6
6
|
exports.orange = { name: 'Orange', id: 32, value: '#ff9933' };
|
|
@@ -43,8 +43,13 @@ exports.colors = [
|
|
|
43
43
|
exports.gray,
|
|
44
44
|
exports.taupe,
|
|
45
45
|
];
|
|
46
|
-
function
|
|
46
|
+
function getColorById(colorId) {
|
|
47
47
|
var color = exports.colors.find(function (color) { return color.id === colorId; });
|
|
48
48
|
return color !== null && color !== void 0 ? color : exports.charcoal;
|
|
49
49
|
}
|
|
50
|
-
exports.
|
|
50
|
+
exports.getColorById = getColorById;
|
|
51
|
+
function getColorByName(colorName) {
|
|
52
|
+
var color = exports.colors.find(function (color) { return color.name === colorName; });
|
|
53
|
+
return color !== null && color !== void 0 ? color : exports.charcoal;
|
|
54
|
+
}
|
|
55
|
+
exports.getColorByName = getColorByName;
|
|
@@ -14,15 +14,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.getTaskFromQuickAddResponse = void 0;
|
|
15
15
|
var showTaskEndpoint = 'https://todoist.com/showTask';
|
|
16
16
|
function getTaskUrlFromQuickAddResponse(responseData) {
|
|
17
|
-
return responseData.
|
|
18
|
-
? "".concat(showTaskEndpoint, "?id=").concat(responseData.id, "&sync_id=").concat(responseData.syncId)
|
|
19
|
-
: "".concat(showTaskEndpoint, "?id=").concat(responseData.id);
|
|
17
|
+
return "".concat(showTaskEndpoint, "?id=").concat(responseData.id);
|
|
20
18
|
}
|
|
21
19
|
function getTaskFromQuickAddResponse(responseData) {
|
|
22
|
-
var _a;
|
|
23
20
|
var due = responseData.due
|
|
24
|
-
? __assign(__assign({
|
|
25
|
-
var task = __assign(__assign(__assign({ id: responseData.id, order: responseData.childOrder, content: responseData.content, description: responseData.description, projectId: responseData.projectId, sectionId:
|
|
21
|
+
? __assign(__assign({ isRecurring: responseData.due.isRecurring, string: responseData.due.string, date: responseData.due.date }, (responseData.due.timezone !== null && { datetime: responseData.due.date })), (responseData.due.timezone !== null && { timezone: responseData.due.timezone })) : undefined;
|
|
22
|
+
var task = __assign(__assign(__assign({ id: responseData.id, order: responseData.childOrder, content: responseData.content, description: responseData.description, projectId: responseData.projectId, sectionId: responseData.sectionId ? responseData.sectionId : undefined, isCompleted: responseData.checked === 1, labels: responseData.labels, priority: responseData.priority, commentCount: 0, createdAt: responseData.added_at, url: getTaskUrlFromQuickAddResponse(responseData), creatorId: responseData.added_by_uid ? responseData.added_by_uid : '' }, (due !== undefined && { due: due })), (responseData.parentId !== null && { parentId: responseData.parentId })), (responseData.responsibleUid !== null && {
|
|
23
|
+
assigneeId: responseData.responsibleUid,
|
|
24
|
+
}));
|
|
26
25
|
return task;
|
|
27
26
|
}
|
|
28
27
|
exports.getTaskFromQuickAddResponse = getTaskFromQuickAddResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-api-typescript",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A typescript wrapper for the Todoist REST API.",
|
|
5
5
|
"author": "Doist developers",
|
|
6
6
|
"repository": "git@github.com:doist/todoist-api-typescript.git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@types/axios": "0.14.0",
|
|
38
38
|
"@types/jest": "27.5.2",
|
|
39
39
|
"@types/uuid": "8.3.4",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "5.36.
|
|
41
|
-
"@typescript-eslint/parser": "5.36.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "5.36.2",
|
|
41
|
+
"@typescript-eslint/parser": "5.36.2",
|
|
42
42
|
"eslint": "8.23.0",
|
|
43
43
|
"eslint-config-prettier": "8.5.0",
|
|
44
44
|
"eslint-import-resolver-webpack": "0.13.2",
|