@doist/todoist-api-typescript 4.0.3 → 5.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 +22 -23
- package/dist/TodoistApi.js +40 -53
- package/dist/consts/endpoints.d.ts +1 -0
- package/dist/consts/endpoints.js +2 -1
- package/dist/restClient.js +7 -5
- package/dist/testUtils/testDefaults.d.ts +41 -21
- package/dist/testUtils/testDefaults.js +71 -115
- package/dist/types/entities.d.ts +282 -139
- package/dist/types/entities.js +42 -45
- package/dist/types/requests.d.ts +2 -26
- package/dist/types/sync.d.ts +2 -2
- package/dist/utils/urlHelpers.d.ts +16 -0
- package/dist/utils/urlHelpers.js +48 -0
- package/dist/utils/validators.d.ts +20 -3
- package/dist/utils/validators.js +27 -13
- package/package.json +1 -1
- package/dist/utils/projectConverter.d.ts +0 -2
- package/dist/utils/projectConverter.js +0 -25
- package/dist/utils/taskConverters.d.ts +0 -3
- package/dist/utils/taskConverters.js +0 -57
package/dist/types/entities.js
CHANGED
|
@@ -22,8 +22,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.ColorSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.
|
|
25
|
+
exports.ColorSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.WorkspaceProjectSchema = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DueDateSchema = void 0;
|
|
26
26
|
var zod_1 = require("zod");
|
|
27
|
+
var urlHelpers_1 = require("../utils/urlHelpers");
|
|
27
28
|
exports.DueDateSchema = zod_1.z
|
|
28
29
|
.object({
|
|
29
30
|
isRecurring: zod_1.z.boolean(),
|
|
@@ -43,13 +44,14 @@ exports.DeadlineSchema = zod_1.z.object({
|
|
|
43
44
|
date: zod_1.z.string(),
|
|
44
45
|
lang: zod_1.z.string(),
|
|
45
46
|
});
|
|
46
|
-
exports.
|
|
47
|
-
|
|
47
|
+
exports.TaskSchema = zod_1.z
|
|
48
|
+
.object({
|
|
48
49
|
id: zod_1.z.string(),
|
|
50
|
+
userId: zod_1.z.string(),
|
|
49
51
|
projectId: zod_1.z.string(),
|
|
50
52
|
sectionId: zod_1.z.string().nullable(),
|
|
51
53
|
parentId: zod_1.z.string().nullable(),
|
|
52
|
-
addedByUid: zod_1.z.string(),
|
|
54
|
+
addedByUid: zod_1.z.string().nullable(),
|
|
53
55
|
assignedByUid: zod_1.z.string().nullable(),
|
|
54
56
|
responsibleUid: zod_1.z.string().nullable(),
|
|
55
57
|
labels: zod_1.z.array(zod_1.z.string()),
|
|
@@ -57,70 +59,65 @@ exports.RawTaskSchema = zod_1.z.object({
|
|
|
57
59
|
duration: exports.DurationSchema.nullable(),
|
|
58
60
|
checked: zod_1.z.boolean(),
|
|
59
61
|
isDeleted: zod_1.z.boolean(),
|
|
60
|
-
addedAt: zod_1.z.string(),
|
|
62
|
+
addedAt: zod_1.z.string().nullable(),
|
|
61
63
|
completedAt: zod_1.z.string().nullable(),
|
|
62
|
-
updatedAt: zod_1.z.string(),
|
|
64
|
+
updatedAt: zod_1.z.string().nullable(),
|
|
63
65
|
due: exports.DueDateSchema.nullable(),
|
|
64
66
|
priority: zod_1.z.number().int(),
|
|
65
67
|
childOrder: zod_1.z.number().int(),
|
|
66
68
|
content: zod_1.z.string(),
|
|
67
69
|
description: zod_1.z.string(),
|
|
70
|
+
noteCount: zod_1.z.number().int(),
|
|
68
71
|
dayOrder: zod_1.z.number().int(),
|
|
69
72
|
isCollapsed: zod_1.z.boolean(),
|
|
73
|
+
})
|
|
74
|
+
.transform(function (data) {
|
|
75
|
+
return __assign(__assign({}, data), { url: (0, urlHelpers_1.getTaskUrl)(data.id, data.content) });
|
|
70
76
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
sectionId: zod_1.z.string().nullable(),
|
|
77
|
-
parentId: zod_1.z.string().nullable(),
|
|
78
|
-
order: zod_1.z.number().int(),
|
|
79
|
-
content: zod_1.z.string(),
|
|
80
|
-
description: zod_1.z.string(),
|
|
81
|
-
isCompleted: zod_1.z.boolean(),
|
|
82
|
-
labels: zod_1.z.array(zod_1.z.string()),
|
|
83
|
-
priority: zod_1.z.number().int(),
|
|
84
|
-
creatorId: zod_1.z.string(),
|
|
85
|
-
createdAt: zod_1.z.string(),
|
|
86
|
-
due: exports.DueDateSchema.nullable(),
|
|
87
|
-
url: zod_1.z.string(),
|
|
88
|
-
duration: exports.DurationSchema.nullable(),
|
|
89
|
-
deadline: exports.DeadlineSchema.nullable(),
|
|
90
|
-
});
|
|
91
|
-
exports.RawProjectSchema = zod_1.z.object({
|
|
77
|
+
/**
|
|
78
|
+
* Base schema for all project types in Todoist.
|
|
79
|
+
* Contains common fields shared between personal and workspace projects.
|
|
80
|
+
*/
|
|
81
|
+
exports.BaseProjectSchema = zod_1.z.object({
|
|
92
82
|
id: zod_1.z.string(),
|
|
93
83
|
canAssignTasks: zod_1.z.boolean(),
|
|
94
|
-
childOrder: zod_1.z.number().int()
|
|
84
|
+
childOrder: zod_1.z.number().int(),
|
|
95
85
|
color: zod_1.z.string(),
|
|
96
|
-
createdAt: zod_1.z.string(),
|
|
86
|
+
createdAt: zod_1.z.string().nullable(),
|
|
97
87
|
isArchived: zod_1.z.boolean(),
|
|
98
88
|
isDeleted: zod_1.z.boolean(),
|
|
99
89
|
isFavorite: zod_1.z.boolean(),
|
|
100
90
|
isFrozen: zod_1.z.boolean(),
|
|
101
91
|
name: zod_1.z.string(),
|
|
102
|
-
updatedAt: zod_1.z.string(),
|
|
92
|
+
updatedAt: zod_1.z.string().nullable(),
|
|
103
93
|
viewStyle: zod_1.z.string(),
|
|
104
|
-
defaultOrder: zod_1.z.number().int()
|
|
94
|
+
defaultOrder: zod_1.z.number().int(),
|
|
105
95
|
description: zod_1.z.string(),
|
|
106
|
-
publicAccess: zod_1.z.boolean(),
|
|
107
|
-
parentId: zod_1.z.string().nullable().optional(),
|
|
108
|
-
inboxProject: zod_1.z.boolean().optional(),
|
|
109
96
|
isCollapsed: zod_1.z.boolean(),
|
|
110
97
|
isShared: zod_1.z.boolean(),
|
|
111
98
|
});
|
|
112
|
-
|
|
113
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Schema for personal projects in Todoist.
|
|
101
|
+
*/
|
|
102
|
+
exports.PersonalProjectSchema = exports.BaseProjectSchema.extend({
|
|
114
103
|
parentId: zod_1.z.string().nullable(),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
104
|
+
inboxProject: zod_1.z.boolean(),
|
|
105
|
+
}).transform(function (data) {
|
|
106
|
+
return __assign(__assign({}, data), { url: (0, urlHelpers_1.getProjectUrl)(data.id, data.name) });
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* Schema for workspace projects in Todoist.
|
|
110
|
+
*/
|
|
111
|
+
exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
|
|
112
|
+
collaboratorRoleDefault: zod_1.z.string(),
|
|
113
|
+
folderId: zod_1.z.boolean().nullable(),
|
|
114
|
+
isInviteOnly: zod_1.z.boolean().nullable(),
|
|
115
|
+
isLinkSharingEnabled: zod_1.z.boolean(),
|
|
116
|
+
role: zod_1.z.string().nullable(),
|
|
117
|
+
status: zod_1.z.string(),
|
|
118
|
+
workspaceId: zod_1.z.string(),
|
|
119
|
+
}).transform(function (data) {
|
|
120
|
+
return __assign(__assign({}, data), { url: (0, urlHelpers_1.getProjectUrl)(data.id, data.name) });
|
|
124
121
|
});
|
|
125
122
|
exports.SectionSchema = zod_1.z.object({
|
|
126
123
|
id: zod_1.z.string(),
|
package/dist/types/requests.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest';
|
|
2
|
-
import type { Comment,
|
|
2
|
+
import type { Comment, Duration, Label, PersonalProject, ProjectViewStyle, Section, Task, User, WorkspaceProject } from './entities';
|
|
3
3
|
/**
|
|
4
4
|
* Arguments for creating a new task.
|
|
5
5
|
* @see https://todoist.com/api/v1/docs#tag/Tasks/operation/create_task_api_v1_tasks_post
|
|
@@ -91,30 +91,6 @@ export type QuickAddTaskArgs = {
|
|
|
91
91
|
* Response from quick adding a task.
|
|
92
92
|
* @see https://todoist.com/api/v1/docs#tag/Tasks/operation/quick_add_api_v1_tasks_quick_post
|
|
93
93
|
*/
|
|
94
|
-
export type SyncTask = {
|
|
95
|
-
id: string;
|
|
96
|
-
projectId: string;
|
|
97
|
-
content: string;
|
|
98
|
-
description: string;
|
|
99
|
-
priority: number;
|
|
100
|
-
sectionId: string | null;
|
|
101
|
-
parentId: string | null;
|
|
102
|
-
childOrder: number;
|
|
103
|
-
labels: string[];
|
|
104
|
-
assignedByUid: string | null;
|
|
105
|
-
responsibleUid: string | null;
|
|
106
|
-
checked: boolean;
|
|
107
|
-
addedAt: string;
|
|
108
|
-
addedByUid: string | null;
|
|
109
|
-
duration: Duration | null;
|
|
110
|
-
due: DueDate | null;
|
|
111
|
-
deadline: Deadline | null;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Response from quick adding a task.
|
|
115
|
-
* @see https://todoist.com/api/v1/docs#tag/Tasks/operation/quick_add_api_v1_tasks_quick_post
|
|
116
|
-
*/
|
|
117
|
-
export type QuickAddTaskResponse = SyncTask;
|
|
118
94
|
/**
|
|
119
95
|
* Arguments for moving a task.
|
|
120
96
|
* @see https://todoist.com/api/v1/docs#tag/Tasks/operation/move_task_api_v1_tasks__task_id__move_post
|
|
@@ -137,7 +113,7 @@ export type GetProjectsArgs = {
|
|
|
137
113
|
* @see https://todoist.com/api/v1/docs#tag/Projects/operation/get_projects_api_v1_projects_get
|
|
138
114
|
*/
|
|
139
115
|
export type GetProjectsResponse = {
|
|
140
|
-
results:
|
|
116
|
+
results: (PersonalProject | WorkspaceProject)[];
|
|
141
117
|
nextCursor: string | null;
|
|
142
118
|
};
|
|
143
119
|
/**
|
package/dist/types/sync.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Task } from './entities';
|
|
2
2
|
export type Command = {
|
|
3
3
|
type: string;
|
|
4
4
|
uuid: string;
|
|
@@ -16,6 +16,6 @@ export type SyncRequest = {
|
|
|
16
16
|
resource_types?: string[];
|
|
17
17
|
};
|
|
18
18
|
export type SyncResponse = {
|
|
19
|
-
items?:
|
|
19
|
+
items?: Task[];
|
|
20
20
|
sync_status?: Record<string, 'ok' | SyncError>;
|
|
21
21
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the URL for a given task.
|
|
3
|
+
*
|
|
4
|
+
* @param taskId The ID of the task.
|
|
5
|
+
* @param content The content of the task.
|
|
6
|
+
* @returns The URL string for the task view.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTaskUrl(taskId: string, content?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate the URL for a given project.
|
|
11
|
+
*
|
|
12
|
+
* @param projectId The ID of the project.
|
|
13
|
+
* @param name The name of the project.
|
|
14
|
+
* @returns The URL string for the project view.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getProjectUrl(projectId: string, name?: string): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectUrl = exports.getTaskUrl = void 0;
|
|
4
|
+
var endpoints_1 = require("../consts/endpoints");
|
|
5
|
+
/**
|
|
6
|
+
* Generate the URL for a given task.
|
|
7
|
+
*
|
|
8
|
+
* @param taskId The ID of the task.
|
|
9
|
+
* @param content The content of the task.
|
|
10
|
+
* @returns The URL string for the task view.
|
|
11
|
+
*/
|
|
12
|
+
function getTaskUrl(taskId, content) {
|
|
13
|
+
var slug = content ? slugify(content) : undefined;
|
|
14
|
+
var path = slug ? "".concat(slug, "-").concat(taskId) : taskId;
|
|
15
|
+
return "".concat(endpoints_1.TODOIST_WEB_URI, "/task/").concat(path);
|
|
16
|
+
}
|
|
17
|
+
exports.getTaskUrl = getTaskUrl;
|
|
18
|
+
/**
|
|
19
|
+
* Generate the URL for a given project.
|
|
20
|
+
*
|
|
21
|
+
* @param projectId The ID of the project.
|
|
22
|
+
* @param name The name of the project.
|
|
23
|
+
* @returns The URL string for the project view.
|
|
24
|
+
*/
|
|
25
|
+
function getProjectUrl(projectId, name) {
|
|
26
|
+
var slug = name ? slugify(name) : undefined;
|
|
27
|
+
var path = slug ? "".concat(slug, "-").concat(projectId) : projectId;
|
|
28
|
+
return "".concat(endpoints_1.TODOIST_WEB_URI, "/project/").concat(path);
|
|
29
|
+
}
|
|
30
|
+
exports.getProjectUrl = getProjectUrl;
|
|
31
|
+
/**
|
|
32
|
+
* Slugify function borrowed from Django.
|
|
33
|
+
*
|
|
34
|
+
* @param value The string to slugify.
|
|
35
|
+
* @returns The slugified string.
|
|
36
|
+
*/
|
|
37
|
+
function slugify(value) {
|
|
38
|
+
// Convert to ASCII
|
|
39
|
+
var result = value.normalize('NFKD').replace(/[\u0300-\u036f]/g, '');
|
|
40
|
+
// Remove non-ASCII characters
|
|
41
|
+
result = result.replace(/[^\x20-\x7E]/g, '');
|
|
42
|
+
// Convert to lowercase and replace non-alphanumeric characters with dashes
|
|
43
|
+
result = result.toLowerCase().replace(/[^\w\s-]/g, '');
|
|
44
|
+
// Replace spaces and repeated dashes with single dashes
|
|
45
|
+
result = result.replace(/[-\s]+/g, '-');
|
|
46
|
+
// Strip dashes from the beginning and end
|
|
47
|
+
return result.replace(/^-+|-+$/g, '');
|
|
48
|
+
}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { type Task, type
|
|
1
|
+
import { type Task, type Section, type Label, type Comment, type User, type WorkspaceProject, type PersonalProject } from '../types/entities';
|
|
2
2
|
export declare function validateTask(input: unknown): Task;
|
|
3
3
|
export declare function validateTaskArray(input: unknown[]): Task[];
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Type guard to check if a project is a workspace project.
|
|
6
|
+
* @param project The project to check
|
|
7
|
+
* @returns True if the project is a workspace project
|
|
8
|
+
*/
|
|
9
|
+
export declare function isWorkspaceProject(project: PersonalProject | WorkspaceProject): project is WorkspaceProject;
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if a project is a personal project.
|
|
12
|
+
* @param project The project to check
|
|
13
|
+
* @returns True if the project is a personal project
|
|
14
|
+
*/
|
|
15
|
+
export declare function isPersonalProject(project: PersonalProject | WorkspaceProject): project is PersonalProject;
|
|
16
|
+
/**
|
|
17
|
+
* Validates and parses a project input.
|
|
18
|
+
* @param input The input to validate
|
|
19
|
+
* @returns A validated project (either PersonalProject or WorkspaceProject)
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateProject(input: unknown): PersonalProject | WorkspaceProject;
|
|
22
|
+
export declare function validateProjectArray(input: unknown[]): (PersonalProject | WorkspaceProject)[];
|
|
6
23
|
export declare function validateSection(input: unknown): Section;
|
|
7
24
|
export declare function validateSectionArray(input: unknown[]): Section[];
|
|
8
25
|
export declare function validateLabel(input: unknown): Label;
|
package/dist/utils/validators.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateUserArray = exports.validateUser = exports.validateCommentArray = exports.validateComment = exports.validateLabelArray = exports.validateLabel = exports.validateSectionArray = exports.validateSection = exports.validateProjectArray = exports.validateProject = exports.validateTaskArray = exports.validateTask = void 0;
|
|
3
|
+
exports.validateUserArray = exports.validateUser = exports.validateCommentArray = exports.validateComment = exports.validateLabelArray = exports.validateLabel = exports.validateSectionArray = exports.validateSection = exports.validateProjectArray = exports.validateProject = exports.isPersonalProject = exports.isWorkspaceProject = exports.validateTaskArray = exports.validateTask = void 0;
|
|
4
4
|
var entities_1 = require("../types/entities");
|
|
5
|
-
var projectConverter_1 = require("./projectConverter");
|
|
6
|
-
var taskConverters_1 = require("./taskConverters");
|
|
7
5
|
function validateTask(input) {
|
|
8
|
-
var rawTaskParse = entities_1.RawTaskSchema.safeParse(input);
|
|
9
|
-
if (rawTaskParse.success) {
|
|
10
|
-
var task = (0, taskConverters_1.getTaskFromRawTaskResponse)(rawTaskParse.data);
|
|
11
|
-
return task;
|
|
12
|
-
}
|
|
13
6
|
return entities_1.TaskSchema.parse(input);
|
|
14
7
|
}
|
|
15
8
|
exports.validateTask = validateTask;
|
|
@@ -17,13 +10,34 @@ function validateTaskArray(input) {
|
|
|
17
10
|
return input.map(validateTask);
|
|
18
11
|
}
|
|
19
12
|
exports.validateTaskArray = validateTaskArray;
|
|
13
|
+
/**
|
|
14
|
+
* Type guard to check if a project is a workspace project.
|
|
15
|
+
* @param project The project to check
|
|
16
|
+
* @returns True if the project is a workspace project
|
|
17
|
+
*/
|
|
18
|
+
function isWorkspaceProject(project) {
|
|
19
|
+
return 'workspaceId' in project;
|
|
20
|
+
}
|
|
21
|
+
exports.isWorkspaceProject = isWorkspaceProject;
|
|
22
|
+
/**
|
|
23
|
+
* Type guard to check if a project is a personal project.
|
|
24
|
+
* @param project The project to check
|
|
25
|
+
* @returns True if the project is a personal project
|
|
26
|
+
*/
|
|
27
|
+
function isPersonalProject(project) {
|
|
28
|
+
return !isWorkspaceProject(project);
|
|
29
|
+
}
|
|
30
|
+
exports.isPersonalProject = isPersonalProject;
|
|
31
|
+
/**
|
|
32
|
+
* Validates and parses a project input.
|
|
33
|
+
* @param input The input to validate
|
|
34
|
+
* @returns A validated project (either PersonalProject or WorkspaceProject)
|
|
35
|
+
*/
|
|
20
36
|
function validateProject(input) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var project = (0, projectConverter_1.getProjectFromRawProjectResponse)(rawProjectParse.data);
|
|
24
|
-
return project;
|
|
37
|
+
if ('workspaceId' in input) {
|
|
38
|
+
return entities_1.WorkspaceProjectSchema.parse(input);
|
|
25
39
|
}
|
|
26
|
-
return entities_1.
|
|
40
|
+
return entities_1.PersonalProjectSchema.parse(input);
|
|
27
41
|
}
|
|
28
42
|
exports.validateProject = validateProject;
|
|
29
43
|
function validateProjectArray(input) {
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProjectFromRawProjectResponse = void 0;
|
|
4
|
-
var showProjectEndpoint = 'https://todoist.com/showProject';
|
|
5
|
-
function getProjectUrlFromProjectId(projectId) {
|
|
6
|
-
return "".concat(showProjectEndpoint, "?id=").concat(projectId);
|
|
7
|
-
}
|
|
8
|
-
function getProjectFromRawProjectResponse(responseData) {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
var project = {
|
|
11
|
-
id: responseData.id,
|
|
12
|
-
parentId: (_a = responseData.parentId) !== null && _a !== void 0 ? _a : null, // workspace projects do not have a parent
|
|
13
|
-
order: responseData.childOrder,
|
|
14
|
-
color: responseData.color,
|
|
15
|
-
name: responseData.name,
|
|
16
|
-
isShared: responseData.isShared,
|
|
17
|
-
isFavorite: responseData.isFavorite,
|
|
18
|
-
isInboxProject: (_b = responseData.inboxProject) !== null && _b !== void 0 ? _b : false, // workspace projects do not set this flag
|
|
19
|
-
isTeamInbox: false, // this flag is no longer used
|
|
20
|
-
url: getProjectUrlFromProjectId(responseData.id),
|
|
21
|
-
viewStyle: responseData.viewStyle,
|
|
22
|
-
};
|
|
23
|
-
return project;
|
|
24
|
-
}
|
|
25
|
-
exports.getProjectFromRawProjectResponse = getProjectFromRawProjectResponse;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTaskFromRawTaskResponse = exports.getTaskFromQuickAddResponse = void 0;
|
|
4
|
-
var showTaskEndpoint = 'https://todoist.com/showTask';
|
|
5
|
-
function getTaskUrlFromTaskId(taskId) {
|
|
6
|
-
return "".concat(showTaskEndpoint, "?id=").concat(taskId);
|
|
7
|
-
}
|
|
8
|
-
function getTaskFromQuickAddResponse(responseData) {
|
|
9
|
-
var _a;
|
|
10
|
-
var task = {
|
|
11
|
-
id: responseData.id,
|
|
12
|
-
order: responseData.childOrder,
|
|
13
|
-
content: responseData.content,
|
|
14
|
-
description: responseData.description,
|
|
15
|
-
projectId: responseData.projectId,
|
|
16
|
-
sectionId: responseData.sectionId,
|
|
17
|
-
isCompleted: responseData.checked,
|
|
18
|
-
labels: responseData.labels,
|
|
19
|
-
priority: responseData.priority,
|
|
20
|
-
createdAt: responseData.addedAt,
|
|
21
|
-
url: getTaskUrlFromTaskId(responseData.id),
|
|
22
|
-
creatorId: (_a = responseData.addedByUid) !== null && _a !== void 0 ? _a : '',
|
|
23
|
-
parentId: responseData.parentId,
|
|
24
|
-
duration: responseData.duration,
|
|
25
|
-
assignerId: responseData.assignedByUid,
|
|
26
|
-
assigneeId: responseData.responsibleUid,
|
|
27
|
-
deadline: responseData.deadline,
|
|
28
|
-
due: responseData.due,
|
|
29
|
-
};
|
|
30
|
-
return task;
|
|
31
|
-
}
|
|
32
|
-
exports.getTaskFromQuickAddResponse = getTaskFromQuickAddResponse;
|
|
33
|
-
function getTaskFromRawTaskResponse(responseData) {
|
|
34
|
-
var _a;
|
|
35
|
-
var task = {
|
|
36
|
-
id: responseData.id,
|
|
37
|
-
assignerId: responseData.assignedByUid,
|
|
38
|
-
assigneeId: responseData.responsibleUid,
|
|
39
|
-
projectId: responseData.projectId,
|
|
40
|
-
sectionId: responseData.sectionId,
|
|
41
|
-
parentId: responseData.parentId,
|
|
42
|
-
order: responseData.childOrder,
|
|
43
|
-
content: responseData.content,
|
|
44
|
-
description: responseData.description,
|
|
45
|
-
isCompleted: responseData.checked,
|
|
46
|
-
labels: responseData.labels,
|
|
47
|
-
priority: responseData.priority,
|
|
48
|
-
creatorId: (_a = responseData.addedByUid) !== null && _a !== void 0 ? _a : '',
|
|
49
|
-
createdAt: responseData.addedAt,
|
|
50
|
-
due: responseData.due,
|
|
51
|
-
url: getTaskUrlFromTaskId(responseData.id),
|
|
52
|
-
duration: responseData.duration,
|
|
53
|
-
deadline: responseData.deadline,
|
|
54
|
-
};
|
|
55
|
-
return task;
|
|
56
|
-
}
|
|
57
|
-
exports.getTaskFromRawTaskResponse = getTaskFromRawTaskResponse;
|