fix: extract list IDs from sortingIndexByTaskList, remove tasklistsync (v0.2.2)

This commit is contained in:
2026-04-15 13:38:52 +02:00
parent 8262c8440c
commit 8cf707e3bd
4 changed files with 52 additions and 33 deletions
+1 -1
View File
@@ -1 +1 @@
__version__ = "0.2.1"
__version__ = "0.2.2"
+33 -13
View File
@@ -37,11 +37,7 @@ def _accgetallfamily() -> dict[str, Any]:
client.login(email, password)
data = client.call(
"accgetallfamily",
{
"a01call": "taskcategorysync",
"a02call": "tasksync",
"a03call": "tasklistsync",
},
{"a01call": "taskcategorysync", "a02call": "tasksync"},
)
client.logout()
return data
@@ -54,22 +50,46 @@ def _accgetallfamily() -> dict[str, Any]:
def _extract_lists(data: dict[str, Any]) -> list[dict[str, Any]]:
"""Extract task lists from an accgetallfamily response.
Lists live under a03.r.r.updatedCreated[] (tasklistsync).
List IDs are derived from the sortingIndexByTaskList keys present in each
taskcategorysync entry (a01.r.r.updatedCreated[]). Each key is a unique
list ID of the form ``taskList/<id>``. Names and counters are not yet
available from this path and are left as None.
Args:
data: Raw response body from accgetallfamily.
Returns:
List of raw task-list dicts (may be empty).
Deduplicated list of dicts with keys id, name, type, open, total.
"""
try:
items = data["a03"]["r"]["r"]["updatedCreated"]
if isinstance(items, list):
logger.debug("Lists found under a03.r.r.updatedCreated (%d items)", len(items))
return items # type: ignore[return-value]
categories = data["a01"]["r"]["r"]["updatedCreated"]
if not isinstance(categories, list):
return []
except (KeyError, TypeError):
pass
return []
return []
seen: set[str] = set()
result: list[dict[str, Any]] = []
for cat in categories:
sorting = cat.get("sortingIndexByTaskList")
if not isinstance(sorting, dict):
continue
for list_id in sorting:
if list_id in seen:
continue
seen.add(list_id)
result.append(
{
"id": list_id,
"name": list_id, # real name unknown — TODO once field identified
"type": "UNKNOWN",
"open": None,
"total": None,
}
)
logger.debug("Extracted %d unique list IDs from sortingIndexByTaskList", len(result))
return result
def _extract_tasks(data: dict[str, Any]) -> list[dict[str, Any]]: