@doist/todoist-api-typescript 1.7.0 → 2.0.0
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/dist/TodoistApi.d.ts +24 -6
- package/dist/TodoistApi.js +57 -5
- package/dist/consts/endpoints.d.ts +3 -0
- package/dist/consts/endpoints.js +6 -3
- package/dist/testUtils/testDefaults.d.ts +31 -29
- package/dist/testUtils/testDefaults.js +29 -23
- package/dist/types/entities.d.ts +39 -37
- package/dist/types/entities.js +31 -29
- package/dist/types/requests.d.ts +30 -20
- 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 +1 -1
package/dist/TodoistApi.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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);
|
|
@@ -9,29 +9,47 @@ export declare class TodoistApi {
|
|
|
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: number, args: UpdateTaskArgs, requestId?: string): Promise<
|
|
12
|
+
updateTask(id: number, args: UpdateTaskArgs, requestId?: string): Promise<Task>;
|
|
13
13
|
closeTask(id: number, requestId?: string): Promise<boolean>;
|
|
14
14
|
reopenTask(id: number, requestId?: string): Promise<boolean>;
|
|
15
15
|
deleteTask(id: number, requestId?: string): Promise<boolean>;
|
|
16
16
|
getProject(id: number): Promise<Project>;
|
|
17
17
|
getProjects(): Promise<Project[]>;
|
|
18
18
|
addProject(args: AddProjectArgs, requestId?: string): Promise<Project>;
|
|
19
|
-
updateProject(id: number, args: UpdateProjectArgs, requestId?: string): Promise<
|
|
19
|
+
updateProject(id: number, args: UpdateProjectArgs, requestId?: string): Promise<Project>;
|
|
20
20
|
deleteProject(id: number, requestId?: string): Promise<boolean>;
|
|
21
21
|
getProjectCollaborators(projectId: number): Promise<User[]>;
|
|
22
22
|
getSections(projectId?: number): Promise<Section[]>;
|
|
23
23
|
getSection(id: number): Promise<Section>;
|
|
24
24
|
addSection(args: AddSectionArgs, requestId?: string): Promise<Section>;
|
|
25
|
-
updateSection(id: number, args: UpdateSectionArgs, requestId?: string): Promise<
|
|
25
|
+
updateSection(id: number, args: UpdateSectionArgs, requestId?: string): Promise<Section>;
|
|
26
26
|
deleteSection(id: number, requestId?: string): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Fetches a personal label
|
|
29
|
+
*/
|
|
27
30
|
getLabel(id: number): 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
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Updates a personal label
|
|
41
|
+
*/
|
|
42
|
+
updateLabel(id: number, args: UpdateLabelArgs, requestId?: string): Promise<Label>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a personal label
|
|
45
|
+
*/
|
|
31
46
|
deleteLabel(id: number, 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
51
|
getComment(id: number): Promise<Comment>;
|
|
34
52
|
addComment(args: AddTaskCommentArgs | AddProjectCommentArgs, requestId?: string): Promise<Comment>;
|
|
35
|
-
updateComment(id: number, args: UpdateCommentArgs, requestId?: string): Promise<
|
|
53
|
+
updateComment(id: number, args: UpdateCommentArgs, requestId?: string): Promise<Comment>;
|
|
36
54
|
deleteComment(id: number, requestId?: string): Promise<boolean>;
|
|
37
55
|
}
|
package/dist/TodoistApi.js
CHANGED
|
@@ -125,7 +125,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
125
125
|
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, String(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
|
});
|
|
@@ -226,7 +226,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
226
226
|
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, String(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
|
});
|
|
@@ -312,7 +312,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
312
312
|
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, String(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
|
});
|
|
@@ -332,6 +332,9 @@ 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;
|
|
@@ -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,6 +382,9 @@ 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;
|
|
@@ -383,11 +395,14 @@ var TodoistApi = /** @class */ (function () {
|
|
|
383
395
|
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, String(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;
|
|
@@ -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;
|
|
@@ -454,7 +506,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
454
506
|
return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, String(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
|
});
|
|
@@ -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';
|
|
@@ -3,12 +3,12 @@ export declare const DEFAULT_AUTH_TOKEN = "AToken";
|
|
|
3
3
|
export declare const DEFAULT_REQUEST_ID = "ARequestID";
|
|
4
4
|
export declare const INVALID_ENTITY_ID: number;
|
|
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,59 +16,61 @@ 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 | undefined;
|
|
36
|
+
assignerId?: string | undefined;
|
|
37
|
+
parentId?: string | undefined;
|
|
38
|
+
sectionId?: string | undefined;
|
|
37
39
|
};
|
|
38
40
|
export declare const DEFAULT_PROJECT: Project;
|
|
39
41
|
export declare const INVALID_PROJECT: {
|
|
40
42
|
name: number;
|
|
41
|
-
id:
|
|
43
|
+
id: string;
|
|
44
|
+
order: number;
|
|
42
45
|
commentCount: number;
|
|
43
46
|
url: string;
|
|
44
|
-
color:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
syncId?: number | undefined;
|
|
47
|
+
color: string;
|
|
48
|
+
isShared: boolean;
|
|
49
|
+
isFavorite: boolean;
|
|
50
|
+
isInboxProject: boolean;
|
|
51
|
+
isTeamInbox: boolean;
|
|
52
|
+
viewStyle: string;
|
|
53
|
+
parentId?: string | undefined;
|
|
52
54
|
};
|
|
53
55
|
export declare const DEFAULT_SECTION: Section;
|
|
54
56
|
export declare const INVALID_SECTION: {
|
|
55
57
|
projectId: undefined;
|
|
56
|
-
id:
|
|
58
|
+
id: string;
|
|
57
59
|
order: number;
|
|
58
60
|
name: string;
|
|
59
61
|
};
|
|
60
62
|
export declare const DEFAULT_LABEL: Label;
|
|
61
63
|
export declare const INVALID_LABEL: {
|
|
62
|
-
|
|
63
|
-
id:
|
|
64
|
+
isFavorite: string;
|
|
65
|
+
id: string;
|
|
64
66
|
order: number;
|
|
65
67
|
name: string;
|
|
66
|
-
color:
|
|
68
|
+
color: string;
|
|
67
69
|
};
|
|
68
70
|
export declare const DEFAULT_USER: User;
|
|
69
71
|
export declare const INVALID_USER: {
|
|
70
72
|
email: undefined;
|
|
71
|
-
id:
|
|
73
|
+
id: string;
|
|
72
74
|
name: string;
|
|
73
75
|
};
|
|
74
76
|
export declare const DEFAULT_ATTACHMENT: Attachment;
|
|
@@ -102,9 +104,9 @@ export declare const INVALID_COMMENT: {
|
|
|
102
104
|
url?: string | undefined;
|
|
103
105
|
title?: string | undefined;
|
|
104
106
|
};
|
|
105
|
-
id:
|
|
107
|
+
id: string;
|
|
106
108
|
content: string;
|
|
107
|
-
|
|
108
|
-
taskId?:
|
|
109
|
-
projectId?:
|
|
109
|
+
postedAt: string;
|
|
110
|
+
taskId?: string | undefined;
|
|
111
|
+
projectId?: string | undefined;
|
|
110
112
|
};
|
|
@@ -12,36 +12,38 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
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;
|
|
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
40
|
exports.INVALID_ENTITY_ID = 'invalid/entity/id';
|
|
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,14 +74,15 @@ 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 });
|
|
85
88
|
exports.DEFAULT_PROJECT = {
|
|
@@ -89,8 +92,11 @@ exports.DEFAULT_PROJECT = {
|
|
|
89
92
|
order: DEFAULT_ORDER,
|
|
90
93
|
parentId: DEFAULT_PROJECT_ID,
|
|
91
94
|
commentCount: 0,
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
isFavorite: false,
|
|
96
|
+
isShared: false,
|
|
97
|
+
isInboxProject: false,
|
|
98
|
+
isTeamInbox: false,
|
|
99
|
+
viewStyle: DEFAULT_PROJECT_VIEW_STYLE,
|
|
94
100
|
url: "https://todoist.com/showProject?id=123",
|
|
95
101
|
};
|
|
96
102
|
exports.INVALID_PROJECT = __assign(__assign({}, exports.DEFAULT_PROJECT), { name: 123 });
|
|
@@ -106,9 +112,9 @@ exports.DEFAULT_LABEL = {
|
|
|
106
112
|
name: DEFAULT_LABEL_NAME,
|
|
107
113
|
color: DEFAULT_ENTITY_COLOR,
|
|
108
114
|
order: DEFAULT_ORDER,
|
|
109
|
-
|
|
115
|
+
isFavorite: false,
|
|
110
116
|
};
|
|
111
|
-
exports.INVALID_LABEL = __assign(__assign({}, exports.DEFAULT_LABEL), {
|
|
117
|
+
exports.INVALID_LABEL = __assign(__assign({}, exports.DEFAULT_LABEL), { isFavorite: 'true' });
|
|
112
118
|
exports.DEFAULT_USER = {
|
|
113
119
|
id: DEFAULT_USER_ID,
|
|
114
120
|
name: DEFAULT_USER_NAME,
|
|
@@ -127,6 +133,6 @@ exports.DEFAULT_COMMENT = {
|
|
|
127
133
|
content: DEFAULT_COMMENT_CONTENT,
|
|
128
134
|
projectId: DEFAULT_PROJECT_ID,
|
|
129
135
|
attachment: exports.DEFAULT_ATTACHMENT,
|
|
130
|
-
|
|
136
|
+
postedAt: DEFAULT_DATE,
|
|
131
137
|
};
|
|
132
138
|
exports.INVALID_COMMENT = __assign(__assign({}, exports.DEFAULT_COMMENT), { attachment: exports.INVALID_ATTACHMENT });
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ 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<{
|
|
@@ -19,60 +19,62 @@ export declare const DueDate: import("runtypes").Intersect<[Record<{
|
|
|
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
|
-
parentId: import("runtypes").Constraint<NumberRunType, number, unknown>;
|
|
36
35
|
due: import("runtypes").Intersect<[Record<{
|
|
37
|
-
|
|
36
|
+
isRecurring: Boolean;
|
|
38
37
|
string: String;
|
|
39
38
|
date: String;
|
|
40
39
|
}, false>, Partial<{
|
|
41
40
|
datetime: String;
|
|
42
41
|
timezone: String;
|
|
43
42
|
}, false>]>;
|
|
44
|
-
|
|
43
|
+
assigneeId: String;
|
|
44
|
+
assignerId: String;
|
|
45
|
+
parentId: String;
|
|
46
|
+
sectionId: String;
|
|
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: String;
|
|
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<{
|
|
@@ -92,12 +94,12 @@ export declare const Attachment: import("runtypes").Intersect<[Record<{
|
|
|
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
|
+
taskId: String;
|
|
102
|
+
projectId: String;
|
|
101
103
|
attachment: import("runtypes").Intersect<[Record<{
|
|
102
104
|
resourceType: String;
|
|
103
105
|
}, false>, Partial<{
|
|
@@ -116,7 +118,7 @@ export declare const Comment: import("runtypes").Intersect<[Record<{
|
|
|
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>;
|
|
@@ -126,19 +128,19 @@ export declare type Color = TodoistEntity & {
|
|
|
126
128
|
value: string;
|
|
127
129
|
};
|
|
128
130
|
export declare type QuickAddTaskResponse = {
|
|
129
|
-
id:
|
|
130
|
-
projectId:
|
|
131
|
+
id: string;
|
|
132
|
+
projectId: string;
|
|
131
133
|
content: string;
|
|
132
134
|
description: string;
|
|
133
135
|
priority: number;
|
|
134
|
-
sectionId:
|
|
135
|
-
parentId:
|
|
136
|
+
sectionId: string | null;
|
|
137
|
+
parentId: string | null;
|
|
136
138
|
childOrder: number;
|
|
137
|
-
labels:
|
|
138
|
-
responsibleUid:
|
|
139
|
+
labels: string[];
|
|
140
|
+
responsibleUid: string | null;
|
|
139
141
|
checked: number;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
added_at: string;
|
|
143
|
+
added_by_uid: string | null;
|
|
142
144
|
due: {
|
|
143
145
|
date: string;
|
|
144
146
|
timezone: string | null;
|
package/dist/types/entities.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
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)({
|
|
@@ -12,50 +12,52 @@ exports.DueDate = (0, runtypes_1.Record)({
|
|
|
12
12
|
timezone: runtypes_1.String,
|
|
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
|
-
parentId: exports.Int,
|
|
29
28
|
due: exports.DueDate,
|
|
30
|
-
|
|
29
|
+
assigneeId: runtypes_1.String,
|
|
30
|
+
assignerId: runtypes_1.String,
|
|
31
|
+
parentId: runtypes_1.String,
|
|
32
|
+
sectionId: runtypes_1.String,
|
|
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,
|
|
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,
|
|
@@ -73,16 +75,16 @@ exports.Attachment = (0, runtypes_1.Record)({
|
|
|
73
75
|
title: runtypes_1.String,
|
|
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
|
+
taskId: runtypes_1.String,
|
|
83
|
+
projectId: runtypes_1.String,
|
|
82
84
|
attachment: exports.Attachment,
|
|
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,9 +20,9 @@ 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
28
|
ids?: number[];
|
|
@@ -30,28 +30,31 @@ export declare type GetTasksArgs = {
|
|
|
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