Skip to content

Commit 3f06c7d

Browse files
Fix bugs and changed file name (raycast#744)
* Fix bugs and changed file name Updated API call to new endpoint, changed add method to "quick add" to reduce the number of arguments, cleaned up redundant code * Update commands/apps/todoist/create-task.sh Co-authored-by: Thiago Holanda <[email protected]> * Update commands/apps/todoist/create-task.sh Co-authored-by: Thiago Holanda <[email protected]> * Update commands/apps/todoist/create-task.sh Co-authored-by: Thiago Holanda <[email protected]> * Rename create-task.sh to create-task.template.sh Co-authored-by: Thiago Holanda <[email protected]>
1 parent 98391d3 commit 3f06c7d

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

commands/apps/todoist/create-task.template.sh

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
11
#!/bin/bash
22

33
# Required parameters:
4-
# @raycast.author Faris Aziz
5-
# @raycast.authorURL https://github.com/farisaziz12
64
# @raycast.schemaVersion 1
75
# @raycast.title Create Task
86
# @raycast.mode silent
9-
# @raycast.packageName Todoist
10-
# @raycast.description Creates Todoist task
11-
# @raycast.needsConfirmation false
12-
# @raycast.argument1 { "type": "text", "placeholder": "Buy Milk", "optional": false, }
13-
# @raycast.argument2 { "type": "text", "placeholder": "Due (Defaults to Tomorrow)", "optional": true, }
14-
157

168
# Optional parameters:
179
# @raycast.icon images/todoist-logo.png
10+
# @raycast.packageName Todoist
11+
# @raycast.argument1 { "type": "text", "placeholder": "Call Mom Tomorrow at 5" }
12+
13+
# Documentation:
14+
# @raycast.description Create Task
15+
# @raycast.author Faris Aziz
16+
# @raycast.authorURL https://github.com/farisaziz12
1817

1918
# Get your API Token from: https://todoist.com/prefs/integrations
2019

21-
API_TOKEN=
20+
API_TOKEN="APITOKENHERE"
2221

2322
if [ -z "$API_TOKEN" ]; then
2423
echo "Todoist API token is missing.";
2524
exit 1;
2625
fi
2726

2827
TASK="$1"
29-
DUE="Tomorrow"
30-
31-
if [[ $2 != "" ]]; then
32-
DUE=$2
33-
fi
3428

3529
if [[ $TASK != "" ]]; then
36-
curl -s "https://api.todoist.com/rest/v1/tasks" \
37-
-X POST \
38-
--data '{"content": "'"$TASK"'", "due_string": "'"$DUE"'"}' \
30+
curl "https://api.todoist.com/sync/v8/quick/add" \
31+
-X -S POST \
32+
--data '{"text": "'"$TASK"'"}' \
3933
-H "Content-Type: application/json" \
4034
-H "Authorization: Bearer $API_TOKEN"
4135

0 commit comments

Comments
 (0)