diff --git a/package-lock.json b/package-lock.json index f298dcde..046c1f66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "devDependencies": { "@seamapi/fake-seam-connect": "1.83.2", "@seamapi/nextlove-sdk-generator": "^1.18.1", - "@seamapi/types": "1.425.0", + "@seamapi/types": "1.429.1", "del": "^7.1.0", "prettier": "^3.2.5" } @@ -475,9 +475,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.425.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.425.0.tgz", - "integrity": "sha512-RzxfgwMNXilJxvvcDE8lcHiOaKRt/z1ZkQT6XWZsaqwGRlaIzHfLL0hvZ+Ocf+zg2ZcSkhPa/kASa3Xlqiqc2Q==", + "version": "1.429.1", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.429.1.tgz", + "integrity": "sha512-94GBjvVNKMJqSv0DRKyhjHB6Gxg6QZi9f+5xPmBYWyhtYYfA0i4QNBFDqyUcp5jXIjjtmzzUltr3BCkoisVYOw==", "dev": true, "engines": { "node": ">=18.12.0", diff --git a/package.json b/package.json index 5f46b96f..d64d3447 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@seamapi/fake-seam-connect": "1.83.2", "@seamapi/nextlove-sdk-generator": "^1.18.1", - "@seamapi/types": "1.425.0", + "@seamapi/types": "1.429.1", "del": "^7.1.0", "prettier": "^3.2.5" } diff --git a/seam/routes/access_methods.py b/seam/routes/access_methods.py index 0bd61158..9641289e 100644 --- a/seam/routes/access_methods.py +++ b/seam/routes/access_methods.py @@ -1,6 +1,8 @@ from typing import Optional, Any, List, Dict, Union from ..client import SeamHttpClient -from .models import AbstractAccessMethods, AccessMethod +from .models import AbstractAccessMethods, ActionAttempt, AccessMethod + +from ..modules.action_attempts import resolve_action_attempt class AccessMethods(AbstractAccessMethods): @@ -18,6 +20,34 @@ def delete(self, *, access_method_id: str) -> None: return None + def encode( + self, + *, + access_method_id: str, + acs_encoder_id: str, + wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None + ) -> ActionAttempt: + json_payload = {} + + if access_method_id is not None: + json_payload["access_method_id"] = access_method_id + if acs_encoder_id is not None: + json_payload["acs_encoder_id"] = acs_encoder_id + + res = self.client.post("/access_methods/encode", 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, + ) + def get(self, *, access_method_id: str) -> AccessMethod: json_payload = {} diff --git a/seam/routes/acs_encoders.py b/seam/routes/acs_encoders.py index 5bb0c772..f2c4d448 100644 --- a/seam/routes/acs_encoders.py +++ b/seam/routes/acs_encoders.py @@ -10,47 +10,22 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.client = client self.defaults = defaults - def encode_access_method( + def encode_credential( self, *, - access_method_id: str, acs_encoder_id: str, + access_method_id: Optional[str] = None, + acs_credential_id: Optional[str] = None, wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None ) -> ActionAttempt: json_payload = {} - if access_method_id is not None: - json_payload["access_method_id"] = access_method_id if acs_encoder_id is not None: json_payload["acs_encoder_id"] = acs_encoder_id - - res = self.client.post("/acs/encoders/encode_access_method", 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, - ) - - def encode_credential( - self, - *, - acs_credential_id: str, - acs_encoder_id: str, - wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None - ) -> ActionAttempt: - json_payload = {} - + if access_method_id is not None: + json_payload["access_method_id"] = access_method_id if acs_credential_id is not None: json_payload["acs_credential_id"] = acs_credential_id - if acs_encoder_id is not None: - json_payload["acs_encoder_id"] = acs_encoder_id res = self.client.post("/acs/encoders/encode_credential", json=json_payload) diff --git a/seam/routes/connected_accounts.py b/seam/routes/connected_accounts.py index 38e4ec18..de67e0b2 100644 --- a/seam/routes/connected_accounts.py +++ b/seam/routes/connected_accounts.py @@ -41,6 +41,7 @@ def list( customer_ids: Optional[List[str]] = None, limit: Optional[int] = None, page_cursor: Optional[str] = None, + search: Optional[str] = None, user_identifier_key: Optional[str] = None ) -> List[ConnectedAccount]: json_payload = {} @@ -53,6 +54,8 @@ def list( json_payload["limit"] = limit if page_cursor is not None: json_payload["page_cursor"] = page_cursor + if search is not None: + json_payload["search"] = search if user_identifier_key is not None: json_payload["user_identifier_key"] = user_identifier_key diff --git a/seam/routes/models.py b/seam/routes/models.py index 5e008b7e..2bb8da30 100644 --- a/seam/routes/models.py +++ b/seam/routes/models.py @@ -69,6 +69,7 @@ class AccessGrant: created_at: str display_name: str ends_at: str + instant_key_url: str location_ids: List[str] requested_access_methods: List[Dict[str, Any]] space_ids: List[str] @@ -84,6 +85,7 @@ def from_dict(d: Dict[str, Any]): created_at=d.get("created_at", None), display_name=d.get("display_name", None), ends_at=d.get("ends_at", None), + instant_key_url=d.get("instant_key_url", None), location_ids=d.get("location_ids", None), requested_access_methods=d.get("requested_access_methods", None), space_ids=d.get("space_ids", None), @@ -99,7 +101,7 @@ class AccessMethod: created_at: str display_name: str instant_key_url: str - is_card_encoding_required: bool + is_encoding_required: bool issued_at: str mode: str workspace_id: str @@ -111,7 +113,7 @@ def from_dict(d: Dict[str, Any]): created_at=d.get("created_at", None), display_name=d.get("display_name", None), instant_key_url=d.get("instant_key_url", None), - is_card_encoding_required=d.get("is_card_encoding_required", None), + is_encoding_required=d.get("is_encoding_required", None), issued_at=d.get("issued_at", None), mode=d.get("mode", None), workspace_id=d.get("workspace_id", None), @@ -659,6 +661,7 @@ class Device: can_simulate_disconnection: bool can_simulate_removal: bool can_turn_off_hvac: bool + can_unlock_with_code: bool capabilities_supported: List[str] connected_account_id: str created_at: str @@ -692,6 +695,7 @@ def from_dict(d: Dict[str, Any]): can_simulate_disconnection=d.get("can_simulate_disconnection", None), can_simulate_removal=d.get("can_simulate_removal", None), can_turn_off_hvac=d.get("can_turn_off_hvac", None), + can_unlock_with_code=d.get("can_unlock_with_code", None), capabilities_supported=d.get("capabilities_supported", None), connected_account_id=d.get("connected_account_id", None), created_at=d.get("created_at", None), @@ -722,6 +726,7 @@ class DeviceProvider: can_simulate_disconnection: bool can_simulate_removal: bool can_turn_off_hvac: bool + can_unlock_with_code: bool device_provider_name: str display_name: str image_url: str @@ -745,6 +750,7 @@ def from_dict(d: Dict[str, Any]): can_simulate_disconnection=d.get("can_simulate_disconnection", None), can_simulate_removal=d.get("can_simulate_removal", None), can_turn_off_hvac=d.get("can_turn_off_hvac", None), + can_unlock_with_code=d.get("can_unlock_with_code", None), device_provider_name=d.get("device_provider_name", None), display_name=d.get("display_name", None), image_url=d.get("image_url", None), @@ -1332,6 +1338,7 @@ class UnmanagedDevice: can_simulate_disconnection: bool can_simulate_removal: bool can_turn_off_hvac: bool + can_unlock_with_code: bool capabilities_supported: List[str] connected_account_id: str created_at: str @@ -1362,6 +1369,7 @@ def from_dict(d: Dict[str, Any]): can_simulate_disconnection=d.get("can_simulate_disconnection", None), can_simulate_removal=d.get("can_simulate_removal", None), can_turn_off_hvac=d.get("can_turn_off_hvac", None), + can_unlock_with_code=d.get("can_unlock_with_code", None), capabilities_supported=d.get("capabilities_supported", None), connected_account_id=d.get("connected_account_id", None), created_at=d.get("created_at", None), @@ -1559,6 +1567,16 @@ class AbstractAccessMethods(abc.ABC): def delete(self, *, access_method_id: str) -> None: raise NotImplementedError() + @abc.abstractmethod + def encode( + self, + *, + access_method_id: str, + acs_encoder_id: str, + wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None + ) -> ActionAttempt: + raise NotImplementedError() + @abc.abstractmethod def get(self, *, access_method_id: str) -> AccessMethod: raise NotImplementedError() @@ -1695,22 +1713,13 @@ def update( class AbstractAcsEncoders(abc.ABC): - @abc.abstractmethod - def encode_access_method( - self, - *, - access_method_id: str, - acs_encoder_id: str, - wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None - ) -> ActionAttempt: - raise NotImplementedError() - @abc.abstractmethod def encode_credential( self, *, - acs_credential_id: str, acs_encoder_id: str, + access_method_id: Optional[str] = None, + acs_credential_id: Optional[str] = None, wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None ) -> ActionAttempt: raise NotImplementedError() @@ -2106,6 +2115,7 @@ def list( customer_ids: Optional[List[str]] = None, limit: Optional[int] = None, page_cursor: Optional[str] = None, + search: Optional[str] = None, user_identifier_key: Optional[str] = None ) -> List[ConnectedAccount]: raise NotImplementedError()