From 86b6985880daec06f60535e2becf79d95a359be2 Mon Sep 17 00:00:00 2001 From: sangeethailango Date: Tue, 16 Jun 2026 18:29:19 +0530 Subject: [PATCH 1/2] fix: updated WorkItemGroupCountEntry response fields --- plane/api/work_items/base.py | 8 ++++---- plane/models/work_items.py | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/plane/api/work_items/base.py b/plane/api/work_items/base.py index 719c002..5eb58bb 100644 --- a/plane/api/work_items/base.py +++ b/plane/api/work_items/base.py @@ -284,9 +284,9 @@ def count_workspace( ISO-date strings for ``target_date`` / ``start_date``. ``"None"`` is used for work items with no value in that dimension. - When only ``group_by`` is supplied each ``grouped_counts`` entry has - shape ``{"count": N}``. When ``sub_group_by`` is also supplied the - shape becomes ``{"total_count": N, "sub_grouped_counts": {sub_key: {"count": N}}}``. + Each ``grouped_counts`` entry always has ``count``. When + ``sub_group_by`` is also supplied it additionally carries + ``sub_grouped_counts``, a dict mapping sub-group keys to ``{"count": N}``. Args: workspace_slug: The workspace slug identifier @@ -323,7 +323,7 @@ def count_workspace( ), ) for group, entry in result.grouped_counts.items(): - print(f"{group}: {entry.total_count} total") + print(f"{group}: {entry.count} total") for sub_group, sub_entry in (entry.sub_grouped_counts or {}).items(): print(f" {sub_group}: {sub_entry.count}") diff --git a/plane/models/work_items.py b/plane/models/work_items.py index 243557e..d91b4f3 100644 --- a/plane/models/work_items.py +++ b/plane/models/work_items.py @@ -611,15 +611,13 @@ class WorkItemGroupCountEntry(BaseModel): * **Flat** (``group_by`` only): ``{"count": N}`` * **Nested** (``group_by`` + ``sub_group_by``): - ``{"total_count": N, "sub_grouped_counts": {sub_key: {"count": N}}}`` + ``{"count": N, "sub_grouped_counts": {sub_key: {"count": N}}}`` """ model_config = ConfigDict(extra="allow", populate_by_name=True) - # flat grouped shape (group_by only) - count: int | None = None - # sub-grouped shape (group_by + sub_group_by) - total_count: int | None = None + count: int + sub_grouped_counts: dict[str, WorkItemSubGroupCountEntry] | None = None @@ -641,7 +639,7 @@ class WorkItemGroupedCountResponse(BaseModel): "grouped_counts": {"urgent": {"count": 3}, "None": {"count": 6}} } - **With** ``group_by`` and ``sub_group_by`` — values carry ``total_count`` + **With** ``group_by`` and ``sub_group_by`` — values carry ``count`` and a nested ``sub_grouped_counts`` dict:: { @@ -650,7 +648,7 @@ class WorkItemGroupedCountResponse(BaseModel): "total_count": 42, "grouped_counts": { "urgent": { - "total_count": 3, + "count": 3, "sub_grouped_counts": { "949645da-a9dd-4a90-94b0-6c8fa16245ee": {"count": 2}, "94d35657-a48c-44fd-bed8-87d895386ba4": {"count": 1} From 60627080886a90ea7e46c8d5b20be01a2de7bc3a Mon Sep 17 00:00:00 2001 From: sangeethailango Date: Tue, 16 Jun 2026 18:45:41 +0530 Subject: [PATCH 2/2] chore: updated version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 18218a5..24d2f78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plane-sdk" -version = "0.2.16" +version = "0.2.17" description = "Python SDK for Plane API" readme = "README.md" requires-python = ">=3.10"