From 1106b01917017ccdc8ff8cb470b44dd70ed799df Mon Sep 17 00:00:00 2001 From: Mathis Gauthey Date: Tue, 16 Jul 2024 20:59:34 +0200 Subject: [PATCH] fix(_Scripts): :bug: fix issue in #12 Informations are found on the issue. Basically, the todoist-sync-plugin changed it's organisation and now use Todoist API v2. --- _Scripts/passionsync.js | 7 ++++--- _Scripts/projectsync.js | 11 +++++++---- _Scripts/somedaysync.js | 7 ++++--- _Scripts/tasksync.js | 12 ++++++++---- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/_Scripts/passionsync.js b/_Scripts/passionsync.js index 8d69346..2934384 100644 --- a/_Scripts/passionsync.js +++ b/_Scripts/passionsync.js @@ -4,7 +4,8 @@ module.exports = { GetAllTasksFromSection: GetAllTasksFromSection, }; -const getTodoistPluginApi = (t) => t.plugins.plugins["todoist-sync-plugin"].api; +const getTodoistPluginApi = (t) => + t.plugins.plugins["todoist-sync-plugin"].services.todoist.api.value; async function SelectFromAllTasks(t) { const s = await getAllTasks(t); if (0 === s.length) return void new Notice("No tasks."); @@ -52,8 +53,8 @@ async function GetAllTasksFromSection(t) { new Notice(`No tasks in '${n.name}'.`); } async function getAllTasks(t) { - const s = getTodoistPluginApi(t.app), - { ok: e } = await s.getTasks(); + const s = getTodoistPluginApi(t.app); + e = await s.getTasks(); return e; } async function selectTasks(t, s) { diff --git a/_Scripts/projectsync.js b/_Scripts/projectsync.js index d174839..5b548dc 100644 --- a/_Scripts/projectsync.js +++ b/_Scripts/projectsync.js @@ -4,7 +4,8 @@ module.exports = { GetAllTasksFromSection: GetAllTasksFromSection, }; -const getTodoistPluginApi = (t) => t.plugins.plugins["todoist-sync-plugin"].api; +const getTodoistPluginApi = (t) => + t.plugins.plugins["todoist-sync-plugin"].services.todoist.api.value; async function SelectFromAllTasks(t) { const s = await getAllTasks(t); if (0 === s.length) return void new Notice("No tasks."); @@ -52,8 +53,8 @@ async function GetAllTasksFromSection(t) { new Notice(`No tasks in '${n.name}'.`); } async function getAllTasks(t) { - const s = getTodoistPluginApi(t.app), - { ok: e } = await s.getTasks(); + const s = getTodoistPluginApi(t.app); + e = await s.getTasks(); return e; } async function selectTasks(t, s) { @@ -71,7 +72,9 @@ function formatTasksToTasksPluginTask(t) { .map( (t) => (t = t.rawDatetime - ? `- [ ] [[${t.content}]] \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format( + ? `- [ ] [[${ + t.content + }]] \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format( "YYYY-MM-DD" )}` : `- [ ] [[${t.content}]] \u2795 ${todayDate}`) diff --git a/_Scripts/somedaysync.js b/_Scripts/somedaysync.js index 18821bf..86dd83c 100644 --- a/_Scripts/somedaysync.js +++ b/_Scripts/somedaysync.js @@ -4,7 +4,8 @@ module.exports = { GetAllTasksFromSection: GetAllTasksFromSection, }; -const getTodoistPluginApi = (t) => t.plugins.plugins["todoist-sync-plugin"].api; +const getTodoistPluginApi = (t) => + t.plugins.plugins["todoist-sync-plugin"].services.todoist.api.value; async function SelectFromAllTasks(t) { const s = await getAllTasks(t); if (0 === s.length) return void new Notice("No tasks."); @@ -52,8 +53,8 @@ async function GetAllTasksFromSection(t) { new Notice(`No tasks in '${n.name}'.`); } async function getAllTasks(t) { - const s = getTodoistPluginApi(t.app), - { ok: e } = await s.getTasks(); + const s = getTodoistPluginApi(t.app); + e = await s.getTasks(); return e; } async function selectTasks(t, s) { diff --git a/_Scripts/tasksync.js b/_Scripts/tasksync.js index 3752325..3bdb11e 100644 --- a/_Scripts/tasksync.js +++ b/_Scripts/tasksync.js @@ -4,7 +4,9 @@ module.exports = { GetAllTasksFromSection: GetAllTasksFromSection, }; -const getTodoistPluginApi = (t) => t.plugins.plugins["todoist-sync-plugin"].api; +const getTodoistPluginApi = (t) => + t.plugins.plugins["todoist-sync-plugin"].services.todoist.api.value; + async function SelectFromAllTasks(t) { const s = await getAllTasks(t); if (0 === s.length) return void new Notice("No tasks."); @@ -52,8 +54,8 @@ async function GetAllTasksFromSection(t) { new Notice(`No tasks in '${n.name}'.`); } async function getAllTasks(t) { - const s = getTodoistPluginApi(t.app), - { ok: e } = await s.getTasks(); + const s = getTodoistPluginApi(t.app); + e = await s.getTasks(); return e; } async function selectTasks(t, s) { @@ -71,7 +73,9 @@ function formatTasksToTasksPluginTask(t) { .map( (t) => (t = t.rawDatetime - ? `- [ ] ${t.content} \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format( + ? `- [ ] ${ + t.content + } \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format( "YYYY-MM-DD" )}` : `- [ ] ${t.content} \u2795 ${todayDate}`)