diff --git a/package-lock.json b/package-lock.json index 4bdf2f2..88955c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@prettier/plugin-php": "^0.24.0", "@seamapi/nextlove-sdk-generator": "^1.19.8", - "@seamapi/types": "1.761.0", + "@seamapi/types": "1.768.1", "del": "^7.1.0", "prettier": "^3.0.0" } @@ -533,9 +533,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.761.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.761.0.tgz", - "integrity": "sha512-M25GTKyWbPYXRh0lTFZzpbtlEHMX5dbKj8amhgYe9H0tugVMYm1OMj9+w3t0V+eNXm7Qy2jw3c8IPFoLQxSmUA==", + "version": "1.768.1", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.768.1.tgz", + "integrity": "sha512-BBYgxv+gaE0rz2iekFB5tYm3VzQ8o/xEGbsZy0AXg/FpVtsTxT2f0481XEh6a7UXEJYYEtHZvA7/bXJyXymcnA==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 87b8b6e..58156d1 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "devDependencies": { "@prettier/plugin-php": "^0.24.0", "@seamapi/nextlove-sdk-generator": "^1.19.8", - "@seamapi/types": "1.761.0", + "@seamapi/types": "1.768.1", "del": "^7.1.0", "prettier": "^3.0.0" } diff --git a/src/Objects/Device.php b/src/Objects/Device.php index a86536e..894bb9a 100644 --- a/src/Objects/Device.php +++ b/src/Objects/Device.php @@ -29,6 +29,7 @@ public static function from_json(mixed $json): Device|null $json->warnings ?? [], ), workspace_id: $json->workspace_id, + can_configure_auto_lock: $json->can_configure_auto_lock ?? null, can_hvac_cool: $json->can_hvac_cool ?? null, can_hvac_heat: $json->can_hvac_heat ?? null, can_hvac_heat_cool: $json->can_hvac_heat_cool ?? null, @@ -87,6 +88,7 @@ public function __construct( public array $space_ids, public array $warnings, public string $workspace_id, + public bool|null $can_configure_auto_lock, public bool|null $can_hvac_cool, public bool|null $can_hvac_heat, public bool|null $can_hvac_heat_cool, diff --git a/src/Objects/DeviceFeatures.php b/src/Objects/DeviceFeatures.php index 7d5ce8b..957d993 100644 --- a/src/Objects/DeviceFeatures.php +++ b/src/Objects/DeviceFeatures.php @@ -10,6 +10,7 @@ public static function from_json(mixed $json): DeviceFeatures|null return null; } return new self( + auto_lock_time_config: $json->auto_lock_time_config, incomplete_keyboard_passcode: $json->incomplete_keyboard_passcode, lock_command: $json->lock_command, passcode: $json->passcode, @@ -20,6 +21,7 @@ public static function from_json(mixed $json): DeviceFeatures|null } public function __construct( + public bool $auto_lock_time_config, public bool $incomplete_keyboard_passcode, public bool $lock_command, public bool $passcode, diff --git a/src/Objects/DeviceProperties.php b/src/Objects/DeviceProperties.php index 70b8db8..38d0988 100644 --- a/src/Objects/DeviceProperties.php +++ b/src/Objects/DeviceProperties.php @@ -42,6 +42,8 @@ public static function from_json(mixed $json): DeviceProperties|null august_metadata: isset($json->august_metadata) ? DeviceAugustMetadata::from_json($json->august_metadata) : null, + auto_lock_delay_seconds: $json->auto_lock_delay_seconds ?? null, + auto_lock_enabled: $json->auto_lock_enabled ?? null, available_climate_preset_modes: $json->available_climate_preset_modes ?? null, available_climate_presets: array_map( @@ -285,6 +287,8 @@ public function __construct( public DeviceAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, public DeviceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, public DeviceAugustMetadata|null $august_metadata, + public float|null $auto_lock_delay_seconds, + public bool|null $auto_lock_enabled, public array|null $available_climate_preset_modes, public array|null $available_climate_presets, public array|null $available_fan_mode_settings, diff --git a/src/Objects/DeviceProvider.php b/src/Objects/DeviceProvider.php index 6b31589..5fa63bd 100644 --- a/src/Objects/DeviceProvider.php +++ b/src/Objects/DeviceProvider.php @@ -14,6 +14,7 @@ public static function from_json(mixed $json): DeviceProvider|null display_name: $json->display_name, image_url: $json->image_url, provider_categories: $json->provider_categories, + can_configure_auto_lock: $json->can_configure_auto_lock ?? null, can_hvac_cool: $json->can_hvac_cool ?? null, can_hvac_heat: $json->can_hvac_heat ?? null, can_hvac_heat_cool: $json->can_hvac_heat_cool ?? null, @@ -51,6 +52,7 @@ public function __construct( public string $display_name, public string $image_url, public array $provider_categories, + public bool|null $can_configure_auto_lock, public bool|null $can_hvac_cool, public bool|null $can_hvac_heat, public bool|null $can_hvac_heat_cool, diff --git a/src/Objects/UnmanagedDevice.php b/src/Objects/UnmanagedDevice.php index 39b166c..77fb832 100644 --- a/src/Objects/UnmanagedDevice.php +++ b/src/Objects/UnmanagedDevice.php @@ -27,6 +27,7 @@ public static function from_json(mixed $json): UnmanagedDevice|null $json->warnings ?? [], ), workspace_id: $json->workspace_id, + can_configure_auto_lock: $json->can_configure_auto_lock ?? null, can_hvac_cool: $json->can_hvac_cool ?? null, can_hvac_heat: $json->can_hvac_heat ?? null, can_hvac_heat_cool: $json->can_hvac_heat_cool ?? null, @@ -74,6 +75,7 @@ public function __construct( public UnmanagedDeviceProperties $properties, public array $warnings, public string $workspace_id, + public bool|null $can_configure_auto_lock, public bool|null $can_hvac_cool, public bool|null $can_hvac_heat, public bool|null $can_hvac_heat_cool, diff --git a/src/SeamClient.php b/src/SeamClient.php index c232056..a135252 100644 --- a/src/SeamClient.php +++ b/src/SeamClient.php @@ -426,38 +426,6 @@ public function get( return AccessCode::from_json($res->access_code); } - public function get_timeline( - string $access_code_id, - ?string $after = null, - ?string $before = null, - ?array $event_types = null, - ?float $limit = null, - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($after !== null) { - $request_payload["after"] = $after; - } - if ($before !== null) { - $request_payload["before"] = $before; - } - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - - $this->seam->request( - "POST", - "/access_codes/get_timeline", - json: (object) $request_payload, - ); - } - public function list( ?array $access_code_ids = null, ?string $access_method_id = null, @@ -3402,11 +3370,10 @@ public function disconnect(string $connected_account_id): void class CustomersClient { private SeamClient $seam; - public CustomersReservationsClient $reservations; + public function __construct(SeamClient $seam) { $this->seam = $seam; - $this->reservations = new CustomersReservationsClient($seam); } public function create_portal( @@ -3652,36 +3619,6 @@ public function push_data( } } -class CustomersReservationsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create_deep_link( - string $customer_key, - string $reservation_key, - ): void { - $request_payload = []; - - if ($customer_key !== null) { - $request_payload["customer_key"] = $customer_key; - } - if ($reservation_key !== null) { - $request_payload["reservation_key"] = $reservation_key; - } - - $this->seam->request( - "POST", - "/customers/reservations/create_deep_link", - json: (object) $request_payload, - ); - } -} - class DevicesClient { private SeamClient $seam; @@ -4366,6 +4303,43 @@ public function __construct(SeamClient $seam) $this->simulate = new LocksSimulateClient($seam); } + public function configure_auto_lock( + bool $auto_lock_enabled, + string $device_id, + ?float $auto_lock_delay_seconds = null, + bool $wait_for_action_attempt = true, + ): ActionAttempt { + $request_payload = []; + + if ($auto_lock_enabled !== null) { + $request_payload["auto_lock_enabled"] = $auto_lock_enabled; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($auto_lock_delay_seconds !== null) { + $request_payload[ + "auto_lock_delay_seconds" + ] = $auto_lock_delay_seconds; + } + + $res = $this->seam->request( + "POST", + "/locks/configure_auto_lock", + json: (object) $request_payload, + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt->action_attempt_id, + ); + + return $action_attempt; + } + public function get(?string $device_id = null, ?string $name = null): Device { $request_payload = [];