|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
3 | 3 | # Required parameters:
|
4 |
| -# @raycast.author Faris Aziz |
5 |
| -# @raycast.authorURL https://github.com/farisaziz12 |
6 | 4 | # @raycast.schemaVersion 1
|
7 | 5 | # @raycast.title Create Task
|
8 | 6 | # @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 |
| - |
15 | 7 |
|
16 | 8 | # Optional parameters:
|
17 | 9 | # @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 |
18 | 17 |
|
19 | 18 | # Get your API Token from: https://todoist.com/prefs/integrations
|
20 | 19 |
|
21 |
| -API_TOKEN= |
| 20 | +API_TOKEN="APITOKENHERE" |
22 | 21 |
|
23 | 22 | if [ -z "$API_TOKEN" ]; then
|
24 | 23 | echo "Todoist API token is missing.";
|
25 | 24 | exit 1;
|
26 | 25 | fi
|
27 | 26 |
|
28 | 27 | TASK="$1"
|
29 |
| -DUE="Tomorrow" |
30 |
| - |
31 |
| -if [[ $2 != "" ]]; then |
32 |
| - DUE=$2 |
33 |
| -fi |
34 | 28 |
|
35 | 29 | 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"'"}' \ |
39 | 33 | -H "Content-Type: application/json" \
|
40 | 34 | -H "Authorization: Bearer $API_TOKEN"
|
41 | 35 |
|
|
0 commit comments