MilanoteUnofficialApi.elements.location

 1class Location:
 2    """
 3    A Milanote element's location data.
 4    """
 5
 6    parent_id: str
 7    """ID of the parent element."""
 8    section: str
 9    """Section of the element."""
10    position_score: int
11    """Position score of the element."""
12    position_x: int
13    """Position x of the element. (Only for CANVAS section)"""
14    position_y: int
15    """Position y of the element. (Only for CANVAS section)"""
16    position_index: int
17    """Position index of the element. (Only for INBOX section)"""
18
19    def __init__(self, data: dict):
20        self.parent_id = data.get("parentId", None)
21        self.section = data.get("section", None)
22        self.position_score = int(data.get("positionScore", -1))
23        self.position_x = int(data.get("positionX", -1))
24        self.position_y = int(data.get("positionY", -1))
25        self.position_index = int(data.get("positionIndex", -1))
26
27    def __repr__(self):
28        if self.section == "CANVAS":
29            return f"Location(parent_id='{self.parent_id}', section='{self.section}', position_score={self.position_score}, position_x={self.position_x}, position_y={self.position_y})"
30        elif self.section == "INBOX":
31            return f"Location(parent_id='{self.parent_id}', section='{self.section}', position_score={self.position_score}, position_index={self.position_index})"
32        else:
33            return f"Location(parent_id='{self.parent_id}', section='{self.section}', position_score={self.position_score})"
class Location:
 3class Location:
 4    """
 5    A Milanote element's location data.
 6    """
 7
 8    parent_id: str
 9    """ID of the parent element."""
10    section: str
11    """Section of the element."""
12    position_score: int
13    """Position score of the element."""
14    position_x: int
15    """Position x of the element. (Only for CANVAS section)"""
16    position_y: int
17    """Position y of the element. (Only for CANVAS section)"""
18    position_index: int
19    """Position index of the element. (Only for INBOX section)"""
20
21    def __init__(self, data: dict):
22        self.parent_id = data.get("parentId", None)
23        self.section = data.get("section", None)
24        self.position_score = int(data.get("positionScore", -1))
25        self.position_x = int(data.get("positionX", -1))
26        self.position_y = int(data.get("positionY", -1))
27        self.position_index = int(data.get("positionIndex", -1))
28
29    def __repr__(self):
30        if self.section == "CANVAS":
31            return f"Location(parent_id='{self.parent_id}', section='{self.section}', position_score={self.position_score}, position_x={self.position_x}, position_y={self.position_y})"
32        elif self.section == "INBOX":
33            return f"Location(parent_id='{self.parent_id}', section='{self.section}', position_score={self.position_score}, position_index={self.position_index})"
34        else:
35            return f"Location(parent_id='{self.parent_id}', section='{self.section}', position_score={self.position_score})"

A Milanote element's location data.

Location(data: dict)
21    def __init__(self, data: dict):
22        self.parent_id = data.get("parentId", None)
23        self.section = data.get("section", None)
24        self.position_score = int(data.get("positionScore", -1))
25        self.position_x = int(data.get("positionX", -1))
26        self.position_y = int(data.get("positionY", -1))
27        self.position_index = int(data.get("positionIndex", -1))
parent_id: str

ID of the parent element.

section: str

Section of the element.

position_score: int

Position score of the element.

position_x: int

Position x of the element. (Only for CANVAS section)

position_y: int

Position y of the element. (Only for CANVAS section)

position_index: int

Position index of the element. (Only for INBOX section)