@pipedream/todoist 0.2.2 → 0.3.1

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.
Files changed (53) hide show
  1. package/actions/create-filter/create-filter.mjs +3 -5
  2. package/actions/create-label/create-label.mjs +3 -3
  3. package/actions/create-project/create-project.mjs +3 -3
  4. package/actions/create-project-comment/create-project-comment.mjs +2 -2
  5. package/actions/create-section/create-section.mjs +2 -2
  6. package/actions/create-task/create-task.mjs +3 -2
  7. package/actions/create-task-comment/create-task-comment.mjs +2 -2
  8. package/actions/delete-comment/delete-comment.mjs +2 -2
  9. package/actions/delete-filter/delete-filter.mjs +2 -2
  10. package/actions/delete-label/delete-label.mjs +2 -2
  11. package/actions/delete-project/delete-project.mjs +2 -2
  12. package/actions/delete-section/delete-section.mjs +2 -2
  13. package/actions/delete-task/delete-task.mjs +2 -2
  14. package/actions/export-tasks/export-tasks.mjs +5 -5
  15. package/actions/find-project/find-project.mjs +2 -2
  16. package/actions/find-task/find-task.mjs +4 -4
  17. package/actions/find-user/find-user.mjs +2 -2
  18. package/actions/get-label/get-label.mjs +2 -2
  19. package/actions/get-project/get-project.mjs +2 -2
  20. package/actions/get-project-comment/get-project-comment.mjs +2 -2
  21. package/actions/get-section/get-section.mjs +2 -2
  22. package/actions/get-task/get-task.mjs +2 -2
  23. package/actions/get-task-comment/get-task-comment.mjs +2 -2
  24. package/actions/import-tasks/import-tasks.mjs +2 -2
  25. package/actions/invite-user-to-project/invite-user-to-project.mjs +2 -2
  26. package/actions/list-filters/list-filters.mjs +2 -2
  27. package/actions/list-labels/list-labels.mjs +4 -4
  28. package/actions/list-project-comments/list-project-comments.mjs +4 -4
  29. package/actions/list-projects/list-projects.mjs +4 -5
  30. package/actions/list-sections/list-sections.mjs +4 -4
  31. package/actions/list-task-comments/list-task-comments.mjs +4 -4
  32. package/actions/list-uncompleted-tasks/list-uncompleted-tasks.mjs +4 -4
  33. package/actions/mark-task-completed/mark-task-completed.mjs +2 -2
  34. package/actions/move-task-to-section/move-task-to-section.mjs +2 -2
  35. package/actions/search-tasks/search-tasks.mjs +6 -6
  36. package/actions/uncomplete-task/uncomplete-task.mjs +2 -2
  37. package/actions/update-comment/update-comment.mjs +2 -2
  38. package/actions/update-filter/update-filter.mjs +3 -5
  39. package/actions/update-label/update-label.mjs +3 -3
  40. package/actions/update-project/update-project.mjs +3 -3
  41. package/actions/update-section/update-section.mjs +2 -2
  42. package/actions/update-task/update-task.mjs +2 -2
  43. package/common/colors.mjs +50 -0
  44. package/package.json +1 -1
  45. package/sources/completed-task/completed-task.mjs +10 -10
  46. package/sources/incomplete-task/incomplete-task.mjs +2 -2
  47. package/sources/new-or-modified-project/new-or-modified-project.mjs +2 -2
  48. package/sources/new-or-modified-task/new-or-modified-task.mjs +2 -2
  49. package/sources/new-project/new-project.mjs +2 -2
  50. package/sources/new-section/new-section.mjs +2 -2
  51. package/sources/new-task/new-task.mjs +2 -2
  52. package/sources/sync-resources/sync-resources.mjs +2 -2
  53. package/todoist.app.mjs +64 -26
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-create-filter",
5
5
  name: "Create Filter",
6
- description: "Creates a filter. [See the docs here](https://developer.todoist.com/sync/v9/#add-a-filter)",
7
- version: "0.0.4",
6
+ description: "Creates a filter. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Filters/Add-a-filter)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -57,9 +57,7 @@ export default {
57
57
  query,
58
58
  color,
59
59
  item_order: order,
60
- is_favorite: favorite
61
- ? 1
62
- : 0,
60
+ is_favorite: favorite,
63
61
  };
64
62
  const resp = await this.todoist.createFilter({
65
63
  $,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-create-label",
5
5
  name: "Create Label",
6
- description: "Creates a label. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-personal-label)",
7
- version: "0.0.4",
6
+ description: "Creates a label. [See the documentation](https://developer.todoist.com/api/v1#tag/Labels/operation/create_label_api_v1_labels_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -49,7 +49,7 @@ export default {
49
49
  name,
50
50
  order,
51
51
  color,
52
- favorite,
52
+ is_favorite: favorite,
53
53
  };
54
54
  const resp = await this.todoist.createLabel({
55
55
  $,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-create-project",
5
5
  name: "Create Project",
6
- description: "Creates a project. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-project)",
7
- version: "0.0.4",
6
+ description: "Creates a project. [See the documentation](https://developer.todoist.com/api/v1#tag/Projects/operation/create_project_api_v1_projects_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -50,7 +50,7 @@ export default {
50
50
  name,
51
51
  parent_id: parent,
52
52
  color,
53
- favorite,
53
+ is_favorite: favorite,
54
54
  };
55
55
  const resp = await this.todoist.createProject({
56
56
  $,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-create-project-comment",
5
5
  name: "Create Project Comment",
6
- description: "Adds a comment to a project. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-comment)",
7
- version: "0.0.4",
6
+ description: "Adds a comment to a project. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/create_comment_api_v1_comments_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-create-section",
5
5
  name: "Create Section",
6
- description: "Creates a section. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-section)",
7
- version: "0.0.4",
6
+ description: "Creates a section. [See the documentation](https://developer.todoist.com/api/v1#tag/Sections/operation/create_section_api_v1_sections_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-create-task",
5
5
  name: "Create Task",
6
- description: "Creates a task. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-task)",
7
- version: "0.0.6",
6
+ description: "Creates a task. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/create_task_api_v1_tasks_post)",
7
+ version: "0.0.8",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -13,6 +13,7 @@ export default {
13
13
  type: "action",
14
14
  props: {
15
15
  todoist,
16
+ // eslint-disable-next-line pipedream/props-label, pipedream/props-description
16
17
  recurringInfoLabel: {
17
18
  type: "alert",
18
19
  alertType: "info",
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-create-task-comment",
5
5
  name: "Create Task Comment",
6
- description: "Adds a comment to a task. [See the docs here](https://developer.todoist.com/rest/v2/#create-a-new-comment)",
7
- version: "0.0.4",
6
+ description: "Adds a comment to a task. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/create_comment_api_v1_comments_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-delete-comment",
5
5
  name: "Delete Comment",
6
- description: "Deletes a comment. [See the docs here](https://developer.todoist.com/rest/v2/#delete-a-comment)",
7
- version: "0.0.4",
6
+ description: "Deletes a comment. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/delete_comment_api_v1_comments__comment_id__delete)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-delete-filter",
5
5
  name: "Delete Filter",
6
- description: "Deletes a filter. [See the docs here](https://developer.todoist.com/sync/v9/#delete-a-filter)",
7
- version: "0.0.4",
6
+ description: "Deletes a filter. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Filters/Delete-a-filter)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-delete-label",
5
5
  name: "Delete Label",
6
- description: "Deletes a label. [See the docs here](https://developer.todoist.com/rest/v2/#delete-a-personal-label)",
7
- version: "0.0.4",
6
+ description: "Deletes a label. [See the documentation](https://developer.todoist.com/api/v1#tag/Labels/operation/delete_label_api_v1_labels__label_id__delete)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-delete-project",
5
5
  name: "Delete Project",
6
- description: "Deletes a project. [See the docs here](https://developer.todoist.com/rest/v2/#delete-a-project)",
7
- version: "0.0.4",
6
+ description: "Deletes a project. [See the documentation](https://developer.todoist.com/api/v1#tag/Projects/operation/delete_project_api_v1_projects__project_id__delete)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-delete-section",
5
5
  name: "Delete Section",
6
- description: "Deletes a section. [See the docs here](https://developer.todoist.com/rest/v2/#delete-a-section)",
7
- version: "0.0.4",
6
+ description: "Deletes a section. [See the documentation](https://developer.todoist.com/api/v1#tag/Sections/operation/delete_section_api_v1_sections__section_id__delete)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-delete-task",
5
5
  name: "Delete Task",
6
- description: "Deletes a task. [See the docs here](https://developer.todoist.com/rest/v2/#delete-a-task)",
7
- version: "0.0.4",
6
+ description: "Deletes a task. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/delete_task_api_v1_tasks__task_id__delete)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -6,8 +6,8 @@ import converter from "json-2-csv";
6
6
  export default {
7
7
  key: "todoist-export-tasks",
8
8
  name: "Export Tasks",
9
- description: "Export project task names as comma separated file. Returns path to new file. [See Docs](https://developer.todoist.com/rest/v2/#get-active-tasks)",
10
- version: "0.1.2",
9
+ description: "Export project task names as comma separated file. Returns path to new file. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/get_tasks_api_v1_tasks_get)",
10
+ version: "0.1.4",
11
11
  annotations: {
12
12
  destructiveHint: false,
13
13
  openWorldHint: true,
@@ -31,20 +31,20 @@ export default {
31
31
  async run ({ $ }) {
32
32
  const { project } = this;
33
33
 
34
- const tasks = await this.todoist.getActiveTasks({
34
+ const resp = await this.todoist.getActiveTasks({
35
35
  $,
36
36
  params: {
37
37
  project_id: project,
38
38
  },
39
39
  });
40
- const csv = converter.json2csv(tasks);
40
+ const csv = converter.json2csv(resp?.results);
41
41
 
42
42
  const { path } = await file({
43
43
  postfix: ".csv",
44
44
  });
45
45
  await fs.promises.appendFile(path, Buffer.from(csv));
46
46
 
47
- $.export("$summary", `Successfully exported ${tasks.length} task${tasks.length === 1
47
+ $.export("$summary", `Successfully exported ${resp?.results?.length} task${resp?.results?.length === 1
48
48
  ? ""
49
49
  : "s"} to "${path}"`);
50
50
  return path;
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-find-project",
5
5
  name: "Find Project",
6
- description: "Finds a project (by name/title). [See Docs](https://developer.todoist.com/rest/v2/#get-all-projects) Optionally, create one if none are found. [See Docs](https://developer.todoist.com/rest/v2/#create-a-new-project)",
7
- version: "0.0.4",
6
+ description: "Finds a project (by name/title). [See the documentation](https://developer.todoist.com/api/v1#tag/Projects/operation/get_projects_api_v1_projects_get) Optionally, create one if none are found. [See the documentation](https://developer.todoist.com/api/v1#tag/Projects/operation/create_project_api_v1_projects_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-find-task",
5
5
  name: "Find Task",
6
- description: "Finds a task by name. [See Docs](https://developer.todoist.com/rest/v2/#get-active-tasks) Optionally, create one if none are found. [See Docs](https://developer.todoist.com/rest/v2/#create-a-new-task)",
7
- version: "0.0.4",
6
+ description: "Finds a task by name. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/get_tasks_api_v1_tasks_get) Optionally, create one if none are found. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/create_task_api_v1_tasks_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -39,13 +39,13 @@ export default {
39
39
  content,
40
40
  createIfNotFound,
41
41
  } = this;
42
- const tasks = await this.todoist.getActiveTasks({
42
+ const resp = await this.todoist.getActiveTasks({
43
43
  $,
44
44
  params: {
45
45
  project_id: project,
46
46
  },
47
47
  });
48
- let result = tasks.find((task) => task.content == content);
48
+ let result = resp?.results?.find((task) => task?.content == content);
49
49
  let summary = result
50
50
  ? "Task found"
51
51
  : "Task not found";
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-find-user",
5
5
  name: "Find User",
6
- description: "Searches by email for a user who is connected/shared with your account. [See the docs here](https://developer.todoist.com/sync/v9/#read-resources)",
7
- version: "0.0.4",
6
+ description: "Searches by email for a user who is connected/shared with your account. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-get-label",
5
5
  name: "Get Label",
6
- description: "Returns info about a label. [See the docs here](https://developer.todoist.com/rest/v2/#get-a-personal-label)",
7
- version: "0.0.4",
6
+ description: "Returns info about a label. [See the documentation](https://developer.todoist.com/api/v1#tag/Labels/operation/get_label_api_v1_labels__label_id__get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-get-project",
5
5
  name: "Get Project",
6
- description: "Returns info about a project. [See the docs here](https://developer.todoist.com/rest/v2/#get-a-project)",
7
- version: "0.0.4",
6
+ description: "Returns info about a project. [See the documentation](https://developer.todoist.com/api/v1#tag/Projects/operation/get_project_api_v1_projects__project_id__get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-get-project-comment",
5
5
  name: "Get Project Comment",
6
- description: "Returns info about a project comment. [See the docs here](https://developer.todoist.com/rest/v2/#get-a-comment)",
7
- version: "0.0.4",
6
+ description: "Returns info about a project comment. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/get_comment_api_v1_comments__comment_id__get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-get-section",
5
5
  name: "Get Section",
6
- description: "Returns info about a section. [See the docs here](https://developer.todoist.com/rest/v2/#get-a-single-section)",
7
- version: "0.0.4",
6
+ description: "Returns info about a section. [See the documentation](https://developer.todoist.com/api/v1#tag/Sections/operation/get_section_api_v1_sections__section_id__get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-get-task",
5
5
  name: "Get Task",
6
- description: "Returns info about a task. [See the docs here](https://developer.todoist.com/rest/v2/#get-an-active-task)",
7
- version: "0.0.4",
6
+ description: "Returns info about a task. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/get_task_api_v1_tasks__task_id__get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-get-task-comment",
5
5
  name: "Get Task Comment",
6
- description: "Returns info about a task comment. [See the docs here](https://developer.todoist.com/rest/v2/#get-a-comment)",
7
- version: "0.0.4",
6
+ description: "Returns info about a task comment. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/get_comment_api_v1_comments__comment_id__get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -5,8 +5,8 @@ import { getFileStream } from "@pipedream/platform";
5
5
  export default {
6
6
  key: "todoist-import-tasks",
7
7
  name: "Import Tasks",
8
- description: "Import tasks into a selected project. [See Docs](https://developer.todoist.com/sync/v9/#add-an-item)",
9
- version: "0.1.2",
8
+ description: "Import tasks into a selected project. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/create_task_api_v1_tasks_post)",
9
+ version: "0.1.4",
10
10
  annotations: {
11
11
  destructiveHint: true,
12
12
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-invite-user-to-project",
5
5
  name: "Invite User To Project",
6
- description: "Sends email to a person, inviting them to use one of your projects. [See the docs here](https://developer.todoist.com/sync/v9/#share-a-project)",
7
- version: "0.0.4",
6
+ description: "Sends email to a person, inviting them to use one of your projects. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Sharing/Share-a-project)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-list-filters",
5
5
  name: "List Filters",
6
- description: "Returns a list of all filters. [See the docs here](https://developer.todoist.com/sync/v9/#read-resources)",
7
- version: "0.0.4",
6
+ description: "Returns a list of all filters. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-list-labels",
5
5
  name: "List Labels",
6
- description: "Returns a list of all labels. [See the docs here](https://developer.todoist.com/rest/v2/#get-all-personal-labels)",
7
- version: "0.0.4",
6
+ description: "Returns a list of all labels. [See the documentation](https://developer.todoist.com/api/v1#tag/Labels/operation/get_labels_api_v1_labels_get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -18,9 +18,9 @@ export default {
18
18
  const resp = await this.todoist.getLabels({
19
19
  $,
20
20
  });
21
- $.export("$summary", `Successfully retrieved ${resp.length} label${resp.length === 1
21
+ $.export("$summary", `Successfully retrieved ${resp?.results?.length} label${resp?.results?.length === 1
22
22
  ? ""
23
23
  : "s"}`);
24
- return resp;
24
+ return resp?.results;
25
25
  },
26
26
  };
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-list-project-comments",
5
5
  name: "List Project Comments",
6
- description: "Returns a list of comments for a project. [See the docs here](https://developer.todoist.com/rest/v2/#get-all-comments)",
7
- version: "0.0.4",
6
+ description: "Returns a list of comments for a project. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/get_comments_api_v1_comments_get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -29,9 +29,9 @@ export default {
29
29
  $,
30
30
  params,
31
31
  });
32
- $.export("$summary", `Successfully retrieved ${resp.length} comment${resp.length === 1
32
+ $.export("$summary", `Successfully retrieved ${resp?.results?.length} comment${resp?.results?.length === 1
33
33
  ? ""
34
34
  : "s"}`);
35
- return resp;
35
+ return resp?.results;
36
36
  },
37
37
  };
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-list-projects",
5
5
  name: "List Projects",
6
- description: "Returns a list of all projects. [See the docs here](https://developer.todoist.com/rest/v2/#get-all-projects)",
7
- version: "0.0.4",
6
+ description: "Returns a list of all projects. [See the documentation](https://developer.todoist.com/api/v1#tag/Projects/operation/get_projects_api_v1_projects_get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -18,10 +18,9 @@ export default {
18
18
  const resp = await this.todoist.getProjects({
19
19
  $,
20
20
  });
21
- $.export("$summary", "Successfully retrieved projects");
22
- $.export("$summary", `Successfully retrieved ${resp.length} project${resp.length === 1
21
+ $.export("$summary", `Successfully retrieved ${resp?.results?.length} project${resp?.results?.length === 1
23
22
  ? ""
24
23
  : "s"}`);
25
- return resp;
24
+ return resp?.results;
26
25
  },
27
26
  };
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-list-sections",
5
5
  name: "List Sections",
6
- description: "Returns a list of all sections. [See the docs here](https://developer.todoist.com/rest/v2/#get-all-sections)",
7
- version: "0.0.4",
6
+ description: "Returns a list of all sections. [See the documentation](https://developer.todoist.com/api/v1#tag/Sections/operation/get_sections_api_v1_sections_get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -28,9 +28,9 @@ export default {
28
28
  $,
29
29
  params,
30
30
  });
31
- $.export("$summary", `Successfully retrieved ${resp.length} section${resp.length === 1
31
+ $.export("$summary", `Successfully retrieved ${resp?.results?.length} section${resp?.results?.length === 1
32
32
  ? ""
33
33
  : "s"}`);
34
- return resp;
34
+ return resp?.results;
35
35
  },
36
36
  };
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-list-task-comments",
5
5
  name: "List Task Comments",
6
- description: "Returns a list of comments for a task. [See the docs here](https://developer.todoist.com/rest/v2/#get-all-comments)",
7
- version: "0.0.4",
6
+ description: "Returns a list of comments for a task. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/get_comments_api_v1_comments_get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -37,9 +37,9 @@ export default {
37
37
  $,
38
38
  params,
39
39
  });
40
- $.export("$summary", `Successfully retrieved ${resp.length} comment${resp.length === 1
40
+ $.export("$summary", `Successfully retrieved ${resp?.results?.length} comment${resp?.results?.length === 1
41
41
  ? ""
42
42
  : "s"}`);
43
- return resp;
43
+ return resp?.results;
44
44
  },
45
45
  };
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-list-uncompleted-tasks",
5
5
  name: "List Uncompleted Tasks",
6
- description: "Returns a list of uncompleted tasks by project, section, and/or label. [See the docs here](https://developer.todoist.com/rest/v2/#get-active-tasks)",
7
- version: "0.0.4",
6
+ description: "Returns a list of uncompleted tasks by project, section, and/or label. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/get_tasks_api_v1_tasks_get)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -50,9 +50,9 @@ export default {
50
50
  $,
51
51
  params,
52
52
  });
53
- $.export("$summary", `Successfully retrieved ${resp.length} task${resp.length === 1
53
+ $.export("$summary", `Successfully retrieved ${resp?.results?.length} task${resp?.results?.length === 1
54
54
  ? ""
55
55
  : "s"}`);
56
- return resp;
56
+ return resp?.results;
57
57
  },
58
58
  };
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-mark-task-completed",
5
5
  name: "Mark Task as Completed",
6
- description: "Marks a task as being completed. [See the docs here](https://developer.todoist.com/rest/v2/#close-a-task)",
7
- version: "0.0.4",
6
+ description: "Marks a task as being completed. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/close_task_api_v1_tasks__task_id__close_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-move-task-to-section",
5
5
  name: "Move Task To Section",
6
- description: "Move a Task to a different section within the same project. [See the docs here](https://developer.todoist.com/sync/v9/#move-an-item)",
7
- version: "0.0.4",
6
+ description: "Move a Task to a different section within the same project. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/move_task_api_v1_tasks__task_id__move_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-search-tasks",
5
5
  name: "Search Tasks",
6
- description: "Search tasks by name, label, project and/or section. [See Docs](https://developer.todoist.com/rest/v2/#get-active-tasks)",
7
- version: "0.0.3",
6
+ description: "Search tasks by name, label, project and/or section. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/get_tasks_api_v1_tasks_get)",
7
+ version: "0.0.5",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -51,7 +51,7 @@ export default {
51
51
  project,
52
52
  section,
53
53
  } = this;
54
- const tasks = await this.todoist.getActiveTasks({
54
+ const resp = await this.todoist.getActiveTasks({
55
55
  $,
56
56
  params: {
57
57
  label,
@@ -60,9 +60,9 @@ export default {
60
60
  },
61
61
  });
62
62
  let result = name
63
- ? tasks.filter((task) => task.content.includes(name))
64
- : tasks;
65
- let summary = `${result.length} task${result.length == 1
63
+ ? resp?.results?.filter((task) => task?.content?.includes(name))
64
+ : resp?.results;
65
+ let summary = `${result?.length} task${result?.length == 1
66
66
  ? ""
67
67
  : "s"} found`;
68
68
  $.export("$summary", summary);
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-uncomplete-task",
5
5
  name: "Uncomplete Task",
6
- description: "Uncompletes a task. [See the docs here](https://developer.todoist.com/rest/v2/#reopen-a-task)",
7
- version: "0.0.4",
6
+ description: "Uncompletes a task. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/reopen_task_api_v1_tasks__task_id__reopen_post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-update-comment",
5
5
  name: "Update Comment",
6
- description: "Updates a comment. [See the docs here](https://developer.todoist.com/rest/v2/#update-a-comment)",
7
- version: "0.0.4",
6
+ description: "Updates a comment. [See the documentation](https://developer.todoist.com/api/v1#tag/Comments/operation/update_comment_api_v1_comments__comment_id__post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-update-filter",
5
5
  name: "Update Filter",
6
- description: "Updates a filter. [See the docs here](https://developer.todoist.com/sync/v9/#update-a-filter)",
7
- version: "0.0.4",
6
+ description: "Updates a filter. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Filters/Update-a-filter)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -67,9 +67,7 @@ export default {
67
67
  query,
68
68
  color,
69
69
  item_order: order,
70
- is_favorite: favorite
71
- ? 1
72
- : 0,
70
+ is_favorite: favorite,
73
71
  };
74
72
  const resp = await this.todoist.updateFilter({
75
73
  $,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-update-label",
5
5
  name: "Update Label",
6
- description: "Updates a label. [See the docs here](https://developer.todoist.com/rest/v2/#update-a-personal-label)",
7
- version: "0.0.4",
6
+ description: "Updates a label. [See the documentation](https://developer.todoist.com/api/v1#tag/Labels/operation/update_label_api_v1_labels__label_id__post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -59,7 +59,7 @@ export default {
59
59
  name,
60
60
  order,
61
61
  color,
62
- favorite,
62
+ is_favorite: favorite,
63
63
  };
64
64
  // No interesting data is returned from Todoist
65
65
  await this.todoist.updateLabel({
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-update-project",
5
5
  name: "Update Project",
6
- description: "Updates a project. [See the docs here](https://developer.todoist.com/rest/v2/#update-a-project)",
7
- version: "0.0.4",
6
+ description: "Updates a project. [See the documentation](https://developer.todoist.com/api/v1#tag/Projects/operation/update_project_api_v1_projects__project_id__post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -51,7 +51,7 @@ export default {
51
51
  projectId,
52
52
  name,
53
53
  color,
54
- favorite,
54
+ is_favorite: favorite,
55
55
  };
56
56
  // No interesting data is returned from Todoist
57
57
  await this.todoist.updateProject({
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-update-section",
5
5
  name: "Update Section",
6
- description: "Updates a section. [See the docs here](https://developer.todoist.com/rest/v2/#update-a-section)",
7
- version: "0.0.4",
6
+ description: "Updates a section. [See the documentation](https://developer.todoist.com/api/v1#tag/Sections/operation/update_section_api_v1_sections__section_id__post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -3,8 +3,8 @@ import todoist from "../../todoist.app.mjs";
3
3
  export default {
4
4
  key: "todoist-update-task",
5
5
  name: "Update Task",
6
- description: "Updates a task. [See the docs here](https://developer.todoist.com/rest/v2/#update-a-task)",
7
- version: "0.0.4",
6
+ description: "Updates a task. [See the documentation](https://developer.todoist.com/api/v1#tag/Tasks/operation/update_task_api_v1_tasks__task_id__post)",
7
+ version: "0.0.6",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
package/common/colors.mjs CHANGED
@@ -1,3 +1,48 @@
1
+ // Map of numeric IDs to v1 API color names
2
+ const COLOR_MAP = {
3
+ 30: "berry_red",
4
+ 31: "red",
5
+ 32: "orange",
6
+ 33: "yellow",
7
+ 34: "olive_green",
8
+ 35: "lime_green",
9
+ 36: "green",
10
+ 37: "mint_green",
11
+ 38: "teal",
12
+ 39: "sky_blue",
13
+ 40: "light_blue",
14
+ 41: "blue",
15
+ 42: "grape",
16
+ 43: "violet",
17
+ 44: "lavender",
18
+ 45: "magenta",
19
+ 46: "salmon",
20
+ 47: "charcoal",
21
+ 48: "grey",
22
+ 49: "taupe",
23
+ };
24
+
25
+ // Reverse mapping
26
+ const COLOR_NAME_TO_ID = Object.fromEntries(
27
+ Object.entries(COLOR_MAP).map(([
28
+ id,
29
+ name,
30
+ ]) => [
31
+ name,
32
+ parseInt(id),
33
+ ]),
34
+ );
35
+
36
+ // Helper functions
37
+ export function numericToString(numericColor) {
38
+ return COLOR_MAP[numericColor] || null;
39
+ }
40
+
41
+ export function stringToNumeric(colorName) {
42
+ return COLOR_NAME_TO_ID[colorName] || null;
43
+ }
44
+
45
+ // Original export for backward compatibility
1
46
  export default [
2
47
  {
3
48
  label: "Berry Red",
@@ -80,3 +125,8 @@ export default [
80
125
  value: 49,
81
126
  },
82
127
  ];
128
+
129
+ export {
130
+ COLOR_MAP,
131
+ COLOR_NAME_TO_ID,
132
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/todoist",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "Pipedream Todoist Components",
5
5
  "main": "todoist.app.mjs",
6
6
  "keywords": [
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-completed-task",
6
6
  name: "New Completed Task",
7
- description: "Emit new event for each completed task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "1.0.0",
7
+ description: "Emit new event for each completed task. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "1.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -18,18 +18,18 @@ export default {
18
18
  },
19
19
  async getSyncResult() {
20
20
  const lastDate = this._getLastDate();
21
- const items = await this.todoist.getCompletedTasks({
22
- params: {
23
- since: lastDate,
24
- annotate_items: true,
25
- },
21
+ const newDate = new Date().toISOString();
22
+ const params = {
23
+ since: lastDate || newDate,
24
+ until: newDate,
25
+ };
26
+ const response = await this.todoist.getCompletedTasks({
27
+ params,
26
28
  });
27
29
 
28
- const newDate = new Date().toISOString();
29
30
  this._setLastDate(newDate);
30
31
 
31
- console.log(items);
32
- return items;
32
+ return response.items ?? [];
33
33
  },
34
34
  filterResults(syncResult) {
35
35
  return syncResult
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-incomplete-task",
6
6
  name: "New Incomplete Task",
7
- description: "Emit new event for each new incomplete task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "0.1.0",
7
+ description: "Emit new event for each new incomplete task. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "0.1.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -4,7 +4,7 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-new-or-modified-project",
6
6
  name: "New or Modified Project",
7
- description: "Emit new event for each new or modified project. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "0.0.6",
7
+ description: "Emit new event for each new or modified project. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  };
@@ -4,7 +4,7 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-new-or-modified-task",
6
6
  name: "New or Modified Task",
7
- description: "Emit new event for each new or modified task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "0.0.6",
7
+ description: "Emit new event for each new or modified task. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  };
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-new-project",
6
6
  name: "New Project",
7
- description: "Emit new event for each new project. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "0.0.6",
7
+ description: "Emit new event for each new project. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  dedupe: "greatest",
11
11
  };
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-new-section",
6
6
  name: "New Section",
7
- description: "Emit new event for each new section added. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "0.0.6",
7
+ description: "Emit new event for each new section added. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  dedupe: "greatest",
11
11
  methods: {
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-new-task",
6
6
  name: "New Task",
7
- description: "Emit new event for each new task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "0.0.6",
7
+ description: "Emit new event for each new task. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  dedupe: "greatest",
11
11
  };
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "todoist-sync-resources",
6
6
  name: "New Sync Resources",
7
- description: "Emit new updates for your selected resources. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8
- version: "0.0.6",
7
+ description: "Emit new updates for your selected resources. [See the documentation](https://developer.todoist.com/api/v1#tag/Sync/Overview/Read-resources)",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
package/todoist.app.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { axios } from "@pipedream/platform";
2
2
  import querystring from "query-string";
3
3
  import resourceTypes from "./common/resource-types.mjs";
4
- import colors from "./common/colors.mjs";
4
+ import colors, { numericToString } from "./common/colors.mjs";
5
5
  import { v4 as uuid } from "uuid";
6
6
 
7
7
  export default {
@@ -24,10 +24,11 @@ export default {
24
24
  "Filter for events that match one or more projects. Leave this blank to emit results for any project.",
25
25
  optional: true,
26
26
  async options() {
27
- return (await this.getProjects({})).map((project) => ({
27
+ const { results } = await this.getProjects({});
28
+ return results?.map((project) => ({
28
29
  label: project.name,
29
30
  value: project.id,
30
- }));
31
+ })) || [];
31
32
  },
32
33
  },
33
34
  project: {
@@ -104,25 +105,28 @@ export default {
104
105
  async options({
105
106
  project, prevContext,
106
107
  }) {
107
- const { offset = 0 } = prevContext;
108
+ const { cursor } = prevContext;
108
109
  const limit = 30;
109
110
  const params = {
110
- offset,
111
111
  limit,
112
112
  };
113
+ if (cursor) {
114
+ params.cursor = cursor;
115
+ }
113
116
  if (project) {
114
117
  params.project_id = project;
115
118
  }
116
- const tasks = (await this.getCompletedTasks({
119
+ const response = await this.getCompletedTasks({
117
120
  params,
118
- })).map((task) => ({
121
+ });
122
+ const tasks = response.items.map((task) => ({
119
123
  label: task.content,
120
- value: task.task_id,
124
+ value: task.id,
121
125
  }));
122
126
  return {
123
127
  options: tasks,
124
128
  context: {
125
- offset: offset + limit,
129
+ cursor: response.next_cursor,
126
130
  },
127
131
  };
128
132
  },
@@ -185,7 +189,7 @@ export default {
185
189
  color: {
186
190
  type: "integer",
187
191
  label: "Color",
188
- description: "A numeric ID representing a color. Refer to the id column in the [Colors](https://developer.todoist.com/guides/#colors) guide for more info.",
192
+ description: "A numeric ID representing a color (automatically converted to v1 API format). Refer to the id column in the [Colors](https://developer.todoist.com/guides/#colors) guide for more info.",
189
193
  options: colors,
190
194
  optional: true,
191
195
  },
@@ -272,7 +276,7 @@ export default {
272
276
  async _makeSyncRequest(opts) {
273
277
  const {
274
278
  $,
275
- path = "/sync/v9/sync",
279
+ path = "/api/v1/sync",
276
280
  } = opts;
277
281
  delete opts.path;
278
282
  delete opts.$;
@@ -302,7 +306,7 @@ export default {
302
306
  } = opts;
303
307
  delete opts.path;
304
308
  delete opts.$;
305
- opts.url = `https://api.todoist.com/rest/v2${path[0] === "/"
309
+ opts.url = `https://api.todoist.com/api/v1${path[0] === "/"
306
310
  ? ""
307
311
  : "/"}${path}`;
308
312
  opts.headers = {
@@ -351,7 +355,7 @@ export default {
351
355
  }) {
352
356
  return this._makeSyncRequest({
353
357
  $,
354
- path: "/sync/v9/sync",
358
+ path: "/api/v1/sync",
355
359
  method: "POST",
356
360
  payload: opts,
357
361
  });
@@ -403,7 +407,9 @@ export default {
403
407
  } = opts;
404
408
  return this._makeRestRequest({
405
409
  $,
406
- path: `/projects/${id}`,
410
+ path: id
411
+ ? `/projects/${id}`
412
+ : "/projects",
407
413
  method: "GET",
408
414
  });
409
415
  },
@@ -419,6 +425,10 @@ export default {
419
425
  $,
420
426
  data = {},
421
427
  } = opts;
428
+ // Transform numeric color to string for v1 API
429
+ if (data.color && typeof data.color === "number") {
430
+ data.color = numericToString(data.color);
431
+ }
422
432
  return this._makeRestRequest({
423
433
  $,
424
434
  path: "/projects",
@@ -439,6 +449,10 @@ export default {
439
449
  } = opts;
440
450
  const { projectId } = data;
441
451
  delete data.projectId;
452
+ // Transform numeric color to string for v1 API
453
+ if (data.color && typeof data.color === "number") {
454
+ data.color = numericToString(data.color);
455
+ }
442
456
  return this._makeRestRequest({
443
457
  $,
444
458
  path: `/projects/${projectId}`,
@@ -520,7 +534,9 @@ export default {
520
534
  delete params.section_id;
521
535
  return this._makeRestRequest({
522
536
  $,
523
- path: `/sections/${id}`,
537
+ path: id
538
+ ? `/sections/${id}`
539
+ : "/sections",
524
540
  method: "GET",
525
541
  params,
526
542
  });
@@ -596,7 +612,9 @@ export default {
596
612
  } = opts;
597
613
  return this._makeRestRequest({
598
614
  $,
599
- path: `/labels/${id}`,
615
+ path: id
616
+ ? `/labels/${id}`
617
+ : "/labels",
600
618
  method: "GET",
601
619
  });
602
620
  },
@@ -611,6 +629,10 @@ export default {
611
629
  $,
612
630
  data = {},
613
631
  } = opts;
632
+ // Transform numeric color to string for v1 API
633
+ if (data.color && typeof data.color === "number") {
634
+ data.color = numericToString(data.color);
635
+ }
614
636
  return this._makeRestRequest({
615
637
  $,
616
638
  path: "/labels",
@@ -631,6 +653,10 @@ export default {
631
653
  } = opts;
632
654
  const { labelId } = data;
633
655
  delete data.labelId;
656
+ // Transform numeric color to string for v1 API
657
+ if (data.color && typeof data.color === "number") {
658
+ data.color = numericToString(data.color);
659
+ }
634
660
  return this._makeRestRequest({
635
661
  $,
636
662
  path: `/labels/${labelId}`,
@@ -678,7 +704,9 @@ export default {
678
704
  delete params.comment_id;
679
705
  return this._makeRestRequest({
680
706
  $,
681
- path: `/comments/${id}`,
707
+ path: id
708
+ ? `/comments/${id}`
709
+ : "/comments",
682
710
  method: "GET",
683
711
  params,
684
712
  });
@@ -757,7 +785,9 @@ export default {
757
785
  delete params.task_id;
758
786
  return this._makeRestRequest({
759
787
  $,
760
- path: `/tasks/${id}`,
788
+ path: id
789
+ ? `/tasks/${id}`
790
+ : "/tasks",
761
791
  method: "GET",
762
792
  params,
763
793
  });
@@ -773,12 +803,12 @@ export default {
773
803
  $,
774
804
  params = {},
775
805
  } = opts;
776
- return (await this._makeSyncRequest({
806
+ return this._makeRestRequest({
777
807
  $,
778
- path: "/sync/v9/completed/get_all",
779
- method: "POST",
780
- payload: params,
781
- })).items;
808
+ path: "/tasks/completed/by_completion_date",
809
+ method: "GET",
810
+ params,
811
+ });
782
812
  },
783
813
  /**
784
814
  * Create a new task
@@ -891,7 +921,7 @@ export default {
891
921
  const { taskId } = params;
892
922
  return this._makeRestRequest({
893
923
  $,
894
- path: `tasks/${taskId}/close`,
924
+ path: `/tasks/${taskId}/close`,
895
925
  method: "POST",
896
926
  });
897
927
  },
@@ -909,7 +939,7 @@ export default {
909
939
  const { taskId } = params;
910
940
  return this._makeRestRequest({
911
941
  $,
912
- path: `tasks/${taskId}/reopen`,
942
+ path: `/tasks/${taskId}/reopen`,
913
943
  method: "POST",
914
944
  });
915
945
  },
@@ -927,7 +957,7 @@ export default {
927
957
  const { taskId } = data;
928
958
  return this._makeRestRequest({
929
959
  $,
930
- path: `tasks/${taskId}`,
960
+ path: `/tasks/${taskId}`,
931
961
  method: "DELETE",
932
962
  });
933
963
  },
@@ -1022,6 +1052,10 @@ export default {
1022
1052
  $,
1023
1053
  data = {},
1024
1054
  } = opts;
1055
+ // Transform numeric color to string for v1 API
1056
+ if (data.color && typeof data.color === "number") {
1057
+ data.color = numericToString(data.color);
1058
+ }
1025
1059
  const commands = [
1026
1060
  {
1027
1061
  type: "filter_add",
@@ -1048,6 +1082,10 @@ export default {
1048
1082
  $,
1049
1083
  data = {},
1050
1084
  } = opts;
1085
+ // Transform numeric color to string for v1 API
1086
+ if (data.color && typeof data.color === "number") {
1087
+ data.color = numericToString(data.color);
1088
+ }
1051
1089
  const commands = [
1052
1090
  {
1053
1091
  type: "filter_update",