diff --git a/package-lock.json b/package-lock.json index 178c4443..0a84fd92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "@seamapi/blueprint": "^1.12.0", "@seamapi/fake-seam-connect": "2.0.6", "@seamapi/smith": "^1.1.0", - "@seamapi/types": "1.1096.0", + "@seamapi/types": "1.1098.0", "change-case": "^5.4.4", "prettier": "^3.2.5" }, @@ -853,9 +853,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.1096.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.1096.0.tgz", - "integrity": "sha512-JMfk6KOq/U7l3InqXZRKLDrZ+OM/5Vfc+kaeZfkWwXPchBKn7nKBiJgEHQJ6V1BIycelFX+qsUXDju3XHoVN+g==", + "version": "1.1098.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.1098.0.tgz", + "integrity": "sha512-pxGJrkuDd62oNiGnKHKnx3LaNvylrWfj5T6IEKlE/njVrp4K/khVmiSqjt4wh3EcgU3R27Zk8pOqivhB8fwKkA==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 62f2b4c1..e4290c80 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@seamapi/blueprint": "^1.12.0", "@seamapi/fake-seam-connect": "2.0.6", "@seamapi/smith": "^1.1.0", - "@seamapi/types": "1.1096.0", + "@seamapi/types": "1.1098.0", "change-case": "^5.4.4", "prettier": "^3.2.5" } diff --git a/seam/resources/space.py b/seam/resources/space.py index 5bb3ec7a..1279dadd 100644 --- a/seam/resources/space.py +++ b/seam/resources/space.py @@ -4,6 +4,13 @@ from ..resource_mapping import ResourceMapping +def _from_discriminated_dict( + d: Any, variants: Dict[str, Any], discriminator: str +) -> Any: + variant = variants.get(d.get(discriminator)) + return DeepAttrDict(d) if variant is None else variant.from_dict(d) + + @dataclass class Space: """Represents a space that is a logical grouping of devices and entrances. You can assign access to an entire space, thereby making granting access more efficient. @@ -28,6 +35,8 @@ class Space: :ivar space_key: Unique key for the space within the workspace. + :ivar warnings: Warnings associated with the space. + :ivar workspace_id: ID of the workspace associated with the space.""" @dataclass @@ -74,6 +83,34 @@ def from_dict(cls, d: Any): longitude=d.get("longitude", None), ) + @dataclass + class BeingDeletedWarning(ResourceMapping): + """Indicates that the space is being deleted. Seam removes it, revokes its access grants, and detaches its devices and entrances shortly. + + :ivar created_at: Date and time at which Seam created the warning. + + :ivar message: Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + + :ivar warning_code: Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + """ + + created_at: str + message: str + warning_code: Literal["being_deleted"] + + @classmethod + def from_dict(cls, d: Any): + return cls( + created_at=d.get("created_at", None), + message=d.get("message", None), + warning_code=d.get("warning_code", None), + ) + + Warnings = Union[BeingDeletedWarning] + _WarningsVariants = { + "being_deleted": BeingDeletedWarning, + } + acs_entrance_count: float created_at: str customer_data: Optional[CustomerData] @@ -84,6 +121,7 @@ def from_dict(cls, d: Any): name: str space_id: str space_key: Optional[str] + warnings: List[Warnings] workspace_id: str @classmethod @@ -107,5 +145,9 @@ def from_dict(cls, d: Any): name=d.get("name", None), space_id=d.get("space_id", None), space_key=d.get("space_key", None), + warnings=[ + _from_discriminated_dict(i, cls._WarningsVariants, "warning_code") + for i in d.get("warnings") or [] + ], workspace_id=d.get("workspace_id", None), )