Skip to content

Commit 69d9d1b

Browse files
committed
Add deadline support
Deadline was already supported when creating and updating tasks since the migration to the Todoist API v1. It is now also returned on the Task object. Closes #165
1 parent 0c215c6 commit 69d9d1b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/data/test_defaults.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class PaginatedItems(TypedDict):
2626
"is_recurring": True,
2727
}
2828

29+
DEFAULT_DEADLINE_RESPONSE = {
30+
"date": "2016-09-01",
31+
"lang": "en",
32+
}
33+
2934
DEFAULT_DURATION_RESPONSE = {
3035
"amount": 60,
3136
"unit": "minute",
@@ -88,6 +93,7 @@ class PaginatedItems(TypedDict):
8893
"labels": [],
8994
"priority": 1,
9095
"due": DEFAULT_DUE_RESPONSE,
96+
"deadline": DEFAULT_DEADLINE_RESPONSE,
9197
"duration": DEFAULT_DURATION_RESPONSE,
9298
"collapsed": False,
9399
"child_order": 3,

todoist_api_python/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ class _(JSONPyWizard.Meta): # noqa:N801
7474
timezone: str | None = None
7575

7676

77+
@dataclass
78+
class Deadline(JSONPyWizard):
79+
class _(JSONPyWizard.Meta): # noqa:N801
80+
v1 = True
81+
82+
date: ApiDue
83+
lang: str = "en"
84+
85+
7786
@dataclass
7887
class Meta(JSONPyWizard):
7988
class _(JSONPyWizard.Meta): # noqa:N801
@@ -100,6 +109,7 @@ class _(JSONPyWizard.Meta): # noqa:N801
100109
labels: list[str] | None
101110
priority: int
102111
due: Due | None
112+
deadline: Deadline | None
103113
duration: Duration | None
104114
is_collapsed: Annotated[bool, Alias(load=("collapsed", "is_collapsed"))]
105115
order: Annotated[int, Alias(load=("child_order", "order"))]

0 commit comments

Comments
 (0)