diff --git a/package-lock.json b/package-lock.json index cb7bc30..dec4bbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "devDependencies": { "@seamapi/fake-seam-connect": "1.74.0", "@seamapi/nextlove-sdk-generator": "1.15.3", - "@seamapi/types": "1.336.0", + "@seamapi/types": "1.338.1", "del": "^7.1.0", "prettier": "^3.2.5" } @@ -473,9 +473,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.336.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.336.0.tgz", - "integrity": "sha512-plDtzA5/gqzHc3EifAN9H3NtQlkXjZ9XM4GZ6KF1LNmSHloJmOdrULvNAvEDJ25BmLZfufEw2RnhyW4g7mQTkw==", + "version": "1.338.1", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.338.1.tgz", + "integrity": "sha512-x5uUP9TCqFRLAl8GotS9AifdoJBvi7Y+6lcd3LgKIKoc+H7e52QvQJxQWTit8KI0PMlcqu2uj97gWtQGDU9P0A==", "dev": true, "engines": { "node": ">=18.12.0", diff --git a/package.json b/package.json index d24140a..b35b1e4 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@seamapi/fake-seam-connect": "1.74.0", "@seamapi/nextlove-sdk-generator": "1.15.3", - "@seamapi/types": "1.336.0", + "@seamapi/types": "1.338.1", "del": "^7.1.0", "prettier": "^3.2.5" } diff --git a/seam/routes/acs_access_groups_unmanaged.py b/seam/routes/acs_access_groups_unmanaged.py index 3270ed4..010869e 100644 --- a/seam/routes/acs_access_groups_unmanaged.py +++ b/seam/routes/acs_access_groups_unmanaged.py @@ -1,6 +1,6 @@ from typing import Optional, Any, List, Dict, Union from ..client import SeamHttpClient -from .models import AbstractAcsAccessGroupsUnmanaged +from .models import AbstractAcsAccessGroupsUnmanaged, UnmanagedAcsAccessGroup class AcsAccessGroupsUnmanaged(AbstractAcsAccessGroupsUnmanaged): @@ -8,19 +8,19 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.client = client self.defaults = defaults - def get(self, *, acs_access_group_id: str) -> None: + def get(self, *, acs_access_group_id: str) -> UnmanagedAcsAccessGroup: json_payload = {} if acs_access_group_id is not None: json_payload["acs_access_group_id"] = acs_access_group_id - self.client.post("/acs/access_groups/unmanaged/get", json=json_payload) + res = self.client.post("/acs/access_groups/unmanaged/get", json=json_payload) - return None + return UnmanagedAcsAccessGroup.from_dict(res["acs_access_group"]) def list( self, *, acs_system_id: Optional[str] = None, acs_user_id: Optional[str] = None - ) -> None: + ) -> List[UnmanagedAcsAccessGroup]: json_payload = {} if acs_system_id is not None: @@ -28,6 +28,8 @@ def list( if acs_user_id is not None: json_payload["acs_user_id"] = acs_user_id - self.client.post("/acs/access_groups/unmanaged/list", json=json_payload) + res = self.client.post("/acs/access_groups/unmanaged/list", json=json_payload) - return None + return [ + UnmanagedAcsAccessGroup.from_dict(item) for item in res["acs_access_groups"] + ] diff --git a/seam/routes/acs_credentials_unmanaged.py b/seam/routes/acs_credentials_unmanaged.py index b86daa9..c7d9d79 100644 --- a/seam/routes/acs_credentials_unmanaged.py +++ b/seam/routes/acs_credentials_unmanaged.py @@ -1,6 +1,6 @@ from typing import Optional, Any, List, Dict, Union from ..client import SeamHttpClient -from .models import AbstractAcsCredentialsUnmanaged +from .models import AbstractAcsCredentialsUnmanaged, UnmanagedAcsCredential class AcsCredentialsUnmanaged(AbstractAcsCredentialsUnmanaged): @@ -8,15 +8,15 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.client = client self.defaults = defaults - def get(self, *, acs_credential_id: str) -> None: + def get(self, *, acs_credential_id: str) -> UnmanagedAcsCredential: json_payload = {} if acs_credential_id is not None: json_payload["acs_credential_id"] = acs_credential_id - self.client.post("/acs/credentials/unmanaged/get", json=json_payload) + res = self.client.post("/acs/credentials/unmanaged/get", json=json_payload) - return None + return UnmanagedAcsCredential.from_dict(res["acs_credential"]) def list( self, @@ -24,7 +24,7 @@ def list( acs_user_id: Optional[str] = None, acs_system_id: Optional[str] = None, user_identity_id: Optional[str] = None - ) -> None: + ) -> List[UnmanagedAcsCredential]: json_payload = {} if acs_user_id is not None: @@ -34,6 +34,8 @@ def list( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - self.client.post("/acs/credentials/unmanaged/list", json=json_payload) + res = self.client.post("/acs/credentials/unmanaged/list", json=json_payload) - return None + return [ + UnmanagedAcsCredential.from_dict(item) for item in res["acs_credentials"] + ] diff --git a/seam/routes/acs_encoders.py b/seam/routes/acs_encoders.py index 5b71a09..6d7a684 100644 --- a/seam/routes/acs_encoders.py +++ b/seam/routes/acs_encoders.py @@ -1,6 +1,6 @@ from typing import Optional, Any, List, Dict, Union from ..client import SeamHttpClient -from .models import AbstractAcsEncoders, ActionAttempt +from .models import AbstractAcsEncoders, ActionAttempt, AcsEncoder from ..modules.action_attempts import resolve_action_attempt @@ -45,7 +45,7 @@ def list( limit: Optional[float] = None, acs_system_ids: Optional[List[str]] = None, acs_encoder_ids: Optional[List[str]] = None - ) -> None: + ) -> List[AcsEncoder]: json_payload = {} if acs_system_id is not None: @@ -57,9 +57,9 @@ def list( if acs_encoder_ids is not None: json_payload["acs_encoder_ids"] = acs_encoder_ids - self.client.post("/acs/encoders/list", json=json_payload) + res = self.client.post("/acs/encoders/list", json=json_payload) - return None + return [AcsEncoder.from_dict(item) for item in res["acs_encoders"]] def scan_credential( self, diff --git a/seam/routes/acs_users_unmanaged.py b/seam/routes/acs_users_unmanaged.py index ce13590..6c98525 100644 --- a/seam/routes/acs_users_unmanaged.py +++ b/seam/routes/acs_users_unmanaged.py @@ -1,6 +1,6 @@ from typing import Optional, Any, List, Dict, Union from ..client import SeamHttpClient -from .models import AbstractAcsUsersUnmanaged +from .models import AbstractAcsUsersUnmanaged, UnmanagedAcsUser class AcsUsersUnmanaged(AbstractAcsUsersUnmanaged): @@ -8,15 +8,15 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.client = client self.defaults = defaults - def get(self, *, acs_user_id: str) -> None: + def get(self, *, acs_user_id: str) -> UnmanagedAcsUser: json_payload = {} if acs_user_id is not None: json_payload["acs_user_id"] = acs_user_id - self.client.post("/acs/users/unmanaged/get", json=json_payload) + res = self.client.post("/acs/users/unmanaged/get", json=json_payload) - return None + return UnmanagedAcsUser.from_dict(res["acs_user"]) def list( self, @@ -26,7 +26,7 @@ def list( user_identity_email_address: Optional[str] = None, user_identity_id: Optional[str] = None, user_identity_phone_number: Optional[str] = None - ) -> None: + ) -> List[UnmanagedAcsUser]: json_payload = {} if acs_system_id is not None: @@ -40,6 +40,6 @@ def list( if user_identity_phone_number is not None: json_payload["user_identity_phone_number"] = user_identity_phone_number - self.client.post("/acs/users/unmanaged/list", json=json_payload) + res = self.client.post("/acs/users/unmanaged/list", json=json_payload) - return None + return [UnmanagedAcsUser.from_dict(item) for item in res["acs_users"]] diff --git a/seam/routes/models.py b/seam/routes/models.py index 9d96337..cfb5be7 100644 --- a/seam/routes/models.py +++ b/seam/routes/models.py @@ -212,6 +212,27 @@ def from_dict(d: Dict[str, Any]): ) +@dataclass +class AcsEncoder: + acs_encoder_id: str + acs_system_id: str + created_at: str + display_name: str + errors: List[Dict[str, Any]] + workspace_id: str + + @staticmethod + def from_dict(d: Dict[str, Any]): + return AcsEncoder( + acs_encoder_id=d.get("acs_encoder_id", None), + acs_system_id=d.get("acs_system_id", None), + created_at=d.get("created_at", None), + display_name=d.get("display_name", None), + errors=d.get("errors", None), + workspace_id=d.get("workspace_id", None), + ) + + @dataclass class AcsEntrance: acs_entrance_id: str @@ -903,6 +924,169 @@ def from_dict(d: Dict[str, Any]): ) +@dataclass +class UnmanagedAcsAccessGroup: + access_group_type: str + access_group_type_display_name: str + acs_access_group_id: str + acs_system_id: str + created_at: str + display_name: str + external_type: str + external_type_display_name: str + is_managed: bool + name: str + warnings: List[Dict[str, Any]] + workspace_id: str + + @staticmethod + def from_dict(d: Dict[str, Any]): + return UnmanagedAcsAccessGroup( + access_group_type=d.get("access_group_type", None), + access_group_type_display_name=d.get( + "access_group_type_display_name", None + ), + acs_access_group_id=d.get("acs_access_group_id", None), + acs_system_id=d.get("acs_system_id", None), + created_at=d.get("created_at", None), + display_name=d.get("display_name", None), + external_type=d.get("external_type", None), + external_type_display_name=d.get("external_type_display_name", None), + is_managed=d.get("is_managed", None), + name=d.get("name", None), + warnings=d.get("warnings", None), + workspace_id=d.get("workspace_id", None), + ) + + +@dataclass +class UnmanagedAcsCredential: + access_method: str + acs_credential_id: str + acs_credential_pool_id: str + acs_system_id: str + acs_user_id: str + assa_abloy_vostio_metadata: Dict[str, Any] + card_number: str + code: str + created_at: str + display_name: str + ends_at: str + errors: List[Dict[str, Any]] + external_type: str + external_type_display_name: str + is_issued: bool + is_latest_desired_state_synced_with_provider: bool + is_managed: bool + is_multi_phone_sync_credential: bool + is_one_time_use: bool + issued_at: str + latest_desired_state_synced_with_provider_at: str + parent_acs_credential_id: str + starts_at: str + visionline_metadata: Dict[str, Any] + warnings: List[Dict[str, Any]] + workspace_id: str + + @staticmethod + def from_dict(d: Dict[str, Any]): + return UnmanagedAcsCredential( + access_method=d.get("access_method", None), + acs_credential_id=d.get("acs_credential_id", None), + acs_credential_pool_id=d.get("acs_credential_pool_id", None), + acs_system_id=d.get("acs_system_id", None), + acs_user_id=d.get("acs_user_id", None), + assa_abloy_vostio_metadata=DeepAttrDict( + d.get("assa_abloy_vostio_metadata", None) + ), + card_number=d.get("card_number", None), + code=d.get("code", None), + created_at=d.get("created_at", None), + display_name=d.get("display_name", None), + ends_at=d.get("ends_at", None), + errors=d.get("errors", None), + external_type=d.get("external_type", None), + external_type_display_name=d.get("external_type_display_name", None), + is_issued=d.get("is_issued", None), + is_latest_desired_state_synced_with_provider=d.get( + "is_latest_desired_state_synced_with_provider", None + ), + is_managed=d.get("is_managed", None), + is_multi_phone_sync_credential=d.get( + "is_multi_phone_sync_credential", None + ), + is_one_time_use=d.get("is_one_time_use", None), + issued_at=d.get("issued_at", None), + latest_desired_state_synced_with_provider_at=d.get( + "latest_desired_state_synced_with_provider_at", None + ), + parent_acs_credential_id=d.get("parent_acs_credential_id", None), + starts_at=d.get("starts_at", None), + visionline_metadata=DeepAttrDict(d.get("visionline_metadata", None)), + warnings=d.get("warnings", None), + workspace_id=d.get("workspace_id", None), + ) + + +@dataclass +class UnmanagedAcsUser: + access_schedule: Dict[str, Any] + acs_system_id: str + acs_user_id: str + created_at: str + display_name: str + email: str + email_address: str + errors: List[Dict[str, Any]] + external_type: str + external_type_display_name: str + full_name: str + hid_acs_system_id: str + is_latest_desired_state_synced_with_provider: bool + is_managed: bool + is_suspended: bool + latest_desired_state_synced_with_provider_at: str + phone_number: str + user_identity_email_address: str + user_identity_full_name: str + user_identity_id: str + user_identity_phone_number: str + warnings: List[Dict[str, Any]] + workspace_id: str + + @staticmethod + def from_dict(d: Dict[str, Any]): + return UnmanagedAcsUser( + access_schedule=DeepAttrDict(d.get("access_schedule", None)), + acs_system_id=d.get("acs_system_id", None), + acs_user_id=d.get("acs_user_id", None), + created_at=d.get("created_at", None), + display_name=d.get("display_name", None), + email=d.get("email", None), + email_address=d.get("email_address", None), + errors=d.get("errors", None), + external_type=d.get("external_type", None), + external_type_display_name=d.get("external_type_display_name", None), + full_name=d.get("full_name", None), + hid_acs_system_id=d.get("hid_acs_system_id", None), + is_latest_desired_state_synced_with_provider=d.get( + "is_latest_desired_state_synced_with_provider", None + ), + is_managed=d.get("is_managed", None), + is_suspended=d.get("is_suspended", None), + latest_desired_state_synced_with_provider_at=d.get( + "latest_desired_state_synced_with_provider_at", None + ), + phone_number=d.get("phone_number", None), + user_identity_email_address=d.get("user_identity_email_address", None), + user_identity_full_name=d.get("user_identity_full_name", None), + user_identity_id=d.get("user_identity_id", None), + user_identity_phone_number=d.get("user_identity_phone_number", None), + warnings=d.get("warnings", None), + workspace_id=d.get("workspace_id", None), + ) + + @dataclass class UnmanagedDevice: can_hvac_cool: bool @@ -1111,13 +1295,13 @@ def remove_user(self, *, acs_access_group_id: str, acs_user_id: str) -> None: class AbstractAcsAccessGroupsUnmanaged(abc.ABC): @abc.abstractmethod - def get(self, *, acs_access_group_id: str) -> None: + def get(self, *, acs_access_group_id: str) -> UnmanagedAcsAccessGroup: raise NotImplementedError() @abc.abstractmethod def list( self, *, acs_system_id: Optional[str] = None, acs_user_id: Optional[str] = None - ) -> None: + ) -> List[UnmanagedAcsAccessGroup]: raise NotImplementedError() @@ -1222,7 +1406,7 @@ def update( class AbstractAcsCredentialsUnmanaged(abc.ABC): @abc.abstractmethod - def get(self, *, acs_credential_id: str) -> None: + def get(self, *, acs_credential_id: str) -> UnmanagedAcsCredential: raise NotImplementedError() @abc.abstractmethod @@ -1232,7 +1416,7 @@ def list( acs_user_id: Optional[str] = None, acs_system_id: Optional[str] = None, user_identity_id: Optional[str] = None - ) -> None: + ) -> List[UnmanagedAcsCredential]: raise NotImplementedError() @@ -1256,7 +1440,7 @@ def list( limit: Optional[float] = None, acs_system_ids: Optional[List[str]] = None, acs_encoder_ids: Optional[List[str]] = None - ) -> None: + ) -> List[AcsEncoder]: raise NotImplementedError() @abc.abstractmethod @@ -1435,7 +1619,7 @@ def update( class AbstractAcsUsersUnmanaged(abc.ABC): @abc.abstractmethod - def get(self, *, acs_user_id: str) -> None: + def get(self, *, acs_user_id: str) -> UnmanagedAcsUser: raise NotImplementedError() @abc.abstractmethod @@ -1447,7 +1631,7 @@ def list( user_identity_email_address: Optional[str] = None, user_identity_id: Optional[str] = None, user_identity_phone_number: Optional[str] = None - ) -> None: + ) -> List[UnmanagedAcsUser]: raise NotImplementedError()