Skip to content

Commit

Permalink
fix missing class method
Browse files Browse the repository at this point in the history
  • Loading branch information
amleczko authored May 7, 2024
1 parent 45b49b3 commit c1c625d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion todoist_api_python/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def from_dict(cls, obj):
due = Due.from_dict(obj["due"])

if obj.get("duration"):
# only get duration when it exists
duration = Duration.from_dict(obj["duration"])

return cls(
Expand Down Expand Up @@ -196,10 +195,14 @@ def to_dict(self):
@classmethod
def from_quick_add_response(cls, obj):
due: Due | None = None
duration: Duration | None = None

if obj.get("due"):
due = Due.from_quick_add_response(obj)

if obj.get("duration"):
duration = Duration.from_dict(obj["duration"])

return cls(
assignee_id=obj.get("responsible_uid"),
assigner_id=obj.get("assigned_by_uid"),
Expand All @@ -210,6 +213,7 @@ def from_quick_add_response(cls, obj):
creator_id=obj["added_by_uid"],
description=obj["description"],
due=due,
duration=duration,
id=obj["id"],
labels=obj["labels"],
order=obj["child_order"],
Expand Down

0 comments on commit c1c625d

Please sign in to comment.