diff --git a/package-lock.json b/package-lock.json index ffcfcee..7582642 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "devDependencies": { "@seamapi/fake-seam-connect": "1.86.0", "@seamapi/nextlove-sdk-generator": "^1.19.8", - "@seamapi/types": "1.749.0", + "@seamapi/types": "1.752.0", "del": "^7.1.0", "prettier": "^3.2.5" } @@ -535,9 +535,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.749.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.749.0.tgz", - "integrity": "sha512-KA8mwwNJRW7+4L+sFgoLsVywCzlq0G0E/84+RA0UQUv+2PdSaJcy6q5xlYjTY0TXUMJ+7cWnqvOc65iUviTgaQ==", + "version": "1.752.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.752.0.tgz", + "integrity": "sha512-xlnEGoW5Zz+dkZ0JPJXUEb8l1vtgagmzREF1uOPGvYu8bBss3sd7rKd4j8cAmxj8LkBiVW3vnByr3pMl0gWcIA==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 6bc8c77..067976a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@seamapi/fake-seam-connect": "1.86.0", "@seamapi/nextlove-sdk-generator": "^1.19.8", - "@seamapi/types": "1.749.0", + "@seamapi/types": "1.752.0", "del": "^7.1.0", "prettier": "^3.2.5" } diff --git a/seam/routes/acs_entrances.py b/seam/routes/acs_entrances.py index 5a3aa8e..4e96150 100644 --- a/seam/routes/acs_entrances.py +++ b/seam/routes/acs_entrances.py @@ -1,6 +1,8 @@ from typing import Optional, Any, List, Dict, Union from ..client import SeamHttpClient -from .models import AbstractAcsEntrances, AcsEntrance, AcsCredential +from .models import AbstractAcsEntrances, AcsEntrance, AcsCredential, ActionAttempt + +from ..modules.action_attempts import resolve_action_attempt class AcsEntrances(AbstractAcsEntrances): @@ -94,3 +96,31 @@ def list_credentials_with_access( ) return [AcsCredential.from_dict(item) for item in res["acs_credentials"]] + + def unlock( + self, + *, + acs_credential_id: str, + acs_entrance_id: str, + wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None + ) -> ActionAttempt: + json_payload = {} + + if acs_credential_id is not None: + json_payload["acs_credential_id"] = acs_credential_id + if acs_entrance_id is not None: + json_payload["acs_entrance_id"] = acs_entrance_id + + res = self.client.post("/acs/entrances/unlock", json=json_payload) + + wait_for_action_attempt = ( + self.defaults.get("wait_for_action_attempt") + if wait_for_action_attempt is None + else wait_for_action_attempt + ) + + return resolve_action_attempt( + client=self.client, + action_attempt=ActionAttempt.from_dict(res["action_attempt"]), + wait_for_action_attempt=wait_for_action_attempt, + ) diff --git a/seam/routes/models.py b/seam/routes/models.py index d00c13c..773e99e 100644 --- a/seam/routes/models.py +++ b/seam/routes/models.py @@ -345,6 +345,7 @@ class AcsEntrance: brivo_metadata: Dict[str, Any] can_belong_to_reservation: bool can_unlock_with_card: bool + can_unlock_with_cloud_key: bool can_unlock_with_code: bool can_unlock_with_mobile_key: bool connected_account_id: str @@ -371,6 +372,7 @@ def from_dict(d: Dict[str, Any]): brivo_metadata=DeepAttrDict(d.get("brivo_metadata", None)), can_belong_to_reservation=d.get("can_belong_to_reservation", None), can_unlock_with_card=d.get("can_unlock_with_card", None), + can_unlock_with_cloud_key=d.get("can_unlock_with_cloud_key", None), can_unlock_with_code=d.get("can_unlock_with_code", None), can_unlock_with_mobile_key=d.get("can_unlock_with_mobile_key", None), connected_account_id=d.get("connected_account_id", None), @@ -2172,6 +2174,16 @@ def list_credentials_with_access( ) -> List[AcsCredential]: raise NotImplementedError() + @abc.abstractmethod + def unlock( + self, + *, + acs_credential_id: str, + acs_entrance_id: str, + wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None + ) -> ActionAttempt: + raise NotImplementedError() + class AbstractAcsSystems(abc.ABC):