Skip to content

Commit

Permalink
original openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Vraník authored and Petr Vraník committed Jan 15, 2025
1 parent a410d25 commit 978bd86
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 11 additions & 8 deletions custom_components/ticktick_todo/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ async def async_create_todo_item(self, project_id: str, item: TodoItem) -> TodoI
async def async_update_todo_item(self, project_id: str, item: TodoItem) -> None:
"""Add an item to the To-do list."""
async with self._api_call_lock:
project=await self._api_instance.get_project_with_data_by_id(project_id)
task = TaskMapper.merge_todo_item_and_task_response(item,
await self._api_instance.open_v1_project_project_id_task_task_id_get(
project_id, item.uid))
task_ = TaskMapper.task_response_to_task_request(task)
await self._api_instance.create_single_task(task_)
asyncio.timeout(1)
await self.async_request_refresh()
await self._api_instance.complete_specify_task_with_http_info
project_data = await self._api_instance.get_project_with_data_by_id(project_id)
for t in project_data.tasks:
if t.id == item.uid:
task = TaskMapper.merge_todo_item_and_task_response(item, t)
task_ = TaskMapper.task_response_to_task_request(task)
await self._api_instance.delete_specify_task(project_id, t.id)
await self._api_instance.create_single_task(task_)
asyncio.timeout(1)
await self.async_request_refresh()
return

async def async_delete_todo_items(self, project_id: str, uids: list[str]) -> None:
"""Delete an item from the to-do list."""
Expand Down
1 change: 0 additions & 1 deletion custom_components/ticktick_todo/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback) -> None:
"""Set up ESPHome binary sensors based on a config entry."""
coordinator = config_entry.runtime_data['coordinator']
# coordinator = hass.data[DOMAIN][config_entry.entry_id]
new_entities_ = [
TickTickTodo(hass, DeviceInfo(name=config_entry.title, identifiers={(DOMAIN, config_entry.entry_id)}),
coordinator, id) for id in coordinator.data.keys()]
Expand Down

0 comments on commit 978bd86

Please sign in to comment.