MilanoteUnofficialApi.elements.task

 1from .element import Element
 2from .meta import Meta
 3from .location import Location
 4
 5
 6class Task(Element):
 7    """
 8    A Milanote task.
 9    """
10
11    id: str
12    """ID of the element."""
13    element_type: str
14    """Type of the element."""
15    meta: Meta
16    """Metadata of the element."""
17    location: Location
18    """Location of the element."""
19    text_content: str = None
20    """Text content of the task."""
21    assignments: list[dict] = None
22    """Assignments of the task."""
23    due_date: str = None
24    """Due date of the task. (UTC)"""
25    due_reminder: str = None
26    """Due reminder UNIX timestamp of the task."""
27    is_complete: bool = False
28    """Whether the task is complete or not."""
29
30    def __init__(self, data: dict):
31        super().__init__(data)
32        self.assignments = data["content"].get("assignments", None)
33        self.due_date = data["content"].get("dueDate", None)
34        self.due_reminder = data["content"].get("dueReminderTimestamp", None)
35        self.is_complete = data["content"].get("isComplete", False)
36        if data["content"]["textContent"] is not None:
37            self.text_content = "".join([block["text"] for block in data["content"]["textContent"]["blocks"]])
38
39    def __repr__(self):
40        return f"Task(id='{self.id}', text_content='{self.text_content}')"
 7class Task(Element):
 8    """
 9    A Milanote task.
10    """
11
12    id: str
13    """ID of the element."""
14    element_type: str
15    """Type of the element."""
16    meta: Meta
17    """Metadata of the element."""
18    location: Location
19    """Location of the element."""
20    text_content: str = None
21    """Text content of the task."""
22    assignments: list[dict] = None
23    """Assignments of the task."""
24    due_date: str = None
25    """Due date of the task. (UTC)"""
26    due_reminder: str = None
27    """Due reminder UNIX timestamp of the task."""
28    is_complete: bool = False
29    """Whether the task is complete or not."""
30
31    def __init__(self, data: dict):
32        super().__init__(data)
33        self.assignments = data["content"].get("assignments", None)
34        self.due_date = data["content"].get("dueDate", None)
35        self.due_reminder = data["content"].get("dueReminderTimestamp", None)
36        self.is_complete = data["content"].get("isComplete", False)
37        if data["content"]["textContent"] is not None:
38            self.text_content = "".join([block["text"] for block in data["content"]["textContent"]["blocks"]])
39
40    def __repr__(self):
41        return f"Task(id='{self.id}', text_content='{self.text_content}')"

A Milanote task.

Task(data: dict)
31    def __init__(self, data: dict):
32        super().__init__(data)
33        self.assignments = data["content"].get("assignments", None)
34        self.due_date = data["content"].get("dueDate", None)
35        self.due_reminder = data["content"].get("dueReminderTimestamp", None)
36        self.is_complete = data["content"].get("isComplete", False)
37        if data["content"]["textContent"] is not None:
38            self.text_content = "".join([block["text"] for block in data["content"]["textContent"]["blocks"]])
id: str

ID of the element.

element_type: str

Type of the element.

Metadata of the element.

Location of the element.

text_content: str = None

Text content of the task.

assignments: list[dict] = None

Assignments of the task.

due_date: str = None

Due date of the task. (UTC)

due_reminder: str = None

Due reminder UNIX timestamp of the task.

is_complete: bool = False

Whether the task is complete or not.