Last active
October 13, 2022 06:13
-
-
Save alchemistake/9a2c620313311f03c7d9904248f72fc3 to your computer and use it in GitHub Desktop.
Todoist Auto-Done Script for iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let task_get = new Request(`https://api.todoist.com/rest/v2/tasks/${task_id}`); | |
task_get.method = "get"; | |
task_get.headers = { | |
"Authorization": `Bearer ${bearer_token}`, | |
"Content-Type": "application/json" | |
}; | |
let res = await task_get.loadJSON(); | |
let due = res["due"]["date"]; | |
let due_date = new Date(due); | |
let today = new Date(); | |
if (today >= due_date){ | |
let task_done = new Request(`https://api.todoist.com/rest/v2/tasks/${task_id}/close`); | |
task_done.method = "post"; | |
task_done.headers = { | |
"Authorization": `Bearer ${bearer_token}`, | |
"Content-Type": "application/json" | |
}; | |
await task_done.load(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment