Skip to content

Commit b75a192

Browse files
committed
Fix label order parameters
1 parent 6457339 commit b75a192

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- **Breaking**: Authentication helpers now accept optional `httpx.Client` / `httpx.AsyncClient` instances instead of `session: requests.Session`.
2626
- **Breaking**: `update_section` now accepts only keyword arguments after `section_id`; any one of `name`, `order`, or `collapsed` can be updated in the same call.
2727

28+
### Fixed
29+
30+
- Label order arguments for `add_label` and `update_label` now use the `order` field. (#247)
31+
2832
## [3.2.1] - 2026-01-22
2933

3034
### Fixed

tests/test_api_labels.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async def test_add_label_full(
169169
label_name = "A Label"
170170
args: dict[str, Any] = {
171171
"color": "red",
172-
"item_order": 3,
172+
"order": 3,
173173
"is_favorite": True,
174174
}
175175

@@ -203,6 +203,7 @@ async def test_update_label(
203203
) -> None:
204204
args: dict[str, Any] = {
205205
"name": "An updated label",
206+
"order": 3,
206207
}
207208
updated_label_dict = default_label.to_dict() | args
208209

todoist_api_python/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,15 +1333,15 @@ def add_label(
13331333
name: Annotated[str, MinLen(1), MaxLen(60)],
13341334
*,
13351335
color: ColorString | None = None,
1336-
item_order: int | None = None,
1336+
order: int | None = None,
13371337
is_favorite: bool | None = None,
13381338
) -> Label:
13391339
"""
13401340
Create a new personal label.
13411341
13421342
:param name: The name of the label.
13431343
:param color: The color of the label icon.
1344-
:param item_order: Label's order in the label list.
1344+
:param order: Label's order in the label list.
13451345
:param is_favorite: Whether the label is a favorite.
13461346
:return: The newly created label.
13471347
:raises httpx.HTTPStatusError: If the API request fails.
@@ -1352,7 +1352,7 @@ def add_label(
13521352
data = kwargs_without_none(
13531353
name=name,
13541354
color=color,
1355-
item_order=item_order,
1355+
order=order,
13561356
is_favorite=is_favorite,
13571357
)
13581358

@@ -1372,7 +1372,7 @@ def update_label(
13721372
*,
13731373
name: Annotated[str, MinLen(1), MaxLen(60)] | None = None,
13741374
color: ColorString | None = None,
1375-
item_order: int | None = None,
1375+
order: int | None = None,
13761376
is_favorite: bool | None = None,
13771377
) -> Label:
13781378
"""
@@ -1383,7 +1383,7 @@ def update_label(
13831383
:param label_id: The ID of the label.
13841384
:param name: The name of the label.
13851385
:param color: The color of the label icon.
1386-
:param item_order: Label's order in the label list.
1386+
:param order: Label's order in the label list.
13871387
:param is_favorite: Whether the label is a favorite.
13881388
:return: the updated Label.
13891389
:raises httpx.HTTPStatusError: If the API request fails.
@@ -1393,7 +1393,7 @@ def update_label(
13931393
data = kwargs_without_none(
13941394
name=name,
13951395
color=color,
1396-
item_order=item_order,
1396+
order=order,
13971397
is_favorite=is_favorite,
13981398
)
13991399

todoist_api_python/api_async.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,15 +1353,15 @@ async def add_label(
13531353
name: Annotated[str, MinLen(1), MaxLen(60)],
13541354
*,
13551355
color: ColorString | None = None,
1356-
item_order: int | None = None,
1356+
order: int | None = None,
13571357
is_favorite: bool | None = None,
13581358
) -> Label:
13591359
"""
13601360
Create a new personal label.
13611361
13621362
:param name: The name of the label.
13631363
:param color: The color of the label icon.
1364-
:param item_order: Label's order in the label list.
1364+
:param order: Label's order in the label list.
13651365
:param is_favorite: Whether the label is a favorite.
13661366
:return: The newly created label.
13671367
:raises httpx.HTTPStatusError: If the API request fails.
@@ -1372,7 +1372,7 @@ async def add_label(
13721372
data = kwargs_without_none(
13731373
name=name,
13741374
color=color,
1375-
item_order=item_order,
1375+
order=order,
13761376
is_favorite=is_favorite,
13771377
)
13781378

@@ -1392,7 +1392,7 @@ async def update_label(
13921392
*,
13931393
name: Annotated[str, MinLen(1), MaxLen(60)] | None = None,
13941394
color: ColorString | None = None,
1395-
item_order: int | None = None,
1395+
order: int | None = None,
13961396
is_favorite: bool | None = None,
13971397
) -> Label:
13981398
"""
@@ -1403,7 +1403,7 @@ async def update_label(
14031403
:param label_id: The ID of the label.
14041404
:param name: The name of the label.
14051405
:param color: The color of the label icon.
1406-
:param item_order: Label's order in the label list.
1406+
:param order: Label's order in the label list.
14071407
:param is_favorite: Whether the label is a favorite.
14081408
:return: the updated Label.
14091409
:raises httpx.HTTPStatusError: If the API request fails.
@@ -1413,7 +1413,7 @@ async def update_label(
14131413
data = kwargs_without_none(
14141414
name=name,
14151415
color=color,
1416-
item_order=item_order,
1416+
order=order,
14171417
is_favorite=is_favorite,
14181418
)
14191419

0 commit comments

Comments
 (0)