MilanoteUnofficialApi.elements.document

 1from .element import Element
 2from .meta import Meta
 3from .location import Location
 4
 5
 6class Document(Element):
 7    """
 8    A Milanote document, contains text.
 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    title: str = None
20    """Title of the document."""
21    text_content: str = None
22    """Text content of the document."""
23
24    def __init__(self, data: dict):
25        super().__init__(data)
26        if "title" in data["content"]:
27            self.title = data["content"]["title"]
28        if data["content"]["textContent"] is not None:
29            self.text_content = "".join([block["text"] for block in data["content"]["textContent"]["blocks"]])
30
31    def __repr__(self):
32        return f"Document(id='{self.id}', title='{self.title}')"
class Document(MilanoteUnofficialApi.elements.element.Element):
 7class Document(Element):
 8    """
 9    A Milanote document, contains text.
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    title: str = None
21    """Title of the document."""
22    text_content: str = None
23    """Text content of the document."""
24
25    def __init__(self, data: dict):
26        super().__init__(data)
27        if "title" in data["content"]:
28            self.title = data["content"]["title"]
29        if data["content"]["textContent"] is not None:
30            self.text_content = "".join([block["text"] for block in data["content"]["textContent"]["blocks"]])
31
32    def __repr__(self):
33        return f"Document(id='{self.id}', title='{self.title}')"

A Milanote document, contains text.

Document(data: dict)
25    def __init__(self, data: dict):
26        super().__init__(data)
27        if "title" in data["content"]:
28            self.title = data["content"]["title"]
29        if data["content"]["textContent"] is not None:
30            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.

title: str = None

Title of the document.

text_content: str = None

Text content of the document.