diff --git a/package-lock.json b/package-lock.json index c279cb58..84d06ee0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@seamapi/blueprint": "^1.13.4", "@seamapi/fake-seam-connect": "2.0.10", "@seamapi/smith": "^1.2.1", - "@seamapi/types": "1.1219.0", + "@seamapi/types": "1.1231.0", "change-case": "^5.4.4", "execa": "^10.0.1", "prettier": "^3.9.6" @@ -879,9 +879,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.1219.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.1219.0.tgz", - "integrity": "sha512-Kkvyj/nx9BA+WthNZquD0Q9YatLhnHs06N1Cnieb/EsvoAx3aDZi08uNGmJ8xuYIF+EYZqKk0GdGhyZn6nrTnQ==", + "version": "1.1231.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.1231.0.tgz", + "integrity": "sha512-TLJY/435QDNZzGVg5ALdUkV3Xs77SpnyGP1oHBES+EXW1PYaep1TxwmYFzaow4kEjPAmupuXgq9Pr4h++S/d8Q==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index e26cb5b1..37dc5f4d 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@seamapi/blueprint": "^1.13.4", "@seamapi/fake-seam-connect": "2.0.10", "@seamapi/smith": "^1.2.1", - "@seamapi/types": "1.1219.0", + "@seamapi/types": "1.1231.0", "change-case": "^5.4.4", "execa": "^10.0.1", "prettier": "^3.9.6" diff --git a/src/Resources/AccessCode.php b/src/Resources/AccessCode.php index b56c3b25..62a73691 100644 --- a/src/Resources/AccessCode.php +++ b/src/Resources/AccessCode.php @@ -350,6 +350,10 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\AccessCode\Errors\AugustLockNotAuthorized::from_json( $json, ), + \Seam\Resources\AccessCode\Errors\ErrorCode::LOW_BATTERY + => \Seam\Resources\AccessCode\Errors\LowBattery::from_json( + $json, + ), \Seam\Resources\AccessCode\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS => \Seam\Resources\AccessCode\Errors\MissingDeviceCredentials::from_json( $json, @@ -1028,7 +1032,7 @@ public function __construct( } /** - * This access code is still active on the device even though its `ends_at` has passed, so the recipient may still be able to unlock the device after their access window ended. Seam is attempting to delete it, and this error clears automatically once the access code is no longer active. + * Seam was unable to remove this access code from the device in time after it was deleted or its `ends_at` passed, so the recipient may still be able to unlock the device. Seam keeps trying to delete it, and this error clears automatically once the access code is no longer usable on the device. */ final class FailedToDelete extends \Seam\Resources\AccessCode\Errors { @@ -1523,6 +1527,48 @@ public function __construct( } } + /** + * Indicates that the lock has about one week, two days, or a critically low amount of battery life remaining. Replace the lock's batteries promptly to avoid losing access. + */ + final class LowBattery extends \Seam\Resources\AccessCode\Errors + { + public static function from_json(mixed $json): LowBattery|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessCode\Errors\ErrorCode>|string|null + */ + string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + /** * Indicates that device credentials are missing. */ @@ -1722,6 +1768,7 @@ enum ErrorCode: string case DEVICE_DISCONNECTED = "device_disconnected"; case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case LOW_BATTERY = "low_battery"; case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; case SUBSCRIPTION_REQUIRED = "subscription_required"; @@ -2691,7 +2738,7 @@ public function __construct( } /** - * Access code is being deleted. + * Access code is being deleted, because it was deleted or passed its `ends_at`. It can no longer be updated. */ final class BeingDeleted extends \Seam\Resources\AccessCode\Warnings { diff --git a/src/Resources/AccessGrant.php b/src/Resources/AccessGrant.php index b8ad4984..03ed4cb7 100644 --- a/src/Resources/AccessGrant.php +++ b/src/Resources/AccessGrant.php @@ -362,6 +362,10 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\AccessGrant\Warnings\AccessRevoked::from_json( $json, ), + \Seam\Resources\AccessGrant\Warnings\WarningCode::MOBILE_KEY_WITHHELD + => \Seam\Resources\AccessGrant\Warnings\MobileKeyWithheld::from_json( + $json, + ), default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, @@ -1148,6 +1152,47 @@ public function __construct( } } + /** + * Indicates that Seam did not issue the mobile key requested for this access grant, because the user's email address or phone number belongs to other user identities and Seam cannot tell which person's app should receive it. The other requested access methods were issued. + */ + final class MobileKeyWithheld extends \Seam\Resources\AccessGrant\Warnings + { + public static function from_json(mixed $json): MobileKeyWithheld|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\AccessGrant\Warnings\WarningCode>|string|null + */ + string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + enum WarningCode: string { case BEING_DELETED = "being_deleted"; @@ -1158,6 +1203,7 @@ enum WarningCode: string case DEVICE_DOES_NOT_SUPPORT_ACCESS_CODES = "device_does_not_support_access_codes"; case DEVICE_TIME_CONSTRAINTS_VIOLATED = "device_time_constraints_violated"; case ACCESS_REVOKED = "access_revoked"; + case MOBILE_KEY_WITHHELD = "mobile_key_withheld"; } } diff --git a/src/Resources/Device.php b/src/Resources/Device.php index 37574346..d2efc97d 100644 --- a/src/Resources/Device.php +++ b/src/Resources/Device.php @@ -24,6 +24,7 @@ public static function from_json(mixed $json): Device|null $json->errors ?? [], ), is_managed: $json->is_managed ?? null, + is_online: $json->is_online ?? null, space_ids: $json->space_ids ?? null, warnings: array_map( fn($w) => \Seam\Resources\Device\Warnings::from_json($w), @@ -78,6 +79,9 @@ public static function from_json(mixed $json): Device|null : null, estimated_occupant_count: $json->estimated_occupant_count ?? null, + is_casing_tampered_with: $json->is_casing_tampered_with ?? null, + is_detached_from_mounting_plate: $json->is_detached_from_mounting_plate ?? + null, is_occupancy_detected: $json->is_occupancy_detected ?? null, is_smoking_detected: $json->is_smoking_detected ?? null, location: isset($json->location) @@ -151,6 +155,10 @@ public function __construct( * Indicates whether Seam manages the device. See also [Managed and Unmanaged Devices](https://www.seam.co/docs/core-concepts/devices/managed-and-unmanaged-devices). */ public true|null $is_managed, + /** + * Indicates whether the device is online. + */ + public bool|null $is_online, /** * IDs of the spaces the device is in. * @@ -279,6 +287,14 @@ public function __construct( * Estimated number of occupants detected by the device. */ public float|null $estimated_occupant_count = null, + /** + * Indicates whether the device was last reported as having its casing opened or tampered with. Omitted when the provider reports no casing state, including when the device does not support casing tamper detection. This is independent of `is_detached_from_mounting_plate`. + */ + public bool|null $is_casing_tampered_with = null, + /** + * Indicates whether the device was last reported as detached from its mounting plate. Omitted when Seam has no accepted observation, including when the device does not support mounting plate detection, reports an unknown status, or is offline. This is the last accepted provider observation, not a guarantee of current hardware state; check `is_online` before acting on it. + */ + public bool|null $is_detached_from_mounting_plate = null, /** * Indicates whether the device detects occupancy. */ @@ -462,6 +478,10 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\Device\Errors\AugustLockNotAuthorized::from_json( $json, ), + \Seam\Resources\Device\Errors\ErrorCode::LOW_BATTERY + => \Seam\Resources\Device\Errors\LowBattery::from_json( + $json, + ), \Seam\Resources\Device\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS => \Seam\Resources\Device\Errors\MissingDeviceCredentials::from_json( $json, @@ -1632,6 +1652,10 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\Device\Warnings\AccessoryKeypadLowBattery::from_json( $json, ), + \Seam\Resources\Device\Warnings\WarningCode::BATTERY_REPLACEMENT_RECOMMENDED + => \Seam\Resources\Device\Warnings\BatteryReplacementRecommended::from_json( + $json, + ), \Seam\Resources\Device\Warnings\WarningCode::UNRELIABLE_ONLINE_STATUS => \Seam\Resources\Device\Warnings\UnreliableOnlineStatus::from_json( $json, @@ -2228,6 +2252,52 @@ public function __construct( } } + /** + * Indicates that the lock has about one week, two days, or a critically low amount of battery life remaining. Replace the lock's batteries promptly to avoid losing access. + */ + final class LowBattery extends \Seam\Resources\Device\Errors + { + public static function from_json(mixed $json): LowBattery|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Errors\ErrorCode>|string|null + */ + string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + /** * Indicates that device credentials are missing. */ @@ -2431,6 +2501,7 @@ enum ErrorCode: string case DEVICE_DISCONNECTED = "device_disconnected"; case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case LOW_BATTERY = "low_battery"; case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; case SUBSCRIPTION_REQUIRED = "subscription_required"; @@ -7137,6 +7208,49 @@ public function __construct( } } + /** + * Indicates that the lock has about two weeks of battery life remaining or the provider otherwise recommends replacing the lock's batteries soon. + */ + final class BatteryReplacementRecommended extends + \Seam\Resources\Device\Warnings + { + public static function from_json( + mixed $json, + ): BatteryReplacementRecommended|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Device\Warnings\WarningCode>|string|null + */ + string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + /** * Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status. */ @@ -7347,6 +7461,7 @@ enum WarningCode: string case KEYNEST_UNSUPPORTED_LOCKER = "keynest_unsupported_locker"; case ACCESSORY_KEYPAD_SETUP_REQUIRED = "accessory_keypad_setup_required"; case ACCESSORY_KEYPAD_LOW_BATTERY = "accessory_keypad_low_battery"; + case BATTERY_REPLACEMENT_RECOMMENDED = "battery_replacement_recommended"; case UNRELIABLE_ONLINE_STATUS = "unreliable_online_status"; case MAX_ACCESS_CODES_REACHED = "max_access_codes_reached"; case SUBSCRIPTION_REQUIRED_FOR_ADDITIONAL_CAPABILITIES = "subscription_required_for_additional_capabilities"; diff --git a/src/Resources/Event.php b/src/Resources/Event.php index cccc3d06..f9af7426 100644 --- a/src/Resources/Event.php +++ b/src/Resources/Event.php @@ -60,6 +60,10 @@ public static function from_json(mixed $json): Event|null => \Seam\Resources\Event\AccessCodeFailedToSetOnDevice::from_json( $json, ), + \Seam\Resources\Event\EventType::ACCESS_CODE_FAILED_TO_DELETE + => \Seam\Resources\Event\AccessCodeFailedToDelete::from_json( + $json, + ), \Seam\Resources\Event\EventType::ACCESS_CODE_DELETED => \Seam\Resources\Event\AccessCodeDeleted::from_json( $json, @@ -1701,6 +1705,178 @@ public function __construct( } } + /** + * Seam was unable to remove an [access code](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes) from the device in time after it was deleted or its `ends_at` passed, so the recipient may still be able to unlock the device. Seam keeps trying to delete it, and the accompanying `failed_to_delete` error clears automatically once the access code is no longer usable on the device. + */ + final class AccessCodeFailedToDelete extends \Seam\Resources\Event + { + public static function from_json( + mixed $json, + ): AccessCodeFailedToDelete|null { + if (!$json) { + return null; + } + return new self( + access_code_errors: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeFailedToDelete\AccessCodeErrors::from_json( + $a, + ), + $json->access_code_errors ?? [], + ), + access_code_id: $json->access_code_id ?? null, + access_code_warnings: array_map( + fn( + $a, + ) => \Seam\Resources\Event\AccessCodeFailedToDelete\AccessCodeWarnings::from_json( + $a, + ), + $json->access_code_warnings ?? [], + ), + connected_account_errors: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeFailedToDelete\ConnectedAccountErrors::from_json( + $c, + ), + $json->connected_account_errors ?? [], + ), + connected_account_id: $json->connected_account_id ?? null, + connected_account_warnings: array_map( + fn( + $c, + ) => \Seam\Resources\Event\AccessCodeFailedToDelete\ConnectedAccountWarnings::from_json( + $c, + ), + $json->connected_account_warnings ?? [], + ), + created_at: $json->created_at ?? null, + device_errors: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeFailedToDelete\DeviceErrors::from_json( + $d, + ), + $json->device_errors ?? [], + ), + device_id: $json->device_id ?? null, + device_warnings: array_map( + fn( + $d, + ) => \Seam\Resources\Event\AccessCodeFailedToDelete\DeviceWarnings::from_json( + $d, + ), + $json->device_warnings ?? [], + ), + event_description: $json->event_description ?? null, + event_id: $json->event_id ?? null, + event_type: $json->event_type ?? null, + occurred_at: $json->occurred_at ?? null, + workspace_id: $json->workspace_id ?? null, + connected_account_custom_metadata: $json->connected_account_custom_metadata ?? + null, + device_custom_metadata: $json->device_custom_metadata ?? null, + ); + } + + public function __construct( + /** + * Errors associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToDelete\AccessCodeErrors> + */ + public array $access_code_errors, + /** + * ID of the affected access code. + */ + public string|null $access_code_id, + /** + * Warnings associated with the access code. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToDelete\AccessCodeWarnings> + */ + public array $access_code_warnings, + /** + * Errors associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToDelete\ConnectedAccountErrors> + */ + public array $connected_account_errors, + /** + * ID of the connected account associated with the affected access code. + */ + public string|null $connected_account_id, + /** + * Warnings associated with the connected account. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToDelete\ConnectedAccountWarnings> + */ + public array $connected_account_warnings, + /** + * Date and time at which the event was created. + */ + string|null $created_at, + /** + * Errors associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToDelete\DeviceErrors> + */ + public array $device_errors, + /** + * ID of the device associated with the affected access code. + */ + public string|null $device_id, + /** + * Warnings associated with the device. + * + * @var list<\Seam\Resources\Event\AccessCodeFailedToDelete\DeviceWarnings> + */ + public array $device_warnings, + /** + * Human-readable description of the event. Persisted when the event is created (so the creating code, including a provider, can supply a tailored description) and otherwise derived from the event. + */ + string|null $event_description, + /** + * ID of the event. + */ + string|null $event_id, + /** + * @var value-of<\Seam\Resources\Event\EventType>|string|null + */ + string|null $event_type, + /** + * Date and time at which the event occurred. + */ + string|null $occurred_at, + /** + * ID of the workspace associated with the event. + */ + string|null $workspace_id, + /** + * Custom metadata of the connected account, present when connected_account_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $connected_account_custom_metadata = null, + /** + * Custom metadata of the device, present when device_id is provided. + * + * @var array|\stdClass|null + */ + public array|\stdClass|null $device_custom_metadata = null, + ) { + parent::__construct( + created_at: $created_at, + event_description: $event_description, + event_id: $event_id, + event_type: $event_type, + occurred_at: $occurred_at, + workspace_id: $workspace_id, + ); + } + } + /** * An [access code](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes) was deleted. */ @@ -10774,6 +10950,7 @@ enum EventType: string case ACCESS_CODE_REMOVED_FROM_DEVICE = "access_code.removed_from_device"; case ACCESS_CODE_DELAY_IN_SETTING_ON_DEVICE = "access_code.delay_in_setting_on_device"; case ACCESS_CODE_FAILED_TO_SET_ON_DEVICE = "access_code.failed_to_set_on_device"; + case ACCESS_CODE_FAILED_TO_DELETE = "access_code.failed_to_delete"; case ACCESS_CODE_DELETED = "access_code.deleted"; case ACCESS_CODE_DELAY_IN_REMOVING_FROM_DEVICE = "access_code.delay_in_removing_from_device"; case ACCESS_CODE_FAILED_TO_REMOVE_FROM_DEVICE = "access_code.failed_to_remove_from_device"; @@ -11514,6 +11691,208 @@ public function __construct( } } +namespace Seam\Resources\Event\AccessCodeFailedToDelete { + /** + * Errors associated with the access code. + */ + class AccessCodeErrors + { + public static function from_json(mixed $json): AccessCodeErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the access code. + */ + class AccessCodeWarnings + { + public static function from_json(mixed $json): AccessCodeWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the connected account. + */ + class ConnectedAccountErrors + { + public static function from_json( + mixed $json, + ): ConnectedAccountErrors|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the connected account. + */ + class ConnectedAccountWarnings + { + public static function from_json( + mixed $json, + ): ConnectedAccountWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } + + /** + * Errors associated with the device. + */ + class DeviceErrors + { + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + */ + public string|null $error_code, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + ) {} + } + + /** + * Warnings associated with the device. + */ + class DeviceWarnings + { + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + public string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + public string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + */ + public string|null $warning_code, + ) {} + } +} + namespace Seam\Resources\Event\AccessCodeDelayInRemovingFromDevice { /** * Errors associated with the access code. diff --git a/src/Resources/Phone.php b/src/Resources/Phone.php index 8ac00006..49e2835a 100644 --- a/src/Resources/Phone.php +++ b/src/Resources/Phone.php @@ -146,6 +146,10 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\Phone\Errors\AugustLockNotAuthorized::from_json( $json, ), + \Seam\Resources\Phone\Errors\ErrorCode::LOW_BATTERY + => \Seam\Resources\Phone\Errors\LowBattery::from_json( + $json, + ), \Seam\Resources\Phone\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS => \Seam\Resources\Phone\Errors\MissingDeviceCredentials::from_json( $json, @@ -353,6 +357,10 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\Phone\Warnings\AccessoryKeypadLowBattery::from_json( $json, ), + \Seam\Resources\Phone\Warnings\WarningCode::BATTERY_REPLACEMENT_RECOMMENDED + => \Seam\Resources\Phone\Warnings\BatteryReplacementRecommended::from_json( + $json, + ), \Seam\Resources\Phone\Warnings\WarningCode::UNRELIABLE_ONLINE_STATUS => \Seam\Resources\Phone\Warnings\UnreliableOnlineStatus::from_json( $json, @@ -893,6 +901,52 @@ public function __construct( } } + /** + * Indicates that the lock has about one week, two days, or a critically low amount of battery life remaining. Replace the lock's batteries promptly to avoid losing access. + */ + final class LowBattery extends \Seam\Resources\Phone\Errors + { + public static function from_json(mixed $json): LowBattery|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Phone\Errors\ErrorCode>|string|null + */ + string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + /** * Indicates that device credentials are missing. */ @@ -1096,6 +1150,7 @@ enum ErrorCode: string case DEVICE_DISCONNECTED = "device_disconnected"; case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case LOW_BATTERY = "low_battery"; case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; case SUBSCRIPTION_REQUIRED = "subscription_required"; @@ -2333,6 +2388,49 @@ public function __construct( } } + /** + * Indicates that the lock has about two weeks of battery life remaining or the provider otherwise recommends replacing the lock's batteries soon. + */ + final class BatteryReplacementRecommended extends + \Seam\Resources\Phone\Warnings + { + public static function from_json( + mixed $json, + ): BatteryReplacementRecommended|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\Phone\Warnings\WarningCode>|string|null + */ + string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + /** * Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status. */ @@ -2543,6 +2641,7 @@ enum WarningCode: string case KEYNEST_UNSUPPORTED_LOCKER = "keynest_unsupported_locker"; case ACCESSORY_KEYPAD_SETUP_REQUIRED = "accessory_keypad_setup_required"; case ACCESSORY_KEYPAD_LOW_BATTERY = "accessory_keypad_low_battery"; + case BATTERY_REPLACEMENT_RECOMMENDED = "battery_replacement_recommended"; case UNRELIABLE_ONLINE_STATUS = "unreliable_online_status"; case MAX_ACCESS_CODES_REACHED = "max_access_codes_reached"; case SUBSCRIPTION_REQUIRED_FOR_ADDITIONAL_CAPABILITIES = "subscription_required_for_additional_capabilities"; diff --git a/src/Resources/UnmanagedAccessCode.php b/src/Resources/UnmanagedAccessCode.php index 53e9d2d9..c963ad56 100644 --- a/src/Resources/UnmanagedAccessCode.php +++ b/src/Resources/UnmanagedAccessCode.php @@ -306,6 +306,10 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UnmanagedAccessCode\Errors\AugustLockNotAuthorized::from_json( $json, ), + \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::LOW_BATTERY + => \Seam\Resources\UnmanagedAccessCode\Errors\LowBattery::from_json( + $json, + ), \Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS => \Seam\Resources\UnmanagedAccessCode\Errors\MissingDeviceCredentials::from_json( $json, @@ -918,7 +922,7 @@ public function __construct( } /** - * This access code is still active on the device even though its `ends_at` has passed, so the recipient may still be able to unlock the device after their access window ended. Seam is attempting to delete it, and this error clears automatically once the access code is no longer active. + * Seam was unable to remove this access code from the device in time after it was deleted or its `ends_at` passed, so the recipient may still be able to unlock the device. Seam keeps trying to delete it, and this error clears automatically once the access code is no longer usable on the device. */ final class FailedToDelete extends \Seam\Resources\UnmanagedAccessCode\Errors @@ -1417,6 +1421,48 @@ public function __construct( } } + /** + * Indicates that the lock has about one week, two days, or a critically low amount of battery life remaining. Replace the lock's batteries promptly to avoid losing access. + */ + final class LowBattery extends \Seam\Resources\UnmanagedAccessCode\Errors + { + public static function from_json(mixed $json): LowBattery|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + public string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessCode\Errors\ErrorCode>|string|null + */ + string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct(error_code: $error_code, message: $message); + } + } + /** * Indicates that device credentials are missing. */ @@ -1619,6 +1665,7 @@ enum ErrorCode: string case DEVICE_DISCONNECTED = "device_disconnected"; case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case LOW_BATTERY = "low_battery"; case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; case SUBSCRIPTION_REQUIRED = "subscription_required"; @@ -2119,7 +2166,7 @@ public function __construct( } /** - * Access code is being deleted. + * Access code is being deleted, because it was deleted or passed its `ends_at`. It can no longer be updated. */ final class BeingDeleted extends \Seam\Resources\UnmanagedAccessCode\Warnings diff --git a/src/Resources/UnmanagedAccessGrant.php b/src/Resources/UnmanagedAccessGrant.php index 8179beba..13688f23 100644 --- a/src/Resources/UnmanagedAccessGrant.php +++ b/src/Resources/UnmanagedAccessGrant.php @@ -342,6 +342,10 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UnmanagedAccessGrant\Warnings\AccessRevoked::from_json( $json, ), + \Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode::MOBILE_KEY_WITHHELD + => \Seam\Resources\UnmanagedAccessGrant\Warnings\MobileKeyWithheld::from_json( + $json, + ), default => new self( created_at: $json->created_at ?? null, message: $json->message ?? null, @@ -1132,6 +1136,48 @@ public function __construct( } } + /** + * Indicates that Seam did not issue the mobile key requested for this access grant, because the user's email address or phone number belongs to other user identities and Seam cannot tell which person's app should receive it. The other requested access methods were issued. + */ + final class MobileKeyWithheld extends + \Seam\Resources\UnmanagedAccessGrant\Warnings + { + public static function from_json(mixed $json): MobileKeyWithheld|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedAccessGrant\Warnings\WarningCode>|string|null + */ + string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + enum WarningCode: string { case BEING_DELETED = "being_deleted"; @@ -1142,6 +1188,7 @@ enum WarningCode: string case DEVICE_DOES_NOT_SUPPORT_ACCESS_CODES = "device_does_not_support_access_codes"; case DEVICE_TIME_CONSTRAINTS_VIOLATED = "device_time_constraints_violated"; case ACCESS_REVOKED = "access_revoked"; + case MOBILE_KEY_WITHHELD = "mobile_key_withheld"; } } diff --git a/src/Resources/UnmanagedDevice.php b/src/Resources/UnmanagedDevice.php index 3b401f42..3af02027 100644 --- a/src/Resources/UnmanagedDevice.php +++ b/src/Resources/UnmanagedDevice.php @@ -26,6 +26,7 @@ public static function from_json(mixed $json): UnmanagedDevice|null $json->errors ?? [], ), is_managed: $json->is_managed ?? null, + is_online: $json->is_online ?? null, warnings: array_map( fn( $w, @@ -126,6 +127,10 @@ public function __construct( * Indicates that Seam does not manage the device. */ public false|null $is_managed, + /** + * Indicates whether the device is online. + */ + public bool|null $is_online, /** * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. * @@ -294,6 +299,10 @@ public static function from_json(mixed $json): Errors|null => \Seam\Resources\UnmanagedDevice\Errors\AugustLockNotAuthorized::from_json( $json, ), + \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::LOW_BATTERY + => \Seam\Resources\UnmanagedDevice\Errors\LowBattery::from_json( + $json, + ), \Seam\Resources\UnmanagedDevice\Errors\ErrorCode::MISSING_DEVICE_CREDENTIALS => \Seam\Resources\UnmanagedDevice\Errors\MissingDeviceCredentials::from_json( $json, @@ -571,6 +580,10 @@ public static function from_json(mixed $json): Warnings|null => \Seam\Resources\UnmanagedDevice\Warnings\AccessoryKeypadLowBattery::from_json( $json, ), + \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::BATTERY_REPLACEMENT_RECOMMENDED + => \Seam\Resources\UnmanagedDevice\Warnings\BatteryReplacementRecommended::from_json( + $json, + ), \Seam\Resources\UnmanagedDevice\Warnings\WarningCode::UNRELIABLE_ONLINE_STATUS => \Seam\Resources\UnmanagedDevice\Warnings\UnreliableOnlineStatus::from_json( $json, @@ -1173,6 +1186,52 @@ public function __construct( } } + /** + * Indicates that the lock has about one week, two days, or a critically low amount of battery life remaining. Replace the lock's batteries promptly to avoid losing access. + */ + final class LowBattery extends \Seam\Resources\UnmanagedDevice\Errors + { + public static function from_json(mixed $json): LowBattery|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + error_code: $json->error_code ?? null, + is_device_error: $json->is_device_error ?? null, + message: $json->message ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the error. + */ + string|null $created_at, + /** + * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Errors\ErrorCode>|string|null + */ + string|null $error_code, + /** + * Indicates that the error is a device error. + */ + public true|null $is_device_error, + /** + * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + ) { + parent::__construct( + created_at: $created_at, + error_code: $error_code, + message: $message, + ); + } + } + /** * Indicates that device credentials are missing. */ @@ -1380,6 +1439,7 @@ enum ErrorCode: string case DEVICE_DISCONNECTED = "device_disconnected"; case EMPTY_BACKUP_ACCESS_CODE_POOL = "empty_backup_access_code_pool"; case AUGUST_LOCK_NOT_AUTHORIZED = "august_lock_not_authorized"; + case LOW_BATTERY = "low_battery"; case MISSING_DEVICE_CREDENTIALS = "missing_device_credentials"; case AUXILIARY_HEAT_RUNNING = "auxiliary_heat_running"; case SUBSCRIPTION_REQUIRED = "subscription_required"; @@ -2668,6 +2728,49 @@ public function __construct( } } + /** + * Indicates that the lock has about two weeks of battery life remaining or the provider otherwise recommends replacing the lock's batteries soon. + */ + final class BatteryReplacementRecommended extends + \Seam\Resources\UnmanagedDevice\Warnings + { + public static function from_json( + mixed $json, + ): BatteryReplacementRecommended|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at ?? null, + message: $json->message ?? null, + warning_code: $json->warning_code ?? null, + ); + } + + public function __construct( + /** + * Date and time at which Seam created the warning. + */ + string|null $created_at, + /** + * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. + */ + string|null $message, + /** + * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. + * + * @var value-of<\Seam\Resources\UnmanagedDevice\Warnings\WarningCode>|string|null + */ + string|null $warning_code, + ) { + parent::__construct( + created_at: $created_at, + message: $message, + warning_code: $warning_code, + ); + } + } + /** * Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status. */ @@ -2881,6 +2984,7 @@ enum WarningCode: string case KEYNEST_UNSUPPORTED_LOCKER = "keynest_unsupported_locker"; case ACCESSORY_KEYPAD_SETUP_REQUIRED = "accessory_keypad_setup_required"; case ACCESSORY_KEYPAD_LOW_BATTERY = "accessory_keypad_low_battery"; + case BATTERY_REPLACEMENT_RECOMMENDED = "battery_replacement_recommended"; case UNRELIABLE_ONLINE_STATUS = "unreliable_online_status"; case MAX_ACCESS_CODES_REACHED = "max_access_codes_reached"; case SUBSCRIPTION_REQUIRED_FOR_ADDITIONAL_CAPABILITIES = "subscription_required_for_additional_capabilities"; diff --git a/src/Routes/AccessMethodsClient.php b/src/Routes/AccessMethodsClient.php index 41519bac..3959c9b6 100644 --- a/src/Routes/AccessMethodsClient.php +++ b/src/Routes/AccessMethodsClient.php @@ -74,6 +74,7 @@ public function assign_card( * @param string $access_method_id ID of access method to delete. * @param string $reservation_key Reservation key of the access grant whose access methods should be deleted. * @return void OK + * @deprecated Access methods are managed by their access grant. Some workflows still need this endpoint today; access grant routes will replace it for them soon. */ public function delete( ?string $access_grant_id = null, diff --git a/src/Routes/NoiseSensorsNoiseThresholdsClient.php b/src/Routes/NoiseSensorsNoiseThresholdsClient.php index 5bc4586f..7f41ac9c 100644 --- a/src/Routes/NoiseSensorsNoiseThresholdsClient.php +++ b/src/Routes/NoiseSensorsNoiseThresholdsClient.php @@ -27,6 +27,8 @@ public function __construct(ClientInterface $client, array $defaults) /** * Creates a new [noise threshold](https://www.seam.co/docs/capability-guides/noise-sensors/configure-noise-threshold-settings) for a [noise sensor](https://www.seam.co/docs/capability-guides/noise-sensors). Thresholds represent the limits of noise tolerated at a property, which can be customized for each hour of the day. Each device has its own default thresholds, but you can use the Seam API to modify them. * + * For Minut sensors, Seam does not change thresholds that Minut manages through a noise preset, which can be shared across homes. If the home of the sensor is assigned a noise preset, the request fails with a `noise_threshold_managed_by_noise_profile` error; edit the noise preset in the Minut app instead. If Seam cannot check which noise preset applies to the home of the sensor, the request fails with a `noise_profile_assignment_unverified` error and nothing is changed; try again. + * * @param string $device_id ID of the device for which you want to create a noise threshold. * @param string $ends_daily_at Time at which the new noise threshold should become inactive daily. * @param string $starts_daily_at Time at which the new noise threshold should become active daily. @@ -80,6 +82,8 @@ public function create( /** * Deletes a [noise threshold](https://www.seam.co/docs/capability-guides/noise-sensors/configure-noise-threshold-settings) from a [noise sensor](https://www.seam.co/docs/capability-guides/noise-sensors). * + * For Minut sensors, Seam does not change thresholds that Minut manages through a noise preset, which can be shared across homes. If the home of the sensor is assigned a noise preset, the action attempt ends with a `noise_threshold_managed_by_noise_profile` error; edit the noise preset in the Minut app instead. If Seam cannot check which noise preset applies to the home of the sensor, the action attempt ends with a `noise_profile_assignment_unverified` error and nothing is changed; try again. + * * @param string $device_id ID of the device that contains the noise threshold that you want to delete. * @param string $noise_threshold_id ID of the noise threshold that you want to delete. * @return void OK @@ -160,6 +164,8 @@ public function list(string $device_id): array /** * Updates a [noise threshold](https://www.seam.co/docs/capability-guides/noise-sensors/configure-noise-threshold-settings) for a [noise sensor](https://www.seam.co/docs/capability-guides/noise-sensors). * + * For Minut sensors, Seam does not change thresholds that Minut manages through a noise preset, which can be shared across homes. If the home of the sensor is assigned a noise preset, the action attempt ends with a `noise_threshold_managed_by_noise_profile` error; edit the noise preset in the Minut app instead. If Seam cannot check which noise preset applies to the home of the sensor, the action attempt ends with a `noise_profile_assignment_unverified` error and nothing is changed; try again. + * * @param string $device_id ID of the device that contains the noise threshold that you want to update. * @param string $noise_threshold_id ID of the noise threshold that you want to update. * @param string $ends_daily_at Time at which the noise threshold should become inactive daily.