lazeroffmichael / ticktick-py

Unofficial TickTick API

Home Page:https://lazeroffmichael.github.io/ticktick-py/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List of Today's Tasks

AlJohri opened this issue · comments

Is there a simple way to get the list of today's tasks using this library? I see that the README states "Acquire all completed tasks in a certain date range" but I was unable to figure out how to do the same for non-completed tasks.

Unrelated, but for anyone else looking for a quick way to get today's tasks, I found raycast's ticktick extension had the answer: https://github.com/raycast/extensions/blob/main/extensions/ticktick/src/service/osScript.ts

❯ osascript -e 'set result to ""
tell application "TickTick"
  set result to today tasks
end tell
return result' | jq
[
  {
    "tasks": [
      {
        "id": "NoneyaBusiness",
        "createdTime": "2023-09-10T03:31:03+0000",
        "exDate": [],
        "sortOrder": -9187629436498084000,
        "repeatTaskId": null,
        "commentCount": 0,
        "focusSummaries": [],
        "isAllDay": true,
        "timeZone": "America/New_York",
        "modifiedTime": "2023-09-10T03:31:09+0000",
        "progress": 0,
        "priority": 3,
        "pinnedTime": "-1",
        "attachments": [],
        "assignee": -1,
        "childIds": [],
        "attendId": null,
        "reminders": [
          {
            "id": "NoneyaBusiness",
            "trigger": "TRIGGER:-P0DT15H0M0S"
          },
          {
            "id": "NoneyaBusiness",
            "trigger": "TRIGGER:P0DT9H0M0S"
          },
          {
            "id": "NoneyaBusiness",
            "trigger": "TRIGGER:-P0DT4H0M0S"
          }
        ],
        "isFloating": false,
        "status": 0,
        "repeatFlag": null,
        "tags": [],
        "content": "",
        "kind": "TEXT",
        "desc": "",
        "projectId": "NoneyaBusiness",
        "parentId": null,
        "title": "NoneyaBusiness",
        "items": [],
        "startDate": "2023-09-10T04:00:00+0000",
        "repeatFrom": null,
        "columnId": null
      }
    ],
    "name": "Today",
    "date": 1694318400,
    "id": null
  }
]

Of course it would be nicer to get it directly from the API (official or otherwise) so still interested in figuring out a way to do that.

Right now there is no easy way that this is implemented. It's plausible that there is an id for the "today" list just like how there is an id for the "inbox" list - although off the top of my head I don't have an easy way for one to get the "today" list id.

If someone knows an easy way to get the project id of the "today" list, then you could just use this method to get the tasks in today: https://lazeroffmichael.github.io/ticktick-py/usage/tasks/#managers.tasks.TaskManager.get_from_project

This is definitely something that could be streamlined though and should be added. Thanks for opening this!