fix(_Scripts): 🐛 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.
This commit is contained in:
Mathis Gauthey
2024-07-16 20:59:34 +02:00
committed by Mathis Gauthey
parent 16ce2681a4
commit 1106b01917
4 changed files with 23 additions and 14 deletions

View File

@@ -4,7 +4,8 @@ module.exports = {
GetAllTasksFromSection: GetAllTasksFromSection, 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) { async function SelectFromAllTasks(t) {
const s = await getAllTasks(t); const s = await getAllTasks(t);
if (0 === s.length) return void new Notice("No tasks."); 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}'.`); new Notice(`No tasks in '${n.name}'.`);
} }
async function getAllTasks(t) { async function getAllTasks(t) {
const s = getTodoistPluginApi(t.app), const s = getTodoistPluginApi(t.app);
{ ok: e } = await s.getTasks(); e = await s.getTasks();
return e; return e;
} }
async function selectTasks(t, s) { async function selectTasks(t, s) {

View File

@@ -4,7 +4,8 @@ module.exports = {
GetAllTasksFromSection: GetAllTasksFromSection, 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) { async function SelectFromAllTasks(t) {
const s = await getAllTasks(t); const s = await getAllTasks(t);
if (0 === s.length) return void new Notice("No tasks."); 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}'.`); new Notice(`No tasks in '${n.name}'.`);
} }
async function getAllTasks(t) { async function getAllTasks(t) {
const s = getTodoistPluginApi(t.app), const s = getTodoistPluginApi(t.app);
{ ok: e } = await s.getTasks(); e = await s.getTasks();
return e; return e;
} }
async function selectTasks(t, s) { async function selectTasks(t, s) {
@@ -71,7 +72,9 @@ function formatTasksToTasksPluginTask(t) {
.map( .map(
(t) => (t) =>
(t = t.rawDatetime (t = t.rawDatetime
? `- [ ] [[${t.content}]] \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format( ? `- [ ] [[${
t.content
}]] \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format(
"YYYY-MM-DD" "YYYY-MM-DD"
)}` )}`
: `- [ ] [[${t.content}]] \u2795 ${todayDate}`) : `- [ ] [[${t.content}]] \u2795 ${todayDate}`)

View File

@@ -4,7 +4,8 @@ module.exports = {
GetAllTasksFromSection: GetAllTasksFromSection, 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) { async function SelectFromAllTasks(t) {
const s = await getAllTasks(t); const s = await getAllTasks(t);
if (0 === s.length) return void new Notice("No tasks."); 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}'.`); new Notice(`No tasks in '${n.name}'.`);
} }
async function getAllTasks(t) { async function getAllTasks(t) {
const s = getTodoistPluginApi(t.app), const s = getTodoistPluginApi(t.app);
{ ok: e } = await s.getTasks(); e = await s.getTasks();
return e; return e;
} }
async function selectTasks(t, s) { async function selectTasks(t, s) {

View File

@@ -4,7 +4,9 @@ module.exports = {
GetAllTasksFromSection: GetAllTasksFromSection, 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) { async function SelectFromAllTasks(t) {
const s = await getAllTasks(t); const s = await getAllTasks(t);
if (0 === s.length) return void new Notice("No tasks."); 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}'.`); new Notice(`No tasks in '${n.name}'.`);
} }
async function getAllTasks(t) { async function getAllTasks(t) {
const s = getTodoistPluginApi(t.app), const s = getTodoistPluginApi(t.app);
{ ok: e } = await s.getTasks(); e = await s.getTasks();
return e; return e;
} }
async function selectTasks(t, s) { async function selectTasks(t, s) {
@@ -71,7 +73,9 @@ function formatTasksToTasksPluginTask(t) {
.map( .map(
(t) => (t) =>
(t = t.rawDatetime (t = t.rawDatetime
? `- [ ] ${t.content} \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format( ? `- [ ] ${
t.content
} \u2795 ${todayDate} \ud83d\udcc5 ${t.rawDatetime.format(
"YYYY-MM-DD" "YYYY-MM-DD"
)}` )}`
: `- [ ] ${t.content} \u2795 ${todayDate}`) : `- [ ] ${t.content} \u2795 ${todayDate}`)