diff --git a/package-lock.json b/package-lock.json index 4097761..9c4cf70 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.19.0", - "@seamapi/types": "1.462.0", + "@seamapi/types": "1.466.1", "del": "^7.1.0", "prettier": "^3.2.5" } @@ -475,9 +475,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.462.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.462.0.tgz", - "integrity": "sha512-kKutohfn1Ju6qgV0zT0IVYf38o5V+qPA01YhQIEyfLT3rdGVdpQZgfOyYJHsNPRDRx4ioeNg9CjyKyFIIVKSAA==", + "version": "1.466.1", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.466.1.tgz", + "integrity": "sha512-sRDleDijArxo3RMWdxyaYZub+bpCs2FlJBcWhcYNMS3hPdyvlRWkqSuB88uu9H0WqK6mnzzPLNv/AO2EV1RVCw==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 3357a64..d9d8748 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@seamapi/fake-seam-connect": "1.83.2", "@seamapi/nextlove-sdk-generator": "^1.19.0", - "@seamapi/types": "1.462.0", + "@seamapi/types": "1.466.1", "del": "^7.1.0", "prettier": "^3.2.5" } diff --git a/seam/routes/instant_keys.py b/seam/routes/instant_keys.py index 5843b27..1685138 100644 --- a/seam/routes/instant_keys.py +++ b/seam/routes/instant_keys.py @@ -8,6 +8,16 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.client = client self.defaults = defaults + def delete(self, *, instant_key_id: str) -> None: + json_payload = {} + + if instant_key_id is not None: + json_payload["instant_key_id"] = instant_key_id + + self.client.post("/instant_keys/delete", json=json_payload) + + return None + def get(self, *, instant_key_id: str) -> InstantKey: json_payload = {} diff --git a/seam/routes/models.py b/seam/routes/models.py index 5438cc9..82dc9c7 100644 --- a/seam/routes/models.py +++ b/seam/routes/models.py @@ -2354,6 +2354,10 @@ def list( class AbstractInstantKeys(abc.ABC): + @abc.abstractmethod + def delete(self, *, instant_key_id: str) -> None: + raise NotImplementedError() + @abc.abstractmethod def get(self, *, instant_key_id: str) -> InstantKey: raise NotImplementedError() @@ -2528,30 +2532,6 @@ def update( raise NotImplementedError() -class AbstractThermostatsDailyPrograms(abc.ABC): - - @abc.abstractmethod - def create( - self, *, device_id: str, name: str, periods: List[Dict[str, Any]] - ) -> ThermostatDailyProgram: - raise NotImplementedError() - - @abc.abstractmethod - def delete(self, *, thermostat_daily_program_id: str) -> None: - raise NotImplementedError() - - @abc.abstractmethod - def update( - self, - *, - name: str, - periods: List[Dict[str, Any]], - thermostat_daily_program_id: str, - wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None - ) -> ActionAttempt: - raise NotImplementedError() - - class AbstractThermostatsSchedules(abc.ABC): @abc.abstractmethod @@ -2623,30 +2603,86 @@ def temperature_reached( raise NotImplementedError() -class AbstractUserIdentitiesEnrollmentAutomations(abc.ABC): +class AbstractUserIdentities(abc.ABC): @abc.abstractmethod - def delete(self, *, enrollment_automation_id: str) -> None: + def add_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: raise NotImplementedError() @abc.abstractmethod - def get(self, *, enrollment_automation_id: str) -> EnrollmentAutomation: + def create( + self, + *, + acs_system_ids: Optional[List[str]] = None, + email_address: Optional[str] = None, + full_name: Optional[str] = None, + phone_number: Optional[str] = None, + user_identity_key: Optional[str] = None + ) -> UserIdentity: + raise NotImplementedError() + + @abc.abstractmethod + def delete(self, *, user_identity_id: str) -> None: raise NotImplementedError() @abc.abstractmethod - def launch( + def generate_instant_key( + self, *, user_identity_id: str, max_use_count: Optional[float] = None + ) -> InstantKey: + raise NotImplementedError() + + @abc.abstractmethod + def get( self, *, - credential_manager_acs_system_id: str, - user_identity_id: str, - acs_credential_pool_id: Optional[str] = None, - create_credential_manager_user: Optional[bool] = None, - credential_manager_acs_user_id: Optional[str] = None - ) -> EnrollmentAutomation: + user_identity_id: Optional[str] = None, + user_identity_key: Optional[str] = None + ) -> UserIdentity: raise NotImplementedError() @abc.abstractmethod - def list(self, *, user_identity_id: str) -> List[EnrollmentAutomation]: + def grant_access_to_device(self, *, device_id: str, user_identity_id: str) -> None: + raise NotImplementedError() + + @abc.abstractmethod + def list( + self, + *, + credential_manager_acs_system_id: Optional[str] = None, + search: Optional[str] = None + ) -> List[UserIdentity]: + raise NotImplementedError() + + @abc.abstractmethod + def list_accessible_devices(self, *, user_identity_id: str) -> List[Device]: + raise NotImplementedError() + + @abc.abstractmethod + def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: + raise NotImplementedError() + + @abc.abstractmethod + def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: + raise NotImplementedError() + + @abc.abstractmethod + def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: + raise NotImplementedError() + + @abc.abstractmethod + def revoke_access_to_device(self, *, device_id: str, user_identity_id: str) -> None: + raise NotImplementedError() + + @abc.abstractmethod + def update( + self, + *, + user_identity_id: str, + email_address: Optional[str] = None, + full_name: Optional[str] = None, + phone_number: Optional[str] = None, + user_identity_key: Optional[str] = None + ) -> None: raise NotImplementedError() @@ -2797,94 +2833,6 @@ def list( raise NotImplementedError() -class AbstractUserIdentities(abc.ABC): - - @property - @abc.abstractmethod - def enrollment_automations(self) -> AbstractUserIdentitiesEnrollmentAutomations: - raise NotImplementedError() - - @abc.abstractmethod - def add_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: - raise NotImplementedError() - - @abc.abstractmethod - def create( - self, - *, - acs_system_ids: Optional[List[str]] = None, - email_address: Optional[str] = None, - full_name: Optional[str] = None, - phone_number: Optional[str] = None, - user_identity_key: Optional[str] = None - ) -> UserIdentity: - raise NotImplementedError() - - @abc.abstractmethod - def delete(self, *, user_identity_id: str) -> None: - raise NotImplementedError() - - @abc.abstractmethod - def generate_instant_key( - self, *, user_identity_id: str, max_use_count: Optional[float] = None - ) -> InstantKey: - raise NotImplementedError() - - @abc.abstractmethod - def get( - self, - *, - user_identity_id: Optional[str] = None, - user_identity_key: Optional[str] = None - ) -> UserIdentity: - raise NotImplementedError() - - @abc.abstractmethod - def grant_access_to_device(self, *, device_id: str, user_identity_id: str) -> None: - raise NotImplementedError() - - @abc.abstractmethod - def list( - self, - *, - credential_manager_acs_system_id: Optional[str] = None, - search: Optional[str] = None - ) -> List[UserIdentity]: - raise NotImplementedError() - - @abc.abstractmethod - def list_accessible_devices(self, *, user_identity_id: str) -> List[Device]: - raise NotImplementedError() - - @abc.abstractmethod - def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: - raise NotImplementedError() - - @abc.abstractmethod - def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: - raise NotImplementedError() - - @abc.abstractmethod - def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: - raise NotImplementedError() - - @abc.abstractmethod - def revoke_access_to_device(self, *, device_id: str, user_identity_id: str) -> None: - raise NotImplementedError() - - @abc.abstractmethod - def update( - self, - *, - user_identity_id: str, - email_address: Optional[str] = None, - full_name: Optional[str] = None, - phone_number: Optional[str] = None, - user_identity_key: Optional[str] = None - ) -> None: - raise NotImplementedError() - - class AbstractAccessCodes(abc.ABC): @property @@ -3138,11 +3086,6 @@ def list( class AbstractThermostats(abc.ABC): - @property - @abc.abstractmethod - def daily_programs(self) -> AbstractThermostatsDailyPrograms: - raise NotImplementedError() - @property @abc.abstractmethod def schedules(self) -> AbstractThermostatsSchedules: @@ -3323,22 +3266,6 @@ def update_climate_preset( ) -> None: raise NotImplementedError() - @abc.abstractmethod - def update_weekly_program( - self, - *, - device_id: str, - friday_program_id: Optional[str] = None, - monday_program_id: Optional[str] = None, - saturday_program_id: Optional[str] = None, - sunday_program_id: Optional[str] = None, - thursday_program_id: Optional[str] = None, - tuesday_program_id: Optional[str] = None, - wednesday_program_id: Optional[str] = None, - wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None - ) -> ActionAttempt: - raise NotImplementedError() - class AbstractAcs(abc.ABC): diff --git a/seam/routes/thermostats.py b/seam/routes/thermostats.py index 97e090f..f6b4e0d 100644 --- a/seam/routes/thermostats.py +++ b/seam/routes/thermostats.py @@ -1,7 +1,6 @@ from typing import Optional, Any, List, Dict, Union from ..client import SeamHttpClient from .models import AbstractThermostats, ActionAttempt, Device -from .thermostats_daily_programs import ThermostatsDailyPrograms from .thermostats_schedules import ThermostatsSchedules from .thermostats_simulate import ThermostatsSimulate from ..modules.action_attempts import resolve_action_attempt @@ -11,16 +10,9 @@ class Thermostats(AbstractThermostats): def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.client = client self.defaults = defaults - self._daily_programs = ThermostatsDailyPrograms( - client=client, defaults=defaults - ) self._schedules = ThermostatsSchedules(client=client, defaults=defaults) self._simulate = ThermostatsSimulate(client=client, defaults=defaults) - @property - def daily_programs(self) -> ThermostatsDailyPrograms: - return self._daily_programs - @property def schedules(self) -> ThermostatsSchedules: return self._schedules @@ -482,49 +474,3 @@ def update_climate_preset( self.client.post("/thermostats/update_climate_preset", json=json_payload) return None - - def update_weekly_program( - self, - *, - device_id: str, - friday_program_id: Optional[str] = None, - monday_program_id: Optional[str] = None, - saturday_program_id: Optional[str] = None, - sunday_program_id: Optional[str] = None, - thursday_program_id: Optional[str] = None, - tuesday_program_id: Optional[str] = None, - wednesday_program_id: Optional[str] = None, - wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None - ) -> ActionAttempt: - json_payload = {} - - if device_id is not None: - json_payload["device_id"] = device_id - if friday_program_id is not None: - json_payload["friday_program_id"] = friday_program_id - if monday_program_id is not None: - json_payload["monday_program_id"] = monday_program_id - if saturday_program_id is not None: - json_payload["saturday_program_id"] = saturday_program_id - if sunday_program_id is not None: - json_payload["sunday_program_id"] = sunday_program_id - if thursday_program_id is not None: - json_payload["thursday_program_id"] = thursday_program_id - if tuesday_program_id is not None: - json_payload["tuesday_program_id"] = tuesday_program_id - if wednesday_program_id is not None: - json_payload["wednesday_program_id"] = wednesday_program_id - - res = self.client.post("/thermostats/update_weekly_program", 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/thermostats_daily_programs.py b/seam/routes/thermostats_daily_programs.py deleted file mode 100644 index a098516..0000000 --- a/seam/routes/thermostats_daily_programs.py +++ /dev/null @@ -1,72 +0,0 @@ -from typing import Optional, Any, List, Dict, Union -from ..client import SeamHttpClient -from .models import ( - AbstractThermostatsDailyPrograms, - ThermostatDailyProgram, - ActionAttempt, -) - -from ..modules.action_attempts import resolve_action_attempt - - -class ThermostatsDailyPrograms(AbstractThermostatsDailyPrograms): - def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): - self.client = client - self.defaults = defaults - - def create( - self, *, device_id: str, name: str, periods: List[Dict[str, Any]] - ) -> ThermostatDailyProgram: - json_payload = {} - - if device_id is not None: - json_payload["device_id"] = device_id - if name is not None: - json_payload["name"] = name - if periods is not None: - json_payload["periods"] = periods - - res = self.client.post("/thermostats/daily_programs/create", json=json_payload) - - return ThermostatDailyProgram.from_dict(res["thermostat_daily_program"]) - - def delete(self, *, thermostat_daily_program_id: str) -> None: - json_payload = {} - - if thermostat_daily_program_id is not None: - json_payload["thermostat_daily_program_id"] = thermostat_daily_program_id - - self.client.post("/thermostats/daily_programs/delete", json=json_payload) - - return None - - def update( - self, - *, - name: str, - periods: List[Dict[str, Any]], - thermostat_daily_program_id: str, - wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None - ) -> ActionAttempt: - json_payload = {} - - if name is not None: - json_payload["name"] = name - if periods is not None: - json_payload["periods"] = periods - if thermostat_daily_program_id is not None: - json_payload["thermostat_daily_program_id"] = thermostat_daily_program_id - - res = self.client.post("/thermostats/daily_programs/update", 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/user_identities.py b/seam/routes/user_identities.py index 1d77bbc..d72cd39 100644 --- a/seam/routes/user_identities.py +++ b/seam/routes/user_identities.py @@ -8,20 +8,12 @@ AcsSystem, AcsUser, ) -from .user_identities_enrollment_automations import UserIdentitiesEnrollmentAutomations class UserIdentities(AbstractUserIdentities): def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.client = client self.defaults = defaults - self._enrollment_automations = UserIdentitiesEnrollmentAutomations( - client=client, defaults=defaults - ) - - @property - def enrollment_automations(self) -> UserIdentitiesEnrollmentAutomations: - return self._enrollment_automations def add_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: json_payload = {} diff --git a/seam/routes/user_identities_enrollment_automations.py b/seam/routes/user_identities_enrollment_automations.py deleted file mode 100644 index 3433499..0000000 --- a/seam/routes/user_identities_enrollment_automations.py +++ /dev/null @@ -1,82 +0,0 @@ -from typing import Optional, Any, List, Dict, Union -from ..client import SeamHttpClient -from .models import AbstractUserIdentitiesEnrollmentAutomations, EnrollmentAutomation - - -class UserIdentitiesEnrollmentAutomations(AbstractUserIdentitiesEnrollmentAutomations): - def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): - self.client = client - self.defaults = defaults - - def delete(self, *, enrollment_automation_id: str) -> None: - json_payload = {} - - if enrollment_automation_id is not None: - json_payload["enrollment_automation_id"] = enrollment_automation_id - - self.client.post( - "/user_identities/enrollment_automations/delete", json=json_payload - ) - - return None - - def get(self, *, enrollment_automation_id: str) -> EnrollmentAutomation: - json_payload = {} - - if enrollment_automation_id is not None: - json_payload["enrollment_automation_id"] = enrollment_automation_id - - res = self.client.post( - "/user_identities/enrollment_automations/get", json=json_payload - ) - - return EnrollmentAutomation.from_dict(res["enrollment_automation"]) - - def launch( - self, - *, - credential_manager_acs_system_id: str, - user_identity_id: str, - acs_credential_pool_id: Optional[str] = None, - create_credential_manager_user: Optional[bool] = None, - credential_manager_acs_user_id: Optional[str] = None - ) -> EnrollmentAutomation: - json_payload = {} - - if credential_manager_acs_system_id is not None: - json_payload["credential_manager_acs_system_id"] = ( - credential_manager_acs_system_id - ) - if user_identity_id is not None: - json_payload["user_identity_id"] = user_identity_id - if acs_credential_pool_id is not None: - json_payload["acs_credential_pool_id"] = acs_credential_pool_id - if create_credential_manager_user is not None: - json_payload["create_credential_manager_user"] = ( - create_credential_manager_user - ) - if credential_manager_acs_user_id is not None: - json_payload["credential_manager_acs_user_id"] = ( - credential_manager_acs_user_id - ) - - res = self.client.post( - "/user_identities/enrollment_automations/launch", json=json_payload - ) - - return EnrollmentAutomation.from_dict(res["enrollment_automation"]) - - def list(self, *, user_identity_id: str) -> List[EnrollmentAutomation]: - json_payload = {} - - if user_identity_id is not None: - json_payload["user_identity_id"] = user_identity_id - - res = self.client.post( - "/user_identities/enrollment_automations/list", json=json_payload - ) - - return [ - EnrollmentAutomation.from_dict(item) - for item in res["enrollment_automations"] - ]