1 """DataUpdateCoordinator for the Todoist component."""
3 from datetime
import timedelta
6 from todoist_api_python.api_async
import TodoistAPIAsync
7 from todoist_api_python.models
import Label, Project, Section, Task
15 """Coordinator for updating task data from Todoist."""
20 logger: logging.Logger,
21 entry: ConfigEntry |
None,
22 update_interval: timedelta,
26 """Initialize the Todoist coordinator."""
32 update_interval=update_interval,
35 self.
_projects_projects: list[Project] |
None =
None
36 self.
_labels_labels: list[Label] |
None =
None
40 """Fetch tasks from the Todoist API."""
42 return await self.
apiapi.get_tasks()
43 except Exception
as err:
44 raise UpdateFailed(f
"Error communicating with API: {err}")
from err
47 """Return todoist projects fetched at most once."""
53 """Return todoist sections for a given project ID."""
54 return await self.
apiapi.get_sections(project_id=project_id)
57 """Return todoist labels fetched at most once."""
list[Task] _async_update_data(self)
list[Project] async_get_projects(self)
list[Label] async_get_labels(self)
list[Section] async_get_sections(self, str project_id)
None __init__(self, HomeAssistant hass, logging.Logger logger, ConfigEntry|None entry, timedelta update_interval, TodoistAPIAsync api, str token)