Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `TodoistAPIAsync` now performs true async HTTP I/O with `httpx2.AsyncClient`.
- Support for Python 3.14.
- `add_project` and `update_project` accept the `table` view style.
- `add_reminder`, `update_reminder`, `add_location_reminder`, and `update_location_reminder` accept `notify_uid` to choose which project collaborator receives the reminder.

### Removed

Expand Down
6 changes: 5 additions & 1 deletion tests/test_api_location_reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ async def test_add_location_reminder(
"loc_long": "-0.1278",
"loc_trigger": "on_enter",
"radius": 200,
"notify_uid": "34567",
},
response_json=default_location_reminder_response,
response_status=200,
Expand All @@ -127,6 +128,7 @@ async def test_add_location_reminder(
loc_long="-0.1278",
loc_trigger="on_enter",
radius=200,
notify_uid="34567",
)

assert len(respx_mock.calls) == 1
Expand All @@ -139,6 +141,7 @@ async def test_add_location_reminder(
loc_long="-0.1278",
loc_trigger="on_enter",
radius=200,
notify_uid="34567",
)

assert len(respx_mock.calls) == 2
Expand All @@ -152,9 +155,10 @@ async def test_update_location_reminder(
respx_mock: respx.MockRouter,
default_location_reminder: LocationReminder,
) -> None:
args = {
args: dict[str, Any] = {
"name": "Home Office",
"radius": 150,
"notify_uid": "2671362",
}
updated_dict = default_location_reminder.to_dict() | args

Expand Down
6 changes: 5 additions & 1 deletion tests/test_api_reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ async def test_add_reminder(
"reminder_type": "absolute",
"due": {"string": "tomorrow at 12", "lang": "en"},
"service": "push",
"notify_uid": "34567",
},
response_json=default_reminder_response,
response_status=200,
Expand All @@ -122,6 +123,7 @@ async def test_add_reminder(
due_string="tomorrow at 12",
due_lang="en",
service="push",
notify_uid="34567",
)

assert len(respx_mock.calls) == 1
Expand All @@ -133,6 +135,7 @@ async def test_add_reminder(
due_string="tomorrow at 12",
due_lang="en",
service="push",
notify_uid="34567",
)

assert len(respx_mock.calls) == 2
Expand All @@ -146,8 +149,9 @@ async def test_update_reminder(
respx_mock: respx.MockRouter,
default_reminder: Reminder,
) -> None:
args = {
args: dict[str, Any] = {
"minute_offset": 45,
"notify_uid": "2671362",
}
updated_reminder_dict = default_reminder.to_dict() | args

Expand Down
16 changes: 16 additions & 0 deletions todoist_api_python/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ def add_reminder(
due_lang: LanguageCode | None = None,
due_timezone: str | None = None,
service: Literal["email", "push"] | None = None,
notify_uid: str | None = None,
) -> Reminder:
"""
Create a new reminder.
Expand All @@ -1593,6 +1594,8 @@ def add_reminder(
:param due_lang: Language for parsing the due date.
:param due_timezone: Timezone for the due date.
:param service: The notification service ("email" or "push").
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project. Defaults to the user creating the reminder.
:return: The newly created reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1613,6 +1616,7 @@ def add_reminder(
minute_offset=minute_offset,
due=due or None,
service=service,
notify_uid=notify_uid,
)

response = post(
Expand All @@ -1636,6 +1640,7 @@ def update_reminder(
due_lang: LanguageCode | None = None,
due_timezone: str | None = None,
service: Literal["email", "push"] | None = None,
notify_uid: str | None = None,
) -> Reminder:
"""
Update an existing reminder.
Expand All @@ -1650,6 +1655,8 @@ def update_reminder(
:param due_lang: Language for parsing the due date.
:param due_timezone: Timezone for the due date.
:param service: The notification service ("email" or "push").
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project.
:return: The updated reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1668,6 +1675,7 @@ def update_reminder(
minute_offset=minute_offset,
due=due or None,
service=service,
notify_uid=notify_uid,
)

response = post(
Expand Down Expand Up @@ -1761,6 +1769,7 @@ def add_location_reminder(
loc_trigger: Literal["on_enter", "on_leave"],
*,
radius: int | None = None,
notify_uid: str | None = None,
) -> LocationReminder:
"""
Create a new location reminder.
Expand All @@ -1771,6 +1780,8 @@ def add_location_reminder(
:param loc_long: The longitude coordinate.
:param loc_trigger: When to trigger ("on_enter" or "on_leave").
:param radius: The radius in meters (default: 100).
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project. Defaults to the user creating the reminder.
:return: The newly created location reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1783,6 +1794,7 @@ def add_location_reminder(
loc_long=loc_long,
loc_trigger=loc_trigger,
radius=radius,
notify_uid=notify_uid,
)

response = post(
Expand All @@ -1804,6 +1816,7 @@ def update_location_reminder(
loc_long: str | None = None,
loc_trigger: Literal["on_enter", "on_leave"] | None = None,
radius: int | None = None,
notify_uid: str | None = None,
) -> LocationReminder:
"""
Update an existing location reminder.
Expand All @@ -1816,6 +1829,8 @@ def update_location_reminder(
:param loc_long: The longitude coordinate.
:param loc_trigger: When to trigger ("on_enter" or "on_leave").
:param radius: The radius in meters.
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project.
:return: The updated location reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1827,6 +1842,7 @@ def update_location_reminder(
loc_long=loc_long,
loc_trigger=loc_trigger,
radius=radius,
notify_uid=notify_uid,
)

response = post(
Expand Down
16 changes: 16 additions & 0 deletions todoist_api_python/api_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,7 @@ async def add_reminder(
due_lang: LanguageCode | None = None,
due_timezone: str | None = None,
service: Literal["email", "push"] | None = None,
notify_uid: str | None = None,
) -> Reminder:
"""
Create a new reminder.
Expand All @@ -1613,6 +1614,8 @@ async def add_reminder(
:param due_lang: Language for parsing the due date.
:param due_timezone: Timezone for the due date.
:param service: The notification service ("email" or "push").
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project. Defaults to the user creating the reminder.
:return: The newly created reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1633,6 +1636,7 @@ async def add_reminder(
minute_offset=minute_offset,
due=due or None,
service=service,
notify_uid=notify_uid,
)

response = await post_async(
Expand All @@ -1656,6 +1660,7 @@ async def update_reminder(
due_lang: LanguageCode | None = None,
due_timezone: str | None = None,
service: Literal["email", "push"] | None = None,
notify_uid: str | None = None,
) -> Reminder:
"""
Update an existing reminder.
Expand All @@ -1670,6 +1675,8 @@ async def update_reminder(
:param due_lang: Language for parsing the due date.
:param due_timezone: Timezone for the due date.
:param service: The notification service ("email" or "push").
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project.
:return: The updated reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1688,6 +1695,7 @@ async def update_reminder(
minute_offset=minute_offset,
due=due or None,
service=service,
notify_uid=notify_uid,
)

response = await post_async(
Expand Down Expand Up @@ -1783,6 +1791,7 @@ async def add_location_reminder(
loc_trigger: Literal["on_enter", "on_leave"],
*,
radius: int | None = None,
notify_uid: str | None = None,
) -> LocationReminder:
"""
Create a new location reminder.
Expand All @@ -1793,6 +1802,8 @@ async def add_location_reminder(
:param loc_long: The longitude coordinate.
:param loc_trigger: When to trigger ("on_enter" or "on_leave").
:param radius: The radius in meters (default: 100).
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project. Defaults to the user creating the reminder.
:return: The newly created location reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1805,6 +1816,7 @@ async def add_location_reminder(
loc_long=loc_long,
loc_trigger=loc_trigger,
radius=radius,
notify_uid=notify_uid,
)

response = await post_async(
Expand All @@ -1826,6 +1838,7 @@ async def update_location_reminder(
loc_long: str | None = None,
loc_trigger: Literal["on_enter", "on_leave"] | None = None,
radius: int | None = None,
notify_uid: str | None = None,
) -> LocationReminder:
"""
Update an existing location reminder.
Expand All @@ -1838,6 +1851,8 @@ async def update_location_reminder(
:param loc_long: The longitude coordinate.
:param loc_trigger: When to trigger ("on_enter" or "on_leave").
:param radius: The radius in meters.
:param notify_uid: The ID of the user to notify, who must be a collaborator
of the task's project.
:return: The updated location reminder.
:raises httpx2.HTTPStatusError: If the API request fails.
"""
Expand All @@ -1849,6 +1864,7 @@ async def update_location_reminder(
loc_long=loc_long,
loc_trigger=loc_trigger,
radius=radius,
notify_uid=notify_uid,
)

response = await post_async(
Expand Down