Add Google Tasks create and update for todo platform (#102754)

* Add Google Tasks create and update for todo platform

* Update comments

* Update comments
This commit is contained in:
Allen Porter 2023-10-25 01:51:21 -07:00 committed by GitHub
parent ffed1e8274
commit 7f7064ce59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 279 additions and 10 deletions

View file

@ -51,3 +51,31 @@ class AsyncConfigEntryAuth:
)
result = await self._hass.async_add_executor_job(cmd.execute)
return result["items"]
async def insert(
self,
task_list_id: str,
task: dict[str, Any],
) -> None:
"""Create a new Task resource on the task list."""
service = await self._get_service()
cmd: HttpRequest = service.tasks().insert(
tasklist=task_list_id,
body=task,
)
await self._hass.async_add_executor_job(cmd.execute)
async def patch(
self,
task_list_id: str,
task_id: str,
task: dict[str, Any],
) -> None:
"""Update a task resource."""
service = await self._get_service()
cmd: HttpRequest = service.tasks().patch(
tasklist=task_list_id,
task=task_id,
body=task,
)
await self._hass.async_add_executor_job(cmd.execute)