From 246d737098a305281f23ae4c7c9875e45eee92f5 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Mon, 17 Mar 2025 14:52:14 +0100 Subject: [PATCH 01/13] Move generated components to src/Routes dir --- .github/workflows/generate.yml | 4 +- src/Exceptions/ActionAttemptError.php | 24 +- src/Exceptions/ActionAttemptFailedError.php | 24 +- src/Exceptions/ActionAttemptTimeoutError.php | 18 +- src/Objects/AccessCode.php | 69 - src/Objects/AccessCodeErrors.php | 32 - src/Objects/AccessCodeWarnings.php | 25 - src/Objects/AcsAccessGroup.php | 46 - src/Objects/AcsAccessGroupWarnings.php | 25 - src/Objects/AcsCredential.php | 89 - .../AcsCredentialAssaAbloyVostioMetadata.php | 31 - src/Objects/AcsCredentialErrors.php | 25 - src/Objects/AcsCredentialPool.php | 33 - .../AcsCredentialProvisioningAutomation.php | 30 - .../AcsCredentialVisionlineMetadata.php | 36 - src/Objects/AcsCredentialWarnings.php | 25 - src/Objects/AcsEncoder.php | 34 - src/Objects/AcsEncoderErrors.php | 25 - src/Objects/AcsEntrance.php | 68 - .../AcsEntranceAssaAbloyVostioMetadata.php | 30 - .../AcsEntranceDormakabaCommunityMetadata.php | 19 - src/Objects/AcsEntranceErrors.php | 25 - src/Objects/AcsEntranceLatchMetadata.php | 27 - src/Objects/AcsEntranceProfiles.php | 23 - src/Objects/AcsEntranceSaltoKsMetadata.php | 36 - src/Objects/AcsEntranceSaltoSpaceMetadata.php | 26 - src/Objects/AcsEntranceVisionlineMetadata.php | 29 - src/Objects/AcsSystem.php | 78 - src/Objects/AcsSystemErrors.php | 25 - src/Objects/AcsSystemLocation.php | 18 - src/Objects/AcsSystemVisionlineMetadata.php | 26 - src/Objects/AcsSystemWarnings.php | 28 - src/Objects/AcsUser.php | 78 - src/Objects/AcsUserAccessSchedule.php | 23 - src/Objects/AcsUserErrors.php | 25 - src/Objects/AcsUserWarnings.php | 25 - src/Objects/ActionAttempt.php | 31 - src/Objects/ActionAttemptError.php | 18 - src/Objects/ClientSession.php | 39 - src/Objects/ConnectWebview.php | 58 - src/Objects/ConnectedAccount.php | 47 - src/Objects/ConnectedAccountErrors.php | 27 - .../ConnectedAccountUserIdentifier.php | 30 - src/Objects/ConnectedAccountWarnings.php | 25 - src/Objects/Device.php | 80 - src/Objects/DeviceAccelerometerZ.php | 18 - src/Objects/DeviceAccessoryKeypad.php | 25 - .../DeviceActiveThermostatSchedule.php | 44 - src/Objects/DeviceAkilesMetadata.php | 27 - src/Objects/DeviceAppearance.php | 18 - ...viceAssaAbloyCredentialServiceMetadata.php | 27 - src/Objects/DeviceAssaAbloyVostioMetadata.php | 19 - src/Objects/DeviceAugustMetadata.php | 33 - src/Objects/DeviceAvailableClimatePresets.php | 46 - src/Objects/DeviceAvigilonAltaMetadata.php | 34 - src/Objects/DeviceBattery.php | 18 - src/Objects/DeviceBrivoMetadata.php | 18 - src/Objects/DeviceCodeConstraints.php | 25 - src/Objects/DeviceControlbywebMetadata.php | 26 - src/Objects/DeviceCurrentClimateSetting.php | 46 - src/Objects/DeviceDefaultClimateSetting.php | 46 - .../DeviceDormakabaOracodeMetadata.php | 39 - src/Objects/DeviceEcobeeMetadata.php | 23 - src/Objects/DeviceEndpoints.php | 23 - src/Objects/DeviceErrors.php | 30 - src/Objects/DeviceFeatures.php | 29 - src/Objects/DeviceFourSuitesMetadata.php | 25 - src/Objects/DeviceGenieMetadata.php | 23 - .../DeviceHoneywellResideoMetadata.php | 24 - src/Objects/DeviceHubitatMetadata.php | 25 - src/Objects/DeviceHumidity.php | 18 - src/Objects/DeviceIglooMetadata.php | 25 - src/Objects/DeviceIgloohomeMetadata.php | 29 - src/Objects/DeviceKeypadBattery.php | 18 - src/Objects/DeviceKwiksetMetadata.php | 25 - src/Objects/DeviceLatestSensorValues.php | 31 - src/Objects/DeviceLocation.php | 23 - src/Objects/DeviceLocklyMetadata.php | 25 - src/Objects/DeviceMinutMetadata.php | 27 - src/Objects/DeviceModel.php | 37 - src/Objects/DeviceNestMetadata.php | 27 - src/Objects/DeviceNoiseawareMetadata.php | 29 - src/Objects/DeviceNukiMetadata.php | 29 - src/Objects/DevicePredefinedTimeSlots.php | 40 - src/Objects/DevicePressure.php | 18 - src/Objects/DeviceProperties.php | 334 -- src/Objects/DeviceProvider.php | 52 - src/Objects/DeviceSaltoKsMetadata.php | 31 - src/Objects/DeviceSaltoMetadata.php | 31 - ...iceSaltoSpaceCredentialServiceMetadata.php | 19 - src/Objects/DeviceSchlageMetadata.php | 27 - src/Objects/DeviceSeamBridgeMetadata.php | 25 - src/Objects/DeviceSmartthingsMetadata.php | 28 - src/Objects/DeviceSound.php | 18 - src/Objects/DeviceTadoMetadata.php | 23 - src/Objects/DeviceTedeeMetadata.php | 33 - src/Objects/DeviceTemperature.php | 18 - src/Objects/DeviceTemperatureThreshold.php | 28 - src/Objects/DeviceTtlockMetadata.php | 34 - src/Objects/DeviceTwoNMetadata.php | 23 - src/Objects/DeviceVisionlineMetadata.php | 18 - src/Objects/DeviceWarnings.php | 25 - src/Objects/DeviceWirelessKeypads.php | 23 - src/Objects/DeviceWyzeMetadata.php | 35 - src/Objects/EnrollmentAutomation.php | 29 - src/Objects/Event.php | 120 - src/Objects/Network.php | 27 - src/Objects/NoiseThreshold.php | 33 - src/Objects/Phone.php | 45 - ...honeAssaAbloyCredentialServiceMetadata.php | 27 - src/Objects/PhoneEndpoints.php | 23 - src/Objects/PhoneErrors.php | 25 - src/Objects/PhoneProperties.php | 35 - ...oneSaltoSpaceCredentialServiceMetadata.php | 19 - src/Objects/PhoneWarnings.php | 25 - src/Objects/ThermostatSchedule.php | 43 - src/Objects/ThermostatScheduleErrors.php | 25 - src/Objects/UnmanagedAccessCode.php | 49 - src/Objects/UnmanagedAccessCodeErrors.php | 33 - src/Objects/UnmanagedAccessCodeWarnings.php | 26 - src/Objects/UnmanagedAcsAccessGroup.php | 46 - .../UnmanagedAcsAccessGroupWarnings.php | 26 - src/Objects/UnmanagedAcsCredential.php | 89 - ...edAcsCredentialAssaAbloyVostioMetadata.php | 31 - src/Objects/UnmanagedAcsCredentialErrors.php | 26 - ...managedAcsCredentialVisionlineMetadata.php | 36 - .../UnmanagedAcsCredentialWarnings.php | 26 - src/Objects/UnmanagedAcsUser.php | 80 - .../UnmanagedAcsUserAccessSchedule.php | 24 - src/Objects/UnmanagedAcsUserErrors.php | 25 - src/Objects/UnmanagedAcsUserWarnings.php | 25 - src/Objects/UnmanagedDevice.php | 74 - .../UnmanagedDeviceAccessoryKeypad.php | 26 - src/Objects/UnmanagedDeviceBattery.php | 18 - src/Objects/UnmanagedDeviceErrors.php | 30 - src/Objects/UnmanagedDeviceLocation.php | 23 - src/Objects/UnmanagedDeviceModel.php | 37 - src/Objects/UnmanagedDeviceProperties.php | 50 - src/Objects/UnmanagedDeviceWarnings.php | 25 - src/Objects/UserIdentity.php | 35 - src/Objects/Webhook.php | 27 - src/Objects/Workspace.php | 29 - src/Routes/Clients/AccessCodesClient.php | 411 ++ .../Clients/AccessCodesSimulateClient.php | 43 + .../Clients/AccessCodesUnmanagedClient.php | 148 + src/Routes/Clients/AcsAccessGroupsClient.php | 136 + .../AcsAccessGroupsUnmanagedClient.php | 60 + src/Routes/Clients/AcsClient.php | 32 + .../Clients/AcsCredentialPoolsClient.php | 34 + ...redentialProvisioningAutomationsClient.php | 51 + src/Routes/Clients/AcsCredentialsClient.php | 263 + .../Clients/AcsCredentialsUnmanagedClient.php | 61 + src/Routes/Clients/AcsEncodersClient.php | 108 + .../Clients/AcsEncodersSimulateClient.php | 107 + src/Routes/Clients/AcsEntrancesClient.php | 101 + src/Routes/Clients/AcsSystemsClient.php | 71 + src/Routes/Clients/AcsUsersClient.php | 279 + .../Clients/AcsUsersUnmanagedClient.php | 69 + src/Routes/Clients/ActionAttemptsClient.php | 80 + src/Routes/Clients/BridgesClient.php | 43 + src/Routes/Clients/ClientSessionsClient.php | 206 + src/Routes/Clients/ConnectWebviewsClient.php | 123 + .../Clients/ConnectedAccountsClient.php | 106 + src/Routes/Clients/DevicesClient.php | 174 + src/Routes/Clients/DevicesSimulateClient.php | 60 + src/Routes/Clients/DevicesUnmanagedClient.php | 124 + src/Routes/Clients/EventsClient.php | 114 + src/Routes/Clients/LocksClient.php | 169 + src/Routes/Clients/NetworksClient.php | 48 + src/Routes/Clients/NoiseSensorsClient.php | 86 + .../NoiseSensorsNoiseThresholdsClient.php | 166 + .../Clients/NoiseSensorsSimulateClient.php | 30 + src/Routes/Clients/PhonesClient.php | 73 + src/Routes/Clients/PhonesSimulateClient.php | 47 + src/Routes/Clients/ThermostatsClient.php | 564 ++ .../Clients/ThermostatsSchedulesClient.php | 155 + .../Clients/ThermostatsSimulateClient.php | 75 + src/Routes/Clients/UserIdentitiesClient.php | 275 + ...rIdentitiesEnrollmentAutomationsClient.php | 100 + src/Routes/Clients/WebhooksClient.php | 102 + src/Routes/Clients/WorkspacesClient.php | 111 + src/Routes/Objects/AccessCode.php | 68 + src/Routes/Objects/AccessCodeErrors.php | 31 + src/Routes/Objects/AccessCodeWarnings.php | 24 + src/Routes/Objects/AcsAccessGroup.php | 45 + src/Routes/Objects/AcsAccessGroupWarnings.php | 24 + src/Routes/Objects/AcsCredential.php | 88 + .../AcsCredentialAssaAbloyVostioMetadata.php | 30 + src/Routes/Objects/AcsCredentialErrors.php | 24 + src/Routes/Objects/AcsCredentialPool.php | 32 + .../AcsCredentialProvisioningAutomation.php | 29 + .../AcsCredentialVisionlineMetadata.php | 35 + src/Routes/Objects/AcsCredentialWarnings.php | 24 + src/Routes/Objects/AcsEncoder.php | 33 + src/Routes/Objects/AcsEncoderErrors.php | 24 + src/Routes/Objects/AcsEntrance.php | 67 + .../AcsEntranceAssaAbloyVostioMetadata.php | 29 + .../AcsEntranceDormakabaCommunityMetadata.php | 17 + src/Routes/Objects/AcsEntranceErrors.php | 24 + .../Objects/AcsEntranceLatchMetadata.php | 26 + src/Routes/Objects/AcsEntranceProfiles.php | 22 + .../Objects/AcsEntranceSaltoKsMetadata.php | 35 + .../Objects/AcsEntranceSaltoSpaceMetadata.php | 25 + .../Objects/AcsEntranceVisionlineMetadata.php | 28 + src/Routes/Objects/AcsSystem.php | 77 + src/Routes/Objects/AcsSystemErrors.php | 24 + src/Routes/Objects/AcsSystemLocation.php | 16 + .../Objects/AcsSystemVisionlineMetadata.php | 25 + src/Routes/Objects/AcsSystemWarnings.php | 27 + src/Routes/Objects/AcsUser.php | 77 + src/Routes/Objects/AcsUserAccessSchedule.php | 22 + src/Routes/Objects/AcsUserErrors.php | 24 + src/Routes/Objects/AcsUserWarnings.php | 24 + src/Routes/Objects/ActionAttempt.php | 30 + src/Routes/Objects/ActionAttemptError.php | 16 + src/Routes/Objects/ClientSession.php | 38 + src/Routes/Objects/ConnectWebview.php | 57 + src/Routes/Objects/ConnectedAccount.php | 46 + src/Routes/Objects/ConnectedAccountErrors.php | 26 + .../ConnectedAccountUserIdentifier.php | 29 + .../Objects/ConnectedAccountWarnings.php | 24 + src/Routes/Objects/Device.php | 79 + src/Routes/Objects/DeviceAccelerometerZ.php | 16 + src/Routes/Objects/DeviceAccessoryKeypad.php | 24 + .../DeviceActiveThermostatSchedule.php | 43 + src/Routes/Objects/DeviceAkilesMetadata.php | 26 + src/Routes/Objects/DeviceAppearance.php | 16 + ...viceAssaAbloyCredentialServiceMetadata.php | 26 + .../Objects/DeviceAssaAbloyVostioMetadata.php | 17 + src/Routes/Objects/DeviceAugustMetadata.php | 32 + .../Objects/DeviceAvailableClimatePresets.php | 45 + .../Objects/DeviceAvigilonAltaMetadata.php | 33 + src/Routes/Objects/DeviceBattery.php | 16 + src/Routes/Objects/DeviceBrivoMetadata.php | 16 + src/Routes/Objects/DeviceCodeConstraints.php | 24 + .../Objects/DeviceControlbywebMetadata.php | 25 + .../Objects/DeviceCurrentClimateSetting.php | 45 + .../Objects/DeviceDefaultClimateSetting.php | 45 + .../DeviceDormakabaOracodeMetadata.php | 38 + src/Routes/Objects/DeviceEcobeeMetadata.php | 22 + src/Routes/Objects/DeviceEndpoints.php | 22 + src/Routes/Objects/DeviceErrors.php | 29 + src/Routes/Objects/DeviceFeatures.php | 28 + .../Objects/DeviceFourSuitesMetadata.php | 24 + src/Routes/Objects/DeviceGenieMetadata.php | 22 + .../DeviceHoneywellResideoMetadata.php | 23 + src/Routes/Objects/DeviceHubitatMetadata.php | 24 + src/Routes/Objects/DeviceHumidity.php | 16 + src/Routes/Objects/DeviceIglooMetadata.php | 24 + .../Objects/DeviceIgloohomeMetadata.php | 28 + src/Routes/Objects/DeviceKeypadBattery.php | 16 + src/Routes/Objects/DeviceKwiksetMetadata.php | 24 + .../Objects/DeviceLatestSensorValues.php | 30 + src/Routes/Objects/DeviceLocation.php | 22 + src/Routes/Objects/DeviceLocklyMetadata.php | 24 + src/Routes/Objects/DeviceMinutMetadata.php | 26 + src/Routes/Objects/DeviceModel.php | 36 + src/Routes/Objects/DeviceNestMetadata.php | 26 + .../Objects/DeviceNoiseawareMetadata.php | 28 + src/Routes/Objects/DeviceNukiMetadata.php | 28 + .../Objects/DevicePredefinedTimeSlots.php | 39 + src/Routes/Objects/DevicePressure.php | 16 + src/Routes/Objects/DeviceProperties.php | 333 ++ src/Routes/Objects/DeviceProvider.php | 51 + src/Routes/Objects/DeviceSaltoKsMetadata.php | 30 + src/Routes/Objects/DeviceSaltoMetadata.php | 30 + ...iceSaltoSpaceCredentialServiceMetadata.php | 17 + src/Routes/Objects/DeviceSchlageMetadata.php | 26 + .../Objects/DeviceSeamBridgeMetadata.php | 24 + .../Objects/DeviceSmartthingsMetadata.php | 27 + src/Routes/Objects/DeviceSound.php | 16 + src/Routes/Objects/DeviceTadoMetadata.php | 22 + src/Routes/Objects/DeviceTedeeMetadata.php | 32 + src/Routes/Objects/DeviceTemperature.php | 16 + .../Objects/DeviceTemperatureThreshold.php | 27 + src/Routes/Objects/DeviceTtlockMetadata.php | 33 + src/Routes/Objects/DeviceTwoNMetadata.php | 22 + .../Objects/DeviceVisionlineMetadata.php | 16 + src/Routes/Objects/DeviceWarnings.php | 24 + src/Routes/Objects/DeviceWirelessKeypads.php | 22 + src/Routes/Objects/DeviceWyzeMetadata.php | 34 + src/Routes/Objects/EnrollmentAutomation.php | 28 + src/Routes/Objects/Event.php | 119 + src/Routes/Objects/Network.php | 26 + src/Routes/Objects/NoiseThreshold.php | 32 + src/Routes/Objects/Phone.php | 44 + ...honeAssaAbloyCredentialServiceMetadata.php | 26 + src/Routes/Objects/PhoneEndpoints.php | 22 + src/Routes/Objects/PhoneErrors.php | 24 + src/Routes/Objects/PhoneProperties.php | 34 + ...oneSaltoSpaceCredentialServiceMetadata.php | 17 + src/Routes/Objects/PhoneWarnings.php | 24 + src/Routes/Objects/ThermostatSchedule.php | 42 + .../Objects/ThermostatScheduleErrors.php | 24 + src/Routes/Objects/UnmanagedAccessCode.php | 48 + .../Objects/UnmanagedAccessCodeErrors.php | 32 + .../Objects/UnmanagedAccessCodeWarnings.php | 25 + .../Objects/UnmanagedAcsAccessGroup.php | 45 + .../UnmanagedAcsAccessGroupWarnings.php | 25 + src/Routes/Objects/UnmanagedAcsCredential.php | 88 + ...edAcsCredentialAssaAbloyVostioMetadata.php | 30 + .../Objects/UnmanagedAcsCredentialErrors.php | 25 + ...managedAcsCredentialVisionlineMetadata.php | 35 + .../UnmanagedAcsCredentialWarnings.php | 25 + src/Routes/Objects/UnmanagedAcsUser.php | 79 + .../UnmanagedAcsUserAccessSchedule.php | 23 + src/Routes/Objects/UnmanagedAcsUserErrors.php | 24 + .../Objects/UnmanagedAcsUserWarnings.php | 24 + src/Routes/Objects/UnmanagedDevice.php | 73 + .../UnmanagedDeviceAccessoryKeypad.php | 25 + src/Routes/Objects/UnmanagedDeviceBattery.php | 16 + src/Routes/Objects/UnmanagedDeviceErrors.php | 29 + .../Objects/UnmanagedDeviceLocation.php | 22 + src/Routes/Objects/UnmanagedDeviceModel.php | 36 + .../Objects/UnmanagedDeviceProperties.php | 49 + .../Objects/UnmanagedDeviceWarnings.php | 24 + src/Routes/Objects/UserIdentity.php | 34 + src/Routes/Objects/Webhook.php | 26 + src/Routes/Objects/Workspace.php | 28 + src/Routes/Routes.php | 64 + src/SeamClient.php | 5180 +---------------- 321 files changed, 9853 insertions(+), 9947 deletions(-) delete mode 100644 src/Objects/AccessCode.php delete mode 100644 src/Objects/AccessCodeErrors.php delete mode 100644 src/Objects/AccessCodeWarnings.php delete mode 100644 src/Objects/AcsAccessGroup.php delete mode 100644 src/Objects/AcsAccessGroupWarnings.php delete mode 100644 src/Objects/AcsCredential.php delete mode 100644 src/Objects/AcsCredentialAssaAbloyVostioMetadata.php delete mode 100644 src/Objects/AcsCredentialErrors.php delete mode 100644 src/Objects/AcsCredentialPool.php delete mode 100644 src/Objects/AcsCredentialProvisioningAutomation.php delete mode 100644 src/Objects/AcsCredentialVisionlineMetadata.php delete mode 100644 src/Objects/AcsCredentialWarnings.php delete mode 100644 src/Objects/AcsEncoder.php delete mode 100644 src/Objects/AcsEncoderErrors.php delete mode 100644 src/Objects/AcsEntrance.php delete mode 100644 src/Objects/AcsEntranceAssaAbloyVostioMetadata.php delete mode 100644 src/Objects/AcsEntranceDormakabaCommunityMetadata.php delete mode 100644 src/Objects/AcsEntranceErrors.php delete mode 100644 src/Objects/AcsEntranceLatchMetadata.php delete mode 100644 src/Objects/AcsEntranceProfiles.php delete mode 100644 src/Objects/AcsEntranceSaltoKsMetadata.php delete mode 100644 src/Objects/AcsEntranceSaltoSpaceMetadata.php delete mode 100644 src/Objects/AcsEntranceVisionlineMetadata.php delete mode 100644 src/Objects/AcsSystem.php delete mode 100644 src/Objects/AcsSystemErrors.php delete mode 100644 src/Objects/AcsSystemLocation.php delete mode 100644 src/Objects/AcsSystemVisionlineMetadata.php delete mode 100644 src/Objects/AcsSystemWarnings.php delete mode 100644 src/Objects/AcsUser.php delete mode 100644 src/Objects/AcsUserAccessSchedule.php delete mode 100644 src/Objects/AcsUserErrors.php delete mode 100644 src/Objects/AcsUserWarnings.php delete mode 100644 src/Objects/ActionAttempt.php delete mode 100644 src/Objects/ActionAttemptError.php delete mode 100644 src/Objects/ClientSession.php delete mode 100644 src/Objects/ConnectWebview.php delete mode 100644 src/Objects/ConnectedAccount.php delete mode 100644 src/Objects/ConnectedAccountErrors.php delete mode 100644 src/Objects/ConnectedAccountUserIdentifier.php delete mode 100644 src/Objects/ConnectedAccountWarnings.php delete mode 100644 src/Objects/Device.php delete mode 100644 src/Objects/DeviceAccelerometerZ.php delete mode 100644 src/Objects/DeviceAccessoryKeypad.php delete mode 100644 src/Objects/DeviceActiveThermostatSchedule.php delete mode 100644 src/Objects/DeviceAkilesMetadata.php delete mode 100644 src/Objects/DeviceAppearance.php delete mode 100644 src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php delete mode 100644 src/Objects/DeviceAssaAbloyVostioMetadata.php delete mode 100644 src/Objects/DeviceAugustMetadata.php delete mode 100644 src/Objects/DeviceAvailableClimatePresets.php delete mode 100644 src/Objects/DeviceAvigilonAltaMetadata.php delete mode 100644 src/Objects/DeviceBattery.php delete mode 100644 src/Objects/DeviceBrivoMetadata.php delete mode 100644 src/Objects/DeviceCodeConstraints.php delete mode 100644 src/Objects/DeviceControlbywebMetadata.php delete mode 100644 src/Objects/DeviceCurrentClimateSetting.php delete mode 100644 src/Objects/DeviceDefaultClimateSetting.php delete mode 100644 src/Objects/DeviceDormakabaOracodeMetadata.php delete mode 100644 src/Objects/DeviceEcobeeMetadata.php delete mode 100644 src/Objects/DeviceEndpoints.php delete mode 100644 src/Objects/DeviceErrors.php delete mode 100644 src/Objects/DeviceFeatures.php delete mode 100644 src/Objects/DeviceFourSuitesMetadata.php delete mode 100644 src/Objects/DeviceGenieMetadata.php delete mode 100644 src/Objects/DeviceHoneywellResideoMetadata.php delete mode 100644 src/Objects/DeviceHubitatMetadata.php delete mode 100644 src/Objects/DeviceHumidity.php delete mode 100644 src/Objects/DeviceIglooMetadata.php delete mode 100644 src/Objects/DeviceIgloohomeMetadata.php delete mode 100644 src/Objects/DeviceKeypadBattery.php delete mode 100644 src/Objects/DeviceKwiksetMetadata.php delete mode 100644 src/Objects/DeviceLatestSensorValues.php delete mode 100644 src/Objects/DeviceLocation.php delete mode 100644 src/Objects/DeviceLocklyMetadata.php delete mode 100644 src/Objects/DeviceMinutMetadata.php delete mode 100644 src/Objects/DeviceModel.php delete mode 100644 src/Objects/DeviceNestMetadata.php delete mode 100644 src/Objects/DeviceNoiseawareMetadata.php delete mode 100644 src/Objects/DeviceNukiMetadata.php delete mode 100644 src/Objects/DevicePredefinedTimeSlots.php delete mode 100644 src/Objects/DevicePressure.php delete mode 100644 src/Objects/DeviceProperties.php delete mode 100644 src/Objects/DeviceProvider.php delete mode 100644 src/Objects/DeviceSaltoKsMetadata.php delete mode 100644 src/Objects/DeviceSaltoMetadata.php delete mode 100644 src/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php delete mode 100644 src/Objects/DeviceSchlageMetadata.php delete mode 100644 src/Objects/DeviceSeamBridgeMetadata.php delete mode 100644 src/Objects/DeviceSmartthingsMetadata.php delete mode 100644 src/Objects/DeviceSound.php delete mode 100644 src/Objects/DeviceTadoMetadata.php delete mode 100644 src/Objects/DeviceTedeeMetadata.php delete mode 100644 src/Objects/DeviceTemperature.php delete mode 100644 src/Objects/DeviceTemperatureThreshold.php delete mode 100644 src/Objects/DeviceTtlockMetadata.php delete mode 100644 src/Objects/DeviceTwoNMetadata.php delete mode 100644 src/Objects/DeviceVisionlineMetadata.php delete mode 100644 src/Objects/DeviceWarnings.php delete mode 100644 src/Objects/DeviceWirelessKeypads.php delete mode 100644 src/Objects/DeviceWyzeMetadata.php delete mode 100644 src/Objects/EnrollmentAutomation.php delete mode 100644 src/Objects/Event.php delete mode 100644 src/Objects/Network.php delete mode 100644 src/Objects/NoiseThreshold.php delete mode 100644 src/Objects/Phone.php delete mode 100644 src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php delete mode 100644 src/Objects/PhoneEndpoints.php delete mode 100644 src/Objects/PhoneErrors.php delete mode 100644 src/Objects/PhoneProperties.php delete mode 100644 src/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php delete mode 100644 src/Objects/PhoneWarnings.php delete mode 100644 src/Objects/ThermostatSchedule.php delete mode 100644 src/Objects/ThermostatScheduleErrors.php delete mode 100644 src/Objects/UnmanagedAccessCode.php delete mode 100644 src/Objects/UnmanagedAccessCodeErrors.php delete mode 100644 src/Objects/UnmanagedAccessCodeWarnings.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroup.php delete mode 100644 src/Objects/UnmanagedAcsAccessGroupWarnings.php delete mode 100644 src/Objects/UnmanagedAcsCredential.php delete mode 100644 src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php delete mode 100644 src/Objects/UnmanagedAcsCredentialErrors.php delete mode 100644 src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php delete mode 100644 src/Objects/UnmanagedAcsCredentialWarnings.php delete mode 100644 src/Objects/UnmanagedAcsUser.php delete mode 100644 src/Objects/UnmanagedAcsUserAccessSchedule.php delete mode 100644 src/Objects/UnmanagedAcsUserErrors.php delete mode 100644 src/Objects/UnmanagedAcsUserWarnings.php delete mode 100644 src/Objects/UnmanagedDevice.php delete mode 100644 src/Objects/UnmanagedDeviceAccessoryKeypad.php delete mode 100644 src/Objects/UnmanagedDeviceBattery.php delete mode 100644 src/Objects/UnmanagedDeviceErrors.php delete mode 100644 src/Objects/UnmanagedDeviceLocation.php delete mode 100644 src/Objects/UnmanagedDeviceModel.php delete mode 100644 src/Objects/UnmanagedDeviceProperties.php delete mode 100644 src/Objects/UnmanagedDeviceWarnings.php delete mode 100644 src/Objects/UserIdentity.php delete mode 100644 src/Objects/Webhook.php delete mode 100644 src/Objects/Workspace.php create mode 100644 src/Routes/Clients/AccessCodesClient.php create mode 100644 src/Routes/Clients/AccessCodesSimulateClient.php create mode 100644 src/Routes/Clients/AccessCodesUnmanagedClient.php create mode 100644 src/Routes/Clients/AcsAccessGroupsClient.php create mode 100644 src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php create mode 100644 src/Routes/Clients/AcsClient.php create mode 100644 src/Routes/Clients/AcsCredentialPoolsClient.php create mode 100644 src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php create mode 100644 src/Routes/Clients/AcsCredentialsClient.php create mode 100644 src/Routes/Clients/AcsCredentialsUnmanagedClient.php create mode 100644 src/Routes/Clients/AcsEncodersClient.php create mode 100644 src/Routes/Clients/AcsEncodersSimulateClient.php create mode 100644 src/Routes/Clients/AcsEntrancesClient.php create mode 100644 src/Routes/Clients/AcsSystemsClient.php create mode 100644 src/Routes/Clients/AcsUsersClient.php create mode 100644 src/Routes/Clients/AcsUsersUnmanagedClient.php create mode 100644 src/Routes/Clients/ActionAttemptsClient.php create mode 100644 src/Routes/Clients/BridgesClient.php create mode 100644 src/Routes/Clients/ClientSessionsClient.php create mode 100644 src/Routes/Clients/ConnectWebviewsClient.php create mode 100644 src/Routes/Clients/ConnectedAccountsClient.php create mode 100644 src/Routes/Clients/DevicesClient.php create mode 100644 src/Routes/Clients/DevicesSimulateClient.php create mode 100644 src/Routes/Clients/DevicesUnmanagedClient.php create mode 100644 src/Routes/Clients/EventsClient.php create mode 100644 src/Routes/Clients/LocksClient.php create mode 100644 src/Routes/Clients/NetworksClient.php create mode 100644 src/Routes/Clients/NoiseSensorsClient.php create mode 100644 src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php create mode 100644 src/Routes/Clients/NoiseSensorsSimulateClient.php create mode 100644 src/Routes/Clients/PhonesClient.php create mode 100644 src/Routes/Clients/PhonesSimulateClient.php create mode 100644 src/Routes/Clients/ThermostatsClient.php create mode 100644 src/Routes/Clients/ThermostatsSchedulesClient.php create mode 100644 src/Routes/Clients/ThermostatsSimulateClient.php create mode 100644 src/Routes/Clients/UserIdentitiesClient.php create mode 100644 src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php create mode 100644 src/Routes/Clients/WebhooksClient.php create mode 100644 src/Routes/Clients/WorkspacesClient.php create mode 100644 src/Routes/Objects/AccessCode.php create mode 100644 src/Routes/Objects/AccessCodeErrors.php create mode 100644 src/Routes/Objects/AccessCodeWarnings.php create mode 100644 src/Routes/Objects/AcsAccessGroup.php create mode 100644 src/Routes/Objects/AcsAccessGroupWarnings.php create mode 100644 src/Routes/Objects/AcsCredential.php create mode 100644 src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php create mode 100644 src/Routes/Objects/AcsCredentialErrors.php create mode 100644 src/Routes/Objects/AcsCredentialPool.php create mode 100644 src/Routes/Objects/AcsCredentialProvisioningAutomation.php create mode 100644 src/Routes/Objects/AcsCredentialVisionlineMetadata.php create mode 100644 src/Routes/Objects/AcsCredentialWarnings.php create mode 100644 src/Routes/Objects/AcsEncoder.php create mode 100644 src/Routes/Objects/AcsEncoderErrors.php create mode 100644 src/Routes/Objects/AcsEntrance.php create mode 100644 src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php create mode 100644 src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php create mode 100644 src/Routes/Objects/AcsEntranceErrors.php create mode 100644 src/Routes/Objects/AcsEntranceLatchMetadata.php create mode 100644 src/Routes/Objects/AcsEntranceProfiles.php create mode 100644 src/Routes/Objects/AcsEntranceSaltoKsMetadata.php create mode 100644 src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php create mode 100644 src/Routes/Objects/AcsEntranceVisionlineMetadata.php create mode 100644 src/Routes/Objects/AcsSystem.php create mode 100644 src/Routes/Objects/AcsSystemErrors.php create mode 100644 src/Routes/Objects/AcsSystemLocation.php create mode 100644 src/Routes/Objects/AcsSystemVisionlineMetadata.php create mode 100644 src/Routes/Objects/AcsSystemWarnings.php create mode 100644 src/Routes/Objects/AcsUser.php create mode 100644 src/Routes/Objects/AcsUserAccessSchedule.php create mode 100644 src/Routes/Objects/AcsUserErrors.php create mode 100644 src/Routes/Objects/AcsUserWarnings.php create mode 100644 src/Routes/Objects/ActionAttempt.php create mode 100644 src/Routes/Objects/ActionAttemptError.php create mode 100644 src/Routes/Objects/ClientSession.php create mode 100644 src/Routes/Objects/ConnectWebview.php create mode 100644 src/Routes/Objects/ConnectedAccount.php create mode 100644 src/Routes/Objects/ConnectedAccountErrors.php create mode 100644 src/Routes/Objects/ConnectedAccountUserIdentifier.php create mode 100644 src/Routes/Objects/ConnectedAccountWarnings.php create mode 100644 src/Routes/Objects/Device.php create mode 100644 src/Routes/Objects/DeviceAccelerometerZ.php create mode 100644 src/Routes/Objects/DeviceAccessoryKeypad.php create mode 100644 src/Routes/Objects/DeviceActiveThermostatSchedule.php create mode 100644 src/Routes/Objects/DeviceAkilesMetadata.php create mode 100644 src/Routes/Objects/DeviceAppearance.php create mode 100644 src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php create mode 100644 src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php create mode 100644 src/Routes/Objects/DeviceAugustMetadata.php create mode 100644 src/Routes/Objects/DeviceAvailableClimatePresets.php create mode 100644 src/Routes/Objects/DeviceAvigilonAltaMetadata.php create mode 100644 src/Routes/Objects/DeviceBattery.php create mode 100644 src/Routes/Objects/DeviceBrivoMetadata.php create mode 100644 src/Routes/Objects/DeviceCodeConstraints.php create mode 100644 src/Routes/Objects/DeviceControlbywebMetadata.php create mode 100644 src/Routes/Objects/DeviceCurrentClimateSetting.php create mode 100644 src/Routes/Objects/DeviceDefaultClimateSetting.php create mode 100644 src/Routes/Objects/DeviceDormakabaOracodeMetadata.php create mode 100644 src/Routes/Objects/DeviceEcobeeMetadata.php create mode 100644 src/Routes/Objects/DeviceEndpoints.php create mode 100644 src/Routes/Objects/DeviceErrors.php create mode 100644 src/Routes/Objects/DeviceFeatures.php create mode 100644 src/Routes/Objects/DeviceFourSuitesMetadata.php create mode 100644 src/Routes/Objects/DeviceGenieMetadata.php create mode 100644 src/Routes/Objects/DeviceHoneywellResideoMetadata.php create mode 100644 src/Routes/Objects/DeviceHubitatMetadata.php create mode 100644 src/Routes/Objects/DeviceHumidity.php create mode 100644 src/Routes/Objects/DeviceIglooMetadata.php create mode 100644 src/Routes/Objects/DeviceIgloohomeMetadata.php create mode 100644 src/Routes/Objects/DeviceKeypadBattery.php create mode 100644 src/Routes/Objects/DeviceKwiksetMetadata.php create mode 100644 src/Routes/Objects/DeviceLatestSensorValues.php create mode 100644 src/Routes/Objects/DeviceLocation.php create mode 100644 src/Routes/Objects/DeviceLocklyMetadata.php create mode 100644 src/Routes/Objects/DeviceMinutMetadata.php create mode 100644 src/Routes/Objects/DeviceModel.php create mode 100644 src/Routes/Objects/DeviceNestMetadata.php create mode 100644 src/Routes/Objects/DeviceNoiseawareMetadata.php create mode 100644 src/Routes/Objects/DeviceNukiMetadata.php create mode 100644 src/Routes/Objects/DevicePredefinedTimeSlots.php create mode 100644 src/Routes/Objects/DevicePressure.php create mode 100644 src/Routes/Objects/DeviceProperties.php create mode 100644 src/Routes/Objects/DeviceProvider.php create mode 100644 src/Routes/Objects/DeviceSaltoKsMetadata.php create mode 100644 src/Routes/Objects/DeviceSaltoMetadata.php create mode 100644 src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php create mode 100644 src/Routes/Objects/DeviceSchlageMetadata.php create mode 100644 src/Routes/Objects/DeviceSeamBridgeMetadata.php create mode 100644 src/Routes/Objects/DeviceSmartthingsMetadata.php create mode 100644 src/Routes/Objects/DeviceSound.php create mode 100644 src/Routes/Objects/DeviceTadoMetadata.php create mode 100644 src/Routes/Objects/DeviceTedeeMetadata.php create mode 100644 src/Routes/Objects/DeviceTemperature.php create mode 100644 src/Routes/Objects/DeviceTemperatureThreshold.php create mode 100644 src/Routes/Objects/DeviceTtlockMetadata.php create mode 100644 src/Routes/Objects/DeviceTwoNMetadata.php create mode 100644 src/Routes/Objects/DeviceVisionlineMetadata.php create mode 100644 src/Routes/Objects/DeviceWarnings.php create mode 100644 src/Routes/Objects/DeviceWirelessKeypads.php create mode 100644 src/Routes/Objects/DeviceWyzeMetadata.php create mode 100644 src/Routes/Objects/EnrollmentAutomation.php create mode 100644 src/Routes/Objects/Event.php create mode 100644 src/Routes/Objects/Network.php create mode 100644 src/Routes/Objects/NoiseThreshold.php create mode 100644 src/Routes/Objects/Phone.php create mode 100644 src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php create mode 100644 src/Routes/Objects/PhoneEndpoints.php create mode 100644 src/Routes/Objects/PhoneErrors.php create mode 100644 src/Routes/Objects/PhoneProperties.php create mode 100644 src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php create mode 100644 src/Routes/Objects/PhoneWarnings.php create mode 100644 src/Routes/Objects/ThermostatSchedule.php create mode 100644 src/Routes/Objects/ThermostatScheduleErrors.php create mode 100644 src/Routes/Objects/UnmanagedAccessCode.php create mode 100644 src/Routes/Objects/UnmanagedAccessCodeErrors.php create mode 100644 src/Routes/Objects/UnmanagedAccessCodeWarnings.php create mode 100644 src/Routes/Objects/UnmanagedAcsAccessGroup.php create mode 100644 src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php create mode 100644 src/Routes/Objects/UnmanagedAcsCredential.php create mode 100644 src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php create mode 100644 src/Routes/Objects/UnmanagedAcsCredentialErrors.php create mode 100644 src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php create mode 100644 src/Routes/Objects/UnmanagedAcsCredentialWarnings.php create mode 100644 src/Routes/Objects/UnmanagedAcsUser.php create mode 100644 src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php create mode 100644 src/Routes/Objects/UnmanagedAcsUserErrors.php create mode 100644 src/Routes/Objects/UnmanagedAcsUserWarnings.php create mode 100644 src/Routes/Objects/UnmanagedDevice.php create mode 100644 src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php create mode 100644 src/Routes/Objects/UnmanagedDeviceBattery.php create mode 100644 src/Routes/Objects/UnmanagedDeviceErrors.php create mode 100644 src/Routes/Objects/UnmanagedDeviceLocation.php create mode 100644 src/Routes/Objects/UnmanagedDeviceModel.php create mode 100644 src/Routes/Objects/UnmanagedDeviceProperties.php create mode 100644 src/Routes/Objects/UnmanagedDeviceWarnings.php create mode 100644 src/Routes/Objects/UserIdentity.php create mode 100644 src/Routes/Objects/Webhook.php create mode 100644 src/Routes/Objects/Workspace.php create mode 100644 src/Routes/Routes.php diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 98269747..e8653dcd 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -3,8 +3,8 @@ name: Generate on: push: - branches-ignore: - - main + branches: + - 'no-branch-will-match-this-pattern' workflow_dispatch: {} jobs: diff --git a/src/Exceptions/ActionAttemptError.php b/src/Exceptions/ActionAttemptError.php index 2581e3b7..8809e672 100644 --- a/src/Exceptions/ActionAttemptError.php +++ b/src/Exceptions/ActionAttemptError.php @@ -2,21 +2,21 @@ namespace Seam; -use Seam\Objects\ActionAttempt; +use Seam\Routes\Objects\ActionAttempt; class ActionAttemptError extends \Exception { - private ActionAttempt $actionAttempt; + private ActionAttempt $actionAttempt; - public function __construct(string $message, ActionAttempt $actionAttempt) - { - parent::__construct($message); - $this->name = get_class($this); - $this->actionAttempt = $actionAttempt; - } + public function __construct(string $message, ActionAttempt $actionAttempt) + { + parent::__construct($message); + $this->name = get_class($this); + $this->actionAttempt = $actionAttempt; + } - public function getActionAttempt(): ActionAttempt - { - return $this->actionAttempt; - } + public function getActionAttempt(): ActionAttempt + { + return $this->actionAttempt; + } } diff --git a/src/Exceptions/ActionAttemptFailedError.php b/src/Exceptions/ActionAttemptFailedError.php index cca53385..9fca1815 100644 --- a/src/Exceptions/ActionAttemptFailedError.php +++ b/src/Exceptions/ActionAttemptFailedError.php @@ -2,21 +2,21 @@ namespace Seam; -use Seam\Objects\ActionAttempt; +use Seam\Routes\Objects\ActionAttempt; class ActionAttemptFailedError extends ActionAttemptError { - private string $errorCode; + private string $errorCode; - public function __construct(ActionAttempt $actionAttempt) - { - parent::__construct($actionAttempt->error->message, $actionAttempt); - $this->name = get_class($this); - $this->errorCode = $actionAttempt->error->type; - } + public function __construct(ActionAttempt $actionAttempt) + { + parent::__construct($actionAttempt->error->message, $actionAttempt); + $this->name = get_class($this); + $this->errorCode = $actionAttempt->error->type; + } - public function getErrorCode(): string - { - return $this->errorCode; - } + public function getErrorCode(): string + { + return $this->errorCode; + } } diff --git a/src/Exceptions/ActionAttemptTimeoutError.php b/src/Exceptions/ActionAttemptTimeoutError.php index 151dc3b4..06ba4403 100644 --- a/src/Exceptions/ActionAttemptTimeoutError.php +++ b/src/Exceptions/ActionAttemptTimeoutError.php @@ -2,16 +2,16 @@ namespace Seam; -use Seam\Objects\ActionAttempt; +use Seam\Routes\Objects\ActionAttempt; class ActionAttemptTimeoutError extends ActionAttemptError { - public function __construct(ActionAttempt $actionAttempt, float $timeout) - { - parent::__construct( - "Timed out waiting for action attempt after {$timeout}s", - $actionAttempt - ); - $this->name = get_class($this); - } + public function __construct(ActionAttempt $actionAttempt, float $timeout) + { + parent::__construct( + "Timed out waiting for action attempt after {$timeout}s", + $actionAttempt + ); + $this->name = get_class($this); + } } diff --git a/src/Objects/AccessCode.php b/src/Objects/AccessCode.php deleted file mode 100644 index c775e831..00000000 --- a/src/Objects/AccessCode.php +++ /dev/null @@ -1,69 +0,0 @@ -access_code_id, - created_at: $json->created_at, - device_id: $json->device_id, - errors: array_map( - fn($e) => AccessCodeErrors::from_json($e), - $json->errors ?? [] - ), - is_backup_access_code_available: $json->is_backup_access_code_available, - is_external_modification_allowed: $json->is_external_modification_allowed, - is_managed: $json->is_managed, - is_offline_access_code: $json->is_offline_access_code, - is_one_time_use: $json->is_one_time_use, - status: $json->status, - type: $json->type, - warnings: array_map( - fn($w) => AccessCodeWarnings::from_json($w), - $json->warnings ?? [] - ), - is_backup: $json->is_backup ?? null, - is_scheduled_on_device: $json->is_scheduled_on_device ?? null, - is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? - null, - code: $json->code ?? null, - common_code_key: $json->common_code_key ?? null, - name: $json->name ?? null, - ends_at: $json->ends_at ?? null, - pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? - null, - starts_at: $json->starts_at ?? null - ); - } - - public function __construct( - public string $access_code_id, - public string $created_at, - public string $device_id, - public array $errors, - public bool $is_backup_access_code_available, - public bool $is_external_modification_allowed, - public bool $is_managed, - public bool $is_offline_access_code, - public bool $is_one_time_use, - public string $status, - public string $type, - public array $warnings, - public bool|null $is_backup, - public bool|null $is_scheduled_on_device, - public bool|null $is_waiting_for_code_assignment, - public string|null $code, - public string|null $common_code_key, - public string|null $name, - public string|null $ends_at, - public string|null $pulled_backup_access_code_id, - public string|null $starts_at - ) { - } -} diff --git a/src/Objects/AccessCodeErrors.php b/src/Objects/AccessCodeErrors.php deleted file mode 100644 index f267c8fb..00000000 --- a/src/Objects/AccessCodeErrors.php +++ /dev/null @@ -1,32 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_access_code_error: $json->is_access_code_error ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_access_code_error, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) { - } -} diff --git a/src/Objects/AccessCodeWarnings.php b/src/Objects/AccessCodeWarnings.php deleted file mode 100644 index 0def7296..00000000 --- a/src/Objects/AccessCodeWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/AcsAccessGroup.php b/src/Objects/AcsAccessGroup.php deleted file mode 100644 index a3ded15b..00000000 --- a/src/Objects/AcsAccessGroup.php +++ /dev/null @@ -1,46 +0,0 @@ -access_group_type, - access_group_type_display_name: $json->access_group_type_display_name, - acs_access_group_id: $json->acs_access_group_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - is_managed: $json->is_managed, - name: $json->name, - warnings: array_map( - fn($w) => AcsAccessGroupWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id - ); - } - - public function __construct( - public string $access_group_type, - public string $access_group_type_display_name, - public string $acs_access_group_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public string $external_type, - public string $external_type_display_name, - public bool $is_managed, - public string $name, - public array $warnings, - public string $workspace_id - ) { - } -} diff --git a/src/Objects/AcsAccessGroupWarnings.php b/src/Objects/AcsAccessGroupWarnings.php deleted file mode 100644 index 282966ef..00000000 --- a/src/Objects/AcsAccessGroupWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) { - } -} diff --git a/src/Objects/AcsCredential.php b/src/Objects/AcsCredential.php deleted file mode 100644 index 05fdec21..00000000 --- a/src/Objects/AcsCredential.php +++ /dev/null @@ -1,89 +0,0 @@ -access_method, - acs_credential_id: $json->acs_credential_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsCredentialErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => AcsCredentialWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? AcsCredentialAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - ends_at: $json->ends_at ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - is_issued: $json->is_issued ?? null, - is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? - null, - is_one_time_use: $json->is_one_time_use ?? null, - parent_acs_credential_id: $json->parent_acs_credential_id ?? null, - starts_at: $json->starts_at ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? AcsCredentialVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null - ); - } - - public function __construct( - public string $access_method, - public string $acs_credential_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public string|null $acs_credential_pool_id, - public string|null $acs_user_id, - public AcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public string|null $ends_at, - public string|null $external_type, - public string|null $external_type_display_name, - public bool|null $is_issued, - public bool|null $is_multi_phone_sync_credential, - public bool|null $is_one_time_use, - public string|null $parent_acs_credential_id, - public string|null $starts_at, - public AcsCredentialVisionlineMetadata|null $visionline_metadata, - public string|null $card_number, - public string|null $code, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at - ) { - } -} diff --git a/src/Objects/AcsCredentialAssaAbloyVostioMetadata.php b/src/Objects/AcsCredentialAssaAbloyVostioMetadata.php deleted file mode 100644 index 1d0c1ea4..00000000 --- a/src/Objects/AcsCredentialAssaAbloyVostioMetadata.php +++ /dev/null @@ -1,31 +0,0 @@ -door_names ?? null, - endpoint_id: $json->endpoint_id ?? null, - key_id: $json->key_id ?? null, - key_issuing_request_id: $json->key_issuing_request_id ?? null, - override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? - null - ); - } - - public function __construct( - public array|null $door_names, - public string|null $endpoint_id, - public string|null $key_id, - public string|null $key_issuing_request_id, - public array|null $override_guest_acs_entrance_ids - ) { - } -} diff --git a/src/Objects/AcsCredentialErrors.php b/src/Objects/AcsCredentialErrors.php deleted file mode 100644 index b6c34f33..00000000 --- a/src/Objects/AcsCredentialErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/AcsCredentialPool.php b/src/Objects/AcsCredentialPool.php deleted file mode 100644 index 84e790d1..00000000 --- a/src/Objects/AcsCredentialPool.php +++ /dev/null @@ -1,33 +0,0 @@ -acs_credential_pool_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - workspace_id: $json->workspace_id - ); - } - - public function __construct( - public string $acs_credential_pool_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public string $external_type, - public string $external_type_display_name, - public string $workspace_id - ) { - } -} diff --git a/src/Objects/AcsCredentialProvisioningAutomation.php b/src/Objects/AcsCredentialProvisioningAutomation.php deleted file mode 100644 index fc2e775a..00000000 --- a/src/Objects/AcsCredentialProvisioningAutomation.php +++ /dev/null @@ -1,30 +0,0 @@ -acs_credential_provisioning_automation_id, - created_at: $json->created_at, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id - ); - } - - public function __construct( - public string $acs_credential_provisioning_automation_id, - public string $created_at, - public string $credential_manager_acs_system_id, - public string $user_identity_id, - public string $workspace_id - ) { - } -} diff --git a/src/Objects/AcsCredentialVisionlineMetadata.php b/src/Objects/AcsCredentialVisionlineMetadata.php deleted file mode 100644 index f1528dfa..00000000 --- a/src/Objects/AcsCredentialVisionlineMetadata.php +++ /dev/null @@ -1,36 +0,0 @@ -card_function_type, - auto_join: $json->auto_join ?? null, - card_id: $json->card_id ?? null, - common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, - credential_id: $json->credential_id ?? null, - guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, - is_valid: $json->is_valid ?? null, - joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null - ); - } - - public function __construct( - public string $card_function_type, - public bool|null $auto_join, - public string|null $card_id, - public array|null $common_acs_entrance_ids, - public string|null $credential_id, - public array|null $guest_acs_entrance_ids, - public bool|null $is_valid, - public array|null $joiner_acs_credential_ids - ) { - } -} diff --git a/src/Objects/AcsCredentialWarnings.php b/src/Objects/AcsCredentialWarnings.php deleted file mode 100644 index 06049b43..00000000 --- a/src/Objects/AcsCredentialWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) { - } -} diff --git a/src/Objects/AcsEncoder.php b/src/Objects/AcsEncoder.php deleted file mode 100644 index 877a341d..00000000 --- a/src/Objects/AcsEncoder.php +++ /dev/null @@ -1,34 +0,0 @@ -acs_encoder_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsEncoderErrors::from_json($e), - $json->errors ?? [] - ), - workspace_id: $json->workspace_id - ); - } - - public function __construct( - public string $acs_encoder_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public string $workspace_id - ) { - } -} diff --git a/src/Objects/AcsEncoderErrors.php b/src/Objects/AcsEncoderErrors.php deleted file mode 100644 index b7ca1c9c..00000000 --- a/src/Objects/AcsEncoderErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - error_code: $json->error_code, - message: $json->message - ); - } - - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) { - } -} diff --git a/src/Objects/AcsEntrance.php b/src/Objects/AcsEntrance.php deleted file mode 100644 index 4f503faa..00000000 --- a/src/Objects/AcsEntrance.php +++ /dev/null @@ -1,68 +0,0 @@ -acs_entrance_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsEntranceErrors::from_json($e), - $json->errors ?? [] - ), - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? AcsEntranceAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - dormakaba_community_metadata: isset( - $json->dormakaba_community_metadata - ) - ? AcsEntranceDormakabaCommunityMetadata::from_json( - $json->dormakaba_community_metadata - ) - : null, - latch_metadata: isset($json->latch_metadata) - ? AcsEntranceLatchMetadata::from_json($json->latch_metadata) - : null, - salto_ks_metadata: isset($json->salto_ks_metadata) - ? AcsEntranceSaltoKsMetadata::from_json( - $json->salto_ks_metadata - ) - : null, - salto_space_metadata: isset($json->salto_space_metadata) - ? AcsEntranceSaltoSpaceMetadata::from_json( - $json->salto_space_metadata - ) - : null, - visionline_metadata: isset($json->visionline_metadata) - ? AcsEntranceVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null - ); - } - - public function __construct( - public string $acs_entrance_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public AcsEntranceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public AcsEntranceDormakabaCommunityMetadata|null $dormakaba_community_metadata, - public AcsEntranceLatchMetadata|null $latch_metadata, - public AcsEntranceSaltoKsMetadata|null $salto_ks_metadata, - public AcsEntranceSaltoSpaceMetadata|null $salto_space_metadata, - public AcsEntranceVisionlineMetadata|null $visionline_metadata - ) { - } -} diff --git a/src/Objects/AcsEntranceAssaAbloyVostioMetadata.php b/src/Objects/AcsEntranceAssaAbloyVostioMetadata.php deleted file mode 100644 index 83cd51c0..00000000 --- a/src/Objects/AcsEntranceAssaAbloyVostioMetadata.php +++ /dev/null @@ -1,30 +0,0 @@ -door_name, - door_type: $json->door_type, - door_number: $json->door_number ?? null, - pms_id: $json->pms_id ?? null, - stand_open: $json->stand_open ?? null - ); - } - - public function __construct( - public string $door_name, - public string $door_type, - public float|null $door_number, - public string|null $pms_id, - public bool|null $stand_open - ) { - } -} diff --git a/src/Objects/AcsEntranceDormakabaCommunityMetadata.php b/src/Objects/AcsEntranceDormakabaCommunityMetadata.php deleted file mode 100644 index 781b6069..00000000 --- a/src/Objects/AcsEntranceDormakabaCommunityMetadata.php +++ /dev/null @@ -1,19 +0,0 @@ -access_point_name); - } - - public function __construct(public string $access_point_name) - { - } -} diff --git a/src/Objects/AcsEntranceErrors.php b/src/Objects/AcsEntranceErrors.php deleted file mode 100644 index 061673d7..00000000 --- a/src/Objects/AcsEntranceErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/AcsEntranceLatchMetadata.php b/src/Objects/AcsEntranceLatchMetadata.php deleted file mode 100644 index b6562854..00000000 --- a/src/Objects/AcsEntranceLatchMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ -accessibility_type, - door_name: $json->door_name, - door_type: $json->door_type, - is_connected: $json->is_connected - ); - } - - public function __construct( - public string $accessibility_type, - public string $door_name, - public string $door_type, - public bool $is_connected - ) { - } -} diff --git a/src/Objects/AcsEntranceProfiles.php b/src/Objects/AcsEntranceProfiles.php deleted file mode 100644 index c94d9189..00000000 --- a/src/Objects/AcsEntranceProfiles.php +++ /dev/null @@ -1,23 +0,0 @@ -visionline_door_profile_id, - visionline_door_profile_type: $json->visionline_door_profile_type - ); - } - - public function __construct( - public string $visionline_door_profile_id, - public string $visionline_door_profile_type - ) { - } -} diff --git a/src/Objects/AcsEntranceSaltoKsMetadata.php b/src/Objects/AcsEntranceSaltoKsMetadata.php deleted file mode 100644 index 3768c597..00000000 --- a/src/Objects/AcsEntranceSaltoKsMetadata.php +++ /dev/null @@ -1,36 +0,0 @@ -battery_level, - door_name: $json->door_name, - lock_type: $json->lock_type, - locked_state: $json->locked_state, - intrusion_alarm: $json->intrusion_alarm ?? null, - left_open_alarm: $json->left_open_alarm ?? null, - online: $json->online ?? null, - privacy_mode: $json->privacy_mode ?? null - ); - } - - public function __construct( - public string $battery_level, - public string $door_name, - public string $lock_type, - public string $locked_state, - public bool|null $intrusion_alarm, - public bool|null $left_open_alarm, - public bool|null $online, - public bool|null $privacy_mode - ) { - } -} diff --git a/src/Objects/AcsEntranceSaltoSpaceMetadata.php b/src/Objects/AcsEntranceSaltoSpaceMetadata.php deleted file mode 100644 index 3721a41a..00000000 --- a/src/Objects/AcsEntranceSaltoSpaceMetadata.php +++ /dev/null @@ -1,26 +0,0 @@ -door_name, - ext_door_id: $json->ext_door_id, - door_description: $json->door_description ?? null - ); - } - - public function __construct( - public string $door_name, - public string $ext_door_id, - public string|null $door_description - ) { - } -} diff --git a/src/Objects/AcsEntranceVisionlineMetadata.php b/src/Objects/AcsEntranceVisionlineMetadata.php deleted file mode 100644 index eb024d93..00000000 --- a/src/Objects/AcsEntranceVisionlineMetadata.php +++ /dev/null @@ -1,29 +0,0 @@ -door_category, - door_name: $json->door_name, - profiles: array_map( - fn($p) => AcsEntranceProfiles::from_json($p), - $json->profiles ?? [] - ) - ); - } - - public function __construct( - public string $door_category, - public string $door_name, - public array|null $profiles - ) { - } -} diff --git a/src/Objects/AcsSystem.php b/src/Objects/AcsSystem.php deleted file mode 100644 index a874ff1f..00000000 --- a/src/Objects/AcsSystem.php +++ /dev/null @@ -1,78 +0,0 @@ -acs_system_id, - connected_account_id: $json->connected_account_id, - connected_account_ids: $json->connected_account_ids, - created_at: $json->created_at, - errors: array_map( - fn($e) => AcsSystemErrors::from_json($e), - $json->errors ?? [] - ), - image_alt_text: $json->image_alt_text, - image_url: $json->image_url, - is_credential_manager: $json->is_credential_manager, - location: AcsSystemLocation::from_json($json->location), - name: $json->name, - warnings: array_map( - fn($w) => AcsSystemWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - can_add_acs_users_to_acs_access_groups: $json->can_add_acs_users_to_acs_access_groups ?? - null, - can_automate_enrollment: $json->can_automate_enrollment ?? null, - can_create_acs_access_groups: $json->can_create_acs_access_groups ?? - null, - can_remove_acs_users_from_acs_access_groups: $json->can_remove_acs_users_from_acs_access_groups ?? - null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - system_type: $json->system_type ?? null, - system_type_display_name: $json->system_type_display_name ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? AcsSystemVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? - null - ); - } - - public function __construct( - public string $acs_system_id, - public string $connected_account_id, - public array $connected_account_ids, - public string $created_at, - public array $errors, - public string $image_alt_text, - public string $image_url, - public bool $is_credential_manager, - public AcsSystemLocation $location, - public string $name, - public array $warnings, - public string $workspace_id, - public bool|null $can_add_acs_users_to_acs_access_groups, - public bool|null $can_automate_enrollment, - public bool|null $can_create_acs_access_groups, - public bool|null $can_remove_acs_users_from_acs_access_groups, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $system_type, - public string|null $system_type_display_name, - public AcsSystemVisionlineMetadata|null $visionline_metadata, - public string|null $default_credential_manager_acs_system_id - ) { - } -} diff --git a/src/Objects/AcsSystemErrors.php b/src/Objects/AcsSystemErrors.php deleted file mode 100644 index 3f6889b2..00000000 --- a/src/Objects/AcsSystemErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - error_code: $json->error_code, - message: $json->message - ); - } - - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) { - } -} diff --git a/src/Objects/AcsSystemLocation.php b/src/Objects/AcsSystemLocation.php deleted file mode 100644 index 14718092..00000000 --- a/src/Objects/AcsSystemLocation.php +++ /dev/null @@ -1,18 +0,0 @@ -time_zone ?? null); - } - - public function __construct(public string|null $time_zone) - { - } -} diff --git a/src/Objects/AcsSystemVisionlineMetadata.php b/src/Objects/AcsSystemVisionlineMetadata.php deleted file mode 100644 index 91b038d3..00000000 --- a/src/Objects/AcsSystemVisionlineMetadata.php +++ /dev/null @@ -1,26 +0,0 @@ -lan_address, - mobile_access_uuid: $json->mobile_access_uuid, - system_id: $json->system_id - ); - } - - public function __construct( - public string $lan_address, - public string $mobile_access_uuid, - public string $system_id - ) { - } -} diff --git a/src/Objects/AcsSystemWarnings.php b/src/Objects/AcsSystemWarnings.php deleted file mode 100644 index 3fc3ab10..00000000 --- a/src/Objects/AcsSystemWarnings.php +++ /dev/null @@ -1,28 +0,0 @@ -created_at, - message: $json->message, - warning_code: $json->warning_code, - misconfigured_acs_entrance_ids: $json->misconfigured_acs_entrance_ids ?? - null - ); - } - - public function __construct( - public string $created_at, - public string $message, - public string $warning_code, - public array|null $misconfigured_acs_entrance_ids - ) { - } -} diff --git a/src/Objects/AcsUser.php b/src/Objects/AcsUser.php deleted file mode 100644 index 08608dfd..00000000 --- a/src/Objects/AcsUser.php +++ /dev/null @@ -1,78 +0,0 @@ -acs_system_id, - acs_user_id: $json->acs_user_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsUserErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => AcsUserWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - access_schedule: isset($json->access_schedule) - ? AcsUserAccessSchedule::from_json($json->access_schedule) - : null, - email: $json->email ?? null, - email_address: $json->email_address ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - full_name: $json->full_name ?? null, - hid_acs_system_id: $json->hid_acs_system_id ?? null, - is_suspended: $json->is_suspended ?? null, - phone_number: $json->phone_number ?? null, - user_identity_id: $json->user_identity_id ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, - user_identity_email_address: $json->user_identity_email_address ?? - null, - user_identity_full_name: $json->user_identity_full_name ?? null, - user_identity_phone_number: $json->user_identity_phone_number ?? - null - ); - } - - public function __construct( - public string $acs_system_id, - public string $acs_user_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public AcsUserAccessSchedule|null $access_schedule, - public string|null $email, - public string|null $email_address, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $full_name, - public string|null $hid_acs_system_id, - public bool|null $is_suspended, - public string|null $phone_number, - public string|null $user_identity_id, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $latest_desired_state_synced_with_provider_at, - public string|null $user_identity_email_address, - public string|null $user_identity_full_name, - public string|null $user_identity_phone_number - ) { - } -} diff --git a/src/Objects/AcsUserAccessSchedule.php b/src/Objects/AcsUserAccessSchedule.php deleted file mode 100644 index b45c7caa..00000000 --- a/src/Objects/AcsUserAccessSchedule.php +++ /dev/null @@ -1,23 +0,0 @@ -starts_at, - ends_at: $json->ends_at ?? null - ); - } - - public function __construct( - public string $starts_at, - public string|null $ends_at - ) { - } -} diff --git a/src/Objects/AcsUserErrors.php b/src/Objects/AcsUserErrors.php deleted file mode 100644 index 26e463bd..00000000 --- a/src/Objects/AcsUserErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - error_code: $json->error_code, - message: $json->message - ); - } - - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) { - } -} diff --git a/src/Objects/AcsUserWarnings.php b/src/Objects/AcsUserWarnings.php deleted file mode 100644 index ab0425ea..00000000 --- a/src/Objects/AcsUserWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) { - } -} diff --git a/src/Objects/ActionAttempt.php b/src/Objects/ActionAttempt.php deleted file mode 100644 index f7c76a48..00000000 --- a/src/Objects/ActionAttempt.php +++ /dev/null @@ -1,31 +0,0 @@ -action_attempt_id ?? null, - action_type: $json->action_type ?? null, - error: isset($json->error) - ? ActionAttemptError::from_json($json->error) - : null, - status: $json->status ?? null, - result: $json->result ?? null - ); - } - - public function __construct( - public string|null $action_attempt_id, - public string|null $action_type, - public ActionAttemptError|null $error, - public string|null $status, - public mixed $result - ) { - } -} diff --git a/src/Objects/ActionAttemptError.php b/src/Objects/ActionAttemptError.php deleted file mode 100644 index b9c7355b..00000000 --- a/src/Objects/ActionAttemptError.php +++ /dev/null @@ -1,18 +0,0 @@ -message, type: $json->type); - } - - public function __construct(public string $message, public string $type) - { - } -} diff --git a/src/Objects/ClientSession.php b/src/Objects/ClientSession.php deleted file mode 100644 index 6db73623..00000000 --- a/src/Objects/ClientSession.php +++ /dev/null @@ -1,39 +0,0 @@ -client_session_id, - connect_webview_ids: $json->connect_webview_ids, - connected_account_ids: $json->connected_account_ids, - created_at: $json->created_at, - device_count: $json->device_count, - expires_at: $json->expires_at, - token: $json->token, - user_identity_ids: $json->user_identity_ids, - workspace_id: $json->workspace_id, - user_identifier_key: $json->user_identifier_key ?? null - ); - } - - public function __construct( - public string $client_session_id, - public array $connect_webview_ids, - public array $connected_account_ids, - public string $created_at, - public float $device_count, - public string $expires_at, - public string $token, - public array $user_identity_ids, - public string $workspace_id, - public string|null $user_identifier_key - ) { - } -} diff --git a/src/Objects/ConnectWebview.php b/src/Objects/ConnectWebview.php deleted file mode 100644 index 9b9d54d0..00000000 --- a/src/Objects/ConnectWebview.php +++ /dev/null @@ -1,58 +0,0 @@ -accepted_devices, - accepted_providers: $json->accepted_providers, - any_device_allowed: $json->any_device_allowed, - any_provider_allowed: $json->any_provider_allowed, - automatically_manage_new_devices: $json->automatically_manage_new_devices, - connect_webview_id: $json->connect_webview_id, - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_selection_mode: $json->device_selection_mode, - login_successful: $json->login_successful, - status: $json->status, - url: $json->url, - wait_for_device_creation: $json->wait_for_device_creation, - workspace_id: $json->workspace_id, - authorized_at: $json->authorized_at ?? null, - connected_account_id: $json->connected_account_id ?? null, - custom_redirect_failure_url: $json->custom_redirect_failure_url ?? - null, - custom_redirect_url: $json->custom_redirect_url ?? null, - selected_provider: $json->selected_provider ?? null - ); - } - - public function __construct( - public array $accepted_devices, - public array $accepted_providers, - public bool $any_device_allowed, - public bool $any_provider_allowed, - public bool $automatically_manage_new_devices, - public string $connect_webview_id, - public string $created_at, - public mixed $custom_metadata, - public string $device_selection_mode, - public bool $login_successful, - public string $status, - public string $url, - public bool $wait_for_device_creation, - public string $workspace_id, - public string|null $authorized_at, - public string|null $connected_account_id, - public string|null $custom_redirect_failure_url, - public string|null $custom_redirect_url, - public string|null $selected_provider - ) { - } -} diff --git a/src/Objects/ConnectedAccount.php b/src/Objects/ConnectedAccount.php deleted file mode 100644 index d9f6e41f..00000000 --- a/src/Objects/ConnectedAccount.php +++ /dev/null @@ -1,47 +0,0 @@ -account_type_display_name, - automatically_manage_new_devices: $json->automatically_manage_new_devices, - custom_metadata: $json->custom_metadata, - errors: array_map( - fn($e) => ConnectedAccountErrors::from_json($e), - $json->errors ?? [] - ), - warnings: array_map( - fn($w) => ConnectedAccountWarnings::from_json($w), - $json->warnings ?? [] - ), - account_type: $json->account_type ?? null, - connected_account_id: $json->connected_account_id ?? null, - created_at: $json->created_at ?? null, - user_identifier: isset($json->user_identifier) - ? ConnectedAccountUserIdentifier::from_json( - $json->user_identifier - ) - : null - ); - } - - public function __construct( - public string $account_type_display_name, - public bool $automatically_manage_new_devices, - public mixed $custom_metadata, - public array $errors, - public array $warnings, - public string|null $account_type, - public string|null $connected_account_id, - public string|null $created_at, - public ConnectedAccountUserIdentifier|null $user_identifier - ) { - } -} diff --git a/src/Objects/ConnectedAccountErrors.php b/src/Objects/ConnectedAccountErrors.php deleted file mode 100644 index c721eb03..00000000 --- a/src/Objects/ConnectedAccountErrors.php +++ /dev/null @@ -1,27 +0,0 @@ -error_code, - is_connected_account_error: $json->is_connected_account_error, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $error_code, - public bool $is_connected_account_error, - public string $message, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/ConnectedAccountUserIdentifier.php b/src/Objects/ConnectedAccountUserIdentifier.php deleted file mode 100644 index 259f86b8..00000000 --- a/src/Objects/ConnectedAccountUserIdentifier.php +++ /dev/null @@ -1,30 +0,0 @@ -api_url ?? null, - email: $json->email ?? null, - exclusive: $json->exclusive ?? null, - phone: $json->phone ?? null, - username: $json->username ?? null - ); - } - - public function __construct( - public string|null $api_url, - public string|null $email, - public bool|null $exclusive, - public string|null $phone, - public string|null $username - ) { - } -} diff --git a/src/Objects/ConnectedAccountWarnings.php b/src/Objects/ConnectedAccountWarnings.php deleted file mode 100644 index 43e69bd8..00000000 --- a/src/Objects/ConnectedAccountWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/Device.php b/src/Objects/Device.php deleted file mode 100644 index 65621ca5..00000000 --- a/src/Objects/Device.php +++ /dev/null @@ -1,80 +0,0 @@ -capabilities_supported, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_id: $json->device_id, - device_type: $json->device_type, - display_name: $json->display_name, - errors: array_map( - fn($e) => DeviceErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - properties: DeviceProperties::from_json($json->properties), - warnings: array_map( - fn($w) => DeviceWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - 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, - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? - null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? - null, - can_remotely_lock: $json->can_remotely_lock ?? null, - can_remotely_unlock: $json->can_remotely_unlock ?? null, - can_simulate_connection: $json->can_simulate_connection ?? null, - can_simulate_disconnection: $json->can_simulate_disconnection ?? - null, - can_simulate_removal: $json->can_simulate_removal ?? null, - can_turn_off_hvac: $json->can_turn_off_hvac ?? null, - nickname: $json->nickname ?? null, - location: isset($json->location) - ? DeviceLocation::from_json($json->location) - : null - ); - } - - public function __construct( - public array $capabilities_supported, - public string $connected_account_id, - public string $created_at, - public mixed $custom_metadata, - public string $device_id, - public string $device_type, - public string $display_name, - public array $errors, - public bool $is_managed, - public DeviceProperties $properties, - public array $warnings, - public string $workspace_id, - public bool|null $can_hvac_cool, - public bool|null $can_hvac_heat, - public bool|null $can_hvac_heat_cool, - public bool|null $can_program_offline_access_codes, - public bool|null $can_program_online_access_codes, - public bool|null $can_remotely_lock, - public bool|null $can_remotely_unlock, - public bool|null $can_simulate_connection, - public bool|null $can_simulate_disconnection, - public bool|null $can_simulate_removal, - public bool|null $can_turn_off_hvac, - public string|null $nickname, - public DeviceLocation|null $location - ) { - } -} diff --git a/src/Objects/DeviceAccelerometerZ.php b/src/Objects/DeviceAccelerometerZ.php deleted file mode 100644 index 214cb857..00000000 --- a/src/Objects/DeviceAccelerometerZ.php +++ /dev/null @@ -1,18 +0,0 @@ -time, value: $json->value); - } - - public function __construct(public string $time, public float $value) - { - } -} diff --git a/src/Objects/DeviceAccessoryKeypad.php b/src/Objects/DeviceAccessoryKeypad.php deleted file mode 100644 index 7699eead..00000000 --- a/src/Objects/DeviceAccessoryKeypad.php +++ /dev/null @@ -1,25 +0,0 @@ -is_connected, - battery: isset($json->battery) - ? DeviceBattery::from_json($json->battery) - : null - ); - } - - public function __construct( - public bool $is_connected, - public DeviceBattery|null $battery - ) { - } -} diff --git a/src/Objects/DeviceActiveThermostatSchedule.php b/src/Objects/DeviceActiveThermostatSchedule.php deleted file mode 100644 index c50473cf..00000000 --- a/src/Objects/DeviceActiveThermostatSchedule.php +++ /dev/null @@ -1,44 +0,0 @@ -climate_preset_key, - created_at: $json->created_at, - device_id: $json->device_id, - ends_at: $json->ends_at, - errors: array_map( - fn($e) => DeviceErrors::from_json($e), - $json->errors ?? [] - ), - max_override_period_minutes: $json->max_override_period_minutes, - starts_at: $json->starts_at, - thermostat_schedule_id: $json->thermostat_schedule_id, - name: $json->name ?? null, - unstable_is_override_allowed: $json->unstable_is_override_allowed ?? - null - ); - } - - public function __construct( - public string $climate_preset_key, - public string $created_at, - public string $device_id, - public string $ends_at, - public array $errors, - public mixed $max_override_period_minutes, - public string $starts_at, - public string $thermostat_schedule_id, - public string|null $name, - public bool|null $unstable_is_override_allowed - ) { - } -} diff --git a/src/Objects/DeviceAkilesMetadata.php b/src/Objects/DeviceAkilesMetadata.php deleted file mode 100644 index 1bebc970..00000000 --- a/src/Objects/DeviceAkilesMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ -gadget_id, - gadget_name: $json->gadget_name, - product_name: $json->product_name, - _member_group_id: $json->_member_group_id ?? null - ); - } - - public function __construct( - public string $gadget_id, - public string $gadget_name, - public string $product_name, - public string|null $_member_group_id - ) { - } -} diff --git a/src/Objects/DeviceAppearance.php b/src/Objects/DeviceAppearance.php deleted file mode 100644 index 07ecae84..00000000 --- a/src/Objects/DeviceAppearance.php +++ /dev/null @@ -1,18 +0,0 @@ -name); - } - - public function __construct(public string $name) - { - } -} diff --git a/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php b/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php deleted file mode 100644 index e5701b85..00000000 --- a/src/Objects/DeviceAssaAbloyCredentialServiceMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ - DeviceEndpoints::from_json($e), - $json->endpoints ?? [] - ), - has_active_endpoint: $json->has_active_endpoint - ); - } - - public function __construct( - public array $endpoints, - public bool $has_active_endpoint - ) { - } -} diff --git a/src/Objects/DeviceAssaAbloyVostioMetadata.php b/src/Objects/DeviceAssaAbloyVostioMetadata.php deleted file mode 100644 index 93fbb4e5..00000000 --- a/src/Objects/DeviceAssaAbloyVostioMetadata.php +++ /dev/null @@ -1,19 +0,0 @@ -encoder_name); - } - - public function __construct(public string $encoder_name) - { - } -} diff --git a/src/Objects/DeviceAugustMetadata.php b/src/Objects/DeviceAugustMetadata.php deleted file mode 100644 index bfcbe3c1..00000000 --- a/src/Objects/DeviceAugustMetadata.php +++ /dev/null @@ -1,33 +0,0 @@ -has_keypad, - house_name: $json->house_name, - lock_id: $json->lock_id, - lock_name: $json->lock_name, - house_id: $json->house_id ?? null, - keypad_battery_level: $json->keypad_battery_level ?? null, - model: $json->model ?? null - ); - } - - public function __construct( - public bool $has_keypad, - public string $house_name, - public string $lock_id, - public string $lock_name, - public string|null $house_id, - public string|null $keypad_battery_level, - public string|null $model - ) { - } -} diff --git a/src/Objects/DeviceAvailableClimatePresets.php b/src/Objects/DeviceAvailableClimatePresets.php deleted file mode 100644 index 3d35be69..00000000 --- a/src/Objects/DeviceAvailableClimatePresets.php +++ /dev/null @@ -1,46 +0,0 @@ -can_delete, - can_edit: $json->can_edit, - climate_preset_key: $json->climate_preset_key, - display_name: $json->display_name, - manual_override_allowed: $json->manual_override_allowed, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - name: $json->name ?? null - ); - } - - public function __construct( - public bool $can_delete, - public bool $can_edit, - public string $climate_preset_key, - public string $display_name, - public bool $manual_override_allowed, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public string|null $name - ) { - } -} diff --git a/src/Objects/DeviceAvigilonAltaMetadata.php b/src/Objects/DeviceAvigilonAltaMetadata.php deleted file mode 100644 index 83a9e59d..00000000 --- a/src/Objects/DeviceAvigilonAltaMetadata.php +++ /dev/null @@ -1,34 +0,0 @@ -entry_name, - entry_relays_total_count: $json->entry_relays_total_count, - org_name: $json->org_name, - site_id: $json->site_id, - site_name: $json->site_name, - zone_id: $json->zone_id, - zone_name: $json->zone_name - ); - } - - public function __construct( - public string $entry_name, - public float $entry_relays_total_count, - public string $org_name, - public float $site_id, - public string $site_name, - public float $zone_id, - public string $zone_name - ) { - } -} diff --git a/src/Objects/DeviceBattery.php b/src/Objects/DeviceBattery.php deleted file mode 100644 index ad416670..00000000 --- a/src/Objects/DeviceBattery.php +++ /dev/null @@ -1,18 +0,0 @@ -level); - } - - public function __construct(public float $level) - { - } -} diff --git a/src/Objects/DeviceBrivoMetadata.php b/src/Objects/DeviceBrivoMetadata.php deleted file mode 100644 index 9119d8b2..00000000 --- a/src/Objects/DeviceBrivoMetadata.php +++ /dev/null @@ -1,18 +0,0 @@ -device_name); - } - - public function __construct(public string $device_name) - { - } -} diff --git a/src/Objects/DeviceCodeConstraints.php b/src/Objects/DeviceCodeConstraints.php deleted file mode 100644 index cc582a0c..00000000 --- a/src/Objects/DeviceCodeConstraints.php +++ /dev/null @@ -1,25 +0,0 @@ -constraint_type, - max_length: $json->max_length ?? null, - min_length: $json->min_length ?? null - ); - } - - public function __construct( - public string $constraint_type, - public float|null $max_length, - public float|null $min_length - ) { - } -} diff --git a/src/Objects/DeviceControlbywebMetadata.php b/src/Objects/DeviceControlbywebMetadata.php deleted file mode 100644 index 1d4ee88c..00000000 --- a/src/Objects/DeviceControlbywebMetadata.php +++ /dev/null @@ -1,26 +0,0 @@ -device_id, - device_name: $json->device_name, - relay_name: $json->relay_name ?? null - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public string|null $relay_name - ) { - } -} diff --git a/src/Objects/DeviceCurrentClimateSetting.php b/src/Objects/DeviceCurrentClimateSetting.php deleted file mode 100644 index 532f7dbc..00000000 --- a/src/Objects/DeviceCurrentClimateSetting.php +++ /dev/null @@ -1,46 +0,0 @@ -can_delete ?? null, - can_edit: $json->can_edit ?? null, - climate_preset_key: $json->climate_preset_key ?? null, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - display_name: $json->display_name ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - manual_override_allowed: $json->manual_override_allowed ?? null, - name: $json->name ?? null - ); - } - - public function __construct( - public bool|null $can_delete, - public bool|null $can_edit, - public string|null $climate_preset_key, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $display_name, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public bool|null $manual_override_allowed, - public string|null $name - ) { - } -} diff --git a/src/Objects/DeviceDefaultClimateSetting.php b/src/Objects/DeviceDefaultClimateSetting.php deleted file mode 100644 index b5198bff..00000000 --- a/src/Objects/DeviceDefaultClimateSetting.php +++ /dev/null @@ -1,46 +0,0 @@ -can_delete ?? null, - can_edit: $json->can_edit ?? null, - climate_preset_key: $json->climate_preset_key ?? null, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - display_name: $json->display_name ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - manual_override_allowed: $json->manual_override_allowed ?? null, - name: $json->name ?? null - ); - } - - public function __construct( - public bool|null $can_delete, - public bool|null $can_edit, - public string|null $climate_preset_key, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $display_name, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public bool|null $manual_override_allowed, - public string|null $name - ) { - } -} diff --git a/src/Objects/DeviceDormakabaOracodeMetadata.php b/src/Objects/DeviceDormakabaOracodeMetadata.php deleted file mode 100644 index 9c5304ba..00000000 --- a/src/Objects/DeviceDormakabaOracodeMetadata.php +++ /dev/null @@ -1,39 +0,0 @@ -door_is_wireless, - door_name: $json->door_name, - site_name: $json->site_name, - device_id: $json->device_id ?? null, - door_id: $json->door_id ?? null, - iana_timezone: $json->iana_timezone ?? null, - predefined_time_slots: array_map( - fn($p) => DevicePredefinedTimeSlots::from_json($p), - $json->predefined_time_slots ?? [] - ), - site_id: $json->site_id ?? null - ); - } - - public function __construct( - public bool $door_is_wireless, - public string $door_name, - public string $site_name, - public float|null $device_id, - public float|null $door_id, - public string|null $iana_timezone, - public array|null $predefined_time_slots, - public float|null $site_id - ) { - } -} diff --git a/src/Objects/DeviceEcobeeMetadata.php b/src/Objects/DeviceEcobeeMetadata.php deleted file mode 100644 index 304c50c6..00000000 --- a/src/Objects/DeviceEcobeeMetadata.php +++ /dev/null @@ -1,23 +0,0 @@ -device_name, - ecobee_device_id: $json->ecobee_device_id - ); - } - - public function __construct( - public string $device_name, - public string $ecobee_device_id - ) { - } -} diff --git a/src/Objects/DeviceEndpoints.php b/src/Objects/DeviceEndpoints.php deleted file mode 100644 index 2b2b6ea3..00000000 --- a/src/Objects/DeviceEndpoints.php +++ /dev/null @@ -1,23 +0,0 @@ -endpoint_id, - is_active: $json->is_active - ); - } - - public function __construct( - public string $endpoint_id, - public bool $is_active - ) { - } -} diff --git a/src/Objects/DeviceErrors.php b/src/Objects/DeviceErrors.php deleted file mode 100644 index ecd009fa..00000000 --- a/src/Objects/DeviceErrors.php +++ /dev/null @@ -1,30 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) { - } -} diff --git a/src/Objects/DeviceFeatures.php b/src/Objects/DeviceFeatures.php deleted file mode 100644 index b4c81580..00000000 --- a/src/Objects/DeviceFeatures.php +++ /dev/null @@ -1,29 +0,0 @@ -incomplete_keyboard_passcode, - lock_command: $json->lock_command, - passcode: $json->passcode, - passcode_management: $json->passcode_management, - unlock_via_gateway: $json->unlock_via_gateway - ); - } - - public function __construct( - public bool $incomplete_keyboard_passcode, - public bool $lock_command, - public bool $passcode, - public bool $passcode_management, - public bool $unlock_via_gateway - ) { - } -} diff --git a/src/Objects/DeviceFourSuitesMetadata.php b/src/Objects/DeviceFourSuitesMetadata.php deleted file mode 100644 index 6ff46954..00000000 --- a/src/Objects/DeviceFourSuitesMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -device_id, - device_name: $json->device_name, - reclose_delay_in_seconds: $json->reclose_delay_in_seconds - ); - } - - public function __construct( - public float $device_id, - public string $device_name, - public float $reclose_delay_in_seconds - ) { - } -} diff --git a/src/Objects/DeviceGenieMetadata.php b/src/Objects/DeviceGenieMetadata.php deleted file mode 100644 index 0332ea08..00000000 --- a/src/Objects/DeviceGenieMetadata.php +++ /dev/null @@ -1,23 +0,0 @@ -device_name, - door_name: $json->door_name - ); - } - - public function __construct( - public string $device_name, - public string $door_name - ) { - } -} diff --git a/src/Objects/DeviceHoneywellResideoMetadata.php b/src/Objects/DeviceHoneywellResideoMetadata.php deleted file mode 100644 index ff1372dc..00000000 --- a/src/Objects/DeviceHoneywellResideoMetadata.php +++ /dev/null @@ -1,24 +0,0 @@ -device_name, - honeywell_resideo_device_id: $json->honeywell_resideo_device_id - ); - } - - public function __construct( - public string $device_name, - public string $honeywell_resideo_device_id - ) { - } -} diff --git a/src/Objects/DeviceHubitatMetadata.php b/src/Objects/DeviceHubitatMetadata.php deleted file mode 100644 index 30f4c71a..00000000 --- a/src/Objects/DeviceHubitatMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -device_id, - device_label: $json->device_label, - device_name: $json->device_name - ); - } - - public function __construct( - public string $device_id, - public string $device_label, - public string $device_name - ) { - } -} diff --git a/src/Objects/DeviceHumidity.php b/src/Objects/DeviceHumidity.php deleted file mode 100644 index c9019d1f..00000000 --- a/src/Objects/DeviceHumidity.php +++ /dev/null @@ -1,18 +0,0 @@ -time, value: $json->value); - } - - public function __construct(public string $time, public float $value) - { - } -} diff --git a/src/Objects/DeviceIglooMetadata.php b/src/Objects/DeviceIglooMetadata.php deleted file mode 100644 index d6abbde6..00000000 --- a/src/Objects/DeviceIglooMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -bridge_id, - device_id: $json->device_id, - model: $json->model ?? null - ); - } - - public function __construct( - public string $bridge_id, - public string $device_id, - public string|null $model - ) { - } -} diff --git a/src/Objects/DeviceIgloohomeMetadata.php b/src/Objects/DeviceIgloohomeMetadata.php deleted file mode 100644 index de29bb29..00000000 --- a/src/Objects/DeviceIgloohomeMetadata.php +++ /dev/null @@ -1,29 +0,0 @@ -device_id, - device_name: $json->device_name, - bridge_id: $json->bridge_id ?? null, - bridge_name: $json->bridge_name ?? null, - keypad_id: $json->keypad_id ?? null - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public string|null $bridge_id, - public string|null $bridge_name, - public string|null $keypad_id - ) { - } -} diff --git a/src/Objects/DeviceKeypadBattery.php b/src/Objects/DeviceKeypadBattery.php deleted file mode 100644 index 785a3e21..00000000 --- a/src/Objects/DeviceKeypadBattery.php +++ /dev/null @@ -1,18 +0,0 @@ -level); - } - - public function __construct(public float $level) - { - } -} diff --git a/src/Objects/DeviceKwiksetMetadata.php b/src/Objects/DeviceKwiksetMetadata.php deleted file mode 100644 index 013ac794..00000000 --- a/src/Objects/DeviceKwiksetMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -device_id, - device_name: $json->device_name, - model_number: $json->model_number - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public string $model_number - ) { - } -} diff --git a/src/Objects/DeviceLatestSensorValues.php b/src/Objects/DeviceLatestSensorValues.php deleted file mode 100644 index df59f48c..00000000 --- a/src/Objects/DeviceLatestSensorValues.php +++ /dev/null @@ -1,31 +0,0 @@ -accelerometer_z - ), - humidity: DeviceHumidity::from_json($json->humidity), - pressure: DevicePressure::from_json($json->pressure), - sound: DeviceSound::from_json($json->sound), - temperature: DeviceTemperature::from_json($json->temperature) - ); - } - - public function __construct( - public DeviceAccelerometerZ $accelerometer_z, - public DeviceHumidity $humidity, - public DevicePressure $pressure, - public DeviceSound $sound, - public DeviceTemperature $temperature - ) { - } -} diff --git a/src/Objects/DeviceLocation.php b/src/Objects/DeviceLocation.php deleted file mode 100644 index db99399f..00000000 --- a/src/Objects/DeviceLocation.php +++ /dev/null @@ -1,23 +0,0 @@ -location_name ?? null, - timezone: $json->timezone ?? null - ); - } - - public function __construct( - public string|null $location_name, - public string|null $timezone - ) { - } -} diff --git a/src/Objects/DeviceLocklyMetadata.php b/src/Objects/DeviceLocklyMetadata.php deleted file mode 100644 index 0228d348..00000000 --- a/src/Objects/DeviceLocklyMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -device_id, - device_name: $json->device_name, - model: $json->model ?? null - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public string|null $model - ) { - } -} diff --git a/src/Objects/DeviceMinutMetadata.php b/src/Objects/DeviceMinutMetadata.php deleted file mode 100644 index 3727f84f..00000000 --- a/src/Objects/DeviceMinutMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ -device_id, - device_name: $json->device_name, - latest_sensor_values: DeviceLatestSensorValues::from_json( - $json->latest_sensor_values - ) - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public DeviceLatestSensorValues $latest_sensor_values - ) { - } -} diff --git a/src/Objects/DeviceModel.php b/src/Objects/DeviceModel.php deleted file mode 100644 index c84d9895..00000000 --- a/src/Objects/DeviceModel.php +++ /dev/null @@ -1,37 +0,0 @@ -display_name, - manufacturer_display_name: $json->manufacturer_display_name, - accessory_keypad_supported: $json->accessory_keypad_supported ?? - null, - can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? - null, - has_built_in_keypad: $json->has_built_in_keypad ?? null, - offline_access_codes_supported: $json->offline_access_codes_supported ?? - null, - online_access_codes_supported: $json->online_access_codes_supported ?? - null - ); - } - - public function __construct( - public string $display_name, - public string $manufacturer_display_name, - public bool|null $accessory_keypad_supported, - public bool|null $can_connect_accessory_keypad, - public bool|null $has_built_in_keypad, - public bool|null $offline_access_codes_supported, - public bool|null $online_access_codes_supported - ) { - } -} diff --git a/src/Objects/DeviceNestMetadata.php b/src/Objects/DeviceNestMetadata.php deleted file mode 100644 index d63dd5d6..00000000 --- a/src/Objects/DeviceNestMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ -device_custom_name, - device_name: $json->device_name, - nest_device_id: $json->nest_device_id, - display_name: $json->display_name ?? null - ); - } - - public function __construct( - public string $device_custom_name, - public string $device_name, - public string $nest_device_id, - public string|null $display_name - ) { - } -} diff --git a/src/Objects/DeviceNoiseawareMetadata.php b/src/Objects/DeviceNoiseawareMetadata.php deleted file mode 100644 index 46d11774..00000000 --- a/src/Objects/DeviceNoiseawareMetadata.php +++ /dev/null @@ -1,29 +0,0 @@ -device_id, - device_model: $json->device_model, - device_name: $json->device_name, - noise_level_decibel: $json->noise_level_decibel, - noise_level_nrs: $json->noise_level_nrs - ); - } - - public function __construct( - public string $device_id, - public string $device_model, - public string $device_name, - public float $noise_level_decibel, - public float $noise_level_nrs - ) { - } -} diff --git a/src/Objects/DeviceNukiMetadata.php b/src/Objects/DeviceNukiMetadata.php deleted file mode 100644 index 3d32229a..00000000 --- a/src/Objects/DeviceNukiMetadata.php +++ /dev/null @@ -1,29 +0,0 @@ -device_id, - device_name: $json->device_name, - keypad_2_paired: $json->keypad_2_paired ?? null, - keypad_battery_critical: $json->keypad_battery_critical ?? null, - keypad_paired: $json->keypad_paired ?? null - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public bool|null $keypad_2_paired, - public bool|null $keypad_battery_critical, - public bool|null $keypad_paired - ) { - } -} diff --git a/src/Objects/DevicePredefinedTimeSlots.php b/src/Objects/DevicePredefinedTimeSlots.php deleted file mode 100644 index 12656443..00000000 --- a/src/Objects/DevicePredefinedTimeSlots.php +++ /dev/null @@ -1,40 +0,0 @@ -check_in_time, - check_out_time: $json->check_out_time, - dormakaba_oracode_user_level_id: $json->dormakaba_oracode_user_level_id, - ext_dormakaba_oracode_user_level_prefix: $json->ext_dormakaba_oracode_user_level_prefix, - is_24_hour: $json->is_24_hour, - is_biweekly_mode: $json->is_biweekly_mode, - is_master: $json->is_master, - is_one_shot: $json->is_one_shot, - name: $json->name, - prefix: $json->prefix - ); - } - - public function __construct( - public string $check_in_time, - public string $check_out_time, - public string $dormakaba_oracode_user_level_id, - public float $ext_dormakaba_oracode_user_level_prefix, - public bool $is_24_hour, - public bool $is_biweekly_mode, - public bool $is_master, - public bool $is_one_shot, - public string $name, - public float $prefix - ) { - } -} diff --git a/src/Objects/DevicePressure.php b/src/Objects/DevicePressure.php deleted file mode 100644 index e56458ac..00000000 --- a/src/Objects/DevicePressure.php +++ /dev/null @@ -1,18 +0,0 @@ -time, value: $json->value); - } - - public function __construct(public string $time, public float $value) - { - } -} diff --git a/src/Objects/DeviceProperties.php b/src/Objects/DeviceProperties.php deleted file mode 100644 index 9a32e4e3..00000000 --- a/src/Objects/DeviceProperties.php +++ /dev/null @@ -1,334 +0,0 @@ -appearance), - model: DeviceModel::from_json($json->model), - name: $json->name, - online: $json->online, - _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? - null, - accessory_keypad: isset($json->accessory_keypad) - ? DeviceAccessoryKeypad::from_json($json->accessory_keypad) - : null, - active_thermostat_schedule: isset($json->active_thermostat_schedule) - ? DeviceActiveThermostatSchedule::from_json( - $json->active_thermostat_schedule - ) - : null, - akiles_metadata: isset($json->akiles_metadata) - ? DeviceAkilesMetadata::from_json($json->akiles_metadata) - : null, - assa_abloy_credential_service_metadata: isset( - $json->assa_abloy_credential_service_metadata - ) - ? DeviceAssaAbloyCredentialServiceMetadata::from_json( - $json->assa_abloy_credential_service_metadata - ) - : null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? DeviceAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - august_metadata: isset($json->august_metadata) - ? DeviceAugustMetadata::from_json($json->august_metadata) - : null, - available_climate_presets: array_map( - fn($a) => DeviceAvailableClimatePresets::from_json($a), - $json->available_climate_presets ?? [] - ), - available_fan_mode_settings: $json->available_fan_mode_settings ?? - null, - available_hvac_mode_settings: $json->available_hvac_mode_settings ?? - null, - avigilon_alta_metadata: isset($json->avigilon_alta_metadata) - ? DeviceAvigilonAltaMetadata::from_json( - $json->avigilon_alta_metadata - ) - : null, - battery: isset($json->battery) - ? DeviceBattery::from_json($json->battery) - : null, - battery_level: $json->battery_level ?? null, - brivo_metadata: isset($json->brivo_metadata) - ? DeviceBrivoMetadata::from_json($json->brivo_metadata) - : null, - code_constraints: array_map( - fn($c) => DeviceCodeConstraints::from_json($c), - $json->code_constraints ?? [] - ), - controlbyweb_metadata: isset($json->controlbyweb_metadata) - ? DeviceControlbywebMetadata::from_json( - $json->controlbyweb_metadata - ) - : null, - current_climate_setting: isset($json->current_climate_setting) - ? DeviceCurrentClimateSetting::from_json( - $json->current_climate_setting - ) - : null, - currently_triggering_noise_threshold_ids: $json->currently_triggering_noise_threshold_ids ?? - null, - default_climate_setting: isset($json->default_climate_setting) - ? DeviceDefaultClimateSetting::from_json( - $json->default_climate_setting - ) - : null, - door_open: $json->door_open ?? null, - dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) - ? DeviceDormakabaOracodeMetadata::from_json( - $json->dormakaba_oracode_metadata - ) - : null, - ecobee_metadata: isset($json->ecobee_metadata) - ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) - : null, - fan_mode_setting: $json->fan_mode_setting ?? null, - four_suites_metadata: isset($json->four_suites_metadata) - ? DeviceFourSuitesMetadata::from_json( - $json->four_suites_metadata - ) - : null, - genie_metadata: isset($json->genie_metadata) - ? DeviceGenieMetadata::from_json($json->genie_metadata) - : null, - has_direct_power: $json->has_direct_power ?? null, - has_native_entry_events: $json->has_native_entry_events ?? null, - honeywell_resideo_metadata: isset($json->honeywell_resideo_metadata) - ? DeviceHoneywellResideoMetadata::from_json( - $json->honeywell_resideo_metadata - ) - : null, - hubitat_metadata: isset($json->hubitat_metadata) - ? DeviceHubitatMetadata::from_json($json->hubitat_metadata) - : null, - igloo_metadata: isset($json->igloo_metadata) - ? DeviceIglooMetadata::from_json($json->igloo_metadata) - : null, - igloohome_metadata: isset($json->igloohome_metadata) - ? DeviceIgloohomeMetadata::from_json($json->igloohome_metadata) - : null, - image_alt_text: $json->image_alt_text ?? null, - image_url: $json->image_url ?? null, - is_cooling: $json->is_cooling ?? null, - is_fan_running: $json->is_fan_running ?? null, - is_heating: $json->is_heating ?? null, - is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? - null, - keypad_battery: isset($json->keypad_battery) - ? DeviceKeypadBattery::from_json($json->keypad_battery) - : null, - kwikset_metadata: isset($json->kwikset_metadata) - ? DeviceKwiksetMetadata::from_json($json->kwikset_metadata) - : null, - locked: $json->locked ?? null, - lockly_metadata: isset($json->lockly_metadata) - ? DeviceLocklyMetadata::from_json($json->lockly_metadata) - : null, - manufacturer: $json->manufacturer ?? null, - max_active_codes_supported: $json->max_active_codes_supported ?? - null, - max_cooling_set_point_celsius: $json->max_cooling_set_point_celsius ?? - null, - max_cooling_set_point_fahrenheit: $json->max_cooling_set_point_fahrenheit ?? - null, - max_heating_set_point_celsius: $json->max_heating_set_point_celsius ?? - null, - max_heating_set_point_fahrenheit: $json->max_heating_set_point_fahrenheit ?? - null, - min_cooling_set_point_celsius: $json->min_cooling_set_point_celsius ?? - null, - min_cooling_set_point_fahrenheit: $json->min_cooling_set_point_fahrenheit ?? - null, - min_heating_cooling_delta_celsius: $json->min_heating_cooling_delta_celsius ?? - null, - min_heating_cooling_delta_fahrenheit: $json->min_heating_cooling_delta_fahrenheit ?? - null, - min_heating_set_point_celsius: $json->min_heating_set_point_celsius ?? - null, - min_heating_set_point_fahrenheit: $json->min_heating_set_point_fahrenheit ?? - null, - minut_metadata: isset($json->minut_metadata) - ? DeviceMinutMetadata::from_json($json->minut_metadata) - : null, - nest_metadata: isset($json->nest_metadata) - ? DeviceNestMetadata::from_json($json->nest_metadata) - : null, - noise_level_decibels: $json->noise_level_decibels ?? null, - noiseaware_metadata: isset($json->noiseaware_metadata) - ? DeviceNoiseawareMetadata::from_json( - $json->noiseaware_metadata - ) - : null, - nuki_metadata: isset($json->nuki_metadata) - ? DeviceNukiMetadata::from_json($json->nuki_metadata) - : null, - offline_access_codes_enabled: $json->offline_access_codes_enabled ?? - null, - online_access_codes_enabled: $json->online_access_codes_enabled ?? - null, - relative_humidity: $json->relative_humidity ?? null, - salto_ks_metadata: isset($json->salto_ks_metadata) - ? DeviceSaltoKsMetadata::from_json($json->salto_ks_metadata) - : null, - salto_metadata: isset($json->salto_metadata) - ? DeviceSaltoMetadata::from_json($json->salto_metadata) - : null, - salto_space_credential_service_metadata: isset( - $json->salto_space_credential_service_metadata - ) - ? DeviceSaltoSpaceCredentialServiceMetadata::from_json( - $json->salto_space_credential_service_metadata - ) - : null, - schlage_metadata: isset($json->schlage_metadata) - ? DeviceSchlageMetadata::from_json($json->schlage_metadata) - : null, - seam_bridge_metadata: isset($json->seam_bridge_metadata) - ? DeviceSeamBridgeMetadata::from_json( - $json->seam_bridge_metadata - ) - : null, - serial_number: $json->serial_number ?? null, - smartthings_metadata: isset($json->smartthings_metadata) - ? DeviceSmartthingsMetadata::from_json( - $json->smartthings_metadata - ) - : null, - supported_code_lengths: $json->supported_code_lengths ?? null, - supports_accessory_keypad: $json->supports_accessory_keypad ?? null, - supports_backup_access_code_pool: $json->supports_backup_access_code_pool ?? - null, - supports_offline_access_codes: $json->supports_offline_access_codes ?? - null, - tado_metadata: isset($json->tado_metadata) - ? DeviceTadoMetadata::from_json($json->tado_metadata) - : null, - tedee_metadata: isset($json->tedee_metadata) - ? DeviceTedeeMetadata::from_json($json->tedee_metadata) - : null, - temperature_celsius: $json->temperature_celsius ?? null, - temperature_fahrenheit: $json->temperature_fahrenheit ?? null, - temperature_threshold: isset($json->temperature_threshold) - ? DeviceTemperatureThreshold::from_json( - $json->temperature_threshold - ) - : null, - ttlock_metadata: isset($json->ttlock_metadata) - ? DeviceTtlockMetadata::from_json($json->ttlock_metadata) - : null, - two_n_metadata: isset($json->two_n_metadata) - ? DeviceTwoNMetadata::from_json($json->two_n_metadata) - : null, - visionline_metadata: isset($json->visionline_metadata) - ? DeviceVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - wyze_metadata: isset($json->wyze_metadata) - ? DeviceWyzeMetadata::from_json($json->wyze_metadata) - : null, - fallback_climate_preset_key: $json->fallback_climate_preset_key ?? - null - ); - } - - public function __construct( - public DeviceAppearance $appearance, - public DeviceModel $model, - public string $name, - public bool $online, - public array|null $_experimental_supported_code_from_access_codes_lengths, - public DeviceAccessoryKeypad|null $accessory_keypad, - public DeviceActiveThermostatSchedule|null $active_thermostat_schedule, - public DeviceAkilesMetadata|null $akiles_metadata, - public DeviceAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, - public DeviceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public DeviceAugustMetadata|null $august_metadata, - public array|null $available_climate_presets, - public array|null $available_fan_mode_settings, - public array|null $available_hvac_mode_settings, - public DeviceAvigilonAltaMetadata|null $avigilon_alta_metadata, - public DeviceBattery|null $battery, - public float|null $battery_level, - public DeviceBrivoMetadata|null $brivo_metadata, - public array|null $code_constraints, - public DeviceControlbywebMetadata|null $controlbyweb_metadata, - public DeviceCurrentClimateSetting|null $current_climate_setting, - public array|null $currently_triggering_noise_threshold_ids, - public DeviceDefaultClimateSetting|null $default_climate_setting, - public bool|null $door_open, - public DeviceDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, - public DeviceEcobeeMetadata|null $ecobee_metadata, - public string|null $fan_mode_setting, - public DeviceFourSuitesMetadata|null $four_suites_metadata, - public DeviceGenieMetadata|null $genie_metadata, - public bool|null $has_direct_power, - public bool|null $has_native_entry_events, - public DeviceHoneywellResideoMetadata|null $honeywell_resideo_metadata, - public DeviceHubitatMetadata|null $hubitat_metadata, - public DeviceIglooMetadata|null $igloo_metadata, - public DeviceIgloohomeMetadata|null $igloohome_metadata, - public string|null $image_alt_text, - public string|null $image_url, - public bool|null $is_cooling, - public bool|null $is_fan_running, - public bool|null $is_heating, - public bool|null $is_temporary_manual_override_active, - public DeviceKeypadBattery|null $keypad_battery, - public DeviceKwiksetMetadata|null $kwikset_metadata, - public bool|null $locked, - public DeviceLocklyMetadata|null $lockly_metadata, - public string|null $manufacturer, - public float|null $max_active_codes_supported, - public float|null $max_cooling_set_point_celsius, - public float|null $max_cooling_set_point_fahrenheit, - public float|null $max_heating_set_point_celsius, - public float|null $max_heating_set_point_fahrenheit, - public float|null $min_cooling_set_point_celsius, - public float|null $min_cooling_set_point_fahrenheit, - public float|null $min_heating_cooling_delta_celsius, - public float|null $min_heating_cooling_delta_fahrenheit, - public float|null $min_heating_set_point_celsius, - public float|null $min_heating_set_point_fahrenheit, - public DeviceMinutMetadata|null $minut_metadata, - public DeviceNestMetadata|null $nest_metadata, - public float|null $noise_level_decibels, - public DeviceNoiseawareMetadata|null $noiseaware_metadata, - public DeviceNukiMetadata|null $nuki_metadata, - public bool|null $offline_access_codes_enabled, - public bool|null $online_access_codes_enabled, - public float|null $relative_humidity, - public DeviceSaltoKsMetadata|null $salto_ks_metadata, - public DeviceSaltoMetadata|null $salto_metadata, - public DeviceSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata, - public DeviceSchlageMetadata|null $schlage_metadata, - public DeviceSeamBridgeMetadata|null $seam_bridge_metadata, - public string|null $serial_number, - public DeviceSmartthingsMetadata|null $smartthings_metadata, - public array|null $supported_code_lengths, - public bool|null $supports_accessory_keypad, - public bool|null $supports_backup_access_code_pool, - public bool|null $supports_offline_access_codes, - public DeviceTadoMetadata|null $tado_metadata, - public DeviceTedeeMetadata|null $tedee_metadata, - public float|null $temperature_celsius, - public float|null $temperature_fahrenheit, - public DeviceTemperatureThreshold|null $temperature_threshold, - public DeviceTtlockMetadata|null $ttlock_metadata, - public DeviceTwoNMetadata|null $two_n_metadata, - public DeviceVisionlineMetadata|null $visionline_metadata, - public DeviceWyzeMetadata|null $wyze_metadata, - public string|null $fallback_climate_preset_key - ) { - } -} diff --git a/src/Objects/DeviceProvider.php b/src/Objects/DeviceProvider.php deleted file mode 100644 index 79686476..00000000 --- a/src/Objects/DeviceProvider.php +++ /dev/null @@ -1,52 +0,0 @@ -device_provider_name, - display_name: $json->display_name, - image_url: $json->image_url, - provider_categories: $json->provider_categories, - 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, - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? - null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? - null, - can_remotely_lock: $json->can_remotely_lock ?? null, - can_remotely_unlock: $json->can_remotely_unlock ?? null, - can_simulate_connection: $json->can_simulate_connection ?? null, - can_simulate_disconnection: $json->can_simulate_disconnection ?? - null, - can_simulate_removal: $json->can_simulate_removal ?? null, - can_turn_off_hvac: $json->can_turn_off_hvac ?? null - ); - } - - public function __construct( - public string $device_provider_name, - public string $display_name, - public string $image_url, - public array $provider_categories, - public bool|null $can_hvac_cool, - public bool|null $can_hvac_heat, - public bool|null $can_hvac_heat_cool, - public bool|null $can_program_offline_access_codes, - public bool|null $can_program_online_access_codes, - public bool|null $can_remotely_lock, - public bool|null $can_remotely_unlock, - public bool|null $can_simulate_connection, - public bool|null $can_simulate_disconnection, - public bool|null $can_simulate_removal, - public bool|null $can_turn_off_hvac - ) { - } -} diff --git a/src/Objects/DeviceSaltoKsMetadata.php b/src/Objects/DeviceSaltoKsMetadata.php deleted file mode 100644 index 55767b1b..00000000 --- a/src/Objects/DeviceSaltoKsMetadata.php +++ /dev/null @@ -1,31 +0,0 @@ -battery_level, - customer_reference: $json->customer_reference, - lock_id: $json->lock_id, - lock_type: $json->lock_type, - locked_state: $json->locked_state, - model: $json->model ?? null - ); - } - - public function __construct( - public string $battery_level, - public string $customer_reference, - public string $lock_id, - public string $lock_type, - public string $locked_state, - public string|null $model - ) { - } -} diff --git a/src/Objects/DeviceSaltoMetadata.php b/src/Objects/DeviceSaltoMetadata.php deleted file mode 100644 index 047845aa..00000000 --- a/src/Objects/DeviceSaltoMetadata.php +++ /dev/null @@ -1,31 +0,0 @@ -battery_level, - customer_reference: $json->customer_reference, - lock_id: $json->lock_id, - lock_type: $json->lock_type, - locked_state: $json->locked_state, - model: $json->model ?? null - ); - } - - public function __construct( - public string $battery_level, - public string $customer_reference, - public string $lock_id, - public string $lock_type, - public string $locked_state, - public string|null $model - ) { - } -} diff --git a/src/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php b/src/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php deleted file mode 100644 index 514beaef..00000000 --- a/src/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php +++ /dev/null @@ -1,19 +0,0 @@ -has_active_phone); - } - - public function __construct(public bool $has_active_phone) - { - } -} diff --git a/src/Objects/DeviceSchlageMetadata.php b/src/Objects/DeviceSchlageMetadata.php deleted file mode 100644 index a9948bc4..00000000 --- a/src/Objects/DeviceSchlageMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ -device_id, - device_name: $json->device_name, - model: $json->model ?? null, - access_code_length: $json->access_code_length ?? null - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public string|null $model, - public float|null $access_code_length - ) { - } -} diff --git a/src/Objects/DeviceSeamBridgeMetadata.php b/src/Objects/DeviceSeamBridgeMetadata.php deleted file mode 100644 index 18d016ae..00000000 --- a/src/Objects/DeviceSeamBridgeMetadata.php +++ /dev/null @@ -1,25 +0,0 @@ -device_num, - name: $json->name, - unlock_method: $json->unlock_method ?? null - ); - } - - public function __construct( - public float $device_num, - public string $name, - public string|null $unlock_method - ) { - } -} diff --git a/src/Objects/DeviceSmartthingsMetadata.php b/src/Objects/DeviceSmartthingsMetadata.php deleted file mode 100644 index 06b8eed2..00000000 --- a/src/Objects/DeviceSmartthingsMetadata.php +++ /dev/null @@ -1,28 +0,0 @@ -device_id, - device_name: $json->device_name, - location_id: $json->location_id ?? null, - model: $json->model ?? null - ); - } - - public function __construct( - public string $device_id, - public string $device_name, - public string|null $location_id, - public string|null $model - ) { - } -} diff --git a/src/Objects/DeviceSound.php b/src/Objects/DeviceSound.php deleted file mode 100644 index 1138b4eb..00000000 --- a/src/Objects/DeviceSound.php +++ /dev/null @@ -1,18 +0,0 @@ -time, value: $json->value); - } - - public function __construct(public string $time, public float $value) - { - } -} diff --git a/src/Objects/DeviceTadoMetadata.php b/src/Objects/DeviceTadoMetadata.php deleted file mode 100644 index 37921883..00000000 --- a/src/Objects/DeviceTadoMetadata.php +++ /dev/null @@ -1,23 +0,0 @@ -device_type, - serial_no: $json->serial_no - ); - } - - public function __construct( - public string $device_type, - public string $serial_no - ) { - } -} diff --git a/src/Objects/DeviceTedeeMetadata.php b/src/Objects/DeviceTedeeMetadata.php deleted file mode 100644 index c1c0b402..00000000 --- a/src/Objects/DeviceTedeeMetadata.php +++ /dev/null @@ -1,33 +0,0 @@ -bridge_id, - bridge_name: $json->bridge_name, - device_id: $json->device_id, - device_model: $json->device_model, - device_name: $json->device_name, - serial_number: $json->serial_number, - keypad_id: $json->keypad_id ?? null - ); - } - - public function __construct( - public float $bridge_id, - public string $bridge_name, - public float $device_id, - public string $device_model, - public string $device_name, - public string $serial_number, - public float|null $keypad_id - ) { - } -} diff --git a/src/Objects/DeviceTemperature.php b/src/Objects/DeviceTemperature.php deleted file mode 100644 index f88e4be5..00000000 --- a/src/Objects/DeviceTemperature.php +++ /dev/null @@ -1,18 +0,0 @@ -time, value: $json->value); - } - - public function __construct(public string $time, public float $value) - { - } -} diff --git a/src/Objects/DeviceTemperatureThreshold.php b/src/Objects/DeviceTemperatureThreshold.php deleted file mode 100644 index c2db54dd..00000000 --- a/src/Objects/DeviceTemperatureThreshold.php +++ /dev/null @@ -1,28 +0,0 @@ -lower_limit_celsius ?? null, - lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, - upper_limit_celsius: $json->upper_limit_celsius ?? null, - upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null - ); - } - - public function __construct( - public float|null $lower_limit_celsius, - public float|null $lower_limit_fahrenheit, - public float|null $upper_limit_celsius, - public float|null $upper_limit_fahrenheit - ) { - } -} diff --git a/src/Objects/DeviceTtlockMetadata.php b/src/Objects/DeviceTtlockMetadata.php deleted file mode 100644 index 1faede80..00000000 --- a/src/Objects/DeviceTtlockMetadata.php +++ /dev/null @@ -1,34 +0,0 @@ -feature_value, - features: DeviceFeatures::from_json($json->features), - lock_alias: $json->lock_alias, - lock_id: $json->lock_id, - has_gateway: $json->has_gateway ?? null, - wireless_keypads: array_map( - fn($w) => DeviceWirelessKeypads::from_json($w), - $json->wireless_keypads ?? [] - ) - ); - } - - public function __construct( - public string $feature_value, - public DeviceFeatures $features, - public string $lock_alias, - public float $lock_id, - public bool|null $has_gateway, - public array|null $wireless_keypads - ) { - } -} diff --git a/src/Objects/DeviceTwoNMetadata.php b/src/Objects/DeviceTwoNMetadata.php deleted file mode 100644 index 39da9752..00000000 --- a/src/Objects/DeviceTwoNMetadata.php +++ /dev/null @@ -1,23 +0,0 @@ -device_id, - device_name: $json->device_name - ); - } - - public function __construct( - public float $device_id, - public string $device_name - ) { - } -} diff --git a/src/Objects/DeviceVisionlineMetadata.php b/src/Objects/DeviceVisionlineMetadata.php deleted file mode 100644 index e46494ee..00000000 --- a/src/Objects/DeviceVisionlineMetadata.php +++ /dev/null @@ -1,18 +0,0 @@ -encoder_id); - } - - public function __construct(public string $encoder_id) - { - } -} diff --git a/src/Objects/DeviceWarnings.php b/src/Objects/DeviceWarnings.php deleted file mode 100644 index fa29faf0..00000000 --- a/src/Objects/DeviceWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/DeviceWirelessKeypads.php b/src/Objects/DeviceWirelessKeypads.php deleted file mode 100644 index bf29b62c..00000000 --- a/src/Objects/DeviceWirelessKeypads.php +++ /dev/null @@ -1,23 +0,0 @@ -wireless_keypad_id, - wireless_keypad_name: $json->wireless_keypad_name - ); - } - - public function __construct( - public float $wireless_keypad_id, - public string $wireless_keypad_name - ) { - } -} diff --git a/src/Objects/DeviceWyzeMetadata.php b/src/Objects/DeviceWyzeMetadata.php deleted file mode 100644 index f2af43c5..00000000 --- a/src/Objects/DeviceWyzeMetadata.php +++ /dev/null @@ -1,35 +0,0 @@ -device_id, - device_info_model: $json->device_info_model, - device_name: $json->device_name, - product_model: $json->product_model, - product_name: $json->product_name, - product_type: $json->product_type, - keypad_uuid: $json->keypad_uuid ?? null, - locker_status_hardlock: $json->locker_status_hardlock ?? null - ); - } - - public function __construct( - public string $device_id, - public string $device_info_model, - public string $device_name, - public string $product_model, - public string $product_name, - public string $product_type, - public string|null $keypad_uuid, - public float|null $locker_status_hardlock - ) { - } -} diff --git a/src/Objects/EnrollmentAutomation.php b/src/Objects/EnrollmentAutomation.php deleted file mode 100644 index 176ba370..00000000 --- a/src/Objects/EnrollmentAutomation.php +++ /dev/null @@ -1,29 +0,0 @@ -created_at, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id, - enrollment_automation_id: $json->enrollment_automation_id, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id - ); - } - - public function __construct( - public string $created_at, - public string $credential_manager_acs_system_id, - public string $enrollment_automation_id, - public string $user_identity_id, - public string $workspace_id - ) { - } -} diff --git a/src/Objects/Event.php b/src/Objects/Event.php deleted file mode 100644 index 5a1030e6..00000000 --- a/src/Objects/Event.php +++ /dev/null @@ -1,120 +0,0 @@ -access_code_id ?? null, - acs_access_group_id: $json->acs_access_group_id ?? null, - acs_credential_id: $json->acs_credential_id ?? null, - acs_encoder_id: $json->acs_encoder_id ?? null, - acs_system_id: $json->acs_system_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - action_attempt_id: $json->action_attempt_id ?? null, - action_type: $json->action_type ?? null, - backup_access_code_id: $json->backup_access_code_id ?? null, - battery_level: $json->battery_level ?? null, - battery_status: $json->battery_status ?? null, - client_session_id: $json->client_session_id ?? null, - climate_preset_key: $json->climate_preset_key ?? null, - connect_webview_id: $json->connect_webview_id ?? null, - connected_account_id: $json->connected_account_id ?? null, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - created_at: $json->created_at ?? null, - desired_temperature_celsius: $json->desired_temperature_celsius ?? - null, - desired_temperature_fahrenheit: $json->desired_temperature_fahrenheit ?? - null, - device_id: $json->device_id ?? null, - enrollment_automation_id: $json->enrollment_automation_id ?? null, - error_code: $json->error_code ?? null, - event_id: $json->event_id ?? null, - event_type: $json->event_type ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - is_fallback_climate_preset: $json->is_fallback_climate_preset ?? - null, - method: $json->method ?? null, - minut_metadata: $json->minut_metadata ?? null, - noise_level_decibels: $json->noise_level_decibels ?? null, - noise_level_nrs: $json->noise_level_nrs ?? null, - noise_threshold_id: $json->noise_threshold_id ?? null, - noise_threshold_name: $json->noise_threshold_name ?? null, - noiseaware_metadata: $json->noiseaware_metadata ?? null, - occurred_at: $json->occurred_at ?? null, - status: $json->status ?? null, - temperature_celsius: $json->temperature_celsius ?? null, - temperature_fahrenheit: $json->temperature_fahrenheit ?? null, - workspace_id: $json->workspace_id ?? null, - code: $json->code ?? null, - lower_limit_celsius: $json->lower_limit_celsius ?? null, - lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, - thermostat_schedule_id: $json->thermostat_schedule_id ?? null, - upper_limit_celsius: $json->upper_limit_celsius ?? null, - upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null - ); - } - - public function __construct( - public string|null $access_code_id, - public string|null $acs_access_group_id, - public string|null $acs_credential_id, - public string|null $acs_encoder_id, - public string|null $acs_system_id, - public string|null $acs_user_id, - public string|null $action_attempt_id, - public string|null $action_type, - public string|null $backup_access_code_id, - public float|null $battery_level, - public string|null $battery_status, - public string|null $client_session_id, - public string|null $climate_preset_key, - public string|null $connect_webview_id, - public string|null $connected_account_id, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $created_at, - public float|null $desired_temperature_celsius, - public float|null $desired_temperature_fahrenheit, - public string|null $device_id, - public string|null $enrollment_automation_id, - public string|null $error_code, - public string|null $event_id, - public string|null $event_type, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public bool|null $is_fallback_climate_preset, - public string|null $method, - public mixed $minut_metadata, - public float|null $noise_level_decibels, - public float|null $noise_level_nrs, - public string|null $noise_threshold_id, - public string|null $noise_threshold_name, - public mixed $noiseaware_metadata, - public string|null $occurred_at, - public string|null $status, - public float|null $temperature_celsius, - public float|null $temperature_fahrenheit, - public string|null $workspace_id, - public string|null $code, - public float|null $lower_limit_celsius, - public float|null $lower_limit_fahrenheit, - public string|null $thermostat_schedule_id, - public float|null $upper_limit_celsius, - public float|null $upper_limit_fahrenheit - ) { - } -} diff --git a/src/Objects/Network.php b/src/Objects/Network.php deleted file mode 100644 index c17b16d8..00000000 --- a/src/Objects/Network.php +++ /dev/null @@ -1,27 +0,0 @@ -created_at, - display_name: $json->display_name, - network_id: $json->network_id, - workspace_id: $json->workspace_id - ); - } - - public function __construct( - public string $created_at, - public string $display_name, - public string $network_id, - public string $workspace_id - ) { - } -} diff --git a/src/Objects/NoiseThreshold.php b/src/Objects/NoiseThreshold.php deleted file mode 100644 index 097240be..00000000 --- a/src/Objects/NoiseThreshold.php +++ /dev/null @@ -1,33 +0,0 @@ -device_id, - ends_daily_at: $json->ends_daily_at, - name: $json->name, - noise_threshold_decibels: $json->noise_threshold_decibels, - noise_threshold_id: $json->noise_threshold_id, - starts_daily_at: $json->starts_daily_at, - noise_threshold_nrs: $json->noise_threshold_nrs ?? null - ); - } - - public function __construct( - public string $device_id, - public string $ends_daily_at, - public string $name, - public float $noise_threshold_decibels, - public string $noise_threshold_id, - public string $starts_daily_at, - public float|null $noise_threshold_nrs - ) { - } -} diff --git a/src/Objects/Phone.php b/src/Objects/Phone.php deleted file mode 100644 index 1a2ab9ca..00000000 --- a/src/Objects/Phone.php +++ /dev/null @@ -1,45 +0,0 @@ -created_at, - custom_metadata: $json->custom_metadata, - device_id: $json->device_id, - device_type: $json->device_type, - display_name: $json->display_name, - errors: array_map( - fn($e) => PhoneErrors::from_json($e), - $json->errors ?? [] - ), - properties: PhoneProperties::from_json($json->properties), - warnings: array_map( - fn($w) => PhoneWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - nickname: $json->nickname ?? null - ); - } - - public function __construct( - public string $created_at, - public mixed $custom_metadata, - public string $device_id, - public string $device_type, - public string $display_name, - public array $errors, - public PhoneProperties $properties, - public array $warnings, - public string $workspace_id, - public string|null $nickname - ) { - } -} diff --git a/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php b/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php deleted file mode 100644 index aaebfb09..00000000 --- a/src/Objects/PhoneAssaAbloyCredentialServiceMetadata.php +++ /dev/null @@ -1,27 +0,0 @@ - PhoneEndpoints::from_json($e), - $json->endpoints ?? [] - ), - has_active_endpoint: $json->has_active_endpoint - ); - } - - public function __construct( - public array $endpoints, - public bool $has_active_endpoint - ) { - } -} diff --git a/src/Objects/PhoneEndpoints.php b/src/Objects/PhoneEndpoints.php deleted file mode 100644 index ef2497f8..00000000 --- a/src/Objects/PhoneEndpoints.php +++ /dev/null @@ -1,23 +0,0 @@ -endpoint_id, - is_active: $json->is_active - ); - } - - public function __construct( - public string $endpoint_id, - public bool $is_active - ) { - } -} diff --git a/src/Objects/PhoneErrors.php b/src/Objects/PhoneErrors.php deleted file mode 100644 index a09d12fd..00000000 --- a/src/Objects/PhoneErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/PhoneProperties.php b/src/Objects/PhoneProperties.php deleted file mode 100644 index 854a9c9f..00000000 --- a/src/Objects/PhoneProperties.php +++ /dev/null @@ -1,35 +0,0 @@ -assa_abloy_credential_service_metadata - ) - ? PhoneAssaAbloyCredentialServiceMetadata::from_json( - $json->assa_abloy_credential_service_metadata - ) - : null, - salto_space_credential_service_metadata: isset( - $json->salto_space_credential_service_metadata - ) - ? PhoneSaltoSpaceCredentialServiceMetadata::from_json( - $json->salto_space_credential_service_metadata - ) - : null - ); - } - - public function __construct( - public PhoneAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, - public PhoneSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata - ) { - } -} diff --git a/src/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php b/src/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php deleted file mode 100644 index 9939716b..00000000 --- a/src/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php +++ /dev/null @@ -1,19 +0,0 @@ -has_active_phone); - } - - public function __construct(public bool $has_active_phone) - { - } -} diff --git a/src/Objects/PhoneWarnings.php b/src/Objects/PhoneWarnings.php deleted file mode 100644 index 965de6c2..00000000 --- a/src/Objects/PhoneWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/ThermostatSchedule.php b/src/Objects/ThermostatSchedule.php deleted file mode 100644 index cee2262f..00000000 --- a/src/Objects/ThermostatSchedule.php +++ /dev/null @@ -1,43 +0,0 @@ -climate_preset_key, - created_at: $json->created_at, - device_id: $json->device_id, - ends_at: $json->ends_at, - errors: array_map( - fn($e) => ThermostatScheduleErrors::from_json($e), - $json->errors ?? [] - ), - max_override_period_minutes: $json->max_override_period_minutes, - starts_at: $json->starts_at, - thermostat_schedule_id: $json->thermostat_schedule_id, - name: $json->name ?? null, - unstable_is_override_allowed: $json->unstable_is_override_allowed ?? - null - ); - } - - public function __construct( - public string $climate_preset_key, - public string $created_at, - public string $device_id, - public string $ends_at, - public array $errors, - public mixed $max_override_period_minutes, - public string $starts_at, - public string $thermostat_schedule_id, - public string|null $name, - public bool|null $unstable_is_override_allowed - ) { - } -} diff --git a/src/Objects/ThermostatScheduleErrors.php b/src/Objects/ThermostatScheduleErrors.php deleted file mode 100644 index a4843a7c..00000000 --- a/src/Objects/ThermostatScheduleErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/UnmanagedAccessCode.php b/src/Objects/UnmanagedAccessCode.php deleted file mode 100644 index 4dff7ff1..00000000 --- a/src/Objects/UnmanagedAccessCode.php +++ /dev/null @@ -1,49 +0,0 @@ -access_code_id, - created_at: $json->created_at, - device_id: $json->device_id, - errors: array_map( - fn($e) => UnmanagedAccessCodeErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - status: $json->status, - type: $json->type, - warnings: array_map( - fn($w) => UnmanagedAccessCodeWarnings::from_json($w), - $json->warnings ?? [] - ), - code: $json->code ?? null, - name: $json->name ?? null, - ends_at: $json->ends_at ?? null, - starts_at: $json->starts_at ?? null - ); - } - - public function __construct( - public string $access_code_id, - public string $created_at, - public string $device_id, - public array $errors, - public bool $is_managed, - public string $status, - public string $type, - public array $warnings, - public string|null $code, - public string|null $name, - public string|null $ends_at, - public string|null $starts_at - ) { - } -} diff --git a/src/Objects/UnmanagedAccessCodeErrors.php b/src/Objects/UnmanagedAccessCodeErrors.php deleted file mode 100644 index 7240b0e2..00000000 --- a/src/Objects/UnmanagedAccessCodeErrors.php +++ /dev/null @@ -1,33 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_access_code_error: $json->is_access_code_error ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_access_code_error, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) { - } -} diff --git a/src/Objects/UnmanagedAccessCodeWarnings.php b/src/Objects/UnmanagedAccessCodeWarnings.php deleted file mode 100644 index d9be4a6d..00000000 --- a/src/Objects/UnmanagedAccessCodeWarnings.php +++ /dev/null @@ -1,26 +0,0 @@ -message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/UnmanagedAcsAccessGroup.php b/src/Objects/UnmanagedAcsAccessGroup.php deleted file mode 100644 index 18b0c93b..00000000 --- a/src/Objects/UnmanagedAcsAccessGroup.php +++ /dev/null @@ -1,46 +0,0 @@ -access_group_type, - access_group_type_display_name: $json->access_group_type_display_name, - acs_access_group_id: $json->acs_access_group_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - is_managed: $json->is_managed, - name: $json->name, - warnings: array_map( - fn($w) => UnmanagedAcsAccessGroupWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id - ); - } - - public function __construct( - public string $access_group_type, - public string $access_group_type_display_name, - public string $acs_access_group_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public string $external_type, - public string $external_type_display_name, - public bool $is_managed, - public string $name, - public array $warnings, - public string $workspace_id - ) { - } -} diff --git a/src/Objects/UnmanagedAcsAccessGroupWarnings.php b/src/Objects/UnmanagedAcsAccessGroupWarnings.php deleted file mode 100644 index b4accd7b..00000000 --- a/src/Objects/UnmanagedAcsAccessGroupWarnings.php +++ /dev/null @@ -1,26 +0,0 @@ -created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) { - } -} diff --git a/src/Objects/UnmanagedAcsCredential.php b/src/Objects/UnmanagedAcsCredential.php deleted file mode 100644 index 499d3717..00000000 --- a/src/Objects/UnmanagedAcsCredential.php +++ /dev/null @@ -1,89 +0,0 @@ -access_method, - acs_credential_id: $json->acs_credential_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => UnmanagedAcsCredentialErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => UnmanagedAcsCredentialWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? UnmanagedAcsCredentialAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - ends_at: $json->ends_at ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - is_issued: $json->is_issued ?? null, - is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? - null, - is_one_time_use: $json->is_one_time_use ?? null, - parent_acs_credential_id: $json->parent_acs_credential_id ?? null, - starts_at: $json->starts_at ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? UnmanagedAcsCredentialVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null - ); - } - - public function __construct( - public string $access_method, - public string $acs_credential_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public string|null $acs_credential_pool_id, - public string|null $acs_user_id, - public UnmanagedAcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public string|null $ends_at, - public string|null $external_type, - public string|null $external_type_display_name, - public bool|null $is_issued, - public bool|null $is_multi_phone_sync_credential, - public bool|null $is_one_time_use, - public string|null $parent_acs_credential_id, - public string|null $starts_at, - public UnmanagedAcsCredentialVisionlineMetadata|null $visionline_metadata, - public string|null $card_number, - public string|null $code, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at - ) { - } -} diff --git a/src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php b/src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php deleted file mode 100644 index f8b01368..00000000 --- a/src/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php +++ /dev/null @@ -1,31 +0,0 @@ -door_names ?? null, - endpoint_id: $json->endpoint_id ?? null, - key_id: $json->key_id ?? null, - key_issuing_request_id: $json->key_issuing_request_id ?? null, - override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? - null - ); - } - - public function __construct( - public array|null $door_names, - public string|null $endpoint_id, - public string|null $key_id, - public string|null $key_issuing_request_id, - public array|null $override_guest_acs_entrance_ids - ) { - } -} diff --git a/src/Objects/UnmanagedAcsCredentialErrors.php b/src/Objects/UnmanagedAcsCredentialErrors.php deleted file mode 100644 index 1a5f69dd..00000000 --- a/src/Objects/UnmanagedAcsCredentialErrors.php +++ /dev/null @@ -1,26 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php b/src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php deleted file mode 100644 index 69d6f4ce..00000000 --- a/src/Objects/UnmanagedAcsCredentialVisionlineMetadata.php +++ /dev/null @@ -1,36 +0,0 @@ -card_function_type, - auto_join: $json->auto_join ?? null, - card_id: $json->card_id ?? null, - common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, - credential_id: $json->credential_id ?? null, - guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, - is_valid: $json->is_valid ?? null, - joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null - ); - } - - public function __construct( - public string $card_function_type, - public bool|null $auto_join, - public string|null $card_id, - public array|null $common_acs_entrance_ids, - public string|null $credential_id, - public array|null $guest_acs_entrance_ids, - public bool|null $is_valid, - public array|null $joiner_acs_credential_ids - ) { - } -} diff --git a/src/Objects/UnmanagedAcsCredentialWarnings.php b/src/Objects/UnmanagedAcsCredentialWarnings.php deleted file mode 100644 index b4738b9d..00000000 --- a/src/Objects/UnmanagedAcsCredentialWarnings.php +++ /dev/null @@ -1,26 +0,0 @@ -created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) { - } -} diff --git a/src/Objects/UnmanagedAcsUser.php b/src/Objects/UnmanagedAcsUser.php deleted file mode 100644 index 5e938fdc..00000000 --- a/src/Objects/UnmanagedAcsUser.php +++ /dev/null @@ -1,80 +0,0 @@ -acs_system_id, - acs_user_id: $json->acs_user_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => UnmanagedAcsUserErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => UnmanagedAcsUserWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - access_schedule: isset($json->access_schedule) - ? UnmanagedAcsUserAccessSchedule::from_json( - $json->access_schedule - ) - : null, - email: $json->email ?? null, - email_address: $json->email_address ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - full_name: $json->full_name ?? null, - hid_acs_system_id: $json->hid_acs_system_id ?? null, - is_suspended: $json->is_suspended ?? null, - phone_number: $json->phone_number ?? null, - user_identity_id: $json->user_identity_id ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, - user_identity_email_address: $json->user_identity_email_address ?? - null, - user_identity_full_name: $json->user_identity_full_name ?? null, - user_identity_phone_number: $json->user_identity_phone_number ?? - null - ); - } - - public function __construct( - public string $acs_system_id, - public string $acs_user_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public UnmanagedAcsUserAccessSchedule|null $access_schedule, - public string|null $email, - public string|null $email_address, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $full_name, - public string|null $hid_acs_system_id, - public bool|null $is_suspended, - public string|null $phone_number, - public string|null $user_identity_id, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $latest_desired_state_synced_with_provider_at, - public string|null $user_identity_email_address, - public string|null $user_identity_full_name, - public string|null $user_identity_phone_number - ) { - } -} diff --git a/src/Objects/UnmanagedAcsUserAccessSchedule.php b/src/Objects/UnmanagedAcsUserAccessSchedule.php deleted file mode 100644 index 1a077a53..00000000 --- a/src/Objects/UnmanagedAcsUserAccessSchedule.php +++ /dev/null @@ -1,24 +0,0 @@ -starts_at, - ends_at: $json->ends_at ?? null - ); - } - - public function __construct( - public string $starts_at, - public string|null $ends_at - ) { - } -} diff --git a/src/Objects/UnmanagedAcsUserErrors.php b/src/Objects/UnmanagedAcsUserErrors.php deleted file mode 100644 index 006ddc6b..00000000 --- a/src/Objects/UnmanagedAcsUserErrors.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - error_code: $json->error_code, - message: $json->message - ); - } - - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) { - } -} diff --git a/src/Objects/UnmanagedAcsUserWarnings.php b/src/Objects/UnmanagedAcsUserWarnings.php deleted file mode 100644 index 3686231d..00000000 --- a/src/Objects/UnmanagedAcsUserWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) { - } -} diff --git a/src/Objects/UnmanagedDevice.php b/src/Objects/UnmanagedDevice.php deleted file mode 100644 index 5dbba21c..00000000 --- a/src/Objects/UnmanagedDevice.php +++ /dev/null @@ -1,74 +0,0 @@ -capabilities_supported, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - device_id: $json->device_id, - device_type: $json->device_type, - errors: array_map( - fn($e) => UnmanagedDeviceErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - properties: UnmanagedDeviceProperties::from_json($json->properties), - warnings: array_map( - fn($w) => UnmanagedDeviceWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - 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, - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? - null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? - null, - can_remotely_lock: $json->can_remotely_lock ?? null, - can_remotely_unlock: $json->can_remotely_unlock ?? null, - can_simulate_connection: $json->can_simulate_connection ?? null, - can_simulate_disconnection: $json->can_simulate_disconnection ?? - null, - can_simulate_removal: $json->can_simulate_removal ?? null, - can_turn_off_hvac: $json->can_turn_off_hvac ?? null, - location: isset($json->location) - ? UnmanagedDeviceLocation::from_json($json->location) - : null - ); - } - - public function __construct( - public array $capabilities_supported, - public string $connected_account_id, - public string $created_at, - public string $device_id, - public string $device_type, - public array $errors, - public bool $is_managed, - public UnmanagedDeviceProperties $properties, - public array $warnings, - public string $workspace_id, - public bool|null $can_hvac_cool, - public bool|null $can_hvac_heat, - public bool|null $can_hvac_heat_cool, - public bool|null $can_program_offline_access_codes, - public bool|null $can_program_online_access_codes, - public bool|null $can_remotely_lock, - public bool|null $can_remotely_unlock, - public bool|null $can_simulate_connection, - public bool|null $can_simulate_disconnection, - public bool|null $can_simulate_removal, - public bool|null $can_turn_off_hvac, - public UnmanagedDeviceLocation|null $location - ) { - } -} diff --git a/src/Objects/UnmanagedDeviceAccessoryKeypad.php b/src/Objects/UnmanagedDeviceAccessoryKeypad.php deleted file mode 100644 index 66313e1c..00000000 --- a/src/Objects/UnmanagedDeviceAccessoryKeypad.php +++ /dev/null @@ -1,26 +0,0 @@ -is_connected, - battery: isset($json->battery) - ? UnmanagedDeviceBattery::from_json($json->battery) - : null - ); - } - - public function __construct( - public bool $is_connected, - public UnmanagedDeviceBattery|null $battery - ) { - } -} diff --git a/src/Objects/UnmanagedDeviceBattery.php b/src/Objects/UnmanagedDeviceBattery.php deleted file mode 100644 index 175aa6bc..00000000 --- a/src/Objects/UnmanagedDeviceBattery.php +++ /dev/null @@ -1,18 +0,0 @@ -level); - } - - public function __construct(public float $level) - { - } -} diff --git a/src/Objects/UnmanagedDeviceErrors.php b/src/Objects/UnmanagedDeviceErrors.php deleted file mode 100644 index 0b0f12a2..00000000 --- a/src/Objects/UnmanagedDeviceErrors.php +++ /dev/null @@ -1,30 +0,0 @@ -error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) { - } -} diff --git a/src/Objects/UnmanagedDeviceLocation.php b/src/Objects/UnmanagedDeviceLocation.php deleted file mode 100644 index 7cf435e8..00000000 --- a/src/Objects/UnmanagedDeviceLocation.php +++ /dev/null @@ -1,23 +0,0 @@ -location_name ?? null, - timezone: $json->timezone ?? null - ); - } - - public function __construct( - public string|null $location_name, - public string|null $timezone - ) { - } -} diff --git a/src/Objects/UnmanagedDeviceModel.php b/src/Objects/UnmanagedDeviceModel.php deleted file mode 100644 index 15d8be89..00000000 --- a/src/Objects/UnmanagedDeviceModel.php +++ /dev/null @@ -1,37 +0,0 @@ -display_name, - manufacturer_display_name: $json->manufacturer_display_name, - accessory_keypad_supported: $json->accessory_keypad_supported ?? - null, - can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? - null, - has_built_in_keypad: $json->has_built_in_keypad ?? null, - offline_access_codes_supported: $json->offline_access_codes_supported ?? - null, - online_access_codes_supported: $json->online_access_codes_supported ?? - null - ); - } - - public function __construct( - public string $display_name, - public string $manufacturer_display_name, - public bool|null $accessory_keypad_supported, - public bool|null $can_connect_accessory_keypad, - public bool|null $has_built_in_keypad, - public bool|null $offline_access_codes_supported, - public bool|null $online_access_codes_supported - ) { - } -} diff --git a/src/Objects/UnmanagedDeviceProperties.php b/src/Objects/UnmanagedDeviceProperties.php deleted file mode 100644 index 83fb4a69..00000000 --- a/src/Objects/UnmanagedDeviceProperties.php +++ /dev/null @@ -1,50 +0,0 @@ -model), - name: $json->name, - online: $json->online, - accessory_keypad: isset($json->accessory_keypad) - ? UnmanagedDeviceAccessoryKeypad::from_json( - $json->accessory_keypad - ) - : null, - battery: isset($json->battery) - ? UnmanagedDeviceBattery::from_json($json->battery) - : null, - battery_level: $json->battery_level ?? null, - image_alt_text: $json->image_alt_text ?? null, - image_url: $json->image_url ?? null, - manufacturer: $json->manufacturer ?? null, - offline_access_codes_enabled: $json->offline_access_codes_enabled ?? - null, - online_access_codes_enabled: $json->online_access_codes_enabled ?? - null - ); - } - - public function __construct( - public UnmanagedDeviceModel $model, - public string $name, - public bool $online, - public UnmanagedDeviceAccessoryKeypad|null $accessory_keypad, - public UnmanagedDeviceBattery|null $battery, - public float|null $battery_level, - public string|null $image_alt_text, - public string|null $image_url, - public string|null $manufacturer, - public bool|null $offline_access_codes_enabled, - public bool|null $online_access_codes_enabled - ) { - } -} diff --git a/src/Objects/UnmanagedDeviceWarnings.php b/src/Objects/UnmanagedDeviceWarnings.php deleted file mode 100644 index 84cc664f..00000000 --- a/src/Objects/UnmanagedDeviceWarnings.php +++ /dev/null @@ -1,25 +0,0 @@ -message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) { - } -} diff --git a/src/Objects/UserIdentity.php b/src/Objects/UserIdentity.php deleted file mode 100644 index f96d616a..00000000 --- a/src/Objects/UserIdentity.php +++ /dev/null @@ -1,35 +0,0 @@ -created_at, - display_name: $json->display_name, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id, - email_address: $json->email_address ?? null, - full_name: $json->full_name ?? null, - phone_number: $json->phone_number ?? null, - user_identity_key: $json->user_identity_key ?? null - ); - } - - public function __construct( - public string $created_at, - public string $display_name, - public string $user_identity_id, - public string $workspace_id, - public string|null $email_address, - public string|null $full_name, - public string|null $phone_number, - public string|null $user_identity_key - ) { - } -} diff --git a/src/Objects/Webhook.php b/src/Objects/Webhook.php deleted file mode 100644 index dff0a67a..00000000 --- a/src/Objects/Webhook.php +++ /dev/null @@ -1,27 +0,0 @@ -url, - webhook_id: $json->webhook_id, - event_types: $json->event_types ?? null, - secret: $json->secret ?? null - ); - } - - public function __construct( - public string $url, - public string $webhook_id, - public array|null $event_types, - public string|null $secret - ) { - } -} diff --git a/src/Objects/Workspace.php b/src/Objects/Workspace.php deleted file mode 100644 index 9ac24e25..00000000 --- a/src/Objects/Workspace.php +++ /dev/null @@ -1,29 +0,0 @@ -company_name, - is_sandbox: $json->is_sandbox, - name: $json->name, - workspace_id: $json->workspace_id, - connect_partner_name: $json->connect_partner_name ?? null - ); - } - - public function __construct( - public string $company_name, - public bool $is_sandbox, - public string $name, - public string $workspace_id, - public string|null $connect_partner_name - ) { - } -} diff --git a/src/Routes/Clients/AccessCodesClient.php b/src/Routes/Clients/AccessCodesClient.php new file mode 100644 index 00000000..37dacd43 --- /dev/null +++ b/src/Routes/Clients/AccessCodesClient.php @@ -0,0 +1,411 @@ +seam = $seam; + $this->simulate = new AccessCodesSimulateClient($seam); + $this->unmanaged = new AccessCodesUnmanagedClient($seam); + } + + public function create( + string $device_id, + bool $allow_external_modification = null, + bool $attempt_for_offline_device = null, + string $code = null, + string $common_code_key = null, + string $ends_at = null, + bool $is_external_modification_allowed = null, + bool $is_offline_access_code = null, + bool $is_one_time_use = null, + string $max_time_rounding = null, + string $name = null, + bool $prefer_native_scheduling = null, + float $preferred_code_length = null, + string $starts_at = null, + bool $sync = null, + bool $use_backup_access_code_pool = null, + bool $use_offline_access_code = null + ): AccessCode { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($allow_external_modification !== null) { + $request_payload["allow_external_modification"] = $allow_external_modification; + } + if ($attempt_for_offline_device !== null) { + $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($common_code_key !== null) { + $request_payload["common_code_key"] = $common_code_key; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_external_modification_allowed !== null) { + $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; + } + if ($is_offline_access_code !== null) { + $request_payload["is_offline_access_code"] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($prefer_native_scheduling !== null) { + $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; + } + if ($preferred_code_length !== null) { + $request_payload["preferred_code_length"] = $preferred_code_length; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($use_backup_access_code_pool !== null) { + $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; + } + if ($use_offline_access_code !== null) { + $request_payload["use_offline_access_code"] = $use_offline_access_code; + } + + $res = $this->seam->request( + "POST", + "/access_codes/create", + json: (object) $request_payload, + inner_object: "access_code" + ); + + return AccessCode::from_json($res); + } + + public function create_multiple( + array $device_ids, + bool $allow_external_modification = null, + bool $attempt_for_offline_device = null, + string $behavior_when_code_cannot_be_shared = null, + string $code = null, + string $ends_at = null, + bool $is_external_modification_allowed = null, + bool $is_offline_access_code = null, + bool $is_one_time_use = null, + string $max_time_rounding = null, + string $name = null, + bool $prefer_native_scheduling = null, + float $preferred_code_length = null, + string $starts_at = null, + bool $use_backup_access_code_pool = null, + bool $use_offline_access_code = null + ): array { + $request_payload = []; + + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($allow_external_modification !== null) { + $request_payload["allow_external_modification"] = $allow_external_modification; + } + if ($attempt_for_offline_device !== null) { + $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; + } + if ($behavior_when_code_cannot_be_shared !== null) { + $request_payload["behavior_when_code_cannot_be_shared"] = $behavior_when_code_cannot_be_shared; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_external_modification_allowed !== null) { + $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; + } + if ($is_offline_access_code !== null) { + $request_payload["is_offline_access_code"] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($prefer_native_scheduling !== null) { + $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; + } + if ($preferred_code_length !== null) { + $request_payload["preferred_code_length"] = $preferred_code_length; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($use_backup_access_code_pool !== null) { + $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; + } + if ($use_offline_access_code !== null) { + $request_payload["use_offline_access_code"] = $use_offline_access_code; + } + + $res = $this->seam->request( + "POST", + "/access_codes/create_multiple", + json: (object) $request_payload, + inner_object: "access_codes" + ); + + return array_map(fn($r) => AccessCode::from_json($r), $res); + } + + public function delete( + string $access_code_id, + string $device_id = null, + bool $sync = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/access_codes/delete", + json: (object) $request_payload + ); + } + + public function generate_code(string $device_id): AccessCode + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/access_codes/generate_code", + json: (object) $request_payload, + inner_object: "generated_code" + ); + + return AccessCode::from_json($res); + } + + public function get( + string $access_code_id = null, + string $code = null, + string $device_id = null + ): AccessCode { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/access_codes/get", + json: (object) $request_payload, + inner_object: "access_code" + ); + + return AccessCode::from_json($res); + } + + public function list( + array $access_code_ids = null, + string $device_id = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($access_code_ids !== null) { + $request_payload["access_code_ids"] = $access_code_ids; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/access_codes/list", + json: (object) $request_payload, + inner_object: "access_codes" + ); + + return array_map(fn($r) => AccessCode::from_json($r), $res); + } + + public function pull_backup_access_code(string $access_code_id): AccessCode + { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + + $res = $this->seam->request( + "POST", + "/access_codes/pull_backup_access_code", + json: (object) $request_payload, + inner_object: "access_code" + ); + + return AccessCode::from_json($res); + } + + public function update( + string $access_code_id, + bool $allow_external_modification = null, + bool $attempt_for_offline_device = null, + string $code = null, + string $device_id = null, + string $ends_at = null, + bool $is_external_modification_allowed = null, + bool $is_managed = null, + bool $is_offline_access_code = null, + bool $is_one_time_use = null, + string $max_time_rounding = null, + string $name = null, + bool $prefer_native_scheduling = null, + float $preferred_code_length = null, + string $starts_at = null, + bool $sync = null, + string $type = null, + bool $use_backup_access_code_pool = null, + bool $use_offline_access_code = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($allow_external_modification !== null) { + $request_payload["allow_external_modification"] = $allow_external_modification; + } + if ($attempt_for_offline_device !== null) { + $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_external_modification_allowed !== null) { + $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($is_offline_access_code !== null) { + $request_payload["is_offline_access_code"] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($prefer_native_scheduling !== null) { + $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; + } + if ($preferred_code_length !== null) { + $request_payload["preferred_code_length"] = $preferred_code_length; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($type !== null) { + $request_payload["type"] = $type; + } + if ($use_backup_access_code_pool !== null) { + $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; + } + if ($use_offline_access_code !== null) { + $request_payload["use_offline_access_code"] = $use_offline_access_code; + } + + $this->seam->request( + "POST", + "/access_codes/update", + json: (object) $request_payload + ); + } + + public function update_multiple( + string $common_code_key, + string $ends_at = null, + string $name = null, + string $starts_at = null + ): void { + $request_payload = []; + + if ($common_code_key !== null) { + $request_payload["common_code_key"] = $common_code_key; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + + $this->seam->request( + "POST", + "/access_codes/update_multiple", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/AccessCodesSimulateClient.php b/src/Routes/Clients/AccessCodesSimulateClient.php new file mode 100644 index 00000000..5f997b10 --- /dev/null +++ b/src/Routes/Clients/AccessCodesSimulateClient.php @@ -0,0 +1,43 @@ +seam = $seam; + } + + public function create_unmanaged_access_code( + string $code, + string $device_id, + string $name + ): UnmanagedAccessCode { + $request_payload = []; + + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/access_codes/simulate/create_unmanaged_access_code", + json: (object) $request_payload, + inner_object: "access_code" + ); + + return UnmanagedAccessCode::from_json($res); + } +} diff --git a/src/Routes/Clients/AccessCodesUnmanagedClient.php b/src/Routes/Clients/AccessCodesUnmanagedClient.php new file mode 100644 index 00000000..a229f959 --- /dev/null +++ b/src/Routes/Clients/AccessCodesUnmanagedClient.php @@ -0,0 +1,148 @@ +seam = $seam; + } + + public function convert_to_managed( + string $access_code_id, + bool $allow_external_modification = null, + bool $force = null, + bool $is_external_modification_allowed = null, + bool $sync = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($allow_external_modification !== null) { + $request_payload["allow_external_modification"] = $allow_external_modification; + } + if ($force !== null) { + $request_payload["force"] = $force; + } + if ($is_external_modification_allowed !== null) { + $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/access_codes/unmanaged/convert_to_managed", + json: (object) $request_payload + ); + } + + public function delete(string $access_code_id, bool $sync = null): void + { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/access_codes/unmanaged/delete", + json: (object) $request_payload + ); + } + + public function get( + string $access_code_id = null, + string $code = null, + string $device_id = null + ): UnmanagedAccessCode { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/access_codes/unmanaged/get", + json: (object) $request_payload, + inner_object: "access_code" + ); + + return UnmanagedAccessCode::from_json($res); + } + + public function list( + string $device_id, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/access_codes/unmanaged/list", + json: (object) $request_payload, + inner_object: "access_codes" + ); + + return array_map(fn($r) => UnmanagedAccessCode::from_json($r), $res); + } + + public function update( + string $access_code_id, + bool $is_managed, + bool $allow_external_modification = null, + bool $force = null, + bool $is_external_modification_allowed = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($allow_external_modification !== null) { + $request_payload["allow_external_modification"] = $allow_external_modification; + } + if ($force !== null) { + $request_payload["force"] = $force; + } + if ($is_external_modification_allowed !== null) { + $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; + } + + $this->seam->request( + "POST", + "/access_codes/unmanaged/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/AcsAccessGroupsClient.php b/src/Routes/Clients/AcsAccessGroupsClient.php new file mode 100644 index 00000000..8ac64124 --- /dev/null +++ b/src/Routes/Clients/AcsAccessGroupsClient.php @@ -0,0 +1,136 @@ +seam = $seam; + } + + public function add_user( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/access_groups/add_user", + json: (object) $request_payload + ); + } + + public function get(string $acs_access_group_id): AcsAccessGroup + { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $res = $this->seam->request( + "POST", + "/acs/access_groups/get", + json: (object) $request_payload, + inner_object: "acs_access_group" + ); + + return AcsAccessGroup::from_json($res); + } + + public function list( + string $acs_system_id = null, + string $acs_user_id = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->request( + "POST", + "/acs/access_groups/list", + json: (object) $request_payload, + inner_object: "acs_access_groups" + ); + + return array_map(fn($r) => AcsAccessGroup::from_json($r), $res); + } + + public function list_accessible_entrances( + string $acs_access_group_id + ): array { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $res = $this->seam->request( + "POST", + "/acs/access_groups/list_accessible_entrances", + json: (object) $request_payload, + inner_object: "acs_entrances" + ); + + return array_map(fn($r) => AcsEntrance::from_json($r), $res); + } + + public function list_users(string $acs_access_group_id): array + { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $res = $this->seam->request( + "POST", + "/acs/access_groups/list_users", + json: (object) $request_payload, + inner_object: "acs_users" + ); + + return array_map(fn($r) => AcsUser::from_json($r), $res); + } + + public function remove_user( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/access_groups/remove_user", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php b/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php new file mode 100644 index 00000000..0cb00699 --- /dev/null +++ b/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php @@ -0,0 +1,60 @@ +seam = $seam; + } + + public function get(string $acs_access_group_id): UnmanagedAcsAccessGroup + { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $res = $this->seam->request( + "POST", + "/acs/access_groups/unmanaged/get", + json: (object) $request_payload, + inner_object: "acs_access_group" + ); + + return UnmanagedAcsAccessGroup::from_json($res); + } + + public function list( + string $acs_system_id = null, + string $acs_user_id = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->request( + "POST", + "/acs/access_groups/unmanaged/list", + json: (object) $request_payload, + inner_object: "acs_access_groups" + ); + + return array_map( + fn($r) => UnmanagedAcsAccessGroup::from_json($r), + $res + ); + } +} \ No newline at end of file diff --git a/src/Routes/Clients/AcsClient.php b/src/Routes/Clients/AcsClient.php new file mode 100644 index 00000000..8c17ef37 --- /dev/null +++ b/src/Routes/Clients/AcsClient.php @@ -0,0 +1,32 @@ +seam = $seam; + $this->access_groups = new AcsAccessGroupsClient($seam); + $this->credential_pools = new AcsCredentialPoolsClient($seam); + $this->credential_provisioning_automations = new AcsCredentialProvisioningAutomationsClient( + $seam + ); + $this->credentials = new AcsCredentialsClient($seam); + $this->encoders = new AcsEncodersClient($seam); + $this->entrances = new AcsEntrancesClient($seam); + $this->systems = new AcsSystemsClient($seam); + $this->users = new AcsUsersClient($seam); + } +} diff --git a/src/Routes/Clients/AcsCredentialPoolsClient.php b/src/Routes/Clients/AcsCredentialPoolsClient.php new file mode 100644 index 00000000..0382a07b --- /dev/null +++ b/src/Routes/Clients/AcsCredentialPoolsClient.php @@ -0,0 +1,34 @@ +seam = $seam; + } + + public function list(string $acs_system_id): array + { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + + $res = $this->seam->request( + "POST", + "/acs/credential_pools/list", + json: (object) $request_payload, + inner_object: "acs_credential_pools" + ); + + return array_map(fn($r) => AcsCredentialPool::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php b/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php new file mode 100644 index 00000000..fcc1e876 --- /dev/null +++ b/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php @@ -0,0 +1,51 @@ +seam = $seam; + } + + public function launch( + string $credential_manager_acs_system_id, + string $user_identity_id, + string $acs_credential_pool_id = null, + bool $create_credential_manager_user = null, + string $credential_manager_acs_user_id = null + ): AcsCredentialProvisioningAutomation { + $request_payload = []; + + if ($credential_manager_acs_system_id !== null) { + $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($acs_credential_pool_id !== null) { + $request_payload["acs_credential_pool_id"] = $acs_credential_pool_id; + } + if ($create_credential_manager_user !== null) { + $request_payload["create_credential_manager_user"] = $create_credential_manager_user; + } + if ($credential_manager_acs_user_id !== null) { + $request_payload["credential_manager_acs_user_id"] = $credential_manager_acs_user_id; + } + + $res = $this->seam->request( + "POST", + "/acs/credential_provisioning_automations/launch", + json: (object) $request_payload, + inner_object: "acs_credential_provisioning_automation" + ); + + return AcsCredentialProvisioningAutomation::from_json($res); + } +} diff --git a/src/Routes/Clients/AcsCredentialsClient.php b/src/Routes/Clients/AcsCredentialsClient.php new file mode 100644 index 00000000..2248bfca --- /dev/null +++ b/src/Routes/Clients/AcsCredentialsClient.php @@ -0,0 +1,263 @@ +seam = $seam; + } + + public function assign(string $acs_credential_id, string $acs_user_id): void + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/credentials/assign", + json: (object) $request_payload + ); + } + + public function create( + string $access_method, + string $acs_user_id, + array $allowed_acs_entrance_ids = null, + mixed $assa_abloy_vostio_metadata = null, + string $code = null, + string $credential_manager_acs_system_id = null, + string $ends_at = null, + bool $is_multi_phone_sync_credential = null, + mixed $salto_space_metadata = null, + string $starts_at = null, + mixed $visionline_metadata = null + ): AcsCredential { + $request_payload = []; + + if ($access_method !== null) { + $request_payload["access_method"] = $access_method; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($allowed_acs_entrance_ids !== null) { + $request_payload["allowed_acs_entrance_ids"] = $allowed_acs_entrance_ids; + } + if ($assa_abloy_vostio_metadata !== null) { + $request_payload["assa_abloy_vostio_metadata"] = $assa_abloy_vostio_metadata; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($credential_manager_acs_system_id !== null) { + $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_multi_phone_sync_credential !== null) { + $request_payload["is_multi_phone_sync_credential"] = $is_multi_phone_sync_credential; + } + if ($salto_space_metadata !== null) { + $request_payload["salto_space_metadata"] = $salto_space_metadata; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($visionline_metadata !== null) { + $request_payload["visionline_metadata"] = $visionline_metadata; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/create", + json: (object) $request_payload, + inner_object: "acs_credential" + ); + + return AcsCredential::from_json($res); + } + + public function create_offline_code( + string $acs_user_id, + string $allowed_acs_entrance_id, + string $ends_at = null, + bool $is_one_time_use = null, + string $starts_at = null + ): AcsCredential { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($allowed_acs_entrance_id !== null) { + $request_payload["allowed_acs_entrance_id"] = $allowed_acs_entrance_id; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/create_offline_code", + json: (object) $request_payload, + inner_object: "acs_credential" + ); + + return AcsCredential::from_json($res); + } + + public function delete(string $acs_credential_id): void + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $this->seam->request( + "POST", + "/acs/credentials/delete", + json: (object) $request_payload + ); + } + + public function get(string $acs_credential_id): AcsCredential + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/get", + json: (object) $request_payload, + inner_object: "acs_credential" + ); + + return AcsCredential::from_json($res); + } + + public function list( + string $acs_user_id = null, + string $acs_system_id = null, + string $user_identity_id = null, + string $created_before = null, + bool $is_multi_phone_sync_credential = null, + float $limit = null + ): array { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($is_multi_phone_sync_credential !== null) { + $request_payload["is_multi_phone_sync_credential"] = $is_multi_phone_sync_credential; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/list", + json: (object) $request_payload, + inner_object: "acs_credentials" + ); + + return array_map(fn($r) => AcsCredential::from_json($r), $res); + } + + public function list_accessible_entrances(string $acs_credential_id): array + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/list_accessible_entrances", + json: (object) $request_payload, + inner_object: "acs_entrances" + ); + + return array_map(fn($r) => AcsEntrance::from_json($r), $res); + } + + public function unassign( + string $acs_credential_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/credentials/unassign", + json: (object) $request_payload + ); + } + + public function update( + string $acs_credential_id, + string $code = null, + string $ends_at = null + ): void { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + + $this->seam->request( + "POST", + "/acs/credentials/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/AcsCredentialsUnmanagedClient.php b/src/Routes/Clients/AcsCredentialsUnmanagedClient.php new file mode 100644 index 00000000..9774c789 --- /dev/null +++ b/src/Routes/Clients/AcsCredentialsUnmanagedClient.php @@ -0,0 +1,61 @@ +seam = $seam; + } + + public function get(string $acs_credential_id): UnmanagedAcsCredential + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/unmanaged/get", + json: (object) $request_payload, + inner_object: "acs_credential" + ); + + return UnmanagedAcsCredential::from_json($res); + } + + public function list( + string $acs_user_id = null, + string $acs_system_id = null, + string $user_identity_id = null + ): array { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/acs/credentials/unmanaged/list", + json: (object) $request_payload, + inner_object: "acs_credentials" + ); + + return array_map(fn($r) => UnmanagedAcsCredential::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/AcsEncodersClient.php b/src/Routes/Clients/AcsEncodersClient.php new file mode 100644 index 00000000..c24f8d35 --- /dev/null +++ b/src/Routes/Clients/AcsEncodersClient.php @@ -0,0 +1,108 @@ +seam = $seam; + } + + public function encode_credential( + string $acs_credential_id, + string $acs_encoder_id, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + + $res = $this->seam->request( + "POST", + "/acs/encoders/encode_credential", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function list( + string $acs_system_id = null, + float $limit = null, + array $acs_system_ids = null, + array $acs_encoder_ids = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($acs_system_ids !== null) { + $request_payload["acs_system_ids"] = $acs_system_ids; + } + if ($acs_encoder_ids !== null) { + $request_payload["acs_encoder_ids"] = $acs_encoder_ids; + } + + $res = $this->seam->request( + "POST", + "/acs/encoders/list", + json: (object) $request_payload, + inner_object: "acs_encoders" + ); + + return array_map(fn($r) => AcsEncoder::from_json($r), $res); + } + + public function scan_credential( + string $acs_encoder_id, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + + $res = $this->seam->request( + "POST", + "/acs/encoders/scan_credential", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } +} diff --git a/src/Routes/Clients/AcsEncodersSimulateClient.php b/src/Routes/Clients/AcsEncodersSimulateClient.php new file mode 100644 index 00000000..35ded544 --- /dev/null +++ b/src/Routes/Clients/AcsEncodersSimulateClient.php @@ -0,0 +1,107 @@ +seam = $seam; + } + + public function next_credential_encode_will_fail( + string $acs_encoder_id, + string $error_code = null, + string $acs_credential_id = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($error_code !== null) { + $request_payload["error_code"] = $error_code; + } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $this->seam->request( + "POST", + "/acs/encoders/simulate/next_credential_encode_will_fail", + json: (object) $request_payload + ); + } + + public function next_credential_encode_will_succeed( + string $acs_encoder_id, + string $scenario = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($scenario !== null) { + $request_payload["scenario"] = $scenario; + } + + $this->seam->request( + "POST", + "/acs/encoders/simulate/next_credential_encode_will_succeed", + json: (object) $request_payload + ); + } + + public function next_credential_scan_will_fail( + string $acs_encoder_id, + string $error_code = null, + string $acs_credential_id_on_seam = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($error_code !== null) { + $request_payload["error_code"] = $error_code; + } + if ($acs_credential_id_on_seam !== null) { + $request_payload["acs_credential_id_on_seam"] = $acs_credential_id_on_seam; + } + + $this->seam->request( + "POST", + "/acs/encoders/simulate/next_credential_scan_will_fail", + json: (object) $request_payload + ); + } + + public function next_credential_scan_will_succeed( + string $acs_encoder_id, + string $acs_credential_id_on_seam = null, + string $scenario = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($acs_credential_id_on_seam !== null) { + $request_payload["acs_credential_id_on_seam"] = $acs_credential_id_on_seam; + } + if ($scenario !== null) { + $request_payload["scenario"] = $scenario; + } + + $this->seam->request( + "POST", + "/acs/encoders/simulate/next_credential_scan_will_succeed", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/AcsEntrancesClient.php b/src/Routes/Clients/AcsEntrancesClient.php new file mode 100644 index 00000000..ca154ad5 --- /dev/null +++ b/src/Routes/Clients/AcsEntrancesClient.php @@ -0,0 +1,101 @@ +seam = $seam; + } + + public function get(string $acs_entrance_id): AcsEntrance + { + $request_payload = []; + + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + + $res = $this->seam->request( + "POST", + "/acs/entrances/get", + json: (object) $request_payload, + inner_object: "acs_entrance" + ); + + return AcsEntrance::from_json($res); + } + + public function grant_access( + string $acs_entrance_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/entrances/grant_access", + json: (object) $request_payload + ); + } + + public function list( + string $acs_credential_id = null, + string $acs_system_id = null + ): array { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + + $res = $this->seam->request( + "POST", + "/acs/entrances/list", + json: (object) $request_payload, + inner_object: "acs_entrances" + ); + + return array_map(fn($r) => AcsEntrance::from_json($r), $res); + } + + public function list_credentials_with_access( + string $acs_entrance_id, + array $include_if = null + ): array { + $request_payload = []; + + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + + $res = $this->seam->request( + "POST", + "/acs/entrances/list_credentials_with_access", + json: (object) $request_payload, + inner_object: "acs_credentials" + ); + + return array_map(fn($r) => AcsCredential::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/AcsSystemsClient.php b/src/Routes/Clients/AcsSystemsClient.php new file mode 100644 index 00000000..76fd0a0f --- /dev/null +++ b/src/Routes/Clients/AcsSystemsClient.php @@ -0,0 +1,71 @@ +seam = $seam; + } + + public function get(string $acs_system_id): AcsSystem + { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + + $res = $this->seam->request( + "POST", + "/acs/systems/get", + json: (object) $request_payload, + inner_object: "acs_system" + ); + + return AcsSystem::from_json($res); + } + + public function list(string $connected_account_id = null): array + { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + + $res = $this->seam->request( + "POST", + "/acs/systems/list", + json: (object) $request_payload, + inner_object: "acs_systems" + ); + + return array_map(fn($r) => AcsSystem::from_json($r), $res); + } + + public function list_compatible_credential_manager_acs_systems( + string $acs_system_id + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + + $res = $this->seam->request( + "POST", + "/acs/systems/list_compatible_credential_manager_acs_systems", + json: (object) $request_payload, + inner_object: "acs_systems" + ); + + return array_map(fn($r) => AcsSystem::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/AcsUsersClient.php b/src/Routes/Clients/AcsUsersClient.php new file mode 100644 index 00000000..e608f54f --- /dev/null +++ b/src/Routes/Clients/AcsUsersClient.php @@ -0,0 +1,279 @@ +seam = $seam; + } + + public function add_to_access_group( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/users/add_to_access_group", + json: (object) $request_payload + ); + } + + public function create( + string $acs_system_id, + string $full_name, + mixed $access_schedule = null, + array $acs_access_group_ids = null, + string $email = null, + string $email_address = null, + string $phone_number = null, + string $user_identity_id = null + ): AcsUser { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($access_schedule !== null) { + $request_payload["access_schedule"] = $access_schedule; + } + if ($acs_access_group_ids !== null) { + $request_payload["acs_access_group_ids"] = $acs_access_group_ids; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/acs/users/create", + json: (object) $request_payload, + inner_object: "acs_user" + ); + + return AcsUser::from_json($res); + } + + public function delete(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/users/delete", + json: (object) $request_payload + ); + } + + public function get(string $acs_user_id): AcsUser + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->request( + "POST", + "/acs/users/get", + json: (object) $request_payload, + inner_object: "acs_user" + ); + + return AcsUser::from_json($res); + } + + public function list( + string $acs_system_id = null, + string $created_before = null, + float $limit = null, + string $user_identity_email_address = null, + string $user_identity_id = null, + string $user_identity_phone_number = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($user_identity_email_address !== null) { + $request_payload["user_identity_email_address"] = $user_identity_email_address; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_phone_number !== null) { + $request_payload["user_identity_phone_number"] = $user_identity_phone_number; + } + + $res = $this->seam->request( + "POST", + "/acs/users/list", + json: (object) $request_payload, + inner_object: "acs_users" + ); + + return array_map(fn($r) => AcsUser::from_json($r), $res); + } + + public function list_accessible_entrances(string $acs_user_id): array + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->request( + "POST", + "/acs/users/list_accessible_entrances", + json: (object) $request_payload, + inner_object: "acs_entrances" + ); + + return array_map(fn($r) => AcsEntrance::from_json($r), $res); + } + + public function remove_from_access_group( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/users/remove_from_access_group", + json: (object) $request_payload + ); + } + + public function revoke_access_to_all_entrances(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/users/revoke_access_to_all_entrances", + json: (object) $request_payload + ); + } + + public function suspend(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/users/suspend", + json: (object) $request_payload + ); + } + + public function unsuspend(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->request( + "POST", + "/acs/users/unsuspend", + json: (object) $request_payload + ); + } + + public function update( + string $acs_user_id, + mixed $access_schedule = null, + string $email = null, + string $email_address = null, + string $full_name = null, + string $hid_acs_system_id = null, + string $phone_number = null + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($access_schedule !== null) { + $request_payload["access_schedule"] = $access_schedule; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($hid_acs_system_id !== null) { + $request_payload["hid_acs_system_id"] = $hid_acs_system_id; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + + $this->seam->request( + "POST", + "/acs/users/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/AcsUsersUnmanagedClient.php b/src/Routes/Clients/AcsUsersUnmanagedClient.php new file mode 100644 index 00000000..23fcf88c --- /dev/null +++ b/src/Routes/Clients/AcsUsersUnmanagedClient.php @@ -0,0 +1,69 @@ +seam = $seam; + } + + public function get(string $acs_user_id): UnmanagedAcsUser + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->request( + "POST", + "/acs/users/unmanaged/get", + json: (object) $request_payload, + inner_object: "acs_user" + ); + + return UnmanagedAcsUser::from_json($res); + } + + public function list( + string $acs_system_id = null, + float $limit = null, + string $user_identity_email_address = null, + string $user_identity_id = null, + string $user_identity_phone_number = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($user_identity_email_address !== null) { + $request_payload["user_identity_email_address"] = $user_identity_email_address; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_phone_number !== null) { + $request_payload["user_identity_phone_number"] = $user_identity_phone_number; + } + + $res = $this->seam->request( + "POST", + "/acs/users/unmanaged/list", + json: (object) $request_payload, + inner_object: "acs_users" + ); + + return array_map(fn($r) => UnmanagedAcsUser::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/ActionAttemptsClient.php b/src/Routes/Clients/ActionAttemptsClient.php new file mode 100644 index 00000000..ffdc7aca --- /dev/null +++ b/src/Routes/Clients/ActionAttemptsClient.php @@ -0,0 +1,80 @@ +seam = $seam; + } + + public function get(string $action_attempt_id): ActionAttempt + { + $request_payload = []; + + if ($action_attempt_id !== null) { + $request_payload["action_attempt_id"] = $action_attempt_id; + } + + $res = $this->seam->request( + "POST", + "/action_attempts/get", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + return ActionAttempt::from_json($res); + } + + public function list(array $action_attempt_ids): array + { + $request_payload = []; + + if ($action_attempt_ids !== null) { + $request_payload["action_attempt_ids"] = $action_attempt_ids; + } + + $res = $this->seam->request( + "POST", + "/action_attempts/list", + json: (object) $request_payload, + inner_object: "action_attempts" + ); + + return array_map(fn($r) => ActionAttempt::from_json($r), $res); + } + public function poll_until_ready( + string $action_attempt_id, + float $timeout = 20.0 + ): ActionAttempt { + $seam = $this->seam; + $time_waiting = 0.0; + $polling_interval = 0.4; + $action_attempt = $seam->action_attempts->get($action_attempt_id); + + while ($action_attempt->status == "pending") { + $action_attempt = $seam->action_attempts->get( + $action_attempt->action_attempt_id + ); + if ($time_waiting > $timeout) { + throw new ActionAttemptTimeoutError($action_attempt, $timeout); + } + $time_waiting += $polling_interval; + usleep($polling_interval * 1000000); + } + + if ($action_attempt->status == "error") { + throw new ActionAttemptFailedError($action_attempt); + } + + return $action_attempt; + } +} diff --git a/src/Routes/Clients/BridgesClient.php b/src/Routes/Clients/BridgesClient.php new file mode 100644 index 00000000..6ba0b273 --- /dev/null +++ b/src/Routes/Clients/BridgesClient.php @@ -0,0 +1,43 @@ +seam = $seam; + } + + public function get(string $bridge_id): void + { + $request_payload = []; + + if ($bridge_id !== null) { + $request_payload["bridge_id"] = $bridge_id; + } + + $this->seam->request( + "POST", + "/bridges/get", + json: (object) $request_payload, + inner_object: "bridge" + ); + } + + public function list(): void + { + $request_payload = []; + + $this->seam->request( + "POST", + "/bridges/list", + json: (object) $request_payload, + inner_object: "bridges" + ); + } +} diff --git a/src/Routes/Clients/ClientSessionsClient.php b/src/Routes/Clients/ClientSessionsClient.php new file mode 100644 index 00000000..35d8904b --- /dev/null +++ b/src/Routes/Clients/ClientSessionsClient.php @@ -0,0 +1,206 @@ +seam = $seam; + } + + public function create( + array $connect_webview_ids = null, + array $connected_account_ids = null, + string $expires_at = null, + string $user_identifier_key = null, + array $user_identity_ids = null + ): ClientSession { + $request_payload = []; + + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($expires_at !== null) { + $request_payload["expires_at"] = $expires_at; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/create", + json: (object) $request_payload, + inner_object: "client_session" + ); + + return ClientSession::from_json($res); + } + + public function delete(string $client_session_id): void + { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + + $this->seam->request( + "POST", + "/client_sessions/delete", + json: (object) $request_payload + ); + } + + public function get( + string $client_session_id = null, + string $user_identifier_key = null + ): ClientSession { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/get", + json: (object) $request_payload, + inner_object: "client_session" + ); + + return ClientSession::from_json($res); + } + + public function get_or_create( + array $connect_webview_ids = null, + array $connected_account_ids = null, + string $expires_at = null, + string $user_identifier_key = null, + array $user_identity_ids = null + ): ClientSession { + $request_payload = []; + + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($expires_at !== null) { + $request_payload["expires_at"] = $expires_at; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/get_or_create", + json: (object) $request_payload, + inner_object: "client_session" + ); + + return ClientSession::from_json($res); + } + + public function grant_access( + string $client_session_id = null, + array $connect_webview_ids = null, + array $connected_account_ids = null, + string $user_identifier_key = null, + array $user_identity_ids = null + ): void { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + + $this->seam->request( + "POST", + "/client_sessions/grant_access", + json: (object) $request_payload + ); + } + + public function list( + string $client_session_id = null, + string $connect_webview_id = null, + string $user_identifier_key = null, + string $user_identity_id = null, + bool $without_user_identifier_key = null + ): array { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($without_user_identifier_key !== null) { + $request_payload["without_user_identifier_key"] = $without_user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/client_sessions/list", + json: (object) $request_payload, + inner_object: "client_sessions" + ); + + return array_map(fn($r) => ClientSession::from_json($r), $res); + } + + public function revoke(string $client_session_id): void + { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + + $this->seam->request( + "POST", + "/client_sessions/revoke", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/ConnectWebviewsClient.php b/src/Routes/Clients/ConnectWebviewsClient.php new file mode 100644 index 00000000..cd1f5b60 --- /dev/null +++ b/src/Routes/Clients/ConnectWebviewsClient.php @@ -0,0 +1,123 @@ +seam = $seam; + } + + public function create( + array $accepted_providers = null, + bool $automatically_manage_new_devices = null, + mixed $custom_metadata = null, + string $custom_redirect_failure_url = null, + string $custom_redirect_url = null, + string $device_selection_mode = null, + string $provider_category = null, + bool $wait_for_device_creation = null + ): ConnectWebview { + $request_payload = []; + + if ($accepted_providers !== null) { + $request_payload["accepted_providers"] = $accepted_providers; + } + if ($automatically_manage_new_devices !== null) { + $request_payload["automatically_manage_new_devices"] = $automatically_manage_new_devices; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + if ($custom_redirect_failure_url !== null) { + $request_payload["custom_redirect_failure_url"] = $custom_redirect_failure_url; + } + if ($custom_redirect_url !== null) { + $request_payload["custom_redirect_url"] = $custom_redirect_url; + } + if ($device_selection_mode !== null) { + $request_payload["device_selection_mode"] = $device_selection_mode; + } + if ($provider_category !== null) { + $request_payload["provider_category"] = $provider_category; + } + if ($wait_for_device_creation !== null) { + $request_payload["wait_for_device_creation"] = $wait_for_device_creation; + } + + $res = $this->seam->request( + "POST", + "/connect_webviews/create", + json: (object) $request_payload, + inner_object: "connect_webview" + ); + + return ConnectWebview::from_json($res); + } + + public function delete(string $connect_webview_id): void + { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + + $this->seam->request( + "POST", + "/connect_webviews/delete", + json: (object) $request_payload + ); + } + + public function get(string $connect_webview_id): ConnectWebview + { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + + $res = $this->seam->request( + "POST", + "/connect_webviews/get", + json: (object) $request_payload, + inner_object: "connect_webview" + ); + + return ConnectWebview::from_json($res); + } + + public function list( + mixed $custom_metadata_has = null, + float $limit = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/connect_webviews/list", + json: (object) $request_payload, + inner_object: "connect_webviews" + ); + + return array_map(fn($r) => ConnectWebview::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/ConnectedAccountsClient.php b/src/Routes/Clients/ConnectedAccountsClient.php new file mode 100644 index 00000000..078ce47b --- /dev/null +++ b/src/Routes/Clients/ConnectedAccountsClient.php @@ -0,0 +1,106 @@ +seam = $seam; + } + + public function delete( + string $connected_account_id, + bool $sync = null + ): void { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/connected_accounts/delete", + json: (object) $request_payload + ); + } + + public function get( + string $connected_account_id = null, + string $email = null + ): ConnectedAccount { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + + $res = $this->seam->request( + "POST", + "/connected_accounts/get", + json: (object) $request_payload, + inner_object: "connected_account" + ); + + return ConnectedAccount::from_json($res); + } + + public function list( + mixed $custom_metadata_has = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/connected_accounts/list", + json: (object) $request_payload, + inner_object: "connected_accounts" + ); + + return array_map(fn($r) => ConnectedAccount::from_json($r), $res); + } + + public function update( + string $connected_account_id, + bool $automatically_manage_new_devices = null, + mixed $custom_metadata = null + ): void { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($automatically_manage_new_devices !== null) { + $request_payload["automatically_manage_new_devices"] = $automatically_manage_new_devices; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + + $this->seam->request( + "POST", + "/connected_accounts/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/DevicesClient.php b/src/Routes/Clients/DevicesClient.php new file mode 100644 index 00000000..7c0e3b3b --- /dev/null +++ b/src/Routes/Clients/DevicesClient.php @@ -0,0 +1,174 @@ +seam = $seam; + $this->simulate = new DevicesSimulateClient($seam); + $this->unmanaged = new DevicesUnmanagedClient($seam); + } + + public function delete(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/devices/delete", + json: (object) $request_payload + ); + } + + public function get(string $device_id = null, string $name = null): Device + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/devices/get", + json: (object) $request_payload, + inner_object: "device" + ); + + return Device::from_json($res); + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/devices/list", + json: (object) $request_payload, + inner_object: "devices" + ); + + return array_map(fn($r) => Device::from_json($r), $res); + } + + public function list_device_providers( + string $provider_category = null + ): array { + $request_payload = []; + + if ($provider_category !== null) { + $request_payload["provider_category"] = $provider_category; + } + + $res = $this->seam->request( + "POST", + "/devices/list_device_providers", + json: (object) $request_payload, + inner_object: "device_providers" + ); + + return array_map(fn($r) => DeviceProvider::from_json($r), $res); + } + + public function update( + string $device_id, + mixed $custom_metadata = null, + bool $is_managed = null, + string $name = null, + mixed $properties = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($properties !== null) { + $request_payload["properties"] = $properties; + } + + $this->seam->request( + "POST", + "/devices/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/DevicesSimulateClient.php b/src/Routes/Clients/DevicesSimulateClient.php new file mode 100644 index 00000000..cb6fba30 --- /dev/null +++ b/src/Routes/Clients/DevicesSimulateClient.php @@ -0,0 +1,60 @@ +seam = $seam; + } + + public function connect(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/devices/simulate/connect", + json: (object) $request_payload + ); + } + + public function disconnect(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/devices/simulate/disconnect", + json: (object) $request_payload + ); + } + + public function remove(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/devices/simulate/remove", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/DevicesUnmanagedClient.php b/src/Routes/Clients/DevicesUnmanagedClient.php new file mode 100644 index 00000000..95c31614 --- /dev/null +++ b/src/Routes/Clients/DevicesUnmanagedClient.php @@ -0,0 +1,124 @@ +seam = $seam; + } + + public function get( + string $device_id = null, + string $name = null + ): UnmanagedDevice { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/devices/unmanaged/get", + json: (object) $request_payload, + inner_object: "device" + ); + + return UnmanagedDevice::from_json($res); + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/devices/unmanaged/list", + json: (object) $request_payload, + inner_object: "devices" + ); + + return array_map(fn($r) => UnmanagedDevice::from_json($r), $res); + } + + public function update(string $device_id, bool $is_managed): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + + $this->seam->request( + "POST", + "/devices/unmanaged/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/EventsClient.php b/src/Routes/Clients/EventsClient.php new file mode 100644 index 00000000..ee082979 --- /dev/null +++ b/src/Routes/Clients/EventsClient.php @@ -0,0 +1,114 @@ +seam = $seam; + } + + public function get( + string $device_id = null, + string $event_id = null, + string $event_type = null + ): Event { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($event_id !== null) { + $request_payload["event_id"] = $event_id; + } + if ($event_type !== null) { + $request_payload["event_type"] = $event_type; + } + + $res = $this->seam->request( + "POST", + "/events/get", + json: (object) $request_payload, + inner_object: "event" + ); + + return Event::from_json($res); + } + + public function list( + string $access_code_id = null, + array $access_code_ids = null, + string $acs_system_id = null, + array $acs_system_ids = null, + array $between = null, + string $connect_webview_id = null, + string $connected_account_id = null, + string $device_id = null, + array $device_ids = null, + string $event_type = null, + array $event_types = null, + float $limit = null, + string $since = null, + float $unstable_offset = null + ): array { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($access_code_ids !== null) { + $request_payload["access_code_ids"] = $access_code_ids; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_system_ids !== null) { + $request_payload["acs_system_ids"] = $acs_system_ids; + } + if ($between !== null) { + $request_payload["between"] = $between; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($event_type !== null) { + $request_payload["event_type"] = $event_type; + } + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($since !== null) { + $request_payload["since"] = $since; + } + if ($unstable_offset !== null) { + $request_payload["unstable_offset"] = $unstable_offset; + } + + $res = $this->seam->request( + "POST", + "/events/list", + json: (object) $request_payload, + inner_object: "events" + ); + + return array_map(fn($r) => Event::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/LocksClient.php b/src/Routes/Clients/LocksClient.php new file mode 100644 index 00000000..9ac134d1 --- /dev/null +++ b/src/Routes/Clients/LocksClient.php @@ -0,0 +1,169 @@ +seam = $seam; + } + + public function get(string $device_id = null, string $name = null): Device + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/locks/get", + json: (object) $request_payload, + inner_object: "device" + ); + + return Device::from_json($res); + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/locks/list", + json: (object) $request_payload, + inner_object: "devices" + ); + + return array_map(fn($r) => Device::from_json($r), $res); + } + + public function lock_door( + string $device_id, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/locks/lock_door", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function unlock_door( + string $device_id, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/locks/unlock_door", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } +} diff --git a/src/Routes/Clients/NetworksClient.php b/src/Routes/Clients/NetworksClient.php new file mode 100644 index 00000000..08102f60 --- /dev/null +++ b/src/Routes/Clients/NetworksClient.php @@ -0,0 +1,48 @@ +seam = $seam; + } + + public function get(string $network_id): Network + { + $request_payload = []; + + if ($network_id !== null) { + $request_payload["network_id"] = $network_id; + } + + $res = $this->seam->request( + "POST", + "/networks/get", + json: (object) $request_payload, + inner_object: "network" + ); + + return Network::from_json($res); + } + + public function list(): array + { + $request_payload = []; + + $res = $this->seam->request( + "POST", + "/networks/list", + json: (object) $request_payload, + inner_object: "networks" + ); + + return array_map(fn($r) => Network::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/NoiseSensorsClient.php b/src/Routes/Clients/NoiseSensorsClient.php new file mode 100644 index 00000000..51fafe4a --- /dev/null +++ b/src/Routes/Clients/NoiseSensorsClient.php @@ -0,0 +1,86 @@ +seam = $seam; + $this->noise_thresholds = new NoiseSensorsNoiseThresholdsClient($seam); + $this->simulate = new NoiseSensorsSimulateClient($seam); + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/noise_sensors/list", + json: (object) $request_payload, + inner_object: "devices" + ); + + return array_map(fn($r) => Device::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php b/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php new file mode 100644 index 00000000..36606eb3 --- /dev/null +++ b/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php @@ -0,0 +1,166 @@ +seam = $seam; + } + + public function create( + string $device_id, + string $ends_daily_at, + string $starts_daily_at, + string $name = null, + float $noise_threshold_decibels = null, + float $noise_threshold_nrs = null, + bool $sync = null + ): NoiseThreshold { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($ends_daily_at !== null) { + $request_payload["ends_daily_at"] = $ends_daily_at; + } + if ($starts_daily_at !== null) { + $request_payload["starts_daily_at"] = $starts_daily_at; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($noise_threshold_decibels !== null) { + $request_payload["noise_threshold_decibels"] = $noise_threshold_decibels; + } + if ($noise_threshold_nrs !== null) { + $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/create", + json: (object) $request_payload, + inner_object: "noise_threshold" + ); + + return NoiseThreshold::from_json($res); + } + + public function delete( + string $device_id, + string $noise_threshold_id, + bool $sync = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/delete", + json: (object) $request_payload + ); + } + + public function get(string $noise_threshold_id): NoiseThreshold + { + $request_payload = []; + + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + + $res = $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/get", + json: (object) $request_payload, + inner_object: "noise_threshold" + ); + + return NoiseThreshold::from_json($res); + } + + public function list(string $device_id, bool $is_programmed = null): array + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($is_programmed !== null) { + $request_payload["is_programmed"] = $is_programmed; + } + + $res = $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/list", + json: (object) $request_payload, + inner_object: "noise_thresholds" + ); + + return array_map(fn($r) => NoiseThreshold::from_json($r), $res); + } + + public function update( + string $device_id, + string $noise_threshold_id, + string $ends_daily_at = null, + string $name = null, + float $noise_threshold_decibels = null, + float $noise_threshold_nrs = null, + string $starts_daily_at = null, + bool $sync = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + if ($ends_daily_at !== null) { + $request_payload["ends_daily_at"] = $ends_daily_at; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($noise_threshold_decibels !== null) { + $request_payload["noise_threshold_decibels"] = $noise_threshold_decibels; + } + if ($noise_threshold_nrs !== null) { + $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; + } + if ($starts_daily_at !== null) { + $request_payload["starts_daily_at"] = $starts_daily_at; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->request( + "POST", + "/noise_sensors/noise_thresholds/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/NoiseSensorsSimulateClient.php b/src/Routes/Clients/NoiseSensorsSimulateClient.php new file mode 100644 index 00000000..089a8475 --- /dev/null +++ b/src/Routes/Clients/NoiseSensorsSimulateClient.php @@ -0,0 +1,30 @@ +seam = $seam; + } + + public function trigger_noise_threshold(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/noise_sensors/simulate/trigger_noise_threshold", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/PhonesClient.php b/src/Routes/Clients/PhonesClient.php new file mode 100644 index 00000000..b0041590 --- /dev/null +++ b/src/Routes/Clients/PhonesClient.php @@ -0,0 +1,73 @@ +seam = $seam; + $this->simulate = new PhonesSimulateClient($seam); + } + + public function deactivate(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/phones/deactivate", + json: (object) $request_payload + ); + } + + public function get(string $device_id): Phone + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/phones/get", + json: (object) $request_payload, + inner_object: "phone" + ); + + return Phone::from_json($res); + } + + public function list( + string $acs_credential_id = null, + string $owner_user_identity_id = null + ): array { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($owner_user_identity_id !== null) { + $request_payload["owner_user_identity_id"] = $owner_user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/phones/list", + json: (object) $request_payload, + inner_object: "phones" + ); + + return array_map(fn($r) => Phone::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/PhonesSimulateClient.php b/src/Routes/Clients/PhonesSimulateClient.php new file mode 100644 index 00000000..38ea9a7c --- /dev/null +++ b/src/Routes/Clients/PhonesSimulateClient.php @@ -0,0 +1,47 @@ +seam = $seam; + } + + public function create_sandbox_phone( + string $user_identity_id, + mixed $assa_abloy_metadata = null, + string $custom_sdk_installation_id = null, + mixed $phone_metadata = null + ): Phone { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($assa_abloy_metadata !== null) { + $request_payload["assa_abloy_metadata"] = $assa_abloy_metadata; + } + if ($custom_sdk_installation_id !== null) { + $request_payload["custom_sdk_installation_id"] = $custom_sdk_installation_id; + } + if ($phone_metadata !== null) { + $request_payload["phone_metadata"] = $phone_metadata; + } + + $res = $this->seam->request( + "POST", + "/phones/simulate/create_sandbox_phone", + json: (object) $request_payload, + inner_object: "phone" + ); + + return Phone::from_json($res); + } +} diff --git a/src/Routes/Clients/ThermostatsClient.php b/src/Routes/Clients/ThermostatsClient.php new file mode 100644 index 00000000..fc27d0cd --- /dev/null +++ b/src/Routes/Clients/ThermostatsClient.php @@ -0,0 +1,564 @@ +seam = $seam; + $this->schedules = new ThermostatsSchedulesClient($seam); + $this->simulate = new ThermostatsSimulateClient($seam); + } + + public function activate_climate_preset( + string $climate_preset_key, + string $device_id, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->request( + "POST", + "/thermostats/activate_climate_preset", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function cool( + string $device_id, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/cool", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function create_climate_preset( + string $climate_preset_key, + string $device_id, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + string $fan_mode_setting = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + string $hvac_mode_setting = null, + bool $manual_override_allowed = null, + string $name = null + ): void { + $request_payload = []; + + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; + } + if ($fan_mode_setting !== null) { + $request_payload["fan_mode_setting"] = $fan_mode_setting; + } + if ($heating_set_point_celsius !== null) { + $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; + } + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($manual_override_allowed !== null) { + $request_payload["manual_override_allowed"] = $manual_override_allowed; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $this->seam->request( + "POST", + "/thermostats/create_climate_preset", + json: (object) $request_payload + ); + } + + public function delete_climate_preset( + string $climate_preset_key, + string $device_id + ): void { + $request_payload = []; + + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/thermostats/delete_climate_preset", + json: (object) $request_payload + ); + } + + public function get(string $device_id = null, string $name = null): Device + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/thermostats/get", + json: (object) $request_payload, + inner_object: "thermostat" + ); + + return Device::from_json($res); + } + + public function heat( + string $device_id, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($heating_set_point_celsius !== null) { + $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/heat", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function heat_cool( + string $device_id, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/heat_cool", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function list( + string $connect_webview_id = null, + string $connected_account_id = null, + array $connected_account_ids = null, + string $created_before = null, + mixed $custom_metadata_has = null, + array $device_ids = null, + string $device_type = null, + array $device_types = null, + array $exclude_if = null, + array $include_if = null, + float $limit = null, + string $manufacturer = null, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/thermostats/list", + json: (object) $request_payload, + inner_object: "devices" + ); + + return array_map(fn($r) => Device::from_json($r), $res); + } + + public function off( + string $device_id, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/off", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function set_fallback_climate_preset( + string $climate_preset_key, + string $device_id + ): void { + $request_payload = []; + + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->request( + "POST", + "/thermostats/set_fallback_climate_preset", + json: (object) $request_payload + ); + } + + public function set_fan_mode( + string $device_id, + string $fan_mode = null, + string $fan_mode_setting = null, + bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($fan_mode !== null) { + $request_payload["fan_mode"] = $fan_mode; + } + if ($fan_mode_setting !== null) { + $request_payload["fan_mode_setting"] = $fan_mode_setting; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->request( + "POST", + "/thermostats/set_fan_mode", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function set_hvac_mode( + string $device_id, + string $hvac_mode_setting, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($cooling_set_point_celsius !== null) { + $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; + } + + $res = $this->seam->request( + "POST", + "/thermostats/set_hvac_mode", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } + + public function set_temperature_threshold( + string $device_id, + float $lower_limit_celsius = null, + float $lower_limit_fahrenheit = null, + float $upper_limit_celsius = null, + float $upper_limit_fahrenheit = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($lower_limit_celsius !== null) { + $request_payload["lower_limit_celsius"] = $lower_limit_celsius; + } + if ($lower_limit_fahrenheit !== null) { + $request_payload["lower_limit_fahrenheit"] = $lower_limit_fahrenheit; + } + if ($upper_limit_celsius !== null) { + $request_payload["upper_limit_celsius"] = $upper_limit_celsius; + } + if ($upper_limit_fahrenheit !== null) { + $request_payload["upper_limit_fahrenheit"] = $upper_limit_fahrenheit; + } + + $this->seam->request( + "POST", + "/thermostats/set_temperature_threshold", + json: (object) $request_payload + ); + } + + public function update_climate_preset( + string $climate_preset_key, + string $device_id, + bool $manual_override_allowed, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + string $fan_mode_setting = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null, + string $hvac_mode_setting = null, + string $name = null + ): void { + $request_payload = []; + + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($manual_override_allowed !== null) { + $request_payload["manual_override_allowed"] = $manual_override_allowed; + } + if ($cooling_set_point_celsius !== null) { + $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; + } + if ($fan_mode_setting !== null) { + $request_payload["fan_mode_setting"] = $fan_mode_setting; + } + if ($heating_set_point_celsius !== null) { + $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; + } + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $this->seam->request( + "POST", + "/thermostats/update_climate_preset", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/ThermostatsSchedulesClient.php b/src/Routes/Clients/ThermostatsSchedulesClient.php new file mode 100644 index 00000000..94b493ac --- /dev/null +++ b/src/Routes/Clients/ThermostatsSchedulesClient.php @@ -0,0 +1,155 @@ +seam = $seam; + } + + public function create( + string $climate_preset_key, + string $device_id, + string $ends_at, + string $starts_at, + bool $is_override_allowed = null, + mixed $max_override_period_minutes = null, + string $name = null + ): ThermostatSchedule { + $request_payload = []; + + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($is_override_allowed !== null) { + $request_payload["is_override_allowed"] = $is_override_allowed; + } + if ($max_override_period_minutes !== null) { + $request_payload["max_override_period_minutes"] = $max_override_period_minutes; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->request( + "POST", + "/thermostats/schedules/create", + json: (object) $request_payload, + inner_object: "thermostat_schedule" + ); + + return ThermostatSchedule::from_json($res); + } + + public function delete(string $thermostat_schedule_id): void + { + $request_payload = []; + + if ($thermostat_schedule_id !== null) { + $request_payload["thermostat_schedule_id"] = $thermostat_schedule_id; + } + + $this->seam->request( + "POST", + "/thermostats/schedules/delete", + json: (object) $request_payload + ); + } + + public function get(string $thermostat_schedule_id): ThermostatSchedule + { + $request_payload = []; + + if ($thermostat_schedule_id !== null) { + $request_payload["thermostat_schedule_id"] = $thermostat_schedule_id; + } + + $res = $this->seam->request( + "POST", + "/thermostats/schedules/get", + json: (object) $request_payload, + inner_object: "thermostat_schedule" + ); + + return ThermostatSchedule::from_json($res); + } + + public function list( + string $device_id, + string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->request( + "POST", + "/thermostats/schedules/list", + json: (object) $request_payload, + inner_object: "thermostat_schedules" + ); + + return array_map(fn($r) => ThermostatSchedule::from_json($r), $res); + } + + public function update( + string $thermostat_schedule_id, + string $climate_preset_key = null, + string $ends_at = null, + bool $is_override_allowed = null, + mixed $max_override_period_minutes = null, + string $name = null, + string $starts_at = null + ): void { + $request_payload = []; + + if ($thermostat_schedule_id !== null) { + $request_payload["thermostat_schedule_id"] = $thermostat_schedule_id; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_override_allowed !== null) { + $request_payload["is_override_allowed"] = $is_override_allowed; + } + if ($max_override_period_minutes !== null) { + $request_payload["max_override_period_minutes"] = $max_override_period_minutes; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + + $this->seam->request( + "POST", + "/thermostats/schedules/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/ThermostatsSimulateClient.php b/src/Routes/Clients/ThermostatsSimulateClient.php new file mode 100644 index 00000000..57f66461 --- /dev/null +++ b/src/Routes/Clients/ThermostatsSimulateClient.php @@ -0,0 +1,75 @@ +seam = $seam; + } + + public function hvac_mode_adjusted( + string $device_id, + string $hvac_mode, + float $cooling_set_point_celsius = null, + float $cooling_set_point_fahrenheit = null, + float $heating_set_point_celsius = null, + float $heating_set_point_fahrenheit = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($hvac_mode !== null) { + $request_payload["hvac_mode"] = $hvac_mode; + } + if ($cooling_set_point_celsius !== null) { + $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; + } + + $this->seam->request( + "POST", + "/thermostats/simulate/hvac_mode_adjusted", + json: (object) $request_payload + ); + } + + public function temperature_reached( + string $device_id, + float $temperature_celsius = null, + float $temperature_fahrenheit = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($temperature_celsius !== null) { + $request_payload["temperature_celsius"] = $temperature_celsius; + } + if ($temperature_fahrenheit !== null) { + $request_payload["temperature_fahrenheit"] = $temperature_fahrenheit; + } + + $this->seam->request( + "POST", + "/thermostats/simulate/temperature_reached", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/UserIdentitiesClient.php b/src/Routes/Clients/UserIdentitiesClient.php new file mode 100644 index 00000000..1caf5814 --- /dev/null +++ b/src/Routes/Clients/UserIdentitiesClient.php @@ -0,0 +1,275 @@ +seam = $seam; + $this->enrollment_automations = new UserIdentitiesEnrollmentAutomationsClient( + $seam + ); + } + + public function add_acs_user( + string $acs_user_id, + string $user_identity_id + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $this->seam->request( + "POST", + "/user_identities/add_acs_user", + json: (object) $request_payload + ); + } + + public function create( + string $email_address = null, + string $full_name = null, + string $phone_number = null, + string $user_identity_key = null + ): UserIdentity { + $request_payload = []; + + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + + $res = $this->seam->request( + "POST", + "/user_identities/create", + json: (object) $request_payload, + inner_object: "user_identity" + ); + + return UserIdentity::from_json($res); + } + + public function delete(string $user_identity_id): void + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $this->seam->request( + "POST", + "/user_identities/delete", + json: (object) $request_payload + ); + } + + public function get( + string $user_identity_id = null, + string $user_identity_key = null + ): UserIdentity { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + + $res = $this->seam->request( + "POST", + "/user_identities/get", + json: (object) $request_payload, + inner_object: "user_identity" + ); + + return UserIdentity::from_json($res); + } + + public function grant_access_to_device( + string $device_id, + string $user_identity_id + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $this->seam->request( + "POST", + "/user_identities/grant_access_to_device", + json: (object) $request_payload + ); + } + + public function list(string $credential_manager_acs_system_id = null): array + { + $request_payload = []; + + if ($credential_manager_acs_system_id !== null) { + $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; + } + + $res = $this->seam->request( + "POST", + "/user_identities/list", + json: (object) $request_payload, + inner_object: "user_identities" + ); + + return array_map(fn($r) => UserIdentity::from_json($r), $res); + } + + public function list_accessible_devices(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/user_identities/list_accessible_devices", + json: (object) $request_payload, + inner_object: "devices" + ); + + return array_map(fn($r) => Device::from_json($r), $res); + } + + public function list_acs_systems(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/user_identities/list_acs_systems", + json: (object) $request_payload, + inner_object: "acs_systems" + ); + + return array_map(fn($r) => AcsSystem::from_json($r), $res); + } + + public function list_acs_users(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/user_identities/list_acs_users", + json: (object) $request_payload, + inner_object: "acs_users" + ); + + return array_map(fn($r) => AcsUser::from_json($r), $res); + } + + public function remove_acs_user( + string $acs_user_id, + string $user_identity_id + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $this->seam->request( + "POST", + "/user_identities/remove_acs_user", + json: (object) $request_payload + ); + } + + public function revoke_access_to_device( + string $device_id, + string $user_identity_id + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $this->seam->request( + "POST", + "/user_identities/revoke_access_to_device", + json: (object) $request_payload + ); + } + + public function update( + string $user_identity_id, + string $email_address = null, + string $full_name = null, + string $phone_number = null, + string $user_identity_key = null + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + + $this->seam->request( + "POST", + "/user_identities/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php b/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php new file mode 100644 index 00000000..eb4d5d64 --- /dev/null +++ b/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php @@ -0,0 +1,100 @@ +seam = $seam; + } + + public function delete(string $enrollment_automation_id): void + { + $request_payload = []; + + if ($enrollment_automation_id !== null) { + $request_payload["enrollment_automation_id"] = $enrollment_automation_id; + } + + $this->seam->request( + "POST", + "/user_identities/enrollment_automations/delete", + json: (object) $request_payload + ); + } + + public function get(string $enrollment_automation_id): EnrollmentAutomation + { + $request_payload = []; + + if ($enrollment_automation_id !== null) { + $request_payload["enrollment_automation_id"] = $enrollment_automation_id; + } + + $res = $this->seam->request( + "POST", + "/user_identities/enrollment_automations/get", + json: (object) $request_payload, + inner_object: "enrollment_automation" + ); + + return EnrollmentAutomation::from_json($res); + } + + public function launch( + string $credential_manager_acs_system_id, + string $user_identity_id, + string $acs_credential_pool_id = null, + bool $create_credential_manager_user = null, + string $credential_manager_acs_user_id = null + ): void { + $request_payload = []; + + if ($credential_manager_acs_system_id !== null) { + $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($acs_credential_pool_id !== null) { + $request_payload["acs_credential_pool_id"] = $acs_credential_pool_id; + } + if ($create_credential_manager_user !== null) { + $request_payload["create_credential_manager_user"] = $create_credential_manager_user; + } + if ($credential_manager_acs_user_id !== null) { + $request_payload["credential_manager_acs_user_id"] = $credential_manager_acs_user_id; + } + + $this->seam->request( + "POST", + "/user_identities/enrollment_automations/launch", + json: (object) $request_payload, + inner_object: "enrollment_automation" + ); + } + + public function list(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/user_identities/enrollment_automations/list", + json: (object) $request_payload, + inner_object: "enrollment_automations" + ); + + return array_map(fn($r) => EnrollmentAutomation::from_json($r), $res); + } +} diff --git a/src/Routes/Clients/WebhooksClient.php b/src/Routes/Clients/WebhooksClient.php new file mode 100644 index 00000000..7c8115b0 --- /dev/null +++ b/src/Routes/Clients/WebhooksClient.php @@ -0,0 +1,102 @@ +seam = $seam; + } + + public function create(string $url, array $event_types = null): Webhook + { + $request_payload = []; + + if ($url !== null) { + $request_payload["url"] = $url; + } + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + + $res = $this->seam->request( + "POST", + "/webhooks/create", + json: (object) $request_payload, + inner_object: "webhook" + ); + + return Webhook::from_json($res); + } + + public function delete(string $webhook_id): void + { + $request_payload = []; + + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + + $this->seam->request( + "POST", + "/webhooks/delete", + json: (object) $request_payload + ); + } + + public function get(string $webhook_id): Webhook + { + $request_payload = []; + + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + + $res = $this->seam->request( + "POST", + "/webhooks/get", + json: (object) $request_payload, + inner_object: "webhook" + ); + + return Webhook::from_json($res); + } + + public function list(): array + { + $request_payload = []; + + $res = $this->seam->request( + "POST", + "/webhooks/list", + json: (object) $request_payload, + inner_object: "webhooks" + ); + + return array_map(fn($r) => Webhook::from_json($r), $res); + } + + public function update(array $event_types, string $webhook_id): void + { + $request_payload = []; + + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + + $this->seam->request( + "POST", + "/webhooks/update", + json: (object) $request_payload + ); + } +} diff --git a/src/Routes/Clients/WorkspacesClient.php b/src/Routes/Clients/WorkspacesClient.php new file mode 100644 index 00000000..5554a0b4 --- /dev/null +++ b/src/Routes/Clients/WorkspacesClient.php @@ -0,0 +1,111 @@ +seam = $seam; + } + + public function create( + string $name, + string $company_name = null, + string $connect_partner_name = null, + bool $is_sandbox = null, + string $webview_logo_shape = null, + string $webview_primary_button_color = null, + string $webview_primary_button_text_color = null + ): Workspace { + $request_payload = []; + + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($company_name !== null) { + $request_payload["company_name"] = $company_name; + } + if ($connect_partner_name !== null) { + $request_payload["connect_partner_name"] = $connect_partner_name; + } + if ($is_sandbox !== null) { + $request_payload["is_sandbox"] = $is_sandbox; + } + if ($webview_logo_shape !== null) { + $request_payload["webview_logo_shape"] = $webview_logo_shape; + } + if ($webview_primary_button_color !== null) { + $request_payload["webview_primary_button_color"] = $webview_primary_button_color; + } + if ($webview_primary_button_text_color !== null) { + $request_payload["webview_primary_button_text_color"] = $webview_primary_button_text_color; + } + + $res = $this->seam->request( + "POST", + "/workspaces/create", + json: (object) $request_payload, + inner_object: "workspace" + ); + + return Workspace::from_json($res); + } + + public function get(): Workspace + { + $request_payload = []; + + $res = $this->seam->request( + "POST", + "/workspaces/get", + json: (object) $request_payload, + inner_object: "workspace" + ); + + return Workspace::from_json($res); + } + + public function list(): array + { + $request_payload = []; + + $res = $this->seam->request( + "POST", + "/workspaces/list", + json: (object) $request_payload, + inner_object: "workspaces" + ); + + return array_map(fn($r) => Workspace::from_json($r), $res); + } + + public function reset_sandbox( + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + $res = $this->seam->request( + "POST", + "/workspaces/reset_sandbox", + json: (object) $request_payload, + inner_object: "action_attempt" + ); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($res); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $res->action_attempt_id + ); + + return $action_attempt; + } +} diff --git a/src/Routes/Objects/AccessCode.php b/src/Routes/Objects/AccessCode.php new file mode 100644 index 00000000..54f18ea7 --- /dev/null +++ b/src/Routes/Objects/AccessCode.php @@ -0,0 +1,68 @@ +access_code_id, + created_at: $json->created_at, + device_id: $json->device_id, + errors: array_map( + fn($e) => AccessCodeErrors::from_json($e), + $json->errors ?? [] + ), + is_backup_access_code_available: $json->is_backup_access_code_available, + is_external_modification_allowed: $json->is_external_modification_allowed, + is_managed: $json->is_managed, + is_offline_access_code: $json->is_offline_access_code, + is_one_time_use: $json->is_one_time_use, + status: $json->status, + type: $json->type, + warnings: array_map( + fn($w) => AccessCodeWarnings::from_json($w), + $json->warnings ?? [] + ), + is_backup: $json->is_backup ?? null, + is_scheduled_on_device: $json->is_scheduled_on_device ?? null, + is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? + null, + code: $json->code ?? null, + common_code_key: $json->common_code_key ?? null, + name: $json->name ?? null, + ends_at: $json->ends_at ?? null, + pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? + null, + starts_at: $json->starts_at ?? null + ); + } + + public function __construct( + public string $access_code_id, + public string $created_at, + public string $device_id, + public array $errors, + public bool $is_backup_access_code_available, + public bool $is_external_modification_allowed, + public bool $is_managed, + public bool $is_offline_access_code, + public bool $is_one_time_use, + public string $status, + public string $type, + public array $warnings, + public bool|null $is_backup, + public bool|null $is_scheduled_on_device, + public bool|null $is_waiting_for_code_assignment, + public string|null $code, + public string|null $common_code_key, + public string|null $name, + public string|null $ends_at, + public string|null $pulled_backup_access_code_id, + public string|null $starts_at + ) {} +} diff --git a/src/Routes/Objects/AccessCodeErrors.php b/src/Routes/Objects/AccessCodeErrors.php new file mode 100644 index 00000000..0f2c9c71 --- /dev/null +++ b/src/Routes/Objects/AccessCodeErrors.php @@ -0,0 +1,31 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_access_code_error: $json->is_access_code_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_access_code_error, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) {} +} diff --git a/src/Routes/Objects/AccessCodeWarnings.php b/src/Routes/Objects/AccessCodeWarnings.php new file mode 100644 index 00000000..61689026 --- /dev/null +++ b/src/Routes/Objects/AccessCodeWarnings.php @@ -0,0 +1,24 @@ +message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/AcsAccessGroup.php b/src/Routes/Objects/AcsAccessGroup.php new file mode 100644 index 00000000..3ca3a222 --- /dev/null +++ b/src/Routes/Objects/AcsAccessGroup.php @@ -0,0 +1,45 @@ +access_group_type, + access_group_type_display_name: $json->access_group_type_display_name, + acs_access_group_id: $json->acs_access_group_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + external_type: $json->external_type, + external_type_display_name: $json->external_type_display_name, + is_managed: $json->is_managed, + name: $json->name, + warnings: array_map( + fn($w) => AcsAccessGroupWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $access_group_type, + public string $access_group_type_display_name, + public string $acs_access_group_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public string $external_type, + public string $external_type_display_name, + public bool $is_managed, + public string $name, + public array $warnings, + public string $workspace_id + ) {} +} diff --git a/src/Routes/Objects/AcsAccessGroupWarnings.php b/src/Routes/Objects/AcsAccessGroupWarnings.php new file mode 100644 index 00000000..c70a1d51 --- /dev/null +++ b/src/Routes/Objects/AcsAccessGroupWarnings.php @@ -0,0 +1,24 @@ +created_at, + message: $json->message, + warning_code: $json->warning_code + ); + } + + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) {} +} diff --git a/src/Routes/Objects/AcsCredential.php b/src/Routes/Objects/AcsCredential.php new file mode 100644 index 00000000..75697fd6 --- /dev/null +++ b/src/Routes/Objects/AcsCredential.php @@ -0,0 +1,88 @@ +access_method, + acs_credential_id: $json->acs_credential_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsCredentialErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => AcsCredentialWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? AcsCredentialAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + ends_at: $json->ends_at ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_issued: $json->is_issued ?? null, + is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? + null, + is_one_time_use: $json->is_one_time_use ?? null, + parent_acs_credential_id: $json->parent_acs_credential_id ?? null, + starts_at: $json->starts_at ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsCredentialVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null + ); + } + + public function __construct( + public string $access_method, + public string $acs_credential_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public string|null $acs_credential_pool_id, + public string|null $acs_user_id, + public AcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $ends_at, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_issued, + public bool|null $is_multi_phone_sync_credential, + public bool|null $is_one_time_use, + public string|null $parent_acs_credential_id, + public string|null $starts_at, + public AcsCredentialVisionlineMetadata|null $visionline_metadata, + public string|null $card_number, + public string|null $code, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at + ) {} +} diff --git a/src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php b/src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php new file mode 100644 index 00000000..764a498c --- /dev/null +++ b/src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php @@ -0,0 +1,30 @@ +door_names ?? null, + endpoint_id: $json->endpoint_id ?? null, + key_id: $json->key_id ?? null, + key_issuing_request_id: $json->key_issuing_request_id ?? null, + override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? + null + ); + } + + public function __construct( + public array|null $door_names, + public string|null $endpoint_id, + public string|null $key_id, + public string|null $key_issuing_request_id, + public array|null $override_guest_acs_entrance_ids + ) {} +} diff --git a/src/Routes/Objects/AcsCredentialErrors.php b/src/Routes/Objects/AcsCredentialErrors.php new file mode 100644 index 00000000..bc78a3b5 --- /dev/null +++ b/src/Routes/Objects/AcsCredentialErrors.php @@ -0,0 +1,24 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/AcsCredentialPool.php b/src/Routes/Objects/AcsCredentialPool.php new file mode 100644 index 00000000..24545731 --- /dev/null +++ b/src/Routes/Objects/AcsCredentialPool.php @@ -0,0 +1,32 @@ +acs_credential_pool_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + external_type: $json->external_type, + external_type_display_name: $json->external_type_display_name, + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $acs_credential_pool_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public string $external_type, + public string $external_type_display_name, + public string $workspace_id + ) {} +} diff --git a/src/Routes/Objects/AcsCredentialProvisioningAutomation.php b/src/Routes/Objects/AcsCredentialProvisioningAutomation.php new file mode 100644 index 00000000..9ed63855 --- /dev/null +++ b/src/Routes/Objects/AcsCredentialProvisioningAutomation.php @@ -0,0 +1,29 @@ +acs_credential_provisioning_automation_id, + created_at: $json->created_at, + credential_manager_acs_system_id: $json->credential_manager_acs_system_id, + user_identity_id: $json->user_identity_id, + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $acs_credential_provisioning_automation_id, + public string $created_at, + public string $credential_manager_acs_system_id, + public string $user_identity_id, + public string $workspace_id + ) {} +} diff --git a/src/Routes/Objects/AcsCredentialVisionlineMetadata.php b/src/Routes/Objects/AcsCredentialVisionlineMetadata.php new file mode 100644 index 00000000..61023a63 --- /dev/null +++ b/src/Routes/Objects/AcsCredentialVisionlineMetadata.php @@ -0,0 +1,35 @@ +card_function_type, + auto_join: $json->auto_join ?? null, + card_id: $json->card_id ?? null, + common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, + credential_id: $json->credential_id ?? null, + guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, + is_valid: $json->is_valid ?? null, + joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null + ); + } + + public function __construct( + public string $card_function_type, + public bool|null $auto_join, + public string|null $card_id, + public array|null $common_acs_entrance_ids, + public string|null $credential_id, + public array|null $guest_acs_entrance_ids, + public bool|null $is_valid, + public array|null $joiner_acs_credential_ids + ) {} +} diff --git a/src/Routes/Objects/AcsCredentialWarnings.php b/src/Routes/Objects/AcsCredentialWarnings.php new file mode 100644 index 00000000..17788c12 --- /dev/null +++ b/src/Routes/Objects/AcsCredentialWarnings.php @@ -0,0 +1,24 @@ +created_at, + message: $json->message, + warning_code: $json->warning_code + ); + } + + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) {} +} diff --git a/src/Routes/Objects/AcsEncoder.php b/src/Routes/Objects/AcsEncoder.php new file mode 100644 index 00000000..b39951f1 --- /dev/null +++ b/src/Routes/Objects/AcsEncoder.php @@ -0,0 +1,33 @@ +acs_encoder_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsEncoderErrors::from_json($e), + $json->errors ?? [] + ), + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $acs_encoder_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public string $workspace_id + ) {} +} diff --git a/src/Routes/Objects/AcsEncoderErrors.php b/src/Routes/Objects/AcsEncoderErrors.php new file mode 100644 index 00000000..1bc7ea13 --- /dev/null +++ b/src/Routes/Objects/AcsEncoderErrors.php @@ -0,0 +1,24 @@ +created_at, + error_code: $json->error_code, + message: $json->message + ); + } + + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) {} +} diff --git a/src/Routes/Objects/AcsEntrance.php b/src/Routes/Objects/AcsEntrance.php new file mode 100644 index 00000000..ea266c26 --- /dev/null +++ b/src/Routes/Objects/AcsEntrance.php @@ -0,0 +1,67 @@ +acs_entrance_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsEntranceErrors::from_json($e), + $json->errors ?? [] + ), + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? AcsEntranceAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + dormakaba_community_metadata: isset( + $json->dormakaba_community_metadata + ) + ? AcsEntranceDormakabaCommunityMetadata::from_json( + $json->dormakaba_community_metadata + ) + : null, + latch_metadata: isset($json->latch_metadata) + ? AcsEntranceLatchMetadata::from_json($json->latch_metadata) + : null, + salto_ks_metadata: isset($json->salto_ks_metadata) + ? AcsEntranceSaltoKsMetadata::from_json( + $json->salto_ks_metadata + ) + : null, + salto_space_metadata: isset($json->salto_space_metadata) + ? AcsEntranceSaltoSpaceMetadata::from_json( + $json->salto_space_metadata + ) + : null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsEntranceVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null + ); + } + + public function __construct( + public string $acs_entrance_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public AcsEntranceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public AcsEntranceDormakabaCommunityMetadata|null $dormakaba_community_metadata, + public AcsEntranceLatchMetadata|null $latch_metadata, + public AcsEntranceSaltoKsMetadata|null $salto_ks_metadata, + public AcsEntranceSaltoSpaceMetadata|null $salto_space_metadata, + public AcsEntranceVisionlineMetadata|null $visionline_metadata + ) {} +} diff --git a/src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php b/src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php new file mode 100644 index 00000000..fbe7f69e --- /dev/null +++ b/src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php @@ -0,0 +1,29 @@ +door_name, + door_type: $json->door_type, + door_number: $json->door_number ?? null, + pms_id: $json->pms_id ?? null, + stand_open: $json->stand_open ?? null + ); + } + + public function __construct( + public string $door_name, + public string $door_type, + public float|null $door_number, + public string|null $pms_id, + public bool|null $stand_open + ) {} +} diff --git a/src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php b/src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php new file mode 100644 index 00000000..12a286a3 --- /dev/null +++ b/src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php @@ -0,0 +1,17 @@ +access_point_name); + } + + public function __construct(public string $access_point_name) {} +} diff --git a/src/Routes/Objects/AcsEntranceErrors.php b/src/Routes/Objects/AcsEntranceErrors.php new file mode 100644 index 00000000..9c7f3d0b --- /dev/null +++ b/src/Routes/Objects/AcsEntranceErrors.php @@ -0,0 +1,24 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/AcsEntranceLatchMetadata.php b/src/Routes/Objects/AcsEntranceLatchMetadata.php new file mode 100644 index 00000000..20311523 --- /dev/null +++ b/src/Routes/Objects/AcsEntranceLatchMetadata.php @@ -0,0 +1,26 @@ +accessibility_type, + door_name: $json->door_name, + door_type: $json->door_type, + is_connected: $json->is_connected + ); + } + + public function __construct( + public string $accessibility_type, + public string $door_name, + public string $door_type, + public bool $is_connected + ) {} +} diff --git a/src/Routes/Objects/AcsEntranceProfiles.php b/src/Routes/Objects/AcsEntranceProfiles.php new file mode 100644 index 00000000..ec5980f5 --- /dev/null +++ b/src/Routes/Objects/AcsEntranceProfiles.php @@ -0,0 +1,22 @@ +visionline_door_profile_id, + visionline_door_profile_type: $json->visionline_door_profile_type + ); + } + + public function __construct( + public string $visionline_door_profile_id, + public string $visionline_door_profile_type + ) {} +} diff --git a/src/Routes/Objects/AcsEntranceSaltoKsMetadata.php b/src/Routes/Objects/AcsEntranceSaltoKsMetadata.php new file mode 100644 index 00000000..66f9e46f --- /dev/null +++ b/src/Routes/Objects/AcsEntranceSaltoKsMetadata.php @@ -0,0 +1,35 @@ +battery_level, + door_name: $json->door_name, + lock_type: $json->lock_type, + locked_state: $json->locked_state, + intrusion_alarm: $json->intrusion_alarm ?? null, + left_open_alarm: $json->left_open_alarm ?? null, + online: $json->online ?? null, + privacy_mode: $json->privacy_mode ?? null + ); + } + + public function __construct( + public string $battery_level, + public string $door_name, + public string $lock_type, + public string $locked_state, + public bool|null $intrusion_alarm, + public bool|null $left_open_alarm, + public bool|null $online, + public bool|null $privacy_mode + ) {} +} diff --git a/src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php b/src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php new file mode 100644 index 00000000..e478e6fe --- /dev/null +++ b/src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php @@ -0,0 +1,25 @@ +door_name, + ext_door_id: $json->ext_door_id, + door_description: $json->door_description ?? null + ); + } + + public function __construct( + public string $door_name, + public string $ext_door_id, + public string|null $door_description + ) {} +} diff --git a/src/Routes/Objects/AcsEntranceVisionlineMetadata.php b/src/Routes/Objects/AcsEntranceVisionlineMetadata.php new file mode 100644 index 00000000..de430a5c --- /dev/null +++ b/src/Routes/Objects/AcsEntranceVisionlineMetadata.php @@ -0,0 +1,28 @@ +door_category, + door_name: $json->door_name, + profiles: array_map( + fn($p) => AcsEntranceProfiles::from_json($p), + $json->profiles ?? [] + ) + ); + } + + public function __construct( + public string $door_category, + public string $door_name, + public array|null $profiles + ) {} +} diff --git a/src/Routes/Objects/AcsSystem.php b/src/Routes/Objects/AcsSystem.php new file mode 100644 index 00000000..b5995539 --- /dev/null +++ b/src/Routes/Objects/AcsSystem.php @@ -0,0 +1,77 @@ +acs_system_id, + connected_account_id: $json->connected_account_id, + connected_account_ids: $json->connected_account_ids, + created_at: $json->created_at, + errors: array_map( + fn($e) => AcsSystemErrors::from_json($e), + $json->errors ?? [] + ), + image_alt_text: $json->image_alt_text, + image_url: $json->image_url, + is_credential_manager: $json->is_credential_manager, + location: AcsSystemLocation::from_json($json->location), + name: $json->name, + warnings: array_map( + fn($w) => AcsSystemWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + can_add_acs_users_to_acs_access_groups: $json->can_add_acs_users_to_acs_access_groups ?? + null, + can_automate_enrollment: $json->can_automate_enrollment ?? null, + can_create_acs_access_groups: $json->can_create_acs_access_groups ?? + null, + can_remove_acs_users_from_acs_access_groups: $json->can_remove_acs_users_from_acs_access_groups ?? + null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + system_type: $json->system_type ?? null, + system_type_display_name: $json->system_type_display_name ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsSystemVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? + null + ); + } + + public function __construct( + public string $acs_system_id, + public string $connected_account_id, + public array $connected_account_ids, + public string $created_at, + public array $errors, + public string $image_alt_text, + public string $image_url, + public bool $is_credential_manager, + public AcsSystemLocation $location, + public string $name, + public array $warnings, + public string $workspace_id, + public bool|null $can_add_acs_users_to_acs_access_groups, + public bool|null $can_automate_enrollment, + public bool|null $can_create_acs_access_groups, + public bool|null $can_remove_acs_users_from_acs_access_groups, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $system_type, + public string|null $system_type_display_name, + public AcsSystemVisionlineMetadata|null $visionline_metadata, + public string|null $default_credential_manager_acs_system_id + ) {} +} diff --git a/src/Routes/Objects/AcsSystemErrors.php b/src/Routes/Objects/AcsSystemErrors.php new file mode 100644 index 00000000..a9f5e041 --- /dev/null +++ b/src/Routes/Objects/AcsSystemErrors.php @@ -0,0 +1,24 @@ +created_at, + error_code: $json->error_code, + message: $json->message + ); + } + + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) {} +} diff --git a/src/Routes/Objects/AcsSystemLocation.php b/src/Routes/Objects/AcsSystemLocation.php new file mode 100644 index 00000000..1bd18824 --- /dev/null +++ b/src/Routes/Objects/AcsSystemLocation.php @@ -0,0 +1,16 @@ +time_zone ?? null); + } + + public function __construct(public string|null $time_zone) {} +} diff --git a/src/Routes/Objects/AcsSystemVisionlineMetadata.php b/src/Routes/Objects/AcsSystemVisionlineMetadata.php new file mode 100644 index 00000000..071b76bd --- /dev/null +++ b/src/Routes/Objects/AcsSystemVisionlineMetadata.php @@ -0,0 +1,25 @@ +lan_address, + mobile_access_uuid: $json->mobile_access_uuid, + system_id: $json->system_id + ); + } + + public function __construct( + public string $lan_address, + public string $mobile_access_uuid, + public string $system_id + ) {} +} diff --git a/src/Routes/Objects/AcsSystemWarnings.php b/src/Routes/Objects/AcsSystemWarnings.php new file mode 100644 index 00000000..0fc1a2b7 --- /dev/null +++ b/src/Routes/Objects/AcsSystemWarnings.php @@ -0,0 +1,27 @@ +created_at, + message: $json->message, + warning_code: $json->warning_code, + misconfigured_acs_entrance_ids: $json->misconfigured_acs_entrance_ids ?? + null + ); + } + + public function __construct( + public string $created_at, + public string $message, + public string $warning_code, + public array|null $misconfigured_acs_entrance_ids + ) {} +} diff --git a/src/Routes/Objects/AcsUser.php b/src/Routes/Objects/AcsUser.php new file mode 100644 index 00000000..c4deca71 --- /dev/null +++ b/src/Routes/Objects/AcsUser.php @@ -0,0 +1,77 @@ +acs_system_id, + acs_user_id: $json->acs_user_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsUserErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => AcsUserWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + access_schedule: isset($json->access_schedule) + ? AcsUserAccessSchedule::from_json($json->access_schedule) + : null, + email: $json->email ?? null, + email_address: $json->email_address ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + full_name: $json->full_name ?? null, + hid_acs_system_id: $json->hid_acs_system_id ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + user_identity_id: $json->user_identity_id ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, + user_identity_email_address: $json->user_identity_email_address ?? + null, + user_identity_full_name: $json->user_identity_full_name ?? null, + user_identity_phone_number: $json->user_identity_phone_number ?? + null + ); + } + + public function __construct( + public string $acs_system_id, + public string $acs_user_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public AcsUserAccessSchedule|null $access_schedule, + public string|null $email, + public string|null $email_address, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $full_name, + public string|null $hid_acs_system_id, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $user_identity_id, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $latest_desired_state_synced_with_provider_at, + public string|null $user_identity_email_address, + public string|null $user_identity_full_name, + public string|null $user_identity_phone_number + ) {} +} diff --git a/src/Routes/Objects/AcsUserAccessSchedule.php b/src/Routes/Objects/AcsUserAccessSchedule.php new file mode 100644 index 00000000..17dca439 --- /dev/null +++ b/src/Routes/Objects/AcsUserAccessSchedule.php @@ -0,0 +1,22 @@ +starts_at, + ends_at: $json->ends_at ?? null + ); + } + + public function __construct( + public string $starts_at, + public string|null $ends_at + ) {} +} diff --git a/src/Routes/Objects/AcsUserErrors.php b/src/Routes/Objects/AcsUserErrors.php new file mode 100644 index 00000000..c2b4c903 --- /dev/null +++ b/src/Routes/Objects/AcsUserErrors.php @@ -0,0 +1,24 @@ +created_at, + error_code: $json->error_code, + message: $json->message + ); + } + + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) {} +} diff --git a/src/Routes/Objects/AcsUserWarnings.php b/src/Routes/Objects/AcsUserWarnings.php new file mode 100644 index 00000000..2d01c8d2 --- /dev/null +++ b/src/Routes/Objects/AcsUserWarnings.php @@ -0,0 +1,24 @@ +created_at, + message: $json->message, + warning_code: $json->warning_code + ); + } + + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) {} +} diff --git a/src/Routes/Objects/ActionAttempt.php b/src/Routes/Objects/ActionAttempt.php new file mode 100644 index 00000000..1cf13362 --- /dev/null +++ b/src/Routes/Objects/ActionAttempt.php @@ -0,0 +1,30 @@ +action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? ActionAttemptError::from_json($json->error) + : null, + status: $json->status ?? null, + result: $json->result ?? null + ); + } + + public function __construct( + public string|null $action_attempt_id, + public string|null $action_type, + public ActionAttemptError|null $error, + public string|null $status, + public mixed $result + ) {} +} diff --git a/src/Routes/Objects/ActionAttemptError.php b/src/Routes/Objects/ActionAttemptError.php new file mode 100644 index 00000000..ffc3666a --- /dev/null +++ b/src/Routes/Objects/ActionAttemptError.php @@ -0,0 +1,16 @@ +message, type: $json->type); + } + + public function __construct(public string $message, public string $type) {} +} diff --git a/src/Routes/Objects/ClientSession.php b/src/Routes/Objects/ClientSession.php new file mode 100644 index 00000000..cba4d877 --- /dev/null +++ b/src/Routes/Objects/ClientSession.php @@ -0,0 +1,38 @@ +client_session_id, + connect_webview_ids: $json->connect_webview_ids, + connected_account_ids: $json->connected_account_ids, + created_at: $json->created_at, + device_count: $json->device_count, + expires_at: $json->expires_at, + token: $json->token, + user_identity_ids: $json->user_identity_ids, + workspace_id: $json->workspace_id, + user_identifier_key: $json->user_identifier_key ?? null + ); + } + + public function __construct( + public string $client_session_id, + public array $connect_webview_ids, + public array $connected_account_ids, + public string $created_at, + public float $device_count, + public string $expires_at, + public string $token, + public array $user_identity_ids, + public string $workspace_id, + public string|null $user_identifier_key + ) {} +} diff --git a/src/Routes/Objects/ConnectWebview.php b/src/Routes/Objects/ConnectWebview.php new file mode 100644 index 00000000..3731cf3c --- /dev/null +++ b/src/Routes/Objects/ConnectWebview.php @@ -0,0 +1,57 @@ +accepted_devices, + accepted_providers: $json->accepted_providers, + any_device_allowed: $json->any_device_allowed, + any_provider_allowed: $json->any_provider_allowed, + automatically_manage_new_devices: $json->automatically_manage_new_devices, + connect_webview_id: $json->connect_webview_id, + created_at: $json->created_at, + custom_metadata: $json->custom_metadata, + device_selection_mode: $json->device_selection_mode, + login_successful: $json->login_successful, + status: $json->status, + url: $json->url, + wait_for_device_creation: $json->wait_for_device_creation, + workspace_id: $json->workspace_id, + authorized_at: $json->authorized_at ?? null, + connected_account_id: $json->connected_account_id ?? null, + custom_redirect_failure_url: $json->custom_redirect_failure_url ?? + null, + custom_redirect_url: $json->custom_redirect_url ?? null, + selected_provider: $json->selected_provider ?? null + ); + } + + public function __construct( + public array $accepted_devices, + public array $accepted_providers, + public bool $any_device_allowed, + public bool $any_provider_allowed, + public bool $automatically_manage_new_devices, + public string $connect_webview_id, + public string $created_at, + public mixed $custom_metadata, + public string $device_selection_mode, + public bool $login_successful, + public string $status, + public string $url, + public bool $wait_for_device_creation, + public string $workspace_id, + public string|null $authorized_at, + public string|null $connected_account_id, + public string|null $custom_redirect_failure_url, + public string|null $custom_redirect_url, + public string|null $selected_provider + ) {} +} diff --git a/src/Routes/Objects/ConnectedAccount.php b/src/Routes/Objects/ConnectedAccount.php new file mode 100644 index 00000000..17af568e --- /dev/null +++ b/src/Routes/Objects/ConnectedAccount.php @@ -0,0 +1,46 @@ +account_type_display_name, + automatically_manage_new_devices: $json->automatically_manage_new_devices, + custom_metadata: $json->custom_metadata, + errors: array_map( + fn($e) => ConnectedAccountErrors::from_json($e), + $json->errors ?? [] + ), + warnings: array_map( + fn($w) => ConnectedAccountWarnings::from_json($w), + $json->warnings ?? [] + ), + account_type: $json->account_type ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + user_identifier: isset($json->user_identifier) + ? ConnectedAccountUserIdentifier::from_json( + $json->user_identifier + ) + : null + ); + } + + public function __construct( + public string $account_type_display_name, + public bool $automatically_manage_new_devices, + public mixed $custom_metadata, + public array $errors, + public array $warnings, + public string|null $account_type, + public string|null $connected_account_id, + public string|null $created_at, + public ConnectedAccountUserIdentifier|null $user_identifier + ) {} +} diff --git a/src/Routes/Objects/ConnectedAccountErrors.php b/src/Routes/Objects/ConnectedAccountErrors.php new file mode 100644 index 00000000..6f297b2a --- /dev/null +++ b/src/Routes/Objects/ConnectedAccountErrors.php @@ -0,0 +1,26 @@ +error_code, + is_connected_account_error: $json->is_connected_account_error, + message: $json->message, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $error_code, + public bool $is_connected_account_error, + public string $message, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/ConnectedAccountUserIdentifier.php b/src/Routes/Objects/ConnectedAccountUserIdentifier.php new file mode 100644 index 00000000..95beae1f --- /dev/null +++ b/src/Routes/Objects/ConnectedAccountUserIdentifier.php @@ -0,0 +1,29 @@ +api_url ?? null, + email: $json->email ?? null, + exclusive: $json->exclusive ?? null, + phone: $json->phone ?? null, + username: $json->username ?? null + ); + } + + public function __construct( + public string|null $api_url, + public string|null $email, + public bool|null $exclusive, + public string|null $phone, + public string|null $username + ) {} +} diff --git a/src/Routes/Objects/ConnectedAccountWarnings.php b/src/Routes/Objects/ConnectedAccountWarnings.php new file mode 100644 index 00000000..d8adcd27 --- /dev/null +++ b/src/Routes/Objects/ConnectedAccountWarnings.php @@ -0,0 +1,24 @@ +message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/Device.php b/src/Routes/Objects/Device.php new file mode 100644 index 00000000..437d8ba9 --- /dev/null +++ b/src/Routes/Objects/Device.php @@ -0,0 +1,79 @@ +capabilities_supported, + connected_account_id: $json->connected_account_id, + created_at: $json->created_at, + custom_metadata: $json->custom_metadata, + device_id: $json->device_id, + device_type: $json->device_type, + display_name: $json->display_name, + errors: array_map( + fn($e) => DeviceErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + properties: DeviceProperties::from_json($json->properties), + warnings: array_map( + fn($w) => DeviceWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + 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, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, + can_remotely_lock: $json->can_remotely_lock ?? null, + can_remotely_unlock: $json->can_remotely_unlock ?? null, + can_simulate_connection: $json->can_simulate_connection ?? null, + can_simulate_disconnection: $json->can_simulate_disconnection ?? + null, + can_simulate_removal: $json->can_simulate_removal ?? null, + can_turn_off_hvac: $json->can_turn_off_hvac ?? null, + nickname: $json->nickname ?? null, + location: isset($json->location) + ? DeviceLocation::from_json($json->location) + : null + ); + } + + public function __construct( + public array $capabilities_supported, + public string $connected_account_id, + public string $created_at, + public mixed $custom_metadata, + public string $device_id, + public string $device_type, + public string $display_name, + public array $errors, + public bool $is_managed, + public DeviceProperties $properties, + public array $warnings, + public string $workspace_id, + public bool|null $can_hvac_cool, + public bool|null $can_hvac_heat, + public bool|null $can_hvac_heat_cool, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_connection, + public bool|null $can_simulate_disconnection, + public bool|null $can_simulate_removal, + public bool|null $can_turn_off_hvac, + public string|null $nickname, + public DeviceLocation|null $location + ) {} +} diff --git a/src/Routes/Objects/DeviceAccelerometerZ.php b/src/Routes/Objects/DeviceAccelerometerZ.php new file mode 100644 index 00000000..f1a673ae --- /dev/null +++ b/src/Routes/Objects/DeviceAccelerometerZ.php @@ -0,0 +1,16 @@ +time, value: $json->value); + } + + public function __construct(public string $time, public float $value) {} +} diff --git a/src/Routes/Objects/DeviceAccessoryKeypad.php b/src/Routes/Objects/DeviceAccessoryKeypad.php new file mode 100644 index 00000000..75f7ee2b --- /dev/null +++ b/src/Routes/Objects/DeviceAccessoryKeypad.php @@ -0,0 +1,24 @@ +is_connected, + battery: isset($json->battery) + ? DeviceBattery::from_json($json->battery) + : null + ); + } + + public function __construct( + public bool $is_connected, + public DeviceBattery|null $battery + ) {} +} diff --git a/src/Routes/Objects/DeviceActiveThermostatSchedule.php b/src/Routes/Objects/DeviceActiveThermostatSchedule.php new file mode 100644 index 00000000..838560d2 --- /dev/null +++ b/src/Routes/Objects/DeviceActiveThermostatSchedule.php @@ -0,0 +1,43 @@ +climate_preset_key, + created_at: $json->created_at, + device_id: $json->device_id, + ends_at: $json->ends_at, + errors: array_map( + fn($e) => DeviceErrors::from_json($e), + $json->errors ?? [] + ), + max_override_period_minutes: $json->max_override_period_minutes, + starts_at: $json->starts_at, + thermostat_schedule_id: $json->thermostat_schedule_id, + name: $json->name ?? null, + unstable_is_override_allowed: $json->unstable_is_override_allowed ?? + null + ); + } + + public function __construct( + public string $climate_preset_key, + public string $created_at, + public string $device_id, + public string $ends_at, + public array $errors, + public mixed $max_override_period_minutes, + public string $starts_at, + public string $thermostat_schedule_id, + public string|null $name, + public bool|null $unstable_is_override_allowed + ) {} +} diff --git a/src/Routes/Objects/DeviceAkilesMetadata.php b/src/Routes/Objects/DeviceAkilesMetadata.php new file mode 100644 index 00000000..43ad606e --- /dev/null +++ b/src/Routes/Objects/DeviceAkilesMetadata.php @@ -0,0 +1,26 @@ +gadget_id, + gadget_name: $json->gadget_name, + product_name: $json->product_name, + _member_group_id: $json->_member_group_id ?? null + ); + } + + public function __construct( + public string $gadget_id, + public string $gadget_name, + public string $product_name, + public string|null $_member_group_id + ) {} +} diff --git a/src/Routes/Objects/DeviceAppearance.php b/src/Routes/Objects/DeviceAppearance.php new file mode 100644 index 00000000..cf784226 --- /dev/null +++ b/src/Routes/Objects/DeviceAppearance.php @@ -0,0 +1,16 @@ +name); + } + + public function __construct(public string $name) {} +} diff --git a/src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php b/src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php new file mode 100644 index 00000000..9edb7595 --- /dev/null +++ b/src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php @@ -0,0 +1,26 @@ + DeviceEndpoints::from_json($e), + $json->endpoints ?? [] + ), + has_active_endpoint: $json->has_active_endpoint + ); + } + + public function __construct( + public array $endpoints, + public bool $has_active_endpoint + ) {} +} diff --git a/src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php b/src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php new file mode 100644 index 00000000..b9c8a5ef --- /dev/null +++ b/src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php @@ -0,0 +1,17 @@ +encoder_name); + } + + public function __construct(public string $encoder_name) {} +} diff --git a/src/Routes/Objects/DeviceAugustMetadata.php b/src/Routes/Objects/DeviceAugustMetadata.php new file mode 100644 index 00000000..9b2b6fee --- /dev/null +++ b/src/Routes/Objects/DeviceAugustMetadata.php @@ -0,0 +1,32 @@ +has_keypad, + house_name: $json->house_name, + lock_id: $json->lock_id, + lock_name: $json->lock_name, + house_id: $json->house_id ?? null, + keypad_battery_level: $json->keypad_battery_level ?? null, + model: $json->model ?? null + ); + } + + public function __construct( + public bool $has_keypad, + public string $house_name, + public string $lock_id, + public string $lock_name, + public string|null $house_id, + public string|null $keypad_battery_level, + public string|null $model + ) {} +} diff --git a/src/Routes/Objects/DeviceAvailableClimatePresets.php b/src/Routes/Objects/DeviceAvailableClimatePresets.php new file mode 100644 index 00000000..1332ff44 --- /dev/null +++ b/src/Routes/Objects/DeviceAvailableClimatePresets.php @@ -0,0 +1,45 @@ +can_delete, + can_edit: $json->can_edit, + climate_preset_key: $json->climate_preset_key, + display_name: $json->display_name, + manual_override_allowed: $json->manual_override_allowed, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + name: $json->name ?? null + ); + } + + public function __construct( + public bool $can_delete, + public bool $can_edit, + public string $climate_preset_key, + public string $display_name, + public bool $manual_override_allowed, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public string|null $name + ) {} +} diff --git a/src/Routes/Objects/DeviceAvigilonAltaMetadata.php b/src/Routes/Objects/DeviceAvigilonAltaMetadata.php new file mode 100644 index 00000000..8ccc3b32 --- /dev/null +++ b/src/Routes/Objects/DeviceAvigilonAltaMetadata.php @@ -0,0 +1,33 @@ +entry_name, + entry_relays_total_count: $json->entry_relays_total_count, + org_name: $json->org_name, + site_id: $json->site_id, + site_name: $json->site_name, + zone_id: $json->zone_id, + zone_name: $json->zone_name + ); + } + + public function __construct( + public string $entry_name, + public float $entry_relays_total_count, + public string $org_name, + public float $site_id, + public string $site_name, + public float $zone_id, + public string $zone_name + ) {} +} diff --git a/src/Routes/Objects/DeviceBattery.php b/src/Routes/Objects/DeviceBattery.php new file mode 100644 index 00000000..1a4fae6b --- /dev/null +++ b/src/Routes/Objects/DeviceBattery.php @@ -0,0 +1,16 @@ +level); + } + + public function __construct(public float $level) {} +} diff --git a/src/Routes/Objects/DeviceBrivoMetadata.php b/src/Routes/Objects/DeviceBrivoMetadata.php new file mode 100644 index 00000000..f4a8be60 --- /dev/null +++ b/src/Routes/Objects/DeviceBrivoMetadata.php @@ -0,0 +1,16 @@ +device_name); + } + + public function __construct(public string $device_name) {} +} diff --git a/src/Routes/Objects/DeviceCodeConstraints.php b/src/Routes/Objects/DeviceCodeConstraints.php new file mode 100644 index 00000000..fe95be55 --- /dev/null +++ b/src/Routes/Objects/DeviceCodeConstraints.php @@ -0,0 +1,24 @@ +constraint_type, + max_length: $json->max_length ?? null, + min_length: $json->min_length ?? null + ); + } + + public function __construct( + public string $constraint_type, + public float|null $max_length, + public float|null $min_length + ) {} +} diff --git a/src/Routes/Objects/DeviceControlbywebMetadata.php b/src/Routes/Objects/DeviceControlbywebMetadata.php new file mode 100644 index 00000000..8f79f596 --- /dev/null +++ b/src/Routes/Objects/DeviceControlbywebMetadata.php @@ -0,0 +1,25 @@ +device_id, + device_name: $json->device_name, + relay_name: $json->relay_name ?? null + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public string|null $relay_name + ) {} +} diff --git a/src/Routes/Objects/DeviceCurrentClimateSetting.php b/src/Routes/Objects/DeviceCurrentClimateSetting.php new file mode 100644 index 00000000..19754d7b --- /dev/null +++ b/src/Routes/Objects/DeviceCurrentClimateSetting.php @@ -0,0 +1,45 @@ +can_delete ?? null, + can_edit: $json->can_edit ?? null, + climate_preset_key: $json->climate_preset_key ?? null, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + display_name: $json->display_name ?? null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + manual_override_allowed: $json->manual_override_allowed ?? null, + name: $json->name ?? null + ); + } + + public function __construct( + public bool|null $can_delete, + public bool|null $can_edit, + public string|null $climate_preset_key, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $display_name, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $manual_override_allowed, + public string|null $name + ) {} +} diff --git a/src/Routes/Objects/DeviceDefaultClimateSetting.php b/src/Routes/Objects/DeviceDefaultClimateSetting.php new file mode 100644 index 00000000..a84003ac --- /dev/null +++ b/src/Routes/Objects/DeviceDefaultClimateSetting.php @@ -0,0 +1,45 @@ +can_delete ?? null, + can_edit: $json->can_edit ?? null, + climate_preset_key: $json->climate_preset_key ?? null, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + display_name: $json->display_name ?? null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + manual_override_allowed: $json->manual_override_allowed ?? null, + name: $json->name ?? null + ); + } + + public function __construct( + public bool|null $can_delete, + public bool|null $can_edit, + public string|null $climate_preset_key, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $display_name, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $manual_override_allowed, + public string|null $name + ) {} +} diff --git a/src/Routes/Objects/DeviceDormakabaOracodeMetadata.php b/src/Routes/Objects/DeviceDormakabaOracodeMetadata.php new file mode 100644 index 00000000..71f9e5d4 --- /dev/null +++ b/src/Routes/Objects/DeviceDormakabaOracodeMetadata.php @@ -0,0 +1,38 @@ +door_is_wireless, + door_name: $json->door_name, + site_name: $json->site_name, + device_id: $json->device_id ?? null, + door_id: $json->door_id ?? null, + iana_timezone: $json->iana_timezone ?? null, + predefined_time_slots: array_map( + fn($p) => DevicePredefinedTimeSlots::from_json($p), + $json->predefined_time_slots ?? [] + ), + site_id: $json->site_id ?? null + ); + } + + public function __construct( + public bool $door_is_wireless, + public string $door_name, + public string $site_name, + public float|null $device_id, + public float|null $door_id, + public string|null $iana_timezone, + public array|null $predefined_time_slots, + public float|null $site_id + ) {} +} diff --git a/src/Routes/Objects/DeviceEcobeeMetadata.php b/src/Routes/Objects/DeviceEcobeeMetadata.php new file mode 100644 index 00000000..e6ac9a7a --- /dev/null +++ b/src/Routes/Objects/DeviceEcobeeMetadata.php @@ -0,0 +1,22 @@ +device_name, + ecobee_device_id: $json->ecobee_device_id + ); + } + + public function __construct( + public string $device_name, + public string $ecobee_device_id + ) {} +} diff --git a/src/Routes/Objects/DeviceEndpoints.php b/src/Routes/Objects/DeviceEndpoints.php new file mode 100644 index 00000000..6d0c8ed7 --- /dev/null +++ b/src/Routes/Objects/DeviceEndpoints.php @@ -0,0 +1,22 @@ +endpoint_id, + is_active: $json->is_active + ); + } + + public function __construct( + public string $endpoint_id, + public bool $is_active + ) {} +} diff --git a/src/Routes/Objects/DeviceErrors.php b/src/Routes/Objects/DeviceErrors.php new file mode 100644 index 00000000..b13b5e91 --- /dev/null +++ b/src/Routes/Objects/DeviceErrors.php @@ -0,0 +1,29 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) {} +} diff --git a/src/Routes/Objects/DeviceFeatures.php b/src/Routes/Objects/DeviceFeatures.php new file mode 100644 index 00000000..772c3102 --- /dev/null +++ b/src/Routes/Objects/DeviceFeatures.php @@ -0,0 +1,28 @@ +incomplete_keyboard_passcode, + lock_command: $json->lock_command, + passcode: $json->passcode, + passcode_management: $json->passcode_management, + unlock_via_gateway: $json->unlock_via_gateway + ); + } + + public function __construct( + public bool $incomplete_keyboard_passcode, + public bool $lock_command, + public bool $passcode, + public bool $passcode_management, + public bool $unlock_via_gateway + ) {} +} diff --git a/src/Routes/Objects/DeviceFourSuitesMetadata.php b/src/Routes/Objects/DeviceFourSuitesMetadata.php new file mode 100644 index 00000000..b5ef6fe6 --- /dev/null +++ b/src/Routes/Objects/DeviceFourSuitesMetadata.php @@ -0,0 +1,24 @@ +device_id, + device_name: $json->device_name, + reclose_delay_in_seconds: $json->reclose_delay_in_seconds + ); + } + + public function __construct( + public float $device_id, + public string $device_name, + public float $reclose_delay_in_seconds + ) {} +} diff --git a/src/Routes/Objects/DeviceGenieMetadata.php b/src/Routes/Objects/DeviceGenieMetadata.php new file mode 100644 index 00000000..961d54a1 --- /dev/null +++ b/src/Routes/Objects/DeviceGenieMetadata.php @@ -0,0 +1,22 @@ +device_name, + door_name: $json->door_name + ); + } + + public function __construct( + public string $device_name, + public string $door_name + ) {} +} diff --git a/src/Routes/Objects/DeviceHoneywellResideoMetadata.php b/src/Routes/Objects/DeviceHoneywellResideoMetadata.php new file mode 100644 index 00000000..67e969fe --- /dev/null +++ b/src/Routes/Objects/DeviceHoneywellResideoMetadata.php @@ -0,0 +1,23 @@ +device_name, + honeywell_resideo_device_id: $json->honeywell_resideo_device_id + ); + } + + public function __construct( + public string $device_name, + public string $honeywell_resideo_device_id + ) {} +} diff --git a/src/Routes/Objects/DeviceHubitatMetadata.php b/src/Routes/Objects/DeviceHubitatMetadata.php new file mode 100644 index 00000000..b36079c8 --- /dev/null +++ b/src/Routes/Objects/DeviceHubitatMetadata.php @@ -0,0 +1,24 @@ +device_id, + device_label: $json->device_label, + device_name: $json->device_name + ); + } + + public function __construct( + public string $device_id, + public string $device_label, + public string $device_name + ) {} +} diff --git a/src/Routes/Objects/DeviceHumidity.php b/src/Routes/Objects/DeviceHumidity.php new file mode 100644 index 00000000..2d6d1f82 --- /dev/null +++ b/src/Routes/Objects/DeviceHumidity.php @@ -0,0 +1,16 @@ +time, value: $json->value); + } + + public function __construct(public string $time, public float $value) {} +} diff --git a/src/Routes/Objects/DeviceIglooMetadata.php b/src/Routes/Objects/DeviceIglooMetadata.php new file mode 100644 index 00000000..a9da74cb --- /dev/null +++ b/src/Routes/Objects/DeviceIglooMetadata.php @@ -0,0 +1,24 @@ +bridge_id, + device_id: $json->device_id, + model: $json->model ?? null + ); + } + + public function __construct( + public string $bridge_id, + public string $device_id, + public string|null $model + ) {} +} diff --git a/src/Routes/Objects/DeviceIgloohomeMetadata.php b/src/Routes/Objects/DeviceIgloohomeMetadata.php new file mode 100644 index 00000000..48201eb0 --- /dev/null +++ b/src/Routes/Objects/DeviceIgloohomeMetadata.php @@ -0,0 +1,28 @@ +device_id, + device_name: $json->device_name, + bridge_id: $json->bridge_id ?? null, + bridge_name: $json->bridge_name ?? null, + keypad_id: $json->keypad_id ?? null + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public string|null $bridge_id, + public string|null $bridge_name, + public string|null $keypad_id + ) {} +} diff --git a/src/Routes/Objects/DeviceKeypadBattery.php b/src/Routes/Objects/DeviceKeypadBattery.php new file mode 100644 index 00000000..f8d72647 --- /dev/null +++ b/src/Routes/Objects/DeviceKeypadBattery.php @@ -0,0 +1,16 @@ +level); + } + + public function __construct(public float $level) {} +} diff --git a/src/Routes/Objects/DeviceKwiksetMetadata.php b/src/Routes/Objects/DeviceKwiksetMetadata.php new file mode 100644 index 00000000..6bcf5e7d --- /dev/null +++ b/src/Routes/Objects/DeviceKwiksetMetadata.php @@ -0,0 +1,24 @@ +device_id, + device_name: $json->device_name, + model_number: $json->model_number + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public string $model_number + ) {} +} diff --git a/src/Routes/Objects/DeviceLatestSensorValues.php b/src/Routes/Objects/DeviceLatestSensorValues.php new file mode 100644 index 00000000..67e200c7 --- /dev/null +++ b/src/Routes/Objects/DeviceLatestSensorValues.php @@ -0,0 +1,30 @@ +accelerometer_z + ), + humidity: DeviceHumidity::from_json($json->humidity), + pressure: DevicePressure::from_json($json->pressure), + sound: DeviceSound::from_json($json->sound), + temperature: DeviceTemperature::from_json($json->temperature) + ); + } + + public function __construct( + public DeviceAccelerometerZ $accelerometer_z, + public DeviceHumidity $humidity, + public DevicePressure $pressure, + public DeviceSound $sound, + public DeviceTemperature $temperature + ) {} +} diff --git a/src/Routes/Objects/DeviceLocation.php b/src/Routes/Objects/DeviceLocation.php new file mode 100644 index 00000000..f0dc22b2 --- /dev/null +++ b/src/Routes/Objects/DeviceLocation.php @@ -0,0 +1,22 @@ +location_name ?? null, + timezone: $json->timezone ?? null + ); + } + + public function __construct( + public string|null $location_name, + public string|null $timezone + ) {} +} diff --git a/src/Routes/Objects/DeviceLocklyMetadata.php b/src/Routes/Objects/DeviceLocklyMetadata.php new file mode 100644 index 00000000..4f624013 --- /dev/null +++ b/src/Routes/Objects/DeviceLocklyMetadata.php @@ -0,0 +1,24 @@ +device_id, + device_name: $json->device_name, + model: $json->model ?? null + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public string|null $model + ) {} +} diff --git a/src/Routes/Objects/DeviceMinutMetadata.php b/src/Routes/Objects/DeviceMinutMetadata.php new file mode 100644 index 00000000..3d471932 --- /dev/null +++ b/src/Routes/Objects/DeviceMinutMetadata.php @@ -0,0 +1,26 @@ +device_id, + device_name: $json->device_name, + latest_sensor_values: DeviceLatestSensorValues::from_json( + $json->latest_sensor_values + ) + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public DeviceLatestSensorValues $latest_sensor_values + ) {} +} diff --git a/src/Routes/Objects/DeviceModel.php b/src/Routes/Objects/DeviceModel.php new file mode 100644 index 00000000..f5348e1f --- /dev/null +++ b/src/Routes/Objects/DeviceModel.php @@ -0,0 +1,36 @@ +display_name, + manufacturer_display_name: $json->manufacturer_display_name, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, + has_built_in_keypad: $json->has_built_in_keypad ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? + null + ); + } + + public function __construct( + public string $display_name, + public string $manufacturer_display_name, + public bool|null $accessory_keypad_supported, + public bool|null $can_connect_accessory_keypad, + public bool|null $has_built_in_keypad, + public bool|null $offline_access_codes_supported, + public bool|null $online_access_codes_supported + ) {} +} diff --git a/src/Routes/Objects/DeviceNestMetadata.php b/src/Routes/Objects/DeviceNestMetadata.php new file mode 100644 index 00000000..a7c984a4 --- /dev/null +++ b/src/Routes/Objects/DeviceNestMetadata.php @@ -0,0 +1,26 @@ +device_custom_name, + device_name: $json->device_name, + nest_device_id: $json->nest_device_id, + display_name: $json->display_name ?? null + ); + } + + public function __construct( + public string $device_custom_name, + public string $device_name, + public string $nest_device_id, + public string|null $display_name + ) {} +} diff --git a/src/Routes/Objects/DeviceNoiseawareMetadata.php b/src/Routes/Objects/DeviceNoiseawareMetadata.php new file mode 100644 index 00000000..7c526c07 --- /dev/null +++ b/src/Routes/Objects/DeviceNoiseawareMetadata.php @@ -0,0 +1,28 @@ +device_id, + device_model: $json->device_model, + device_name: $json->device_name, + noise_level_decibel: $json->noise_level_decibel, + noise_level_nrs: $json->noise_level_nrs + ); + } + + public function __construct( + public string $device_id, + public string $device_model, + public string $device_name, + public float $noise_level_decibel, + public float $noise_level_nrs + ) {} +} diff --git a/src/Routes/Objects/DeviceNukiMetadata.php b/src/Routes/Objects/DeviceNukiMetadata.php new file mode 100644 index 00000000..4e87e7e4 --- /dev/null +++ b/src/Routes/Objects/DeviceNukiMetadata.php @@ -0,0 +1,28 @@ +device_id, + device_name: $json->device_name, + keypad_2_paired: $json->keypad_2_paired ?? null, + keypad_battery_critical: $json->keypad_battery_critical ?? null, + keypad_paired: $json->keypad_paired ?? null + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public bool|null $keypad_2_paired, + public bool|null $keypad_battery_critical, + public bool|null $keypad_paired + ) {} +} diff --git a/src/Routes/Objects/DevicePredefinedTimeSlots.php b/src/Routes/Objects/DevicePredefinedTimeSlots.php new file mode 100644 index 00000000..b4d5f73f --- /dev/null +++ b/src/Routes/Objects/DevicePredefinedTimeSlots.php @@ -0,0 +1,39 @@ +check_in_time, + check_out_time: $json->check_out_time, + dormakaba_oracode_user_level_id: $json->dormakaba_oracode_user_level_id, + ext_dormakaba_oracode_user_level_prefix: $json->ext_dormakaba_oracode_user_level_prefix, + is_24_hour: $json->is_24_hour, + is_biweekly_mode: $json->is_biweekly_mode, + is_master: $json->is_master, + is_one_shot: $json->is_one_shot, + name: $json->name, + prefix: $json->prefix + ); + } + + public function __construct( + public string $check_in_time, + public string $check_out_time, + public string $dormakaba_oracode_user_level_id, + public float $ext_dormakaba_oracode_user_level_prefix, + public bool $is_24_hour, + public bool $is_biweekly_mode, + public bool $is_master, + public bool $is_one_shot, + public string $name, + public float $prefix + ) {} +} diff --git a/src/Routes/Objects/DevicePressure.php b/src/Routes/Objects/DevicePressure.php new file mode 100644 index 00000000..69ec3481 --- /dev/null +++ b/src/Routes/Objects/DevicePressure.php @@ -0,0 +1,16 @@ +time, value: $json->value); + } + + public function __construct(public string $time, public float $value) {} +} diff --git a/src/Routes/Objects/DeviceProperties.php b/src/Routes/Objects/DeviceProperties.php new file mode 100644 index 00000000..fcd5f79e --- /dev/null +++ b/src/Routes/Objects/DeviceProperties.php @@ -0,0 +1,333 @@ +appearance), + model: DeviceModel::from_json($json->model), + name: $json->name, + online: $json->online, + _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? + null, + accessory_keypad: isset($json->accessory_keypad) + ? DeviceAccessoryKeypad::from_json($json->accessory_keypad) + : null, + active_thermostat_schedule: isset($json->active_thermostat_schedule) + ? DeviceActiveThermostatSchedule::from_json( + $json->active_thermostat_schedule + ) + : null, + akiles_metadata: isset($json->akiles_metadata) + ? DeviceAkilesMetadata::from_json($json->akiles_metadata) + : null, + assa_abloy_credential_service_metadata: isset( + $json->assa_abloy_credential_service_metadata + ) + ? DeviceAssaAbloyCredentialServiceMetadata::from_json( + $json->assa_abloy_credential_service_metadata + ) + : null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? DeviceAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + august_metadata: isset($json->august_metadata) + ? DeviceAugustMetadata::from_json($json->august_metadata) + : null, + available_climate_presets: array_map( + fn($a) => DeviceAvailableClimatePresets::from_json($a), + $json->available_climate_presets ?? [] + ), + available_fan_mode_settings: $json->available_fan_mode_settings ?? + null, + available_hvac_mode_settings: $json->available_hvac_mode_settings ?? + null, + avigilon_alta_metadata: isset($json->avigilon_alta_metadata) + ? DeviceAvigilonAltaMetadata::from_json( + $json->avigilon_alta_metadata + ) + : null, + battery: isset($json->battery) + ? DeviceBattery::from_json($json->battery) + : null, + battery_level: $json->battery_level ?? null, + brivo_metadata: isset($json->brivo_metadata) + ? DeviceBrivoMetadata::from_json($json->brivo_metadata) + : null, + code_constraints: array_map( + fn($c) => DeviceCodeConstraints::from_json($c), + $json->code_constraints ?? [] + ), + controlbyweb_metadata: isset($json->controlbyweb_metadata) + ? DeviceControlbywebMetadata::from_json( + $json->controlbyweb_metadata + ) + : null, + current_climate_setting: isset($json->current_climate_setting) + ? DeviceCurrentClimateSetting::from_json( + $json->current_climate_setting + ) + : null, + currently_triggering_noise_threshold_ids: $json->currently_triggering_noise_threshold_ids ?? + null, + default_climate_setting: isset($json->default_climate_setting) + ? DeviceDefaultClimateSetting::from_json( + $json->default_climate_setting + ) + : null, + door_open: $json->door_open ?? null, + dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) + ? DeviceDormakabaOracodeMetadata::from_json( + $json->dormakaba_oracode_metadata + ) + : null, + ecobee_metadata: isset($json->ecobee_metadata) + ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) + : null, + fan_mode_setting: $json->fan_mode_setting ?? null, + four_suites_metadata: isset($json->four_suites_metadata) + ? DeviceFourSuitesMetadata::from_json( + $json->four_suites_metadata + ) + : null, + genie_metadata: isset($json->genie_metadata) + ? DeviceGenieMetadata::from_json($json->genie_metadata) + : null, + has_direct_power: $json->has_direct_power ?? null, + has_native_entry_events: $json->has_native_entry_events ?? null, + honeywell_resideo_metadata: isset($json->honeywell_resideo_metadata) + ? DeviceHoneywellResideoMetadata::from_json( + $json->honeywell_resideo_metadata + ) + : null, + hubitat_metadata: isset($json->hubitat_metadata) + ? DeviceHubitatMetadata::from_json($json->hubitat_metadata) + : null, + igloo_metadata: isset($json->igloo_metadata) + ? DeviceIglooMetadata::from_json($json->igloo_metadata) + : null, + igloohome_metadata: isset($json->igloohome_metadata) + ? DeviceIgloohomeMetadata::from_json($json->igloohome_metadata) + : null, + image_alt_text: $json->image_alt_text ?? null, + image_url: $json->image_url ?? null, + is_cooling: $json->is_cooling ?? null, + is_fan_running: $json->is_fan_running ?? null, + is_heating: $json->is_heating ?? null, + is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? + null, + keypad_battery: isset($json->keypad_battery) + ? DeviceKeypadBattery::from_json($json->keypad_battery) + : null, + kwikset_metadata: isset($json->kwikset_metadata) + ? DeviceKwiksetMetadata::from_json($json->kwikset_metadata) + : null, + locked: $json->locked ?? null, + lockly_metadata: isset($json->lockly_metadata) + ? DeviceLocklyMetadata::from_json($json->lockly_metadata) + : null, + manufacturer: $json->manufacturer ?? null, + max_active_codes_supported: $json->max_active_codes_supported ?? + null, + max_cooling_set_point_celsius: $json->max_cooling_set_point_celsius ?? + null, + max_cooling_set_point_fahrenheit: $json->max_cooling_set_point_fahrenheit ?? + null, + max_heating_set_point_celsius: $json->max_heating_set_point_celsius ?? + null, + max_heating_set_point_fahrenheit: $json->max_heating_set_point_fahrenheit ?? + null, + min_cooling_set_point_celsius: $json->min_cooling_set_point_celsius ?? + null, + min_cooling_set_point_fahrenheit: $json->min_cooling_set_point_fahrenheit ?? + null, + min_heating_cooling_delta_celsius: $json->min_heating_cooling_delta_celsius ?? + null, + min_heating_cooling_delta_fahrenheit: $json->min_heating_cooling_delta_fahrenheit ?? + null, + min_heating_set_point_celsius: $json->min_heating_set_point_celsius ?? + null, + min_heating_set_point_fahrenheit: $json->min_heating_set_point_fahrenheit ?? + null, + minut_metadata: isset($json->minut_metadata) + ? DeviceMinutMetadata::from_json($json->minut_metadata) + : null, + nest_metadata: isset($json->nest_metadata) + ? DeviceNestMetadata::from_json($json->nest_metadata) + : null, + noise_level_decibels: $json->noise_level_decibels ?? null, + noiseaware_metadata: isset($json->noiseaware_metadata) + ? DeviceNoiseawareMetadata::from_json( + $json->noiseaware_metadata + ) + : null, + nuki_metadata: isset($json->nuki_metadata) + ? DeviceNukiMetadata::from_json($json->nuki_metadata) + : null, + offline_access_codes_enabled: $json->offline_access_codes_enabled ?? + null, + online_access_codes_enabled: $json->online_access_codes_enabled ?? + null, + relative_humidity: $json->relative_humidity ?? null, + salto_ks_metadata: isset($json->salto_ks_metadata) + ? DeviceSaltoKsMetadata::from_json($json->salto_ks_metadata) + : null, + salto_metadata: isset($json->salto_metadata) + ? DeviceSaltoMetadata::from_json($json->salto_metadata) + : null, + salto_space_credential_service_metadata: isset( + $json->salto_space_credential_service_metadata + ) + ? DeviceSaltoSpaceCredentialServiceMetadata::from_json( + $json->salto_space_credential_service_metadata + ) + : null, + schlage_metadata: isset($json->schlage_metadata) + ? DeviceSchlageMetadata::from_json($json->schlage_metadata) + : null, + seam_bridge_metadata: isset($json->seam_bridge_metadata) + ? DeviceSeamBridgeMetadata::from_json( + $json->seam_bridge_metadata + ) + : null, + serial_number: $json->serial_number ?? null, + smartthings_metadata: isset($json->smartthings_metadata) + ? DeviceSmartthingsMetadata::from_json( + $json->smartthings_metadata + ) + : null, + supported_code_lengths: $json->supported_code_lengths ?? null, + supports_accessory_keypad: $json->supports_accessory_keypad ?? null, + supports_backup_access_code_pool: $json->supports_backup_access_code_pool ?? + null, + supports_offline_access_codes: $json->supports_offline_access_codes ?? + null, + tado_metadata: isset($json->tado_metadata) + ? DeviceTadoMetadata::from_json($json->tado_metadata) + : null, + tedee_metadata: isset($json->tedee_metadata) + ? DeviceTedeeMetadata::from_json($json->tedee_metadata) + : null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + temperature_threshold: isset($json->temperature_threshold) + ? DeviceTemperatureThreshold::from_json( + $json->temperature_threshold + ) + : null, + ttlock_metadata: isset($json->ttlock_metadata) + ? DeviceTtlockMetadata::from_json($json->ttlock_metadata) + : null, + two_n_metadata: isset($json->two_n_metadata) + ? DeviceTwoNMetadata::from_json($json->two_n_metadata) + : null, + visionline_metadata: isset($json->visionline_metadata) + ? DeviceVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + wyze_metadata: isset($json->wyze_metadata) + ? DeviceWyzeMetadata::from_json($json->wyze_metadata) + : null, + fallback_climate_preset_key: $json->fallback_climate_preset_key ?? + null + ); + } + + public function __construct( + public DeviceAppearance $appearance, + public DeviceModel $model, + public string $name, + public bool $online, + public array|null $_experimental_supported_code_from_access_codes_lengths, + public DeviceAccessoryKeypad|null $accessory_keypad, + public DeviceActiveThermostatSchedule|null $active_thermostat_schedule, + public DeviceAkilesMetadata|null $akiles_metadata, + public DeviceAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, + public DeviceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public DeviceAugustMetadata|null $august_metadata, + public array|null $available_climate_presets, + public array|null $available_fan_mode_settings, + public array|null $available_hvac_mode_settings, + public DeviceAvigilonAltaMetadata|null $avigilon_alta_metadata, + public DeviceBattery|null $battery, + public float|null $battery_level, + public DeviceBrivoMetadata|null $brivo_metadata, + public array|null $code_constraints, + public DeviceControlbywebMetadata|null $controlbyweb_metadata, + public DeviceCurrentClimateSetting|null $current_climate_setting, + public array|null $currently_triggering_noise_threshold_ids, + public DeviceDefaultClimateSetting|null $default_climate_setting, + public bool|null $door_open, + public DeviceDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, + public DeviceEcobeeMetadata|null $ecobee_metadata, + public string|null $fan_mode_setting, + public DeviceFourSuitesMetadata|null $four_suites_metadata, + public DeviceGenieMetadata|null $genie_metadata, + public bool|null $has_direct_power, + public bool|null $has_native_entry_events, + public DeviceHoneywellResideoMetadata|null $honeywell_resideo_metadata, + public DeviceHubitatMetadata|null $hubitat_metadata, + public DeviceIglooMetadata|null $igloo_metadata, + public DeviceIgloohomeMetadata|null $igloohome_metadata, + public string|null $image_alt_text, + public string|null $image_url, + public bool|null $is_cooling, + public bool|null $is_fan_running, + public bool|null $is_heating, + public bool|null $is_temporary_manual_override_active, + public DeviceKeypadBattery|null $keypad_battery, + public DeviceKwiksetMetadata|null $kwikset_metadata, + public bool|null $locked, + public DeviceLocklyMetadata|null $lockly_metadata, + public string|null $manufacturer, + public float|null $max_active_codes_supported, + public float|null $max_cooling_set_point_celsius, + public float|null $max_cooling_set_point_fahrenheit, + public float|null $max_heating_set_point_celsius, + public float|null $max_heating_set_point_fahrenheit, + public float|null $min_cooling_set_point_celsius, + public float|null $min_cooling_set_point_fahrenheit, + public float|null $min_heating_cooling_delta_celsius, + public float|null $min_heating_cooling_delta_fahrenheit, + public float|null $min_heating_set_point_celsius, + public float|null $min_heating_set_point_fahrenheit, + public DeviceMinutMetadata|null $minut_metadata, + public DeviceNestMetadata|null $nest_metadata, + public float|null $noise_level_decibels, + public DeviceNoiseawareMetadata|null $noiseaware_metadata, + public DeviceNukiMetadata|null $nuki_metadata, + public bool|null $offline_access_codes_enabled, + public bool|null $online_access_codes_enabled, + public float|null $relative_humidity, + public DeviceSaltoKsMetadata|null $salto_ks_metadata, + public DeviceSaltoMetadata|null $salto_metadata, + public DeviceSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata, + public DeviceSchlageMetadata|null $schlage_metadata, + public DeviceSeamBridgeMetadata|null $seam_bridge_metadata, + public string|null $serial_number, + public DeviceSmartthingsMetadata|null $smartthings_metadata, + public array|null $supported_code_lengths, + public bool|null $supports_accessory_keypad, + public bool|null $supports_backup_access_code_pool, + public bool|null $supports_offline_access_codes, + public DeviceTadoMetadata|null $tado_metadata, + public DeviceTedeeMetadata|null $tedee_metadata, + public float|null $temperature_celsius, + public float|null $temperature_fahrenheit, + public DeviceTemperatureThreshold|null $temperature_threshold, + public DeviceTtlockMetadata|null $ttlock_metadata, + public DeviceTwoNMetadata|null $two_n_metadata, + public DeviceVisionlineMetadata|null $visionline_metadata, + public DeviceWyzeMetadata|null $wyze_metadata, + public string|null $fallback_climate_preset_key + ) {} +} diff --git a/src/Routes/Objects/DeviceProvider.php b/src/Routes/Objects/DeviceProvider.php new file mode 100644 index 00000000..92aa892a --- /dev/null +++ b/src/Routes/Objects/DeviceProvider.php @@ -0,0 +1,51 @@ +device_provider_name, + display_name: $json->display_name, + image_url: $json->image_url, + provider_categories: $json->provider_categories, + 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, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, + can_remotely_lock: $json->can_remotely_lock ?? null, + can_remotely_unlock: $json->can_remotely_unlock ?? null, + can_simulate_connection: $json->can_simulate_connection ?? null, + can_simulate_disconnection: $json->can_simulate_disconnection ?? + null, + can_simulate_removal: $json->can_simulate_removal ?? null, + can_turn_off_hvac: $json->can_turn_off_hvac ?? null + ); + } + + public function __construct( + public string $device_provider_name, + public string $display_name, + public string $image_url, + public array $provider_categories, + public bool|null $can_hvac_cool, + public bool|null $can_hvac_heat, + public bool|null $can_hvac_heat_cool, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_connection, + public bool|null $can_simulate_disconnection, + public bool|null $can_simulate_removal, + public bool|null $can_turn_off_hvac + ) {} +} diff --git a/src/Routes/Objects/DeviceSaltoKsMetadata.php b/src/Routes/Objects/DeviceSaltoKsMetadata.php new file mode 100644 index 00000000..0e91a223 --- /dev/null +++ b/src/Routes/Objects/DeviceSaltoKsMetadata.php @@ -0,0 +1,30 @@ +battery_level, + customer_reference: $json->customer_reference, + lock_id: $json->lock_id, + lock_type: $json->lock_type, + locked_state: $json->locked_state, + model: $json->model ?? null + ); + } + + public function __construct( + public string $battery_level, + public string $customer_reference, + public string $lock_id, + public string $lock_type, + public string $locked_state, + public string|null $model + ) {} +} diff --git a/src/Routes/Objects/DeviceSaltoMetadata.php b/src/Routes/Objects/DeviceSaltoMetadata.php new file mode 100644 index 00000000..3c9fd629 --- /dev/null +++ b/src/Routes/Objects/DeviceSaltoMetadata.php @@ -0,0 +1,30 @@ +battery_level, + customer_reference: $json->customer_reference, + lock_id: $json->lock_id, + lock_type: $json->lock_type, + locked_state: $json->locked_state, + model: $json->model ?? null + ); + } + + public function __construct( + public string $battery_level, + public string $customer_reference, + public string $lock_id, + public string $lock_type, + public string $locked_state, + public string|null $model + ) {} +} diff --git a/src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php b/src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php new file mode 100644 index 00000000..38224c03 --- /dev/null +++ b/src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php @@ -0,0 +1,17 @@ +has_active_phone); + } + + public function __construct(public bool $has_active_phone) {} +} diff --git a/src/Routes/Objects/DeviceSchlageMetadata.php b/src/Routes/Objects/DeviceSchlageMetadata.php new file mode 100644 index 00000000..9301f752 --- /dev/null +++ b/src/Routes/Objects/DeviceSchlageMetadata.php @@ -0,0 +1,26 @@ +device_id, + device_name: $json->device_name, + model: $json->model ?? null, + access_code_length: $json->access_code_length ?? null + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public string|null $model, + public float|null $access_code_length + ) {} +} diff --git a/src/Routes/Objects/DeviceSeamBridgeMetadata.php b/src/Routes/Objects/DeviceSeamBridgeMetadata.php new file mode 100644 index 00000000..da836870 --- /dev/null +++ b/src/Routes/Objects/DeviceSeamBridgeMetadata.php @@ -0,0 +1,24 @@ +device_num, + name: $json->name, + unlock_method: $json->unlock_method ?? null + ); + } + + public function __construct( + public float $device_num, + public string $name, + public string|null $unlock_method + ) {} +} diff --git a/src/Routes/Objects/DeviceSmartthingsMetadata.php b/src/Routes/Objects/DeviceSmartthingsMetadata.php new file mode 100644 index 00000000..a31c1eec --- /dev/null +++ b/src/Routes/Objects/DeviceSmartthingsMetadata.php @@ -0,0 +1,27 @@ +device_id, + device_name: $json->device_name, + location_id: $json->location_id ?? null, + model: $json->model ?? null + ); + } + + public function __construct( + public string $device_id, + public string $device_name, + public string|null $location_id, + public string|null $model + ) {} +} diff --git a/src/Routes/Objects/DeviceSound.php b/src/Routes/Objects/DeviceSound.php new file mode 100644 index 00000000..cc3e4d43 --- /dev/null +++ b/src/Routes/Objects/DeviceSound.php @@ -0,0 +1,16 @@ +time, value: $json->value); + } + + public function __construct(public string $time, public float $value) {} +} diff --git a/src/Routes/Objects/DeviceTadoMetadata.php b/src/Routes/Objects/DeviceTadoMetadata.php new file mode 100644 index 00000000..d3430356 --- /dev/null +++ b/src/Routes/Objects/DeviceTadoMetadata.php @@ -0,0 +1,22 @@ +device_type, + serial_no: $json->serial_no + ); + } + + public function __construct( + public string $device_type, + public string $serial_no + ) {} +} diff --git a/src/Routes/Objects/DeviceTedeeMetadata.php b/src/Routes/Objects/DeviceTedeeMetadata.php new file mode 100644 index 00000000..4dc3ba7b --- /dev/null +++ b/src/Routes/Objects/DeviceTedeeMetadata.php @@ -0,0 +1,32 @@ +bridge_id, + bridge_name: $json->bridge_name, + device_id: $json->device_id, + device_model: $json->device_model, + device_name: $json->device_name, + serial_number: $json->serial_number, + keypad_id: $json->keypad_id ?? null + ); + } + + public function __construct( + public float $bridge_id, + public string $bridge_name, + public float $device_id, + public string $device_model, + public string $device_name, + public string $serial_number, + public float|null $keypad_id + ) {} +} diff --git a/src/Routes/Objects/DeviceTemperature.php b/src/Routes/Objects/DeviceTemperature.php new file mode 100644 index 00000000..4298b1ea --- /dev/null +++ b/src/Routes/Objects/DeviceTemperature.php @@ -0,0 +1,16 @@ +time, value: $json->value); + } + + public function __construct(public string $time, public float $value) {} +} diff --git a/src/Routes/Objects/DeviceTemperatureThreshold.php b/src/Routes/Objects/DeviceTemperatureThreshold.php new file mode 100644 index 00000000..989c4fc3 --- /dev/null +++ b/src/Routes/Objects/DeviceTemperatureThreshold.php @@ -0,0 +1,27 @@ +lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null + ); + } + + public function __construct( + public float|null $lower_limit_celsius, + public float|null $lower_limit_fahrenheit, + public float|null $upper_limit_celsius, + public float|null $upper_limit_fahrenheit + ) {} +} diff --git a/src/Routes/Objects/DeviceTtlockMetadata.php b/src/Routes/Objects/DeviceTtlockMetadata.php new file mode 100644 index 00000000..0716e468 --- /dev/null +++ b/src/Routes/Objects/DeviceTtlockMetadata.php @@ -0,0 +1,33 @@ +feature_value, + features: DeviceFeatures::from_json($json->features), + lock_alias: $json->lock_alias, + lock_id: $json->lock_id, + has_gateway: $json->has_gateway ?? null, + wireless_keypads: array_map( + fn($w) => DeviceWirelessKeypads::from_json($w), + $json->wireless_keypads ?? [] + ) + ); + } + + public function __construct( + public string $feature_value, + public DeviceFeatures $features, + public string $lock_alias, + public float $lock_id, + public bool|null $has_gateway, + public array|null $wireless_keypads + ) {} +} diff --git a/src/Routes/Objects/DeviceTwoNMetadata.php b/src/Routes/Objects/DeviceTwoNMetadata.php new file mode 100644 index 00000000..8b3a8fc7 --- /dev/null +++ b/src/Routes/Objects/DeviceTwoNMetadata.php @@ -0,0 +1,22 @@ +device_id, + device_name: $json->device_name + ); + } + + public function __construct( + public float $device_id, + public string $device_name + ) {} +} diff --git a/src/Routes/Objects/DeviceVisionlineMetadata.php b/src/Routes/Objects/DeviceVisionlineMetadata.php new file mode 100644 index 00000000..8697f5b6 --- /dev/null +++ b/src/Routes/Objects/DeviceVisionlineMetadata.php @@ -0,0 +1,16 @@ +encoder_id); + } + + public function __construct(public string $encoder_id) {} +} diff --git a/src/Routes/Objects/DeviceWarnings.php b/src/Routes/Objects/DeviceWarnings.php new file mode 100644 index 00000000..38f0a30e --- /dev/null +++ b/src/Routes/Objects/DeviceWarnings.php @@ -0,0 +1,24 @@ +message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/DeviceWirelessKeypads.php b/src/Routes/Objects/DeviceWirelessKeypads.php new file mode 100644 index 00000000..59f3592e --- /dev/null +++ b/src/Routes/Objects/DeviceWirelessKeypads.php @@ -0,0 +1,22 @@ +wireless_keypad_id, + wireless_keypad_name: $json->wireless_keypad_name + ); + } + + public function __construct( + public float $wireless_keypad_id, + public string $wireless_keypad_name + ) {} +} diff --git a/src/Routes/Objects/DeviceWyzeMetadata.php b/src/Routes/Objects/DeviceWyzeMetadata.php new file mode 100644 index 00000000..6cfc4ffb --- /dev/null +++ b/src/Routes/Objects/DeviceWyzeMetadata.php @@ -0,0 +1,34 @@ +device_id, + device_info_model: $json->device_info_model, + device_name: $json->device_name, + product_model: $json->product_model, + product_name: $json->product_name, + product_type: $json->product_type, + keypad_uuid: $json->keypad_uuid ?? null, + locker_status_hardlock: $json->locker_status_hardlock ?? null + ); + } + + public function __construct( + public string $device_id, + public string $device_info_model, + public string $device_name, + public string $product_model, + public string $product_name, + public string $product_type, + public string|null $keypad_uuid, + public float|null $locker_status_hardlock + ) {} +} diff --git a/src/Routes/Objects/EnrollmentAutomation.php b/src/Routes/Objects/EnrollmentAutomation.php new file mode 100644 index 00000000..1474faea --- /dev/null +++ b/src/Routes/Objects/EnrollmentAutomation.php @@ -0,0 +1,28 @@ +created_at, + credential_manager_acs_system_id: $json->credential_manager_acs_system_id, + enrollment_automation_id: $json->enrollment_automation_id, + user_identity_id: $json->user_identity_id, + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $created_at, + public string $credential_manager_acs_system_id, + public string $enrollment_automation_id, + public string $user_identity_id, + public string $workspace_id + ) {} +} diff --git a/src/Routes/Objects/Event.php b/src/Routes/Objects/Event.php new file mode 100644 index 00000000..6a984f11 --- /dev/null +++ b/src/Routes/Objects/Event.php @@ -0,0 +1,119 @@ +access_code_id ?? null, + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + acs_encoder_id: $json->acs_encoder_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + backup_access_code_id: $json->backup_access_code_id ?? null, + battery_level: $json->battery_level ?? null, + battery_status: $json->battery_status ?? null, + client_session_id: $json->client_session_id ?? null, + climate_preset_key: $json->climate_preset_key ?? null, + connect_webview_id: $json->connect_webview_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + created_at: $json->created_at ?? null, + desired_temperature_celsius: $json->desired_temperature_celsius ?? + null, + desired_temperature_fahrenheit: $json->desired_temperature_fahrenheit ?? + null, + device_id: $json->device_id ?? null, + enrollment_automation_id: $json->enrollment_automation_id ?? null, + error_code: $json->error_code ?? null, + event_id: $json->event_id ?? null, + event_type: $json->event_type ?? null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + is_fallback_climate_preset: $json->is_fallback_climate_preset ?? + null, + method: $json->method ?? null, + minut_metadata: $json->minut_metadata ?? null, + noise_level_decibels: $json->noise_level_decibels ?? null, + noise_level_nrs: $json->noise_level_nrs ?? null, + noise_threshold_id: $json->noise_threshold_id ?? null, + noise_threshold_name: $json->noise_threshold_name ?? null, + noiseaware_metadata: $json->noiseaware_metadata ?? null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + workspace_id: $json->workspace_id ?? null, + code: $json->code ?? null, + lower_limit_celsius: $json->lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, + thermostat_schedule_id: $json->thermostat_schedule_id ?? null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null + ); + } + + public function __construct( + public string|null $access_code_id, + public string|null $acs_access_group_id, + public string|null $acs_credential_id, + public string|null $acs_encoder_id, + public string|null $acs_system_id, + public string|null $acs_user_id, + public string|null $action_attempt_id, + public string|null $action_type, + public string|null $backup_access_code_id, + public float|null $battery_level, + public string|null $battery_status, + public string|null $client_session_id, + public string|null $climate_preset_key, + public string|null $connect_webview_id, + public string|null $connected_account_id, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $created_at, + public float|null $desired_temperature_celsius, + public float|null $desired_temperature_fahrenheit, + public string|null $device_id, + public string|null $enrollment_automation_id, + public string|null $error_code, + public string|null $event_id, + public string|null $event_type, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $is_fallback_climate_preset, + public string|null $method, + public mixed $minut_metadata, + public float|null $noise_level_decibels, + public float|null $noise_level_nrs, + public string|null $noise_threshold_id, + public string|null $noise_threshold_name, + public mixed $noiseaware_metadata, + public string|null $occurred_at, + public string|null $status, + public float|null $temperature_celsius, + public float|null $temperature_fahrenheit, + public string|null $workspace_id, + public string|null $code, + public float|null $lower_limit_celsius, + public float|null $lower_limit_fahrenheit, + public string|null $thermostat_schedule_id, + public float|null $upper_limit_celsius, + public float|null $upper_limit_fahrenheit + ) {} +} diff --git a/src/Routes/Objects/Network.php b/src/Routes/Objects/Network.php new file mode 100644 index 00000000..dab7aec7 --- /dev/null +++ b/src/Routes/Objects/Network.php @@ -0,0 +1,26 @@ +created_at, + display_name: $json->display_name, + network_id: $json->network_id, + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $created_at, + public string $display_name, + public string $network_id, + public string $workspace_id + ) {} +} diff --git a/src/Routes/Objects/NoiseThreshold.php b/src/Routes/Objects/NoiseThreshold.php new file mode 100644 index 00000000..9c4b1bfe --- /dev/null +++ b/src/Routes/Objects/NoiseThreshold.php @@ -0,0 +1,32 @@ +device_id, + ends_daily_at: $json->ends_daily_at, + name: $json->name, + noise_threshold_decibels: $json->noise_threshold_decibels, + noise_threshold_id: $json->noise_threshold_id, + starts_daily_at: $json->starts_daily_at, + noise_threshold_nrs: $json->noise_threshold_nrs ?? null + ); + } + + public function __construct( + public string $device_id, + public string $ends_daily_at, + public string $name, + public float $noise_threshold_decibels, + public string $noise_threshold_id, + public string $starts_daily_at, + public float|null $noise_threshold_nrs + ) {} +} diff --git a/src/Routes/Objects/Phone.php b/src/Routes/Objects/Phone.php new file mode 100644 index 00000000..76ace6af --- /dev/null +++ b/src/Routes/Objects/Phone.php @@ -0,0 +1,44 @@ +created_at, + custom_metadata: $json->custom_metadata, + device_id: $json->device_id, + device_type: $json->device_type, + display_name: $json->display_name, + errors: array_map( + fn($e) => PhoneErrors::from_json($e), + $json->errors ?? [] + ), + properties: PhoneProperties::from_json($json->properties), + warnings: array_map( + fn($w) => PhoneWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + nickname: $json->nickname ?? null + ); + } + + public function __construct( + public string $created_at, + public mixed $custom_metadata, + public string $device_id, + public string $device_type, + public string $display_name, + public array $errors, + public PhoneProperties $properties, + public array $warnings, + public string $workspace_id, + public string|null $nickname + ) {} +} diff --git a/src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php b/src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php new file mode 100644 index 00000000..601beb22 --- /dev/null +++ b/src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php @@ -0,0 +1,26 @@ + PhoneEndpoints::from_json($e), + $json->endpoints ?? [] + ), + has_active_endpoint: $json->has_active_endpoint + ); + } + + public function __construct( + public array $endpoints, + public bool $has_active_endpoint + ) {} +} diff --git a/src/Routes/Objects/PhoneEndpoints.php b/src/Routes/Objects/PhoneEndpoints.php new file mode 100644 index 00000000..7ac9888c --- /dev/null +++ b/src/Routes/Objects/PhoneEndpoints.php @@ -0,0 +1,22 @@ +endpoint_id, + is_active: $json->is_active + ); + } + + public function __construct( + public string $endpoint_id, + public bool $is_active + ) {} +} diff --git a/src/Routes/Objects/PhoneErrors.php b/src/Routes/Objects/PhoneErrors.php new file mode 100644 index 00000000..6d4e51c3 --- /dev/null +++ b/src/Routes/Objects/PhoneErrors.php @@ -0,0 +1,24 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/PhoneProperties.php b/src/Routes/Objects/PhoneProperties.php new file mode 100644 index 00000000..debbdbaf --- /dev/null +++ b/src/Routes/Objects/PhoneProperties.php @@ -0,0 +1,34 @@ +assa_abloy_credential_service_metadata + ) + ? PhoneAssaAbloyCredentialServiceMetadata::from_json( + $json->assa_abloy_credential_service_metadata + ) + : null, + salto_space_credential_service_metadata: isset( + $json->salto_space_credential_service_metadata + ) + ? PhoneSaltoSpaceCredentialServiceMetadata::from_json( + $json->salto_space_credential_service_metadata + ) + : null + ); + } + + public function __construct( + public PhoneAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, + public PhoneSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata + ) {} +} diff --git a/src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php b/src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php new file mode 100644 index 00000000..f93f553c --- /dev/null +++ b/src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php @@ -0,0 +1,17 @@ +has_active_phone); + } + + public function __construct(public bool $has_active_phone) {} +} diff --git a/src/Routes/Objects/PhoneWarnings.php b/src/Routes/Objects/PhoneWarnings.php new file mode 100644 index 00000000..6891854f --- /dev/null +++ b/src/Routes/Objects/PhoneWarnings.php @@ -0,0 +1,24 @@ +message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/ThermostatSchedule.php b/src/Routes/Objects/ThermostatSchedule.php new file mode 100644 index 00000000..5d229732 --- /dev/null +++ b/src/Routes/Objects/ThermostatSchedule.php @@ -0,0 +1,42 @@ +climate_preset_key, + created_at: $json->created_at, + device_id: $json->device_id, + ends_at: $json->ends_at, + errors: array_map( + fn($e) => ThermostatScheduleErrors::from_json($e), + $json->errors ?? [] + ), + max_override_period_minutes: $json->max_override_period_minutes, + starts_at: $json->starts_at, + thermostat_schedule_id: $json->thermostat_schedule_id, + name: $json->name ?? null, + unstable_is_override_allowed: $json->unstable_is_override_allowed ?? + null + ); + } + + public function __construct( + public string $climate_preset_key, + public string $created_at, + public string $device_id, + public string $ends_at, + public array $errors, + public mixed $max_override_period_minutes, + public string $starts_at, + public string $thermostat_schedule_id, + public string|null $name, + public bool|null $unstable_is_override_allowed + ) {} +} diff --git a/src/Routes/Objects/ThermostatScheduleErrors.php b/src/Routes/Objects/ThermostatScheduleErrors.php new file mode 100644 index 00000000..77acd975 --- /dev/null +++ b/src/Routes/Objects/ThermostatScheduleErrors.php @@ -0,0 +1,24 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAccessCode.php b/src/Routes/Objects/UnmanagedAccessCode.php new file mode 100644 index 00000000..b8912840 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAccessCode.php @@ -0,0 +1,48 @@ +access_code_id, + created_at: $json->created_at, + device_id: $json->device_id, + errors: array_map( + fn($e) => UnmanagedAccessCodeErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + status: $json->status, + type: $json->type, + warnings: array_map( + fn($w) => UnmanagedAccessCodeWarnings::from_json($w), + $json->warnings ?? [] + ), + code: $json->code ?? null, + name: $json->name ?? null, + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null + ); + } + + public function __construct( + public string $access_code_id, + public string $created_at, + public string $device_id, + public array $errors, + public bool $is_managed, + public string $status, + public string $type, + public array $warnings, + public string|null $code, + public string|null $name, + public string|null $ends_at, + public string|null $starts_at + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAccessCodeErrors.php b/src/Routes/Objects/UnmanagedAccessCodeErrors.php new file mode 100644 index 00000000..86f2c717 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAccessCodeErrors.php @@ -0,0 +1,32 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_access_code_error: $json->is_access_code_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_access_code_error, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAccessCodeWarnings.php b/src/Routes/Objects/UnmanagedAccessCodeWarnings.php new file mode 100644 index 00000000..472eda49 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAccessCodeWarnings.php @@ -0,0 +1,25 @@ +message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsAccessGroup.php b/src/Routes/Objects/UnmanagedAcsAccessGroup.php new file mode 100644 index 00000000..f682833d --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsAccessGroup.php @@ -0,0 +1,45 @@ +access_group_type, + access_group_type_display_name: $json->access_group_type_display_name, + acs_access_group_id: $json->acs_access_group_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + external_type: $json->external_type, + external_type_display_name: $json->external_type_display_name, + is_managed: $json->is_managed, + name: $json->name, + warnings: array_map( + fn($w) => UnmanagedAcsAccessGroupWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $access_group_type, + public string $access_group_type_display_name, + public string $acs_access_group_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public string $external_type, + public string $external_type_display_name, + public bool $is_managed, + public string $name, + public array $warnings, + public string $workspace_id + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php b/src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php new file mode 100644 index 00000000..d976fc14 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php @@ -0,0 +1,25 @@ +created_at, + message: $json->message, + warning_code: $json->warning_code + ); + } + + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsCredential.php b/src/Routes/Objects/UnmanagedAcsCredential.php new file mode 100644 index 00000000..871d420a --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsCredential.php @@ -0,0 +1,88 @@ +access_method, + acs_credential_id: $json->acs_credential_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => UnmanagedAcsCredentialErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => UnmanagedAcsCredentialWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? UnmanagedAcsCredentialAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + ends_at: $json->ends_at ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_issued: $json->is_issued ?? null, + is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? + null, + is_one_time_use: $json->is_one_time_use ?? null, + parent_acs_credential_id: $json->parent_acs_credential_id ?? null, + starts_at: $json->starts_at ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? UnmanagedAcsCredentialVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null + ); + } + + public function __construct( + public string $access_method, + public string $acs_credential_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public string|null $acs_credential_pool_id, + public string|null $acs_user_id, + public UnmanagedAcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $ends_at, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_issued, + public bool|null $is_multi_phone_sync_credential, + public bool|null $is_one_time_use, + public string|null $parent_acs_credential_id, + public string|null $starts_at, + public UnmanagedAcsCredentialVisionlineMetadata|null $visionline_metadata, + public string|null $card_number, + public string|null $code, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php b/src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php new file mode 100644 index 00000000..d6b62c71 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php @@ -0,0 +1,30 @@ +door_names ?? null, + endpoint_id: $json->endpoint_id ?? null, + key_id: $json->key_id ?? null, + key_issuing_request_id: $json->key_issuing_request_id ?? null, + override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? + null + ); + } + + public function __construct( + public array|null $door_names, + public string|null $endpoint_id, + public string|null $key_id, + public string|null $key_issuing_request_id, + public array|null $override_guest_acs_entrance_ids + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsCredentialErrors.php b/src/Routes/Objects/UnmanagedAcsCredentialErrors.php new file mode 100644 index 00000000..8e4cb998 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsCredentialErrors.php @@ -0,0 +1,25 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php b/src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php new file mode 100644 index 00000000..3a34d7c4 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php @@ -0,0 +1,35 @@ +card_function_type, + auto_join: $json->auto_join ?? null, + card_id: $json->card_id ?? null, + common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, + credential_id: $json->credential_id ?? null, + guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, + is_valid: $json->is_valid ?? null, + joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null + ); + } + + public function __construct( + public string $card_function_type, + public bool|null $auto_join, + public string|null $card_id, + public array|null $common_acs_entrance_ids, + public string|null $credential_id, + public array|null $guest_acs_entrance_ids, + public bool|null $is_valid, + public array|null $joiner_acs_credential_ids + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsCredentialWarnings.php b/src/Routes/Objects/UnmanagedAcsCredentialWarnings.php new file mode 100644 index 00000000..223089d0 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsCredentialWarnings.php @@ -0,0 +1,25 @@ +created_at, + message: $json->message, + warning_code: $json->warning_code + ); + } + + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsUser.php b/src/Routes/Objects/UnmanagedAcsUser.php new file mode 100644 index 00000000..cf3e205f --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsUser.php @@ -0,0 +1,79 @@ +acs_system_id, + acs_user_id: $json->acs_user_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => UnmanagedAcsUserErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => UnmanagedAcsUserWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + access_schedule: isset($json->access_schedule) + ? UnmanagedAcsUserAccessSchedule::from_json( + $json->access_schedule + ) + : null, + email: $json->email ?? null, + email_address: $json->email_address ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + full_name: $json->full_name ?? null, + hid_acs_system_id: $json->hid_acs_system_id ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + user_identity_id: $json->user_identity_id ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, + user_identity_email_address: $json->user_identity_email_address ?? + null, + user_identity_full_name: $json->user_identity_full_name ?? null, + user_identity_phone_number: $json->user_identity_phone_number ?? + null + ); + } + + public function __construct( + public string $acs_system_id, + public string $acs_user_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public UnmanagedAcsUserAccessSchedule|null $access_schedule, + public string|null $email, + public string|null $email_address, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $full_name, + public string|null $hid_acs_system_id, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $user_identity_id, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $latest_desired_state_synced_with_provider_at, + public string|null $user_identity_email_address, + public string|null $user_identity_full_name, + public string|null $user_identity_phone_number + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php b/src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php new file mode 100644 index 00000000..3e23b242 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php @@ -0,0 +1,23 @@ +starts_at, + ends_at: $json->ends_at ?? null + ); + } + + public function __construct( + public string $starts_at, + public string|null $ends_at + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsUserErrors.php b/src/Routes/Objects/UnmanagedAcsUserErrors.php new file mode 100644 index 00000000..e7623cc1 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsUserErrors.php @@ -0,0 +1,24 @@ +created_at, + error_code: $json->error_code, + message: $json->message + ); + } + + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) {} +} diff --git a/src/Routes/Objects/UnmanagedAcsUserWarnings.php b/src/Routes/Objects/UnmanagedAcsUserWarnings.php new file mode 100644 index 00000000..6f372b02 --- /dev/null +++ b/src/Routes/Objects/UnmanagedAcsUserWarnings.php @@ -0,0 +1,24 @@ +created_at, + message: $json->message, + warning_code: $json->warning_code + ); + } + + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) {} +} diff --git a/src/Routes/Objects/UnmanagedDevice.php b/src/Routes/Objects/UnmanagedDevice.php new file mode 100644 index 00000000..91d3fb85 --- /dev/null +++ b/src/Routes/Objects/UnmanagedDevice.php @@ -0,0 +1,73 @@ +capabilities_supported, + connected_account_id: $json->connected_account_id, + created_at: $json->created_at, + device_id: $json->device_id, + device_type: $json->device_type, + errors: array_map( + fn($e) => UnmanagedDeviceErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + properties: UnmanagedDeviceProperties::from_json($json->properties), + warnings: array_map( + fn($w) => UnmanagedDeviceWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + 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, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, + can_remotely_lock: $json->can_remotely_lock ?? null, + can_remotely_unlock: $json->can_remotely_unlock ?? null, + can_simulate_connection: $json->can_simulate_connection ?? null, + can_simulate_disconnection: $json->can_simulate_disconnection ?? + null, + can_simulate_removal: $json->can_simulate_removal ?? null, + can_turn_off_hvac: $json->can_turn_off_hvac ?? null, + location: isset($json->location) + ? UnmanagedDeviceLocation::from_json($json->location) + : null + ); + } + + public function __construct( + public array $capabilities_supported, + public string $connected_account_id, + public string $created_at, + public string $device_id, + public string $device_type, + public array $errors, + public bool $is_managed, + public UnmanagedDeviceProperties $properties, + public array $warnings, + public string $workspace_id, + public bool|null $can_hvac_cool, + public bool|null $can_hvac_heat, + public bool|null $can_hvac_heat_cool, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_connection, + public bool|null $can_simulate_disconnection, + public bool|null $can_simulate_removal, + public bool|null $can_turn_off_hvac, + public UnmanagedDeviceLocation|null $location + ) {} +} diff --git a/src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php b/src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php new file mode 100644 index 00000000..32070626 --- /dev/null +++ b/src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php @@ -0,0 +1,25 @@ +is_connected, + battery: isset($json->battery) + ? UnmanagedDeviceBattery::from_json($json->battery) + : null + ); + } + + public function __construct( + public bool $is_connected, + public UnmanagedDeviceBattery|null $battery + ) {} +} diff --git a/src/Routes/Objects/UnmanagedDeviceBattery.php b/src/Routes/Objects/UnmanagedDeviceBattery.php new file mode 100644 index 00000000..06a3f94c --- /dev/null +++ b/src/Routes/Objects/UnmanagedDeviceBattery.php @@ -0,0 +1,16 @@ +level); + } + + public function __construct(public float $level) {} +} diff --git a/src/Routes/Objects/UnmanagedDeviceErrors.php b/src/Routes/Objects/UnmanagedDeviceErrors.php new file mode 100644 index 00000000..6693298f --- /dev/null +++ b/src/Routes/Objects/UnmanagedDeviceErrors.php @@ -0,0 +1,29 @@ +error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); + } + + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) {} +} diff --git a/src/Routes/Objects/UnmanagedDeviceLocation.php b/src/Routes/Objects/UnmanagedDeviceLocation.php new file mode 100644 index 00000000..cfb22819 --- /dev/null +++ b/src/Routes/Objects/UnmanagedDeviceLocation.php @@ -0,0 +1,22 @@ +location_name ?? null, + timezone: $json->timezone ?? null + ); + } + + public function __construct( + public string|null $location_name, + public string|null $timezone + ) {} +} diff --git a/src/Routes/Objects/UnmanagedDeviceModel.php b/src/Routes/Objects/UnmanagedDeviceModel.php new file mode 100644 index 00000000..c24000d2 --- /dev/null +++ b/src/Routes/Objects/UnmanagedDeviceModel.php @@ -0,0 +1,36 @@ +display_name, + manufacturer_display_name: $json->manufacturer_display_name, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, + has_built_in_keypad: $json->has_built_in_keypad ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? + null + ); + } + + public function __construct( + public string $display_name, + public string $manufacturer_display_name, + public bool|null $accessory_keypad_supported, + public bool|null $can_connect_accessory_keypad, + public bool|null $has_built_in_keypad, + public bool|null $offline_access_codes_supported, + public bool|null $online_access_codes_supported + ) {} +} diff --git a/src/Routes/Objects/UnmanagedDeviceProperties.php b/src/Routes/Objects/UnmanagedDeviceProperties.php new file mode 100644 index 00000000..b31bb597 --- /dev/null +++ b/src/Routes/Objects/UnmanagedDeviceProperties.php @@ -0,0 +1,49 @@ +model), + name: $json->name, + online: $json->online, + accessory_keypad: isset($json->accessory_keypad) + ? UnmanagedDeviceAccessoryKeypad::from_json( + $json->accessory_keypad + ) + : null, + battery: isset($json->battery) + ? UnmanagedDeviceBattery::from_json($json->battery) + : null, + battery_level: $json->battery_level ?? null, + image_alt_text: $json->image_alt_text ?? null, + image_url: $json->image_url ?? null, + manufacturer: $json->manufacturer ?? null, + offline_access_codes_enabled: $json->offline_access_codes_enabled ?? + null, + online_access_codes_enabled: $json->online_access_codes_enabled ?? + null + ); + } + + public function __construct( + public UnmanagedDeviceModel $model, + public string $name, + public bool $online, + public UnmanagedDeviceAccessoryKeypad|null $accessory_keypad, + public UnmanagedDeviceBattery|null $battery, + public float|null $battery_level, + public string|null $image_alt_text, + public string|null $image_url, + public string|null $manufacturer, + public bool|null $offline_access_codes_enabled, + public bool|null $online_access_codes_enabled + ) {} +} diff --git a/src/Routes/Objects/UnmanagedDeviceWarnings.php b/src/Routes/Objects/UnmanagedDeviceWarnings.php new file mode 100644 index 00000000..51f5730d --- /dev/null +++ b/src/Routes/Objects/UnmanagedDeviceWarnings.php @@ -0,0 +1,24 @@ +message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); + } + + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) {} +} diff --git a/src/Routes/Objects/UserIdentity.php b/src/Routes/Objects/UserIdentity.php new file mode 100644 index 00000000..807870ee --- /dev/null +++ b/src/Routes/Objects/UserIdentity.php @@ -0,0 +1,34 @@ +created_at, + display_name: $json->display_name, + user_identity_id: $json->user_identity_id, + workspace_id: $json->workspace_id, + email_address: $json->email_address ?? null, + full_name: $json->full_name ?? null, + phone_number: $json->phone_number ?? null, + user_identity_key: $json->user_identity_key ?? null + ); + } + + public function __construct( + public string $created_at, + public string $display_name, + public string $user_identity_id, + public string $workspace_id, + public string|null $email_address, + public string|null $full_name, + public string|null $phone_number, + public string|null $user_identity_key + ) {} +} diff --git a/src/Routes/Objects/Webhook.php b/src/Routes/Objects/Webhook.php new file mode 100644 index 00000000..9435ed2f --- /dev/null +++ b/src/Routes/Objects/Webhook.php @@ -0,0 +1,26 @@ +url, + webhook_id: $json->webhook_id, + event_types: $json->event_types ?? null, + secret: $json->secret ?? null + ); + } + + public function __construct( + public string $url, + public string $webhook_id, + public array|null $event_types, + public string|null $secret + ) {} +} diff --git a/src/Routes/Objects/Workspace.php b/src/Routes/Objects/Workspace.php new file mode 100644 index 00000000..14b4b358 --- /dev/null +++ b/src/Routes/Objects/Workspace.php @@ -0,0 +1,28 @@ +company_name, + is_sandbox: $json->is_sandbox, + name: $json->name, + workspace_id: $json->workspace_id, + connect_partner_name: $json->connect_partner_name ?? null + ); + } + + public function __construct( + public string $company_name, + public bool $is_sandbox, + public string $name, + public string $workspace_id, + public string|null $connect_partner_name + ) {} +} diff --git a/src/Routes/Routes.php b/src/Routes/Routes.php new file mode 100644 index 00000000..854a96e0 --- /dev/null +++ b/src/Routes/Routes.php @@ -0,0 +1,64 @@ +access_codes = new AccessCodesClient($seam); + $this->acs = new AcsClient($seam); + $this->action_attempts = new ActionAttemptsClient($seam); + $this->bridges = new BridgesClient($seam); + $this->client_sessions = new ClientSessionsClient($seam); + $this->connect_webviews = new ConnectWebviewsClient($seam); + $this->connected_accounts = new ConnectedAccountsClient($seam); + $this->devices = new DevicesClient($seam); + $this->events = new EventsClient($seam); + $this->locks = new LocksClient($seam); + $this->networks = new NetworksClient($seam); + $this->noise_sensors = new NoiseSensorsClient($seam); + $this->phones = new PhonesClient($seam); + $this->thermostats = new ThermostatsClient($seam); + $this->user_identities = new UserIdentitiesClient($seam); + $this->webhooks = new WebhooksClient($seam); + $this->workspaces = new WorkspacesClient($seam); + } +} diff --git a/src/SeamClient.php b/src/SeamClient.php index 3af13b56..a6727e6e 100644 --- a/src/SeamClient.php +++ b/src/SeamClient.php @@ -2,35 +2,6 @@ namespace Seam; -use Seam\Objects\AccessCode; -use Seam\Objects\AcsAccessGroup; -use Seam\Objects\AcsCredential; -use Seam\Objects\AcsCredentialPool; -use Seam\Objects\AcsCredentialProvisioningAutomation; -use Seam\Objects\AcsEncoder; -use Seam\Objects\AcsEntrance; -use Seam\Objects\AcsSystem; -use Seam\Objects\AcsUser; -use Seam\Objects\ActionAttempt; -use Seam\Objects\ClientSession; -use Seam\Objects\ConnectWebview; -use Seam\Objects\ConnectedAccount; -use Seam\Objects\Device; -use Seam\Objects\DeviceProvider; -use Seam\Objects\EnrollmentAutomation; -use Seam\Objects\Event; -use Seam\Objects\Network; -use Seam\Objects\NoiseThreshold; -use Seam\Objects\Phone; -use Seam\Objects\ThermostatSchedule; -use Seam\Objects\UnmanagedAccessCode; -use Seam\Objects\UnmanagedAcsAccessGroup; -use Seam\Objects\UnmanagedAcsCredential; -use Seam\Objects\UnmanagedAcsUser; -use Seam\Objects\UnmanagedDevice; -use Seam\Objects\UserIdentity; -use Seam\Objects\Webhook; -use Seam\Objects\Workspace; use Seam\Utils\PackageVersion; use GuzzleHttp\Client as HTTPClient; @@ -38,5074 +9,95 @@ use Seam\HttpApiError; use Seam\HttpUnauthorizedError; use Seam\HttpInvalidInputError; -use Seam\ActionAttemptFailedError; -use Seam\ActionAttemptTimeoutError; +use Seam\Routes\Routes; define("LTS_VERSION", "1.0.0"); class SeamClient { - public AccessCodesClient $access_codes; - public AcsClient $acs; - public ActionAttemptsClient $action_attempts; - public BridgesClient $bridges; - public ClientSessionsClient $client_sessions; - public ConnectWebviewsClient $connect_webviews; - public ConnectedAccountsClient $connected_accounts; - public DevicesClient $devices; - public EventsClient $events; - public LocksClient $locks; - public NetworksClient $networks; - public NoiseSensorsClient $noise_sensors; - public PhonesClient $phones; - public ThermostatsClient $thermostats; - public UserIdentitiesClient $user_identities; - public WebhooksClient $webhooks; - public WorkspacesClient $workspaces; - - public string $api_key; - public HTTPClient $client; - public string $ltsVersion = LTS_VERSION; - - public function __construct( - $api_key = null, - $endpoint = "https://connect.getseam.com", - $throw_http_errors = false - ) { - $this->api_key = $api_key ?: (getenv("SEAM_API_KEY") ?: null); - $seam_sdk_version = PackageVersion::get(); - $this->client = new HTTPClient([ - "base_uri" => $endpoint, - "timeout" => 60.0, - "headers" => [ - "Authorization" => "Bearer " . $this->api_key, - "User-Agent" => "Seam PHP Client " . $seam_sdk_version, - "seam-sdk-name" => "seamapi/php", - "seam-sdk-version" => $seam_sdk_version, - "seam-lts-version" => $this->ltsVersion, - ], - "http_errors" => $throw_http_errors, - ]); - $this->access_codes = new AccessCodesClient($this); - $this->acs = new AcsClient($this); - $this->action_attempts = new ActionAttemptsClient($this); - $this->bridges = new BridgesClient($this); - $this->client_sessions = new ClientSessionsClient($this); - $this->connect_webviews = new ConnectWebviewsClient($this); - $this->connected_accounts = new ConnectedAccountsClient($this); - $this->devices = new DevicesClient($this); - $this->events = new EventsClient($this); - $this->locks = new LocksClient($this); - $this->networks = new NetworksClient($this); - $this->noise_sensors = new NoiseSensorsClient($this); - $this->phones = new PhonesClient($this); - $this->thermostats = new ThermostatsClient($this); - $this->user_identities = new UserIdentitiesClient($this); - $this->webhooks = new WebhooksClient($this); - $this->workspaces = new WorkspacesClient($this); - } - - public function request( - $method, - $path, - $json = null, - $query = null, - $inner_object = null - ) { - $options = [ - "json" => $json, - "query" => $query, - ]; - $options = array_filter($options, fn($option) => $option !== null); - - // TODO handle request errors - $response = $this->client->request($method, $path, $options); - $status_code = $response->getStatusCode(); - $request_id = $response->getHeaderLine("seam-request-id"); - - $res_json = null; - try { - $res_json = json_decode($response->getBody()); - } catch (Exception $ignoreError) { - } - - if ($status_code >= 400) { - if ($status_code === 401) { - throw new HttpUnauthorizedError($request_id); - } - - if (($res_json->error ?? null) != null) { - if ($res_json->error->type === "invalid_input") { - throw new HttpInvalidInputError( - $res_json->error, - $status_code, - $request_id - ); - } - - throw new HttpApiError( - $res_json->error, - $status_code, - $request_id - ); - } - - throw GuzzleHttpExceptionRequestException::create( - new GuzzleHttpPsr7Request($method, $path), - $response - ); - } - - return $inner_object ? $res_json->$inner_object : $res_json; - } -} - -class AccessCodesClient -{ - private SeamClient $seam; - public AccessCodesSimulateClient $simulate; - public AccessCodesUnmanagedClient $unmanaged; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->simulate = new AccessCodesSimulateClient($seam); - $this->unmanaged = new AccessCodesUnmanagedClient($seam); - } - - public function create( - string $device_id, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $code = null, - string $common_code_key = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - float $preferred_code_length = null, - string $starts_at = null, - bool $sync = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): AccessCode { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($allow_external_modification !== null) { - $request_payload[ - "allow_external_modification" - ] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload[ - "attempt_for_offline_device" - ] = $attempt_for_offline_device; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($common_code_key !== null) { - $request_payload["common_code_key"] = $common_code_key; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload[ - "is_external_modification_allowed" - ] = $is_external_modification_allowed; - } - if ($is_offline_access_code !== null) { - $request_payload[ - "is_offline_access_code" - ] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload[ - "prefer_native_scheduling" - ] = $prefer_native_scheduling; - } - if ($preferred_code_length !== null) { - $request_payload["preferred_code_length"] = $preferred_code_length; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - if ($use_backup_access_code_pool !== null) { - $request_payload[ - "use_backup_access_code_pool" - ] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload[ - "use_offline_access_code" - ] = $use_offline_access_code; - } - - $res = $this->seam->request( - "POST", - "/access_codes/create", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return AccessCode::from_json($res); - } - - public function create_multiple( - array $device_ids, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $behavior_when_code_cannot_be_shared = null, - string $code = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - float $preferred_code_length = null, - string $starts_at = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): array { - $request_payload = []; - - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($allow_external_modification !== null) { - $request_payload[ - "allow_external_modification" - ] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload[ - "attempt_for_offline_device" - ] = $attempt_for_offline_device; - } - if ($behavior_when_code_cannot_be_shared !== null) { - $request_payload[ - "behavior_when_code_cannot_be_shared" - ] = $behavior_when_code_cannot_be_shared; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload[ - "is_external_modification_allowed" - ] = $is_external_modification_allowed; - } - if ($is_offline_access_code !== null) { - $request_payload[ - "is_offline_access_code" - ] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload[ - "prefer_native_scheduling" - ] = $prefer_native_scheduling; - } - if ($preferred_code_length !== null) { - $request_payload["preferred_code_length"] = $preferred_code_length; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($use_backup_access_code_pool !== null) { - $request_payload[ - "use_backup_access_code_pool" - ] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload[ - "use_offline_access_code" - ] = $use_offline_access_code; - } - - $res = $this->seam->request( - "POST", - "/access_codes/create_multiple", - json: (object) $request_payload, - inner_object: "access_codes" - ); - - return array_map(fn($r) => AccessCode::from_json($r), $res); - } - - public function delete( - string $access_code_id, - string $device_id = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/delete", - json: (object) $request_payload - ); - } - - public function generate_code(string $device_id): AccessCode - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/generate_code", - json: (object) $request_payload, - inner_object: "generated_code" - ); - - return AccessCode::from_json($res); - } - - public function get( - string $access_code_id = null, - string $code = null, - string $device_id = null - ): AccessCode { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/get", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return AccessCode::from_json($res); - } - - public function list( - array $access_code_ids = null, - string $device_id = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($access_code_ids !== null) { - $request_payload["access_code_ids"] = $access_code_ids; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/access_codes/list", - json: (object) $request_payload, - inner_object: "access_codes" - ); - - return array_map(fn($r) => AccessCode::from_json($r), $res); - } - - public function pull_backup_access_code(string $access_code_id): AccessCode - { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/pull_backup_access_code", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return AccessCode::from_json($res); - } - - public function update( - string $access_code_id, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $code = null, - string $device_id = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_managed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - float $preferred_code_length = null, - string $starts_at = null, - bool $sync = null, - string $type = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($allow_external_modification !== null) { - $request_payload[ - "allow_external_modification" - ] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload[ - "attempt_for_offline_device" - ] = $attempt_for_offline_device; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload[ - "is_external_modification_allowed" - ] = $is_external_modification_allowed; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($is_offline_access_code !== null) { - $request_payload[ - "is_offline_access_code" - ] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload[ - "prefer_native_scheduling" - ] = $prefer_native_scheduling; - } - if ($preferred_code_length !== null) { - $request_payload["preferred_code_length"] = $preferred_code_length; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - if ($type !== null) { - $request_payload["type"] = $type; - } - if ($use_backup_access_code_pool !== null) { - $request_payload[ - "use_backup_access_code_pool" - ] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload[ - "use_offline_access_code" - ] = $use_offline_access_code; - } - - $this->seam->request( - "POST", - "/access_codes/update", - json: (object) $request_payload - ); - } - - public function update_multiple( - string $common_code_key, - string $ends_at = null, - string $name = null, - string $starts_at = null - ): void { - $request_payload = []; - - if ($common_code_key !== null) { - $request_payload["common_code_key"] = $common_code_key; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - - $this->seam->request( - "POST", - "/access_codes/update_multiple", - json: (object) $request_payload - ); - } -} - -class AccessCodesSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create_unmanaged_access_code( - string $code, - string $device_id, - string $name - ): UnmanagedAccessCode { - $request_payload = []; - - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/access_codes/simulate/create_unmanaged_access_code", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return UnmanagedAccessCode::from_json($res); - } -} - -class AccessCodesUnmanagedClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function convert_to_managed( - string $access_code_id, - bool $allow_external_modification = null, - bool $force = null, - bool $is_external_modification_allowed = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($allow_external_modification !== null) { - $request_payload[ - "allow_external_modification" - ] = $allow_external_modification; - } - if ($force !== null) { - $request_payload["force"] = $force; - } - if ($is_external_modification_allowed !== null) { - $request_payload[ - "is_external_modification_allowed" - ] = $is_external_modification_allowed; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/convert_to_managed", - json: (object) $request_payload - ); - } - - public function delete(string $access_code_id, bool $sync = null): void - { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/delete", - json: (object) $request_payload - ); - } - - public function get( - string $access_code_id = null, - string $code = null, - string $device_id = null - ): UnmanagedAccessCode { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/unmanaged/get", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return UnmanagedAccessCode::from_json($res); - } - - public function list( - string $device_id, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/access_codes/unmanaged/list", - json: (object) $request_payload, - inner_object: "access_codes" - ); - - return array_map(fn($r) => UnmanagedAccessCode::from_json($r), $res); - } - - public function update( - string $access_code_id, - bool $is_managed, - bool $allow_external_modification = null, - bool $force = null, - bool $is_external_modification_allowed = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($allow_external_modification !== null) { - $request_payload[ - "allow_external_modification" - ] = $allow_external_modification; - } - if ($force !== null) { - $request_payload["force"] = $force; - } - if ($is_external_modification_allowed !== null) { - $request_payload[ - "is_external_modification_allowed" - ] = $is_external_modification_allowed; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/update", - json: (object) $request_payload - ); - } -} - -class AcsAccessGroupsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function add_user( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/access_groups/add_user", - json: (object) $request_payload - ); - } - - public function get(string $acs_access_group_id): AcsAccessGroup - { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/get", - json: (object) $request_payload, - inner_object: "acs_access_group" - ); - - return AcsAccessGroup::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $acs_user_id = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list", - json: (object) $request_payload, - inner_object: "acs_access_groups" - ); - - return array_map(fn($r) => AcsAccessGroup::from_json($r), $res); - } - - public function list_accessible_entrances( - string $acs_access_group_id - ): array { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list_accessible_entrances", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function list_users(string $acs_access_group_id): array - { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list_users", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => AcsUser::from_json($r), $res); - } - - public function remove_user( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/access_groups/remove_user", - json: (object) $request_payload - ); - } -} - -class AcsClient -{ - private SeamClient $seam; - public AcsAccessGroupsClient $access_groups; - public AcsCredentialPoolsClient $credential_pools; - public AcsCredentialProvisioningAutomationsClient $credential_provisioning_automations; - public AcsCredentialsClient $credentials; - public AcsEncodersClient $encoders; - public AcsEntrancesClient $entrances; - public AcsSystemsClient $systems; - public AcsUsersClient $users; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->access_groups = new AcsAccessGroupsClient($seam); - $this->credential_pools = new AcsCredentialPoolsClient($seam); - $this->credential_provisioning_automations = new AcsCredentialProvisioningAutomationsClient( - $seam - ); - $this->credentials = new AcsCredentialsClient($seam); - $this->encoders = new AcsEncodersClient($seam); - $this->entrances = new AcsEntrancesClient($seam); - $this->systems = new AcsSystemsClient($seam); - $this->users = new AcsUsersClient($seam); - } -} - -class AcsAccessGroupsUnmanagedClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $acs_access_group_id): UnmanagedAcsAccessGroup - { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/unmanaged/get", - json: (object) $request_payload, - inner_object: "acs_access_group" - ); - - return UnmanagedAcsAccessGroup::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $acs_user_id = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/unmanaged/list", - json: (object) $request_payload, - inner_object: "acs_access_groups" - ); - - return array_map( - fn($r) => UnmanagedAcsAccessGroup::from_json($r), - $res - ); - } -} - -class AcsCredentialPoolsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function list(string $acs_system_id): array - { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credential_pools/list", - json: (object) $request_payload, - inner_object: "acs_credential_pools" - ); - - return array_map(fn($r) => AcsCredentialPool::from_json($r), $res); - } -} - -class AcsCredentialProvisioningAutomationsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function launch( - string $credential_manager_acs_system_id, - string $user_identity_id, - string $acs_credential_pool_id = null, - bool $create_credential_manager_user = null, - string $credential_manager_acs_user_id = null - ): AcsCredentialProvisioningAutomation { - $request_payload = []; - - if ($credential_manager_acs_system_id !== null) { - $request_payload[ - "credential_manager_acs_system_id" - ] = $credential_manager_acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($acs_credential_pool_id !== null) { - $request_payload[ - "acs_credential_pool_id" - ] = $acs_credential_pool_id; - } - if ($create_credential_manager_user !== null) { - $request_payload[ - "create_credential_manager_user" - ] = $create_credential_manager_user; - } - if ($credential_manager_acs_user_id !== null) { - $request_payload[ - "credential_manager_acs_user_id" - ] = $credential_manager_acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credential_provisioning_automations/launch", - json: (object) $request_payload, - inner_object: "acs_credential_provisioning_automation" - ); - - return AcsCredentialProvisioningAutomation::from_json($res); - } -} - -class AcsCredentialsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function assign(string $acs_credential_id, string $acs_user_id): void - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/assign", - json: (object) $request_payload - ); - } - - public function create( - string $access_method, - string $acs_user_id, - array $allowed_acs_entrance_ids = null, - mixed $assa_abloy_vostio_metadata = null, - string $code = null, - string $credential_manager_acs_system_id = null, - string $ends_at = null, - bool $is_multi_phone_sync_credential = null, - mixed $salto_space_metadata = null, - string $starts_at = null, - mixed $visionline_metadata = null - ): AcsCredential { - $request_payload = []; - - if ($access_method !== null) { - $request_payload["access_method"] = $access_method; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($allowed_acs_entrance_ids !== null) { - $request_payload[ - "allowed_acs_entrance_ids" - ] = $allowed_acs_entrance_ids; - } - if ($assa_abloy_vostio_metadata !== null) { - $request_payload[ - "assa_abloy_vostio_metadata" - ] = $assa_abloy_vostio_metadata; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($credential_manager_acs_system_id !== null) { - $request_payload[ - "credential_manager_acs_system_id" - ] = $credential_manager_acs_system_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_multi_phone_sync_credential !== null) { - $request_payload[ - "is_multi_phone_sync_credential" - ] = $is_multi_phone_sync_credential; - } - if ($salto_space_metadata !== null) { - $request_payload["salto_space_metadata"] = $salto_space_metadata; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($visionline_metadata !== null) { - $request_payload["visionline_metadata"] = $visionline_metadata; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/create", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return AcsCredential::from_json($res); - } - - public function create_offline_code( - string $acs_user_id, - string $allowed_acs_entrance_id, - string $ends_at = null, - bool $is_one_time_use = null, - string $starts_at = null - ): AcsCredential { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($allowed_acs_entrance_id !== null) { - $request_payload[ - "allowed_acs_entrance_id" - ] = $allowed_acs_entrance_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/create_offline_code", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return AcsCredential::from_json($res); - } - - public function delete(string $acs_credential_id): void - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/delete", - json: (object) $request_payload - ); - } - - public function get(string $acs_credential_id): AcsCredential - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/get", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return AcsCredential::from_json($res); - } - - public function list( - string $acs_user_id = null, - string $acs_system_id = null, - string $user_identity_id = null, - string $created_before = null, - bool $is_multi_phone_sync_credential = null, - float $limit = null - ): array { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($is_multi_phone_sync_credential !== null) { - $request_payload[ - "is_multi_phone_sync_credential" - ] = $is_multi_phone_sync_credential; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/list", - json: (object) $request_payload, - inner_object: "acs_credentials" - ); - - return array_map(fn($r) => AcsCredential::from_json($r), $res); - } - - public function list_accessible_entrances(string $acs_credential_id): array - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/list_accessible_entrances", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function unassign( - string $acs_credential_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/unassign", - json: (object) $request_payload - ); - } - - public function update( - string $acs_credential_id, - string $code = null, - string $ends_at = null - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - - $this->seam->request( - "POST", - "/acs/credentials/update", - json: (object) $request_payload - ); - } -} - -class AcsCredentialsUnmanagedClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $acs_credential_id): UnmanagedAcsCredential - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/unmanaged/get", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return UnmanagedAcsCredential::from_json($res); - } - - public function list( - string $acs_user_id = null, - string $acs_system_id = null, - string $user_identity_id = null - ): array { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/unmanaged/list", - json: (object) $request_payload, - inner_object: "acs_credentials" - ); - - return array_map(fn($r) => UnmanagedAcsCredential::from_json($r), $res); - } -} - -class AcsEncodersClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function encode_credential( - string $acs_credential_id, - string $acs_encoder_id, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - - $res = $this->seam->request( - "POST", - "/acs/encoders/encode_credential", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function list( - string $acs_system_id = null, - float $limit = null, - array $acs_system_ids = null, - array $acs_encoder_ids = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($acs_system_ids !== null) { - $request_payload["acs_system_ids"] = $acs_system_ids; - } - if ($acs_encoder_ids !== null) { - $request_payload["acs_encoder_ids"] = $acs_encoder_ids; - } - - $res = $this->seam->request( - "POST", - "/acs/encoders/list", - json: (object) $request_payload, - inner_object: "acs_encoders" - ); - - return array_map(fn($r) => AcsEncoder::from_json($r), $res); - } - - public function scan_credential( - string $acs_encoder_id, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - - $res = $this->seam->request( - "POST", - "/acs/encoders/scan_credential", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } -} - -class AcsEncodersSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function next_credential_encode_will_fail( - string $acs_encoder_id, - string $error_code = null, - string $acs_credential_id = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($error_code !== null) { - $request_payload["error_code"] = $error_code; - } - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_encode_will_fail", - json: (object) $request_payload - ); - } - - public function next_credential_encode_will_succeed( - string $acs_encoder_id, - string $scenario = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($scenario !== null) { - $request_payload["scenario"] = $scenario; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_encode_will_succeed", - json: (object) $request_payload - ); - } - - public function next_credential_scan_will_fail( - string $acs_encoder_id, - string $error_code = null, - string $acs_credential_id_on_seam = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($error_code !== null) { - $request_payload["error_code"] = $error_code; - } - if ($acs_credential_id_on_seam !== null) { - $request_payload[ - "acs_credential_id_on_seam" - ] = $acs_credential_id_on_seam; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_scan_will_fail", - json: (object) $request_payload - ); - } - - public function next_credential_scan_will_succeed( - string $acs_encoder_id, - string $acs_credential_id_on_seam = null, - string $scenario = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($acs_credential_id_on_seam !== null) { - $request_payload[ - "acs_credential_id_on_seam" - ] = $acs_credential_id_on_seam; - } - if ($scenario !== null) { - $request_payload["scenario"] = $scenario; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_scan_will_succeed", - json: (object) $request_payload - ); - } -} - -class AcsEntrancesClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $acs_entrance_id): AcsEntrance - { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/get", - json: (object) $request_payload, - inner_object: "acs_entrance" - ); - - return AcsEntrance::from_json($res); - } - - public function grant_access( - string $acs_entrance_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/entrances/grant_access", - json: (object) $request_payload - ); - } - - public function list( - string $acs_credential_id = null, - string $acs_system_id = null - ): array { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/list", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function list_credentials_with_access( - string $acs_entrance_id, - array $include_if = null - ): array { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/list_credentials_with_access", - json: (object) $request_payload, - inner_object: "acs_credentials" - ); - - return array_map(fn($r) => AcsCredential::from_json($r), $res); - } -} - -class AcsSystemsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $acs_system_id): AcsSystem - { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/get", - json: (object) $request_payload, - inner_object: "acs_system" - ); - - return AcsSystem::from_json($res); - } - - public function list(string $connected_account_id = null): array - { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/list", - json: (object) $request_payload, - inner_object: "acs_systems" - ); - - return array_map(fn($r) => AcsSystem::from_json($r), $res); - } - - public function list_compatible_credential_manager_acs_systems( - string $acs_system_id - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/list_compatible_credential_manager_acs_systems", - json: (object) $request_payload, - inner_object: "acs_systems" - ); - - return array_map(fn($r) => AcsSystem::from_json($r), $res); - } -} - -class AcsUsersClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function add_to_access_group( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/add_to_access_group", - json: (object) $request_payload - ); - } - - public function create( - string $acs_system_id, - string $full_name, - mixed $access_schedule = null, - array $acs_access_group_ids = null, - string $email = null, - string $email_address = null, - string $phone_number = null, - string $user_identity_id = null - ): AcsUser { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($access_schedule !== null) { - $request_payload["access_schedule"] = $access_schedule; - } - if ($acs_access_group_ids !== null) { - $request_payload["acs_access_group_ids"] = $acs_access_group_ids; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/create", - json: (object) $request_payload, - inner_object: "acs_user" - ); - - return AcsUser::from_json($res); - } - - public function delete(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/delete", - json: (object) $request_payload - ); - } - - public function get(string $acs_user_id): AcsUser - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/get", - json: (object) $request_payload, - inner_object: "acs_user" - ); - - return AcsUser::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $created_before = null, - float $limit = null, - string $user_identity_email_address = null, - string $user_identity_id = null, - string $user_identity_phone_number = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($user_identity_email_address !== null) { - $request_payload[ - "user_identity_email_address" - ] = $user_identity_email_address; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_phone_number !== null) { - $request_payload[ - "user_identity_phone_number" - ] = $user_identity_phone_number; - } - - $res = $this->seam->request( - "POST", - "/acs/users/list", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => AcsUser::from_json($r), $res); - } - - public function list_accessible_entrances(string $acs_user_id): array - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/list_accessible_entrances", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function remove_from_access_group( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/remove_from_access_group", - json: (object) $request_payload - ); - } - - public function revoke_access_to_all_entrances(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/revoke_access_to_all_entrances", - json: (object) $request_payload - ); - } - - public function suspend(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/suspend", - json: (object) $request_payload - ); - } - - public function unsuspend(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/unsuspend", - json: (object) $request_payload - ); - } - - public function update( - string $acs_user_id, - mixed $access_schedule = null, - string $email = null, - string $email_address = null, - string $full_name = null, - string $hid_acs_system_id = null, - string $phone_number = null - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($access_schedule !== null) { - $request_payload["access_schedule"] = $access_schedule; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($hid_acs_system_id !== null) { - $request_payload["hid_acs_system_id"] = $hid_acs_system_id; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - - $this->seam->request( - "POST", - "/acs/users/update", - json: (object) $request_payload - ); - } -} - -class AcsUsersUnmanagedClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $acs_user_id): UnmanagedAcsUser - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/unmanaged/get", - json: (object) $request_payload, - inner_object: "acs_user" - ); - - return UnmanagedAcsUser::from_json($res); - } - - public function list( - string $acs_system_id = null, - float $limit = null, - string $user_identity_email_address = null, - string $user_identity_id = null, - string $user_identity_phone_number = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($user_identity_email_address !== null) { - $request_payload[ - "user_identity_email_address" - ] = $user_identity_email_address; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_phone_number !== null) { - $request_payload[ - "user_identity_phone_number" - ] = $user_identity_phone_number; - } - - $res = $this->seam->request( - "POST", - "/acs/users/unmanaged/list", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => UnmanagedAcsUser::from_json($r), $res); - } -} - -class ActionAttemptsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $action_attempt_id): ActionAttempt - { - $request_payload = []; - - if ($action_attempt_id !== null) { - $request_payload["action_attempt_id"] = $action_attempt_id; - } - - $res = $this->seam->request( - "POST", - "/action_attempts/get", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - return ActionAttempt::from_json($res); - } - - public function list(array $action_attempt_ids): array - { - $request_payload = []; - - if ($action_attempt_ids !== null) { - $request_payload["action_attempt_ids"] = $action_attempt_ids; - } - - $res = $this->seam->request( - "POST", - "/action_attempts/list", - json: (object) $request_payload, - inner_object: "action_attempts" - ); - - return array_map(fn($r) => ActionAttempt::from_json($r), $res); - } - public function poll_until_ready( - string $action_attempt_id, - float $timeout = 20.0 - ): ActionAttempt { - $seam = $this->seam; - $time_waiting = 0.0; - $polling_interval = 0.4; - $action_attempt = $seam->action_attempts->get($action_attempt_id); - - while ($action_attempt->status == "pending") { - $action_attempt = $seam->action_attempts->get( - $action_attempt->action_attempt_id - ); - if ($time_waiting > $timeout) { - throw new ActionAttemptTimeoutError($action_attempt, $timeout); - } - $time_waiting += $polling_interval; - usleep($polling_interval * 1000000); - } - - if ($action_attempt->status == "error") { - throw new ActionAttemptFailedError($action_attempt); - } - - return $action_attempt; - } -} - -class BridgesClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $bridge_id): void - { - $request_payload = []; - - if ($bridge_id !== null) { - $request_payload["bridge_id"] = $bridge_id; - } - - $this->seam->request( - "POST", - "/bridges/get", - json: (object) $request_payload, - inner_object: "bridge" - ); - } - - public function list(): void - { - $request_payload = []; - - $this->seam->request( - "POST", - "/bridges/list", - json: (object) $request_payload, - inner_object: "bridges" - ); - } -} - -class ClientSessionsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create( - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $expires_at = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): ClientSession { - $request_payload = []; - - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($expires_at !== null) { - $request_payload["expires_at"] = $expires_at; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/create", - json: (object) $request_payload, - inner_object: "client_session" - ); - - return ClientSession::from_json($res); - } - - public function delete(string $client_session_id): void - { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - - $this->seam->request( - "POST", - "/client_sessions/delete", - json: (object) $request_payload - ); - } - - public function get( - string $client_session_id = null, - string $user_identifier_key = null - ): ClientSession { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/get", - json: (object) $request_payload, - inner_object: "client_session" - ); - - return ClientSession::from_json($res); - } - - public function get_or_create( - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $expires_at = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): ClientSession { - $request_payload = []; - - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($expires_at !== null) { - $request_payload["expires_at"] = $expires_at; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/get_or_create", - json: (object) $request_payload, - inner_object: "client_session" - ); - - return ClientSession::from_json($res); - } - - public function grant_access( - string $client_session_id = null, - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): void { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $this->seam->request( - "POST", - "/client_sessions/grant_access", - json: (object) $request_payload - ); - } - - public function list( - string $client_session_id = null, - string $connect_webview_id = null, - string $user_identifier_key = null, - string $user_identity_id = null, - bool $without_user_identifier_key = null - ): array { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($without_user_identifier_key !== null) { - $request_payload[ - "without_user_identifier_key" - ] = $without_user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/list", - json: (object) $request_payload, - inner_object: "client_sessions" - ); - - return array_map(fn($r) => ClientSession::from_json($r), $res); - } - - public function revoke(string $client_session_id): void - { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - - $this->seam->request( - "POST", - "/client_sessions/revoke", - json: (object) $request_payload - ); - } -} - -class ConnectWebviewsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create( - array $accepted_providers = null, - bool $automatically_manage_new_devices = null, - mixed $custom_metadata = null, - string $custom_redirect_failure_url = null, - string $custom_redirect_url = null, - string $device_selection_mode = null, - string $provider_category = null, - bool $wait_for_device_creation = null - ): ConnectWebview { - $request_payload = []; - - if ($accepted_providers !== null) { - $request_payload["accepted_providers"] = $accepted_providers; - } - if ($automatically_manage_new_devices !== null) { - $request_payload[ - "automatically_manage_new_devices" - ] = $automatically_manage_new_devices; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - if ($custom_redirect_failure_url !== null) { - $request_payload[ - "custom_redirect_failure_url" - ] = $custom_redirect_failure_url; - } - if ($custom_redirect_url !== null) { - $request_payload["custom_redirect_url"] = $custom_redirect_url; - } - if ($device_selection_mode !== null) { - $request_payload["device_selection_mode"] = $device_selection_mode; - } - if ($provider_category !== null) { - $request_payload["provider_category"] = $provider_category; - } - if ($wait_for_device_creation !== null) { - $request_payload[ - "wait_for_device_creation" - ] = $wait_for_device_creation; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/create", - json: (object) $request_payload, - inner_object: "connect_webview" - ); - - return ConnectWebview::from_json($res); - } - - public function delete(string $connect_webview_id): void - { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - - $this->seam->request( - "POST", - "/connect_webviews/delete", - json: (object) $request_payload - ); - } - - public function get(string $connect_webview_id): ConnectWebview - { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/get", - json: (object) $request_payload, - inner_object: "connect_webview" - ); - - return ConnectWebview::from_json($res); - } - - public function list( - mixed $custom_metadata_has = null, - float $limit = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/list", - json: (object) $request_payload, - inner_object: "connect_webviews" - ); - - return array_map(fn($r) => ConnectWebview::from_json($r), $res); - } -} - -class ConnectedAccountsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function delete( - string $connected_account_id, - bool $sync = null - ): void { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/connected_accounts/delete", - json: (object) $request_payload - ); - } - - public function get( - string $connected_account_id = null, - string $email = null - ): ConnectedAccount { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - - $res = $this->seam->request( - "POST", - "/connected_accounts/get", - json: (object) $request_payload, - inner_object: "connected_account" - ); - - return ConnectedAccount::from_json($res); - } - - public function list( - mixed $custom_metadata_has = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/connected_accounts/list", - json: (object) $request_payload, - inner_object: "connected_accounts" - ); - - return array_map(fn($r) => ConnectedAccount::from_json($r), $res); - } - - public function update( - string $connected_account_id, - bool $automatically_manage_new_devices = null, - mixed $custom_metadata = null - ): void { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($automatically_manage_new_devices !== null) { - $request_payload[ - "automatically_manage_new_devices" - ] = $automatically_manage_new_devices; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - - $this->seam->request( - "POST", - "/connected_accounts/update", - json: (object) $request_payload - ); - } -} - -class DevicesClient -{ - private SeamClient $seam; - public DevicesSimulateClient $simulate; - public DevicesUnmanagedClient $unmanaged; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->simulate = new DevicesSimulateClient($seam); - $this->unmanaged = new DevicesUnmanagedClient($seam); - } - - public function delete(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/delete", - json: (object) $request_payload - ); - } - - public function get(string $device_id = null, string $name = null): Device - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/devices/get", - json: (object) $request_payload, - inner_object: "device" - ); - - return Device::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/devices/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function list_device_providers( - string $provider_category = null - ): array { - $request_payload = []; - - if ($provider_category !== null) { - $request_payload["provider_category"] = $provider_category; - } - - $res = $this->seam->request( - "POST", - "/devices/list_device_providers", - json: (object) $request_payload, - inner_object: "device_providers" - ); - - return array_map(fn($r) => DeviceProvider::from_json($r), $res); - } - - public function update( - string $device_id, - mixed $custom_metadata = null, - bool $is_managed = null, - string $name = null, - mixed $properties = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($properties !== null) { - $request_payload["properties"] = $properties; - } - - $this->seam->request( - "POST", - "/devices/update", - json: (object) $request_payload - ); - } -} - -class DevicesSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function connect(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/simulate/connect", - json: (object) $request_payload - ); - } - - public function disconnect(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/simulate/disconnect", - json: (object) $request_payload - ); - } - - public function remove(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/simulate/remove", - json: (object) $request_payload - ); - } -} - -class DevicesUnmanagedClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get( - string $device_id = null, - string $name = null - ): UnmanagedDevice { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/devices/unmanaged/get", - json: (object) $request_payload, - inner_object: "device" - ); - - return UnmanagedDevice::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/devices/unmanaged/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => UnmanagedDevice::from_json($r), $res); - } - - public function update(string $device_id, bool $is_managed): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - - $this->seam->request( - "POST", - "/devices/unmanaged/update", - json: (object) $request_payload - ); - } -} - -class EventsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get( - string $device_id = null, - string $event_id = null, - string $event_type = null - ): Event { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($event_id !== null) { - $request_payload["event_id"] = $event_id; - } - if ($event_type !== null) { - $request_payload["event_type"] = $event_type; - } - - $res = $this->seam->request( - "POST", - "/events/get", - json: (object) $request_payload, - inner_object: "event" - ); - - return Event::from_json($res); - } - - public function list( - string $access_code_id = null, - array $access_code_ids = null, - string $acs_system_id = null, - array $acs_system_ids = null, - array $between = null, - string $connect_webview_id = null, - string $connected_account_id = null, - string $device_id = null, - array $device_ids = null, - string $event_type = null, - array $event_types = null, - float $limit = null, - string $since = null, - float $unstable_offset = null - ): array { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($access_code_ids !== null) { - $request_payload["access_code_ids"] = $access_code_ids; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($acs_system_ids !== null) { - $request_payload["acs_system_ids"] = $acs_system_ids; - } - if ($between !== null) { - $request_payload["between"] = $between; - } - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($event_type !== null) { - $request_payload["event_type"] = $event_type; - } - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($since !== null) { - $request_payload["since"] = $since; - } - if ($unstable_offset !== null) { - $request_payload["unstable_offset"] = $unstable_offset; - } - - $res = $this->seam->request( - "POST", - "/events/list", - json: (object) $request_payload, - inner_object: "events" - ); - - return array_map(fn($r) => Event::from_json($r), $res); - } -} - -class LocksClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $device_id = null, string $name = null): Device - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/locks/get", - json: (object) $request_payload, - inner_object: "device" - ); - - return Device::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/locks/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function lock_door( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/locks/lock_door", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function unlock_door( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/locks/unlock_door", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } -} - -class NetworksClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function get(string $network_id): Network - { - $request_payload = []; - - if ($network_id !== null) { - $request_payload["network_id"] = $network_id; - } - - $res = $this->seam->request( - "POST", - "/networks/get", - json: (object) $request_payload, - inner_object: "network" - ); - - return Network::from_json($res); - } - - public function list(): array - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/networks/list", - json: (object) $request_payload, - inner_object: "networks" - ); - - return array_map(fn($r) => Network::from_json($r), $res); - } -} - -class NoiseSensorsClient -{ - private SeamClient $seam; - public NoiseSensorsNoiseThresholdsClient $noise_thresholds; - public NoiseSensorsSimulateClient $simulate; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->noise_thresholds = new NoiseSensorsNoiseThresholdsClient($seam); - $this->simulate = new NoiseSensorsSimulateClient($seam); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } -} - -class NoiseSensorsNoiseThresholdsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create( - string $device_id, - string $ends_daily_at, - string $starts_daily_at, - string $name = null, - float $noise_threshold_decibels = null, - float $noise_threshold_nrs = null, - bool $sync = null - ): NoiseThreshold { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_daily_at !== null) { - $request_payload["ends_daily_at"] = $ends_daily_at; - } - if ($starts_daily_at !== null) { - $request_payload["starts_daily_at"] = $starts_daily_at; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($noise_threshold_decibels !== null) { - $request_payload[ - "noise_threshold_decibels" - ] = $noise_threshold_decibels; - } - if ($noise_threshold_nrs !== null) { - $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/create", - json: (object) $request_payload, - inner_object: "noise_threshold" - ); - - return NoiseThreshold::from_json($res); - } - - public function delete( - string $device_id, - string $noise_threshold_id, - bool $sync = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/delete", - json: (object) $request_payload - ); - } - - public function get(string $noise_threshold_id): NoiseThreshold - { - $request_payload = []; - - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/get", - json: (object) $request_payload, - inner_object: "noise_threshold" - ); - - return NoiseThreshold::from_json($res); - } - - public function list(string $device_id, bool $is_programmed = null): array - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($is_programmed !== null) { - $request_payload["is_programmed"] = $is_programmed; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/list", - json: (object) $request_payload, - inner_object: "noise_thresholds" - ); - - return array_map(fn($r) => NoiseThreshold::from_json($r), $res); - } - - public function update( - string $device_id, - string $noise_threshold_id, - string $ends_daily_at = null, - string $name = null, - float $noise_threshold_decibels = null, - float $noise_threshold_nrs = null, - string $starts_daily_at = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - if ($ends_daily_at !== null) { - $request_payload["ends_daily_at"] = $ends_daily_at; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($noise_threshold_decibels !== null) { - $request_payload[ - "noise_threshold_decibels" - ] = $noise_threshold_decibels; - } - if ($noise_threshold_nrs !== null) { - $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; - } - if ($starts_daily_at !== null) { - $request_payload["starts_daily_at"] = $starts_daily_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/update", - json: (object) $request_payload - ); - } -} - -class NoiseSensorsSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function trigger_noise_threshold(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/noise_sensors/simulate/trigger_noise_threshold", - json: (object) $request_payload - ); - } -} - -class PhonesClient -{ - private SeamClient $seam; - public PhonesSimulateClient $simulate; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->simulate = new PhonesSimulateClient($seam); - } - - public function deactivate(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/phones/deactivate", - json: (object) $request_payload - ); - } - - public function get(string $device_id): Phone - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/phones/get", - json: (object) $request_payload, - inner_object: "phone" - ); - - return Phone::from_json($res); - } - - public function list( - string $acs_credential_id = null, - string $owner_user_identity_id = null - ): array { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($owner_user_identity_id !== null) { - $request_payload[ - "owner_user_identity_id" - ] = $owner_user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/phones/list", - json: (object) $request_payload, - inner_object: "phones" - ); - - return array_map(fn($r) => Phone::from_json($r), $res); - } -} - -class PhonesSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create_sandbox_phone( - string $user_identity_id, - mixed $assa_abloy_metadata = null, - string $custom_sdk_installation_id = null, - mixed $phone_metadata = null - ): Phone { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($assa_abloy_metadata !== null) { - $request_payload["assa_abloy_metadata"] = $assa_abloy_metadata; - } - if ($custom_sdk_installation_id !== null) { - $request_payload[ - "custom_sdk_installation_id" - ] = $custom_sdk_installation_id; - } - if ($phone_metadata !== null) { - $request_payload["phone_metadata"] = $phone_metadata; - } - - $res = $this->seam->request( - "POST", - "/phones/simulate/create_sandbox_phone", - json: (object) $request_payload, - inner_object: "phone" - ); - - return Phone::from_json($res); - } -} - -class ThermostatsClient -{ - private SeamClient $seam; - public ThermostatsSchedulesClient $schedules; - public ThermostatsSimulateClient $simulate; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->schedules = new ThermostatsSchedulesClient($seam); - $this->simulate = new ThermostatsSimulateClient($seam); - } - - public function activate_climate_preset( - string $climate_preset_key, - string $device_id, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/thermostats/activate_climate_preset", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function cool( - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload[ - "cooling_set_point_celsius" - ] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload[ - "cooling_set_point_fahrenheit" - ] = $cooling_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/cool", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function create_climate_preset( - string $climate_preset_key, - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - string $fan_mode_setting = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - string $hvac_mode_setting = null, - bool $manual_override_allowed = null, - string $name = null - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload[ - "cooling_set_point_celsius" - ] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload[ - "cooling_set_point_fahrenheit" - ] = $cooling_set_point_fahrenheit; - } - if ($fan_mode_setting !== null) { - $request_payload["fan_mode_setting"] = $fan_mode_setting; - } - if ($heating_set_point_celsius !== null) { - $request_payload[ - "heating_set_point_celsius" - ] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload[ - "heating_set_point_fahrenheit" - ] = $heating_set_point_fahrenheit; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($manual_override_allowed !== null) { - $request_payload[ - "manual_override_allowed" - ] = $manual_override_allowed; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $this->seam->request( - "POST", - "/thermostats/create_climate_preset", - json: (object) $request_payload - ); - } - - public function delete_climate_preset( - string $climate_preset_key, - string $device_id - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/thermostats/delete_climate_preset", - json: (object) $request_payload - ); - } - - public function get(string $device_id = null, string $name = null): Device - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/thermostats/get", - json: (object) $request_payload, - inner_object: "thermostat" - ); - - return Device::from_json($res); - } - - public function heat( - string $device_id, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($heating_set_point_celsius !== null) { - $request_payload[ - "heating_set_point_celsius" - ] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload[ - "heating_set_point_fahrenheit" - ] = $heating_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/heat", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function heat_cool( - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload[ - "cooling_set_point_celsius" - ] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload[ - "cooling_set_point_fahrenheit" - ] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload[ - "heating_set_point_celsius" - ] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload[ - "heating_set_point_fahrenheit" - ] = $heating_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/heat_cool", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/thermostats/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function off( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/off", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function set_fallback_climate_preset( - string $climate_preset_key, - string $device_id - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/thermostats/set_fallback_climate_preset", - json: (object) $request_payload - ); - } - - public function set_fan_mode( - string $device_id, - string $fan_mode = null, - string $fan_mode_setting = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($fan_mode !== null) { - $request_payload["fan_mode"] = $fan_mode; - } - if ($fan_mode_setting !== null) { - $request_payload["fan_mode_setting"] = $fan_mode_setting; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/set_fan_mode", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function set_hvac_mode( - string $device_id, - string $hvac_mode_setting, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($cooling_set_point_celsius !== null) { - $request_payload[ - "cooling_set_point_celsius" - ] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload[ - "cooling_set_point_fahrenheit" - ] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload[ - "heating_set_point_celsius" - ] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload[ - "heating_set_point_fahrenheit" - ] = $heating_set_point_fahrenheit; - } - - $res = $this->seam->request( - "POST", - "/thermostats/set_hvac_mode", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function set_temperature_threshold( - string $device_id, - float $lower_limit_celsius = null, - float $lower_limit_fahrenheit = null, - float $upper_limit_celsius = null, - float $upper_limit_fahrenheit = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($lower_limit_celsius !== null) { - $request_payload["lower_limit_celsius"] = $lower_limit_celsius; - } - if ($lower_limit_fahrenheit !== null) { - $request_payload[ - "lower_limit_fahrenheit" - ] = $lower_limit_fahrenheit; - } - if ($upper_limit_celsius !== null) { - $request_payload["upper_limit_celsius"] = $upper_limit_celsius; - } - if ($upper_limit_fahrenheit !== null) { - $request_payload[ - "upper_limit_fahrenheit" - ] = $upper_limit_fahrenheit; - } - - $this->seam->request( - "POST", - "/thermostats/set_temperature_threshold", - json: (object) $request_payload - ); - } - - public function update_climate_preset( - string $climate_preset_key, - string $device_id, - bool $manual_override_allowed, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - string $fan_mode_setting = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - string $hvac_mode_setting = null, - string $name = null - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($manual_override_allowed !== null) { - $request_payload[ - "manual_override_allowed" - ] = $manual_override_allowed; - } - if ($cooling_set_point_celsius !== null) { - $request_payload[ - "cooling_set_point_celsius" - ] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload[ - "cooling_set_point_fahrenheit" - ] = $cooling_set_point_fahrenheit; - } - if ($fan_mode_setting !== null) { - $request_payload["fan_mode_setting"] = $fan_mode_setting; - } - if ($heating_set_point_celsius !== null) { - $request_payload[ - "heating_set_point_celsius" - ] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload[ - "heating_set_point_fahrenheit" - ] = $heating_set_point_fahrenheit; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $this->seam->request( - "POST", - "/thermostats/update_climate_preset", - json: (object) $request_payload - ); - } -} - -class ThermostatsSchedulesClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create( - string $climate_preset_key, - string $device_id, - string $ends_at, - string $starts_at, - bool $is_override_allowed = null, - mixed $max_override_period_minutes = null, - string $name = null - ): ThermostatSchedule { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($is_override_allowed !== null) { - $request_payload["is_override_allowed"] = $is_override_allowed; - } - if ($max_override_period_minutes !== null) { - $request_payload[ - "max_override_period_minutes" - ] = $max_override_period_minutes; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/thermostats/schedules/create", - json: (object) $request_payload, - inner_object: "thermostat_schedule" - ); - - return ThermostatSchedule::from_json($res); - } - - public function delete(string $thermostat_schedule_id): void - { - $request_payload = []; - - if ($thermostat_schedule_id !== null) { - $request_payload[ - "thermostat_schedule_id" - ] = $thermostat_schedule_id; - } - - $this->seam->request( - "POST", - "/thermostats/schedules/delete", - json: (object) $request_payload - ); - } - - public function get(string $thermostat_schedule_id): ThermostatSchedule - { - $request_payload = []; - - if ($thermostat_schedule_id !== null) { - $request_payload[ - "thermostat_schedule_id" - ] = $thermostat_schedule_id; - } - - $res = $this->seam->request( - "POST", - "/thermostats/schedules/get", - json: (object) $request_payload, - inner_object: "thermostat_schedule" - ); - - return ThermostatSchedule::from_json($res); - } - - public function list( - string $device_id, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/thermostats/schedules/list", - json: (object) $request_payload, - inner_object: "thermostat_schedules" - ); - - return array_map(fn($r) => ThermostatSchedule::from_json($r), $res); - } - - public function update( - string $thermostat_schedule_id, - string $climate_preset_key = null, - string $ends_at = null, - bool $is_override_allowed = null, - mixed $max_override_period_minutes = null, - string $name = null, - string $starts_at = null - ): void { - $request_payload = []; - - if ($thermostat_schedule_id !== null) { - $request_payload[ - "thermostat_schedule_id" - ] = $thermostat_schedule_id; - } - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_override_allowed !== null) { - $request_payload["is_override_allowed"] = $is_override_allowed; - } - if ($max_override_period_minutes !== null) { - $request_payload[ - "max_override_period_minutes" - ] = $max_override_period_minutes; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - - $this->seam->request( - "POST", - "/thermostats/schedules/update", - json: (object) $request_payload - ); - } -} - -class ThermostatsSimulateClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function hvac_mode_adjusted( - string $device_id, - string $hvac_mode, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($hvac_mode !== null) { - $request_payload["hvac_mode"] = $hvac_mode; - } - if ($cooling_set_point_celsius !== null) { - $request_payload[ - "cooling_set_point_celsius" - ] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload[ - "cooling_set_point_fahrenheit" - ] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload[ - "heating_set_point_celsius" - ] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload[ - "heating_set_point_fahrenheit" - ] = $heating_set_point_fahrenheit; - } - - $this->seam->request( - "POST", - "/thermostats/simulate/hvac_mode_adjusted", - json: (object) $request_payload - ); - } - - public function temperature_reached( - string $device_id, - float $temperature_celsius = null, - float $temperature_fahrenheit = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($temperature_celsius !== null) { - $request_payload["temperature_celsius"] = $temperature_celsius; - } - if ($temperature_fahrenheit !== null) { - $request_payload[ - "temperature_fahrenheit" - ] = $temperature_fahrenheit; - } - - $this->seam->request( - "POST", - "/thermostats/simulate/temperature_reached", - json: (object) $request_payload - ); - } -} - -class UserIdentitiesClient -{ - private SeamClient $seam; - public UserIdentitiesEnrollmentAutomationsClient $enrollment_automations; - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - $this->enrollment_automations = new UserIdentitiesEnrollmentAutomationsClient( - $seam - ); - } - - public function add_acs_user( - string $acs_user_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/add_acs_user", - json: (object) $request_payload - ); - } - - public function create( - string $email_address = null, - string $full_name = null, - string $phone_number = null, - string $user_identity_key = null - ): UserIdentity { - $request_payload = []; - - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; - } - - $res = $this->seam->request( - "POST", - "/user_identities/create", - json: (object) $request_payload, - inner_object: "user_identity" - ); - - return UserIdentity::from_json($res); - } - - public function delete(string $user_identity_id): void - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/delete", - json: (object) $request_payload - ); - } - - public function get( - string $user_identity_id = null, - string $user_identity_key = null - ): UserIdentity { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; - } - - $res = $this->seam->request( - "POST", - "/user_identities/get", - json: (object) $request_payload, - inner_object: "user_identity" - ); - - return UserIdentity::from_json($res); - } - - public function grant_access_to_device( - string $device_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/grant_access_to_device", - json: (object) $request_payload - ); - } - - public function list(string $credential_manager_acs_system_id = null): array - { - $request_payload = []; - - if ($credential_manager_acs_system_id !== null) { - $request_payload[ - "credential_manager_acs_system_id" - ] = $credential_manager_acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list", - json: (object) $request_payload, - inner_object: "user_identities" - ); - - return array_map(fn($r) => UserIdentity::from_json($r), $res); - } - - public function list_accessible_devices(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list_accessible_devices", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function list_acs_systems(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list_acs_systems", - json: (object) $request_payload, - inner_object: "acs_systems" - ); - - return array_map(fn($r) => AcsSystem::from_json($r), $res); - } - - public function list_acs_users(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list_acs_users", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => AcsUser::from_json($r), $res); - } - - public function remove_acs_user( - string $acs_user_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/remove_acs_user", - json: (object) $request_payload - ); - } - - public function revoke_access_to_device( - string $device_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/revoke_access_to_device", - json: (object) $request_payload - ); - } - - public function update( - string $user_identity_id, - string $email_address = null, - string $full_name = null, - string $phone_number = null, - string $user_identity_key = null - ): void { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; - } - - $this->seam->request( - "POST", - "/user_identities/update", - json: (object) $request_payload - ); - } -} - -class UserIdentitiesEnrollmentAutomationsClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function delete(string $enrollment_automation_id): void - { - $request_payload = []; - - if ($enrollment_automation_id !== null) { - $request_payload[ - "enrollment_automation_id" - ] = $enrollment_automation_id; - } - - $this->seam->request( - "POST", - "/user_identities/enrollment_automations/delete", - json: (object) $request_payload - ); - } - - public function get(string $enrollment_automation_id): EnrollmentAutomation - { - $request_payload = []; - - if ($enrollment_automation_id !== null) { - $request_payload[ - "enrollment_automation_id" - ] = $enrollment_automation_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/enrollment_automations/get", - json: (object) $request_payload, - inner_object: "enrollment_automation" - ); - - return EnrollmentAutomation::from_json($res); - } - - public function launch( - string $credential_manager_acs_system_id, - string $user_identity_id, - string $acs_credential_pool_id = null, - bool $create_credential_manager_user = null, - string $credential_manager_acs_user_id = null - ): void { - $request_payload = []; - - if ($credential_manager_acs_system_id !== null) { - $request_payload[ - "credential_manager_acs_system_id" - ] = $credential_manager_acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($acs_credential_pool_id !== null) { - $request_payload[ - "acs_credential_pool_id" - ] = $acs_credential_pool_id; - } - if ($create_credential_manager_user !== null) { - $request_payload[ - "create_credential_manager_user" - ] = $create_credential_manager_user; - } - if ($credential_manager_acs_user_id !== null) { - $request_payload[ - "credential_manager_acs_user_id" - ] = $credential_manager_acs_user_id; - } - - $this->seam->request( - "POST", - "/user_identities/enrollment_automations/launch", - json: (object) $request_payload, - inner_object: "enrollment_automation" - ); - } - - public function list(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/enrollment_automations/list", - json: (object) $request_payload, - inner_object: "enrollment_automations" - ); - - return array_map(fn($r) => EnrollmentAutomation::from_json($r), $res); - } -} - -class WebhooksClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create(string $url, array $event_types = null): Webhook - { - $request_payload = []; - - if ($url !== null) { - $request_payload["url"] = $url; - } - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - - $res = $this->seam->request( - "POST", - "/webhooks/create", - json: (object) $request_payload, - inner_object: "webhook" - ); - - return Webhook::from_json($res); - } - - public function delete(string $webhook_id): void - { - $request_payload = []; - - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; - } - - $this->seam->request( - "POST", - "/webhooks/delete", - json: (object) $request_payload - ); - } - - public function get(string $webhook_id): Webhook - { - $request_payload = []; - - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; - } - - $res = $this->seam->request( - "POST", - "/webhooks/get", - json: (object) $request_payload, - inner_object: "webhook" - ); - - return Webhook::from_json($res); - } - - public function list(): array - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/webhooks/list", - json: (object) $request_payload, - inner_object: "webhooks" - ); - - return array_map(fn($r) => Webhook::from_json($r), $res); - } - - public function update(array $event_types, string $webhook_id): void - { - $request_payload = []; - - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; - } - - $this->seam->request( - "POST", - "/webhooks/update", - json: (object) $request_payload - ); - } -} - -class WorkspacesClient -{ - private SeamClient $seam; - - public function __construct(SeamClient $seam) - { - $this->seam = $seam; - } - - public function create( - string $name, - string $company_name = null, - string $connect_partner_name = null, - bool $is_sandbox = null, - string $webview_logo_shape = null, - string $webview_primary_button_color = null, - string $webview_primary_button_text_color = null - ): Workspace { - $request_payload = []; - - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($company_name !== null) { - $request_payload["company_name"] = $company_name; - } - if ($connect_partner_name !== null) { - $request_payload["connect_partner_name"] = $connect_partner_name; - } - if ($is_sandbox !== null) { - $request_payload["is_sandbox"] = $is_sandbox; - } - if ($webview_logo_shape !== null) { - $request_payload["webview_logo_shape"] = $webview_logo_shape; - } - if ($webview_primary_button_color !== null) { - $request_payload[ - "webview_primary_button_color" - ] = $webview_primary_button_color; - } - if ($webview_primary_button_text_color !== null) { - $request_payload[ - "webview_primary_button_text_color" - ] = $webview_primary_button_text_color; - } - - $res = $this->seam->request( - "POST", - "/workspaces/create", - json: (object) $request_payload, - inner_object: "workspace" - ); - - return Workspace::from_json($res); - } - - public function get(): Workspace - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/workspaces/get", - json: (object) $request_payload, - inner_object: "workspace" - ); - - return Workspace::from_json($res); - } - - public function list(): array - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/workspaces/list", - json: (object) $request_payload, - inner_object: "workspaces" - ); - - return array_map(fn($r) => Workspace::from_json($r), $res); - } - - public function reset_sandbox( - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/workspaces/reset_sandbox", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } + private Routes $routes; + public string $api_key; + public HTTPClient $client; + public string $ltsVersion = LTS_VERSION; + + public function __construct( + $api_key = null, + $endpoint = "https://connect.getseam.com", + $throw_http_errors = false + ) { + $this->api_key = $api_key ?: (getenv("SEAM_API_KEY") ?: null); + $seam_sdk_version = PackageVersion::get(); + $this->client = new HTTPClient([ + "base_uri" => $endpoint, + "timeout" => 60.0, + "headers" => [ + "Authorization" => "Bearer " . $this->api_key, + "User-Agent" => "Seam PHP Client " . $seam_sdk_version, + "seam-sdk-name" => "seamapi/php", + "seam-sdk-version" => $seam_sdk_version, + "seam-lts-version" => $this->ltsVersion, + ], + "http_errors" => $throw_http_errors, + ]); + $this->routes = new Routes($this); + } + + public function __get(string $name): mixed + { + return $this->routes->$name; + } + + public function request( + $method, + $path, + $json = null, + $query = null, + $inner_object = null + ) { + $options = [ + "json" => $json, + "query" => $query, + ]; + $options = array_filter($options, fn($option) => $option !== null); + + // TODO handle request errors + $response = $this->client->request($method, $path, $options); + $status_code = $response->getStatusCode(); + $request_id = $response->getHeaderLine("seam-request-id"); + + $res_json = null; + try { + $res_json = json_decode($response->getBody()); + } catch (Exception $ignoreError) { + } + + if ($status_code >= 400) { + if ($status_code === 401) { + throw new HttpUnauthorizedError($request_id); + } + + if (($res_json->error ?? null) != null) { + if ($res_json->error->type === "invalid_input") { + throw new HttpInvalidInputError( + $res_json->error, + $status_code, + $request_id + ); + } + + throw new HttpApiError( + $res_json->error, + $status_code, + $request_id + ); + } + + throw GuzzleHttpExceptionRequestException::create( + new GuzzleHttpPsr7Request($method, $path), + $response + ); + } + + return $inner_object ? $res_json->$inner_object : $res_json; + } } From 2a9779fe8b9f75bcf5d88f3585d8fe228f94409c Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Tue, 18 Mar 2025 14:18:08 +0100 Subject: [PATCH 02/13] Create client with middlewares --- src/Http.php | 123 ++++++++++++++++++ src/Routes/Clients/AccessCodesClient.php | 6 +- .../Clients/AccessCodesSimulateClient.php | 6 +- .../Clients/AccessCodesUnmanagedClient.php | 6 +- src/Routes/Clients/AcsAccessGroupsClient.php | 6 +- .../AcsAccessGroupsUnmanagedClient.php | 8 +- src/Routes/Clients/AcsClient.php | 6 +- .../Clients/AcsCredentialPoolsClient.php | 6 +- ...redentialProvisioningAutomationsClient.php | 6 +- src/Routes/Clients/AcsCredentialsClient.php | 6 +- .../Clients/AcsCredentialsUnmanagedClient.php | 6 +- src/Routes/Clients/AcsEncodersClient.php | 6 +- .../Clients/AcsEncodersSimulateClient.php | 6 +- src/Routes/Clients/AcsEntrancesClient.php | 6 +- src/Routes/Clients/AcsSystemsClient.php | 6 +- src/Routes/Clients/AcsUsersClient.php | 6 +- .../Clients/AcsUsersUnmanagedClient.php | 6 +- src/Routes/Clients/ActionAttemptsClient.php | 6 +- src/Routes/Clients/BridgesClient.php | 6 +- src/Routes/Clients/ClientSessionsClient.php | 6 +- src/Routes/Clients/ConnectWebviewsClient.php | 6 +- .../Clients/ConnectedAccountsClient.php | 6 +- src/Routes/Clients/DevicesClient.php | 6 +- src/Routes/Clients/DevicesSimulateClient.php | 6 +- src/Routes/Clients/DevicesUnmanagedClient.php | 6 +- src/Routes/Clients/EventsClient.php | 6 +- src/Routes/Clients/LocksClient.php | 6 +- src/Routes/Clients/NetworksClient.php | 6 +- src/Routes/Clients/NoiseSensorsClient.php | 6 +- .../NoiseSensorsNoiseThresholdsClient.php | 6 +- .../Clients/NoiseSensorsSimulateClient.php | 6 +- src/Routes/Clients/PhonesClient.php | 6 +- src/Routes/Clients/PhonesSimulateClient.php | 6 +- src/Routes/Clients/ThermostatsClient.php | 6 +- .../Clients/ThermostatsSchedulesClient.php | 6 +- .../Clients/ThermostatsSimulateClient.php | 6 +- src/Routes/Clients/UserIdentitiesClient.php | 6 +- ...rIdentitiesEnrollmentAutomationsClient.php | 6 +- src/Routes/Clients/WebhooksClient.php | 6 +- src/Routes/Clients/WorkspacesClient.php | 6 +- src/Routes/Routes.php | 4 +- src/Seam.php | 72 ++++++++++ src/SeamClient.php | 103 --------------- 43 files changed, 315 insertions(+), 223 deletions(-) create mode 100644 src/Http.php create mode 100644 src/Seam.php delete mode 100644 src/SeamClient.php diff --git a/src/Http.php b/src/Http.php new file mode 100644 index 00000000..ffbaea20 --- /dev/null +++ b/src/Http.php @@ -0,0 +1,123 @@ +push(self::createJsonDecodingMiddleware()); + $handlerStack->push(self::createErrorHandlingMiddleware()); + + $clientOptions = [ + 'base_uri' => $baseUrl, + 'timeout' => $timeout, + 'headers' => $headers, + 'handler' => $handlerStack, + 'http_errors' => false, + ]; + + return new GuzzleHttpClient($clientOptions); + } + + public static function createJsonDecodingMiddleware(): callable + { + return function (callable $nextHandler) { + return function ($request, array $options) use ($nextHandler) { + return $nextHandler($request, $options)->then( + function (ResponseInterface $response) { + $contentType = $response->getHeaderLine('Content-Type'); + + if (stripos($contentType, 'application/json') !== 0) { + return $response; + } + + $bodyContent = (string) $response->getBody(); + $decodedJson = json_decode($bodyContent, true); + + if (json_last_error() !== JSON_ERROR_NONE) { + throw new \RuntimeException('Error decoding JSON: ' . json_last_error_msg()); + } + + return $decodedJson; + } + ); + }; + }; + } + + public static function createErrorHandlingMiddleware(): callable + { + return function (callable $nextHandler) { + return function ($request, array $options) use ($nextHandler) { + return $nextHandler($request, $options)->then( + function (ResponseInterface $response) use ($request) { + $statusCode = $response->getStatusCode(); + $requestId = trim($response->getHeaderLine('seam-request-id')); + $body = (string)$response->getBody(); + $decodedBody = json_decode($body); + + if ($statusCode === 401) { + throw new HttpUnauthorizedError($requestId); + } + + if (!self::isApiErrorResponse($response, $decodedBody)) { + if ($statusCode >= 400) { + throw RequestException::create($request, $response); + } + + return $response; + } + + $errorData = $decodedBody->error; + if (isset($errorData->type) && $errorData->type === 'invalid_input') { + throw new HttpInvalidInputError($errorData, $statusCode, $requestId); + } + + throw new HttpApiError($errorData, $statusCode, $requestId); + } + ); + }; + }; + } + + public static function isApiErrorResponse(ResponseInterface $response, $decodedBody): bool + { + $contentType = $response->getHeaderLine('Content-Type'); + if (stripos($contentType, 'application/json') !== 0) { + return false; + } + + if (!is_object($decodedBody) || !isset($decodedBody->error)) { + return false; + } + + $error = $decodedBody->error; + if (!is_object($error)) { + return false; + } + + if (!isset($error->type) || !is_string($error->type)) { + return false; + } + + if (!isset($error->message) || !is_string($error->message)) { + return false; + } + + return true; + } +} diff --git a/src/Routes/Clients/AccessCodesClient.php b/src/Routes/Clients/AccessCodesClient.php index 37dacd43..e9653218 100644 --- a/src/Routes/Clients/AccessCodesClient.php +++ b/src/Routes/Clients/AccessCodesClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AccessCode; class AccessCodesClient { - private SeamClient $seam; + private Seam $seam; public AccessCodesSimulateClient $simulate; public AccessCodesUnmanagedClient $unmanaged; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; $this->simulate = new AccessCodesSimulateClient($seam); diff --git a/src/Routes/Clients/AccessCodesSimulateClient.php b/src/Routes/Clients/AccessCodesSimulateClient.php index 5f997b10..af863b67 100644 --- a/src/Routes/Clients/AccessCodesSimulateClient.php +++ b/src/Routes/Clients/AccessCodesSimulateClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\UnmanagedAccessCode; class AccessCodesSimulateClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AccessCodesUnmanagedClient.php b/src/Routes/Clients/AccessCodesUnmanagedClient.php index a229f959..046c3d1d 100644 --- a/src/Routes/Clients/AccessCodesUnmanagedClient.php +++ b/src/Routes/Clients/AccessCodesUnmanagedClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\UnmanagedAccessCode; class AccessCodesUnmanagedClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsAccessGroupsClient.php b/src/Routes/Clients/AcsAccessGroupsClient.php index 8ac64124..eb72f20d 100644 --- a/src/Routes/Clients/AcsAccessGroupsClient.php +++ b/src/Routes/Clients/AcsAccessGroupsClient.php @@ -2,16 +2,16 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AcsAccessGroup; use Seam\Routes\Objects\AcsEntrance; use Seam\Routes\Objects\AcsUser; class AcsAccessGroupsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php b/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php index 0cb00699..ac00e588 100644 --- a/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php +++ b/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\UnmanagedAcsAccessGroup; class AcsAccessGroupsUnmanagedClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } @@ -57,4 +57,4 @@ public function list( $res ); } -} \ No newline at end of file +} diff --git a/src/Routes/Clients/AcsClient.php b/src/Routes/Clients/AcsClient.php index 8c17ef37..f2268c2b 100644 --- a/src/Routes/Clients/AcsClient.php +++ b/src/Routes/Clients/AcsClient.php @@ -2,11 +2,11 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; class AcsClient { - private SeamClient $seam; + private Seam $seam; public AcsAccessGroupsClient $access_groups; public AcsCredentialPoolsClient $credential_pools; public AcsCredentialProvisioningAutomationsClient $credential_provisioning_automations; @@ -15,7 +15,7 @@ class AcsClient public AcsEntrancesClient $entrances; public AcsSystemsClient $systems; public AcsUsersClient $users; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; $this->access_groups = new AcsAccessGroupsClient($seam); diff --git a/src/Routes/Clients/AcsCredentialPoolsClient.php b/src/Routes/Clients/AcsCredentialPoolsClient.php index 0382a07b..a5b993d6 100644 --- a/src/Routes/Clients/AcsCredentialPoolsClient.php +++ b/src/Routes/Clients/AcsCredentialPoolsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AcsCredentialPool; class AcsCredentialPoolsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php b/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php index fcc1e876..23f66de0 100644 --- a/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php +++ b/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AcsCredentialProvisioningAutomation; class AcsCredentialProvisioningAutomationsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsCredentialsClient.php b/src/Routes/Clients/AcsCredentialsClient.php index 2248bfca..49b646bd 100644 --- a/src/Routes/Clients/AcsCredentialsClient.php +++ b/src/Routes/Clients/AcsCredentialsClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AcsCredential; use Seam\Routes\Objects\AcsEntrance; class AcsCredentialsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsCredentialsUnmanagedClient.php b/src/Routes/Clients/AcsCredentialsUnmanagedClient.php index 9774c789..cf9a671e 100644 --- a/src/Routes/Clients/AcsCredentialsUnmanagedClient.php +++ b/src/Routes/Clients/AcsCredentialsUnmanagedClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\UnmanagedAcsCredential; class AcsCredentialsUnmanagedClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsEncodersClient.php b/src/Routes/Clients/AcsEncodersClient.php index c24f8d35..bd62ec1a 100644 --- a/src/Routes/Clients/AcsEncodersClient.php +++ b/src/Routes/Clients/AcsEncodersClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\ActionAttempt; use Seam\Routes\Objects\AcsEncoder; class AcsEncodersClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsEncodersSimulateClient.php b/src/Routes/Clients/AcsEncodersSimulateClient.php index 35ded544..b5d24ceb 100644 --- a/src/Routes/Clients/AcsEncodersSimulateClient.php +++ b/src/Routes/Clients/AcsEncodersSimulateClient.php @@ -2,13 +2,13 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; class AcsEncodersSimulateClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsEntrancesClient.php b/src/Routes/Clients/AcsEntrancesClient.php index ca154ad5..20934b0d 100644 --- a/src/Routes/Clients/AcsEntrancesClient.php +++ b/src/Routes/Clients/AcsEntrancesClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AcsEntrance; use Seam\Routes\Objects\AcsCredential; class AcsEntrancesClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsSystemsClient.php b/src/Routes/Clients/AcsSystemsClient.php index 76fd0a0f..c03d9a69 100644 --- a/src/Routes/Clients/AcsSystemsClient.php +++ b/src/Routes/Clients/AcsSystemsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AcsSystem; class AcsSystemsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsUsersClient.php b/src/Routes/Clients/AcsUsersClient.php index e608f54f..426c0c94 100644 --- a/src/Routes/Clients/AcsUsersClient.php +++ b/src/Routes/Clients/AcsUsersClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\AcsUser; use Seam\Routes\Objects\AcsEntrance; class AcsUsersClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/AcsUsersUnmanagedClient.php b/src/Routes/Clients/AcsUsersUnmanagedClient.php index 23fcf88c..182f9bcd 100644 --- a/src/Routes/Clients/AcsUsersUnmanagedClient.php +++ b/src/Routes/Clients/AcsUsersUnmanagedClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\UnmanagedAcsUser; class AcsUsersUnmanagedClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/ActionAttemptsClient.php b/src/Routes/Clients/ActionAttemptsClient.php index ffdc7aca..360d3dfb 100644 --- a/src/Routes/Clients/ActionAttemptsClient.php +++ b/src/Routes/Clients/ActionAttemptsClient.php @@ -2,16 +2,16 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\ActionAttempt; use Seam\ActionAttemptFailedError; use Seam\ActionAttemptTimeoutError; class ActionAttemptsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/BridgesClient.php b/src/Routes/Clients/BridgesClient.php index 6ba0b273..22ac4cf1 100644 --- a/src/Routes/Clients/BridgesClient.php +++ b/src/Routes/Clients/BridgesClient.php @@ -2,13 +2,13 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; class BridgesClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/ClientSessionsClient.php b/src/Routes/Clients/ClientSessionsClient.php index 35d8904b..26b25fa7 100644 --- a/src/Routes/Clients/ClientSessionsClient.php +++ b/src/Routes/Clients/ClientSessionsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\ClientSession; class ClientSessionsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/ConnectWebviewsClient.php b/src/Routes/Clients/ConnectWebviewsClient.php index cd1f5b60..6dfe36d1 100644 --- a/src/Routes/Clients/ConnectWebviewsClient.php +++ b/src/Routes/Clients/ConnectWebviewsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\ConnectWebview; class ConnectWebviewsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/ConnectedAccountsClient.php b/src/Routes/Clients/ConnectedAccountsClient.php index 078ce47b..1124d0fa 100644 --- a/src/Routes/Clients/ConnectedAccountsClient.php +++ b/src/Routes/Clients/ConnectedAccountsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\ConnectedAccount; class ConnectedAccountsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/DevicesClient.php b/src/Routes/Clients/DevicesClient.php index 7c0e3b3b..b0a22fd2 100644 --- a/src/Routes/Clients/DevicesClient.php +++ b/src/Routes/Clients/DevicesClient.php @@ -2,16 +2,16 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Device; use Seam\Routes\Objects\DeviceProvider; class DevicesClient { - private SeamClient $seam; + private Seam $seam; public DevicesSimulateClient $simulate; public DevicesUnmanagedClient $unmanaged; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; $this->simulate = new DevicesSimulateClient($seam); diff --git a/src/Routes/Clients/DevicesSimulateClient.php b/src/Routes/Clients/DevicesSimulateClient.php index cb6fba30..e09fcb20 100644 --- a/src/Routes/Clients/DevicesSimulateClient.php +++ b/src/Routes/Clients/DevicesSimulateClient.php @@ -2,13 +2,13 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; class DevicesSimulateClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/DevicesUnmanagedClient.php b/src/Routes/Clients/DevicesUnmanagedClient.php index 95c31614..87d9438f 100644 --- a/src/Routes/Clients/DevicesUnmanagedClient.php +++ b/src/Routes/Clients/DevicesUnmanagedClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\UnmanagedDevice; class DevicesUnmanagedClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/EventsClient.php b/src/Routes/Clients/EventsClient.php index ee082979..038d222a 100644 --- a/src/Routes/Clients/EventsClient.php +++ b/src/Routes/Clients/EventsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Event; class EventsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/LocksClient.php b/src/Routes/Clients/LocksClient.php index 9ac134d1..004ce86b 100644 --- a/src/Routes/Clients/LocksClient.php +++ b/src/Routes/Clients/LocksClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Device; use Seam\Routes\Objects\ActionAttempt; class LocksClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/NetworksClient.php b/src/Routes/Clients/NetworksClient.php index 08102f60..1308ddcd 100644 --- a/src/Routes/Clients/NetworksClient.php +++ b/src/Routes/Clients/NetworksClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Network; class NetworksClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/NoiseSensorsClient.php b/src/Routes/Clients/NoiseSensorsClient.php index 51fafe4a..22ea7016 100644 --- a/src/Routes/Clients/NoiseSensorsClient.php +++ b/src/Routes/Clients/NoiseSensorsClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Device; class NoiseSensorsClient { - private SeamClient $seam; + private Seam $seam; public NoiseSensorsNoiseThresholdsClient $noise_thresholds; public NoiseSensorsSimulateClient $simulate; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; $this->noise_thresholds = new NoiseSensorsNoiseThresholdsClient($seam); diff --git a/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php b/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php index 36606eb3..4bf386c2 100644 --- a/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php +++ b/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\NoiseThreshold; class NoiseSensorsNoiseThresholdsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/NoiseSensorsSimulateClient.php b/src/Routes/Clients/NoiseSensorsSimulateClient.php index 089a8475..9fa77daf 100644 --- a/src/Routes/Clients/NoiseSensorsSimulateClient.php +++ b/src/Routes/Clients/NoiseSensorsSimulateClient.php @@ -2,13 +2,13 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; class NoiseSensorsSimulateClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/PhonesClient.php b/src/Routes/Clients/PhonesClient.php index b0041590..f42809c6 100644 --- a/src/Routes/Clients/PhonesClient.php +++ b/src/Routes/Clients/PhonesClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Phone; class PhonesClient { - private SeamClient $seam; + private Seam $seam; public PhonesSimulateClient $simulate; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; $this->simulate = new PhonesSimulateClient($seam); diff --git a/src/Routes/Clients/PhonesSimulateClient.php b/src/Routes/Clients/PhonesSimulateClient.php index 38ea9a7c..127250b5 100644 --- a/src/Routes/Clients/PhonesSimulateClient.php +++ b/src/Routes/Clients/PhonesSimulateClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Phone; class PhonesSimulateClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/ThermostatsClient.php b/src/Routes/Clients/ThermostatsClient.php index fc27d0cd..e08338c6 100644 --- a/src/Routes/Clients/ThermostatsClient.php +++ b/src/Routes/Clients/ThermostatsClient.php @@ -2,16 +2,16 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\ActionAttempt; use Seam\Routes\Objects\Device; class ThermostatsClient { - private SeamClient $seam; + private Seam $seam; public ThermostatsSchedulesClient $schedules; public ThermostatsSimulateClient $simulate; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; $this->schedules = new ThermostatsSchedulesClient($seam); diff --git a/src/Routes/Clients/ThermostatsSchedulesClient.php b/src/Routes/Clients/ThermostatsSchedulesClient.php index 94b493ac..62456101 100644 --- a/src/Routes/Clients/ThermostatsSchedulesClient.php +++ b/src/Routes/Clients/ThermostatsSchedulesClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\ThermostatSchedule; class ThermostatsSchedulesClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/ThermostatsSimulateClient.php b/src/Routes/Clients/ThermostatsSimulateClient.php index 57f66461..77ffeea9 100644 --- a/src/Routes/Clients/ThermostatsSimulateClient.php +++ b/src/Routes/Clients/ThermostatsSimulateClient.php @@ -2,13 +2,13 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; class ThermostatsSimulateClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/UserIdentitiesClient.php b/src/Routes/Clients/UserIdentitiesClient.php index 1caf5814..b804e9d0 100644 --- a/src/Routes/Clients/UserIdentitiesClient.php +++ b/src/Routes/Clients/UserIdentitiesClient.php @@ -2,7 +2,7 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\UserIdentity; use Seam\Routes\Objects\Device; use Seam\Routes\Objects\AcsSystem; @@ -10,9 +10,9 @@ class UserIdentitiesClient { - private SeamClient $seam; + private Seam $seam; public UserIdentitiesEnrollmentAutomationsClient $enrollment_automations; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; $this->enrollment_automations = new UserIdentitiesEnrollmentAutomationsClient( diff --git a/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php b/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php index eb4d5d64..31c4d306 100644 --- a/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php +++ b/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\EnrollmentAutomation; class UserIdentitiesEnrollmentAutomationsClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/WebhooksClient.php b/src/Routes/Clients/WebhooksClient.php index 7c8115b0..a3d55460 100644 --- a/src/Routes/Clients/WebhooksClient.php +++ b/src/Routes/Clients/WebhooksClient.php @@ -2,14 +2,14 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Webhook; class WebhooksClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Clients/WorkspacesClient.php b/src/Routes/Clients/WorkspacesClient.php index 5554a0b4..b9503dd1 100644 --- a/src/Routes/Clients/WorkspacesClient.php +++ b/src/Routes/Clients/WorkspacesClient.php @@ -2,15 +2,15 @@ namespace Seam\Routes\Clients; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Objects\Workspace; use Seam\Routes\Objects\ActionAttempt; class WorkspacesClient { - private SeamClient $seam; + private Seam $seam; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->seam = $seam; } diff --git a/src/Routes/Routes.php b/src/Routes/Routes.php index 854a96e0..43a82e03 100644 --- a/src/Routes/Routes.php +++ b/src/Routes/Routes.php @@ -2,7 +2,7 @@ namespace Seam\Routes; -use Seam\SeamClient; +use Seam\Seam; use Seam\Routes\Clients\AccessCodesClient; use Seam\Routes\Clients\AcsClient; use Seam\Routes\Clients\ActionAttemptsClient; @@ -41,7 +41,7 @@ class Routes public WebhooksClient $webhooks; public WorkspacesClient $workspaces; - public function __construct(SeamClient $seam) + public function __construct(Seam $seam) { $this->access_codes = new AccessCodesClient($seam); $this->acs = new AcsClient($seam); diff --git a/src/Seam.php b/src/Seam.php new file mode 100644 index 00000000..0a65752d --- /dev/null +++ b/src/Seam.php @@ -0,0 +1,72 @@ +api_key = $api_key ?: (getenv("SEAM_API_KEY") ?: null); + $seam_sdk_version = PackageVersion::get(); + + $headers = [ + "Authorization" => "Bearer " . $this->api_key, + "User-Agent" => "Seam PHP Client " . $seam_sdk_version, + "seam-sdk-name" => "seamapi/php", + "seam-sdk-version" => $seam_sdk_version, + "seam-lts-version" => $this->ltsVersion, + ]; + + $this->client = Http::createClient([ + 'base_url' => $endpoint, + 'headers' => $headers + ]); + $this->routes = new Routes($this); + } + + public function __get(string $name): mixed + { + return $this->routes->$name; + } + + public function request( + $method, + $path, + $json = null, + $query = null, + $inner_object = null + ) { + $options = []; + + if ($json !== null) { + $options['json'] = $json; + } + + if ($query !== null) { + $options['query'] = $query; + } + + $response = $this->client->request($method, $path, $options); + $body = json_decode($response->getBody()); + + // Handle inner_object extraction if needed + if ($inner_object && isset($body->$inner_object)) { + return $body->$inner_object; + } + + return $body; + } +} diff --git a/src/SeamClient.php b/src/SeamClient.php deleted file mode 100644 index a6727e6e..00000000 --- a/src/SeamClient.php +++ /dev/null @@ -1,103 +0,0 @@ -api_key = $api_key ?: (getenv("SEAM_API_KEY") ?: null); - $seam_sdk_version = PackageVersion::get(); - $this->client = new HTTPClient([ - "base_uri" => $endpoint, - "timeout" => 60.0, - "headers" => [ - "Authorization" => "Bearer " . $this->api_key, - "User-Agent" => "Seam PHP Client " . $seam_sdk_version, - "seam-sdk-name" => "seamapi/php", - "seam-sdk-version" => $seam_sdk_version, - "seam-lts-version" => $this->ltsVersion, - ], - "http_errors" => $throw_http_errors, - ]); - $this->routes = new Routes($this); - } - - public function __get(string $name): mixed - { - return $this->routes->$name; - } - - public function request( - $method, - $path, - $json = null, - $query = null, - $inner_object = null - ) { - $options = [ - "json" => $json, - "query" => $query, - ]; - $options = array_filter($options, fn($option) => $option !== null); - - // TODO handle request errors - $response = $this->client->request($method, $path, $options); - $status_code = $response->getStatusCode(); - $request_id = $response->getHeaderLine("seam-request-id"); - - $res_json = null; - try { - $res_json = json_decode($response->getBody()); - } catch (Exception $ignoreError) { - } - - if ($status_code >= 400) { - if ($status_code === 401) { - throw new HttpUnauthorizedError($request_id); - } - - if (($res_json->error ?? null) != null) { - if ($res_json->error->type === "invalid_input") { - throw new HttpInvalidInputError( - $res_json->error, - $status_code, - $request_id - ); - } - - throw new HttpApiError( - $res_json->error, - $status_code, - $request_id - ); - } - - throw GuzzleHttpExceptionRequestException::create( - new GuzzleHttpPsr7Request($method, $path), - $response - ); - } - - return $inner_object ? $res_json->$inner_object : $res_json; - } -} From 8c104dee02b38bb6585defb35d1bcba4f63ecdb3 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Tue, 18 Mar 2025 14:18:34 +0100 Subject: [PATCH 03/13] Minor fixes --- README.md | 4 +- tests/Fixture.php | 28 ++++----- tests/HttpErrorTest.php | 131 ++++++++++++++++++++-------------------- 3 files changed, 83 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index dd85a49f..a9e435f9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ Check out [the documentation](https://docs.seam.co) or the usage below. ## Usage ```php -$seam = new Seam\SeamClient("YOUR_API_KEY"); +use Seam\Seam; + +$seam = new Seam("YOUR_API_KEY"); # Create a Connect Webview to login to a provider $connect_webview = $seam->connect_webviews->create( diff --git a/tests/Fixture.php b/tests/Fixture.php index 4d9efd54..183c1b84 100644 --- a/tests/Fixture.php +++ b/tests/Fixture.php @@ -2,23 +2,23 @@ namespace Tests; -use Seam\SeamClient; +use Seam\Seam; final class Fixture { - public static function getTestServer() - { - $random_string = substr( - str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"), - 0, - 10 - ); - echo $random_string; - $api_url = "https://{$random_string}.fakeseamconnect.seam.vc"; - $api_key = "seam_apikey1_token"; + public static function getTestServer() + { + $random_string = substr( + str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"), + 0, + 10 + ); + echo $random_string; + $api_url = "https://{$random_string}.fakeseamconnect.seam.vc"; + $api_key = "seam_apikey1_token"; - $seam = new SeamClient($api_key, $api_url); + $seam = new Seam($api_key, $api_url); - return $seam; - } + return $seam; + } } diff --git a/tests/HttpErrorTest.php b/tests/HttpErrorTest.php index 184aba3f..2c7654f4 100644 --- a/tests/HttpErrorTest.php +++ b/tests/HttpErrorTest.php @@ -2,86 +2,87 @@ declare(strict_types=1); +use Seam\Seam; use PHPUnit\Framework\TestCase; use Tests\Fixture; final class HttpErrorTest extends TestCase { - public function testInvalidInputError(): void - { - $seam = Fixture::getTestServer(); + public function testInvalidInputError(): void + { + $seam = Fixture::getTestServer(); - try { - $seam->request( - "POST", - "/devices/list", - json: [ - "device_ids" => 1234, - ] - ); - $this->fail("Expected InvalidInputError"); - } catch (\Seam\HttpInvalidInputError $e) { - $this->assertEquals(400, $e->getStatusCode()); - $this->assertNotEmpty($e->getRequestId()); - $this->assertEquals("invalid_input", $e->getErrorCode()); - $this->assertEquals( - ["Expected array, received number"], - $e->getValidationErrorMessages("device_ids") - ); - } + try { + $seam->request( + "POST", + "/devices/list", + json: [ + "device_ids" => 1234, + ] + ); + $this->fail("Expected InvalidInputError"); + } catch (\Seam\HttpInvalidInputError $e) { + $this->assertEquals(400, $e->getStatusCode()); + $this->assertNotEmpty($e->getRequestId()); + $this->assertEquals("invalid_input", $e->getErrorCode()); + $this->assertEquals( + ["Expected array, received number"], + $e->getValidationErrorMessages("device_ids") + ); } + } - public function testUnauthorizedError(): void - { - $test_server = Fixture::getTestServer(); - $seam = new \Seam\SeamClient( - "invalid_api_key", - $test_server->client->getConfig("base_uri")->__toString() - ); + public function testUnauthorizedError(): void + { + $test_server = Fixture::getTestServer(); + $seam = new Seam( + "invalid_api_key", + $test_server->client->getConfig("base_uri")->__toString() + ); - try { - $seam->devices->list(); - $this->fail("Expected UnauthorizedError"); - } catch (\Seam\HttpUnauthorizedError $e) { - $this->assertNotEmpty($e->getRequestId()); - } + try { + $seam->devices->list(); + $this->fail("Expected UnauthorizedError"); + } catch (\Seam\HttpUnauthorizedError $e) { + $this->assertNotEmpty($e->getRequestId()); } + } - public function testApiError(): void - { - $seam = Fixture::getTestServer(); + public function testApiError(): void + { + $seam = Fixture::getTestServer(); - try { - $seam->devices->get(device_id: "nonexistent_device_id"); - $this->fail("Expected ApiError"); - } catch (\Seam\HttpApiError $e) { - $this->assertEquals(404, $e->getStatusCode()); - $this->assertNotEmpty($e->getRequestId()); - $this->assertEquals("device_not_found", $e->getErrorCode()); - } + try { + $seam->devices->get(device_id: "nonexistent_device_id"); + $this->fail("Expected ApiError"); + } catch (\Seam\HttpApiError $e) { + $this->assertEquals(404, $e->getStatusCode()); + $this->assertNotEmpty($e->getRequestId()); + $this->assertEquals("device_not_found", $e->getErrorCode()); } + } - public function testNonSeamError(): void - { - $seam = Fixture::getTestServer(); + public function testNonSeamError(): void + { + $seam = Fixture::getTestServer(); - $seam = new \Seam\SeamClient( - "seam_apikey1_token", - "https://nonexistent.example.com" - ); + $seam = new Seam( + "seam_apikey1_token", + "https://nonexistent.example.com" + ); - try { - $seam->devices->list(); - $this->fail("Expected GuzzleHttp ConnectException"); - } catch (\GuzzleHttp\Exception\ConnectException $e) { - $this->assertInstanceOf( - \GuzzleHttp\Exception\ConnectException::class, - $e - ); - $this->assertStringContainsString( - "Could not resolve host", - $e->getMessage() - ); - } + try { + $seam->devices->list(); + $this->fail("Expected GuzzleHttp ConnectException"); + } catch (\GuzzleHttp\Exception\ConnectException $e) { + $this->assertInstanceOf( + \GuzzleHttp\Exception\ConnectException::class, + $e + ); + $this->assertStringContainsString( + "Could not resolve host", + $e->getMessage() + ); } + } } From 6bb88a35697670fbb2d7f37f5c6e8d8b24f6e0fd Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Tue, 18 Mar 2025 15:00:56 +0100 Subject: [PATCH 04/13] Remove createJsonDecodingMiddleware --- src/Http.php | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/Http.php b/src/Http.php index ffbaea20..b85f5580 100644 --- a/src/Http.php +++ b/src/Http.php @@ -19,7 +19,6 @@ public static function createClient(array $config): GuzzleHttpClient $timeout = $config['timeout'] ?? 60.0; $handlerStack = HandlerStack::create(); - $handlerStack->push(self::createJsonDecodingMiddleware()); $handlerStack->push(self::createErrorHandlingMiddleware()); $clientOptions = [ @@ -33,32 +32,6 @@ public static function createClient(array $config): GuzzleHttpClient return new GuzzleHttpClient($clientOptions); } - public static function createJsonDecodingMiddleware(): callable - { - return function (callable $nextHandler) { - return function ($request, array $options) use ($nextHandler) { - return $nextHandler($request, $options)->then( - function (ResponseInterface $response) { - $contentType = $response->getHeaderLine('Content-Type'); - - if (stripos($contentType, 'application/json') !== 0) { - return $response; - } - - $bodyContent = (string) $response->getBody(); - $decodedJson = json_decode($bodyContent, true); - - if (json_last_error() !== JSON_ERROR_NONE) { - throw new \RuntimeException('Error decoding JSON: ' . json_last_error_msg()); - } - - return $decodedJson; - } - ); - }; - }; - } - public static function createErrorHandlingMiddleware(): callable { return function (callable $nextHandler) { From c050c382ad4ac0dd2d6ae72ba697c6511f1b39af Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Tue, 18 Mar 2025 15:02:49 +0100 Subject: [PATCH 05/13] Update .gitattributes --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index a31dbc4d..1602424c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -src/Objects/**/*.php linguist-generated +src/Routes/**/*.php linguist-generated From 7d71d2e412e9d024f0ed062600dad3f279bd89a5 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Tue, 18 Mar 2025 15:05:11 +0100 Subject: [PATCH 06/13] Checkout exceptions from main --- src/Exceptions/ActionAttemptError.php | 24 ++++++++++---------- src/Exceptions/ActionAttemptFailedError.php | 24 ++++++++++---------- src/Exceptions/ActionAttemptTimeoutError.php | 18 +++++++-------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Exceptions/ActionAttemptError.php b/src/Exceptions/ActionAttemptError.php index 8809e672..2581e3b7 100644 --- a/src/Exceptions/ActionAttemptError.php +++ b/src/Exceptions/ActionAttemptError.php @@ -2,21 +2,21 @@ namespace Seam; -use Seam\Routes\Objects\ActionAttempt; +use Seam\Objects\ActionAttempt; class ActionAttemptError extends \Exception { - private ActionAttempt $actionAttempt; + private ActionAttempt $actionAttempt; - public function __construct(string $message, ActionAttempt $actionAttempt) - { - parent::__construct($message); - $this->name = get_class($this); - $this->actionAttempt = $actionAttempt; - } + public function __construct(string $message, ActionAttempt $actionAttempt) + { + parent::__construct($message); + $this->name = get_class($this); + $this->actionAttempt = $actionAttempt; + } - public function getActionAttempt(): ActionAttempt - { - return $this->actionAttempt; - } + public function getActionAttempt(): ActionAttempt + { + return $this->actionAttempt; + } } diff --git a/src/Exceptions/ActionAttemptFailedError.php b/src/Exceptions/ActionAttemptFailedError.php index 9fca1815..cca53385 100644 --- a/src/Exceptions/ActionAttemptFailedError.php +++ b/src/Exceptions/ActionAttemptFailedError.php @@ -2,21 +2,21 @@ namespace Seam; -use Seam\Routes\Objects\ActionAttempt; +use Seam\Objects\ActionAttempt; class ActionAttemptFailedError extends ActionAttemptError { - private string $errorCode; + private string $errorCode; - public function __construct(ActionAttempt $actionAttempt) - { - parent::__construct($actionAttempt->error->message, $actionAttempt); - $this->name = get_class($this); - $this->errorCode = $actionAttempt->error->type; - } + public function __construct(ActionAttempt $actionAttempt) + { + parent::__construct($actionAttempt->error->message, $actionAttempt); + $this->name = get_class($this); + $this->errorCode = $actionAttempt->error->type; + } - public function getErrorCode(): string - { - return $this->errorCode; - } + public function getErrorCode(): string + { + return $this->errorCode; + } } diff --git a/src/Exceptions/ActionAttemptTimeoutError.php b/src/Exceptions/ActionAttemptTimeoutError.php index 06ba4403..151dc3b4 100644 --- a/src/Exceptions/ActionAttemptTimeoutError.php +++ b/src/Exceptions/ActionAttemptTimeoutError.php @@ -2,16 +2,16 @@ namespace Seam; -use Seam\Routes\Objects\ActionAttempt; +use Seam\Objects\ActionAttempt; class ActionAttemptTimeoutError extends ActionAttemptError { - public function __construct(ActionAttempt $actionAttempt, float $timeout) - { - parent::__construct( - "Timed out waiting for action attempt after {$timeout}s", - $actionAttempt - ); - $this->name = get_class($this); - } + public function __construct(ActionAttempt $actionAttempt, float $timeout) + { + parent::__construct( + "Timed out waiting for action attempt after {$timeout}s", + $actionAttempt + ); + $this->name = get_class($this); + } } From 0bb1d959a7332e448c45d065f37aec8bf2bd705b Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 19 Mar 2025 13:12:23 +0100 Subject: [PATCH 07/13] Fix imports, client names, format --- src/Exceptions/ActionAttemptError.php | 2 +- src/Exceptions/ActionAttemptFailedError.php | 2 +- src/Exceptions/ActionAttemptTimeoutError.php | 2 +- src/Http.php | 163 +++-- src/Routes/Clients/AccessCodes.php | 444 ++++++++++++ src/Routes/Clients/AccessCodesClient.php | 411 ----------- src/Routes/Clients/AccessCodesSimulate.php | 42 ++ .../Clients/AccessCodesSimulateClient.php | 43 -- src/Routes/Clients/AccessCodesUnmanaged.php | 150 ++++ .../Clients/AccessCodesUnmanagedClient.php | 148 ---- src/Routes/Clients/Acs.php | 26 + src/Routes/Clients/AcsAccessGroups.php | 131 ++++ src/Routes/Clients/AcsAccessGroupsClient.php | 136 ---- .../AcsAccessGroupsUnmanagedClient.php | 60 -- src/Routes/Clients/AcsClient.php | 32 - .../Clients/AcsCredentialPoolsClient.php | 34 - ...redentialProvisioningAutomationsClient.php | 51 -- src/Routes/Clients/AcsCredentials.php | 229 ++++++ src/Routes/Clients/AcsCredentialsClient.php | 263 ------- .../Clients/AcsCredentialsUnmanagedClient.php | 61 -- src/Routes/Clients/AcsEncoders.php | 105 +++ src/Routes/Clients/AcsEncodersClient.php | 108 --- src/Routes/Clients/AcsEncodersSimulate.php | 107 +++ .../Clients/AcsEncodersSimulateClient.php | 107 --- src/Routes/Clients/AcsEntrances.php | 100 +++ src/Routes/Clients/AcsEntrancesClient.php | 101 --- src/Routes/Clients/AcsSystems.php | 72 ++ src/Routes/Clients/AcsSystemsClient.php | 71 -- src/Routes/Clients/AcsUsers.php | 273 ++++++++ src/Routes/Clients/AcsUsersClient.php | 279 -------- .../Clients/AcsUsersUnmanagedClient.php | 69 -- src/Routes/Clients/ActionAttempts.php | 79 +++ src/Routes/Clients/ActionAttemptsClient.php | 80 --- src/Routes/Clients/Bridges.php | 37 + src/Routes/Clients/BridgesClient.php | 43 -- src/Routes/Clients/ClientSessions.php | 197 ++++++ src/Routes/Clients/ClientSessionsClient.php | 206 ------ src/Routes/Clients/ConnectWebviews.php | 124 ++++ src/Routes/Clients/ConnectWebviewsClient.php | 123 ---- src/Routes/Clients/ConnectedAccounts.php | 103 +++ .../Clients/ConnectedAccountsClient.php | 106 --- src/Routes/Clients/Devices.php | 158 +++++ src/Routes/Clients/DevicesClient.php | 174 ----- src/Routes/Clients/DevicesSimulate.php | 54 ++ src/Routes/Clients/DevicesSimulateClient.php | 60 -- src/Routes/Clients/DevicesUnmanaged.php | 125 ++++ src/Routes/Clients/DevicesUnmanagedClient.php | 124 ---- src/Routes/Clients/Events.php | 114 +++ src/Routes/Clients/EventsClient.php | 114 --- src/Routes/Clients/Locks.php | 165 +++++ src/Routes/Clients/LocksClient.php | 169 ----- src/Routes/Clients/Networks.php | 44 ++ src/Routes/Clients/NetworksClient.php | 48 -- src/Routes/Clients/NoiseSensors.php | 88 +++ src/Routes/Clients/NoiseSensorsClient.php | 86 --- .../Clients/NoiseSensorsNoiseThresholds.php | 166 +++++ .../NoiseSensorsNoiseThresholdsClient.php | 166 ----- src/Routes/Clients/NoiseSensorsSimulate.php | 29 + .../Clients/NoiseSensorsSimulateClient.php | 30 - src/Routes/Clients/Phones.php | 69 ++ src/Routes/Clients/PhonesClient.php | 73 -- src/Routes/Clients/PhonesSimulate.php | 48 ++ src/Routes/Clients/PhonesSimulateClient.php | 47 -- src/Routes/Clients/Thermostats.php | 570 +++++++++++++++ src/Routes/Clients/ThermostatsClient.php | 564 --------------- src/Routes/Clients/ThermostatsSchedules.php | 158 +++++ .../Clients/ThermostatsSchedulesClient.php | 155 ----- src/Routes/Clients/ThermostatsSimulate.php | 81 +++ .../Clients/ThermostatsSimulateClient.php | 75 -- src/Routes/Clients/UserIdentities.php | 261 +++++++ src/Routes/Clients/UserIdentitiesClient.php | 275 -------- .../UserIdentitiesEnrollmentAutomations.php | 110 +++ ...rIdentitiesEnrollmentAutomationsClient.php | 100 --- src/Routes/Clients/Webhooks.php | 92 +++ src/Routes/Clients/WebhooksClient.php | 102 --- src/Routes/Clients/Workspaces.php | 107 +++ src/Routes/Clients/WorkspacesClient.php | 111 --- src/Routes/Objects/AccessCode.php | 119 ++-- src/Routes/Objects/AccessCodeErrors.php | 45 +- src/Routes/Objects/AccessCodeWarnings.php | 31 +- src/Routes/Objects/AcsAccessGroup.php | 73 +- src/Routes/Objects/AcsAccessGroupWarnings.php | 31 +- src/Routes/Objects/AcsCredential.php | 159 ++--- .../AcsCredentialAssaAbloyVostioMetadata.php | 43 +- src/Routes/Objects/AcsCredentialErrors.php | 31 +- src/Routes/Objects/AcsCredentialPool.php | 47 +- .../AcsCredentialProvisioningAutomation.php | 41 +- .../AcsCredentialVisionlineMetadata.php | 53 +- src/Routes/Objects/AcsCredentialWarnings.php | 31 +- src/Routes/Objects/AcsEncoder.php | 49 +- src/Routes/Objects/AcsEncoderErrors.php | 31 +- src/Routes/Objects/AcsEntrance.php | 117 ++-- .../AcsEntranceAssaAbloyVostioMetadata.php | 41 +- .../AcsEntranceDormakabaCommunityMetadata.php | 18 +- src/Routes/Objects/AcsEntranceErrors.php | 31 +- .../Objects/AcsEntranceLatchMetadata.php | 35 +- src/Routes/Objects/AcsEntranceProfiles.php | 27 +- .../Objects/AcsEntranceSaltoKsMetadata.php | 53 +- .../Objects/AcsEntranceSaltoSpaceMetadata.php | 33 +- .../Objects/AcsEntranceVisionlineMetadata.php | 39 +- src/Routes/Objects/AcsSystem.php | 137 ++-- src/Routes/Objects/AcsSystemErrors.php | 31 +- src/Routes/Objects/AcsSystemLocation.php | 16 +- .../Objects/AcsSystemVisionlineMetadata.php | 33 +- src/Routes/Objects/AcsSystemWarnings.php | 37 +- src/Routes/Objects/AcsUser.php | 137 ++-- src/Routes/Objects/AcsUserAccessSchedule.php | 27 +- src/Routes/Objects/AcsUserErrors.php | 31 +- src/Routes/Objects/AcsUserWarnings.php | 31 +- src/Routes/Objects/ActionAttempt.php | 43 +- src/Routes/Objects/ActionAttemptError.php | 16 +- src/Routes/Objects/ClientSession.php | 59 +- src/Routes/Objects/ConnectWebview.php | 97 +-- src/Routes/Objects/ConnectedAccount.php | 75 +- src/Routes/Objects/ConnectedAccountErrors.php | 35 +- .../ConnectedAccountUserIdentifier.php | 41 +- .../Objects/ConnectedAccountWarnings.php | 31 +- src/Routes/Objects/Device.php | 141 ++-- src/Routes/Objects/DeviceAccelerometerZ.php | 16 +- src/Routes/Objects/DeviceAccessoryKeypad.php | 31 +- .../DeviceActiveThermostatSchedule.php | 69 +- src/Routes/Objects/DeviceAkilesMetadata.php | 35 +- src/Routes/Objects/DeviceAppearance.php | 16 +- ...viceAssaAbloyCredentialServiceMetadata.php | 35 +- .../Objects/DeviceAssaAbloyVostioMetadata.php | 18 +- src/Routes/Objects/DeviceAugustMetadata.php | 47 +- .../Objects/DeviceAvailableClimatePresets.php | 73 +- .../Objects/DeviceAvigilonAltaMetadata.php | 49 +- src/Routes/Objects/DeviceBattery.php | 16 +- src/Routes/Objects/DeviceBrivoMetadata.php | 16 +- src/Routes/Objects/DeviceCodeConstraints.php | 31 +- .../Objects/DeviceControlbywebMetadata.php | 33 +- .../Objects/DeviceCurrentClimateSetting.php | 73 +- .../Objects/DeviceDefaultClimateSetting.php | 73 +- .../DeviceDormakabaOracodeMetadata.php | 59 +- src/Routes/Objects/DeviceEcobeeMetadata.php | 27 +- src/Routes/Objects/DeviceEndpoints.php | 27 +- src/Routes/Objects/DeviceErrors.php | 41 +- src/Routes/Objects/DeviceFeatures.php | 39 +- .../Objects/DeviceFourSuitesMetadata.php | 31 +- src/Routes/Objects/DeviceGenieMetadata.php | 27 +- .../DeviceHoneywellResideoMetadata.php | 29 +- src/Routes/Objects/DeviceHubitatMetadata.php | 31 +- src/Routes/Objects/DeviceHumidity.php | 16 +- src/Routes/Objects/DeviceIglooMetadata.php | 31 +- .../Objects/DeviceIgloohomeMetadata.php | 39 +- src/Routes/Objects/DeviceKeypadBattery.php | 16 +- src/Routes/Objects/DeviceKwiksetMetadata.php | 31 +- .../Objects/DeviceLatestSensorValues.php | 43 +- src/Routes/Objects/DeviceLocation.php | 27 +- src/Routes/Objects/DeviceLocklyMetadata.php | 31 +- src/Routes/Objects/DeviceMinutMetadata.php | 35 +- src/Routes/Objects/DeviceModel.php | 55 +- src/Routes/Objects/DeviceNestMetadata.php | 35 +- .../Objects/DeviceNoiseawareMetadata.php | 39 +- src/Routes/Objects/DeviceNukiMetadata.php | 39 +- .../Objects/DevicePredefinedTimeSlots.php | 61 +- src/Routes/Objects/DevicePressure.php | 16 +- src/Routes/Objects/DeviceProperties.php | 649 +++++++++--------- src/Routes/Objects/DeviceProvider.php | 85 +-- src/Routes/Objects/DeviceSaltoKsMetadata.php | 43 +- src/Routes/Objects/DeviceSaltoMetadata.php | 43 +- ...iceSaltoSpaceCredentialServiceMetadata.php | 18 +- src/Routes/Objects/DeviceSchlageMetadata.php | 35 +- .../Objects/DeviceSeamBridgeMetadata.php | 31 +- .../Objects/DeviceSmartthingsMetadata.php | 37 +- src/Routes/Objects/DeviceSound.php | 16 +- src/Routes/Objects/DeviceTadoMetadata.php | 27 +- src/Routes/Objects/DeviceTedeeMetadata.php | 47 +- src/Routes/Objects/DeviceTemperature.php | 16 +- .../Objects/DeviceTemperatureThreshold.php | 37 +- src/Routes/Objects/DeviceTtlockMetadata.php | 49 +- src/Routes/Objects/DeviceTwoNMetadata.php | 27 +- .../Objects/DeviceVisionlineMetadata.php | 16 +- src/Routes/Objects/DeviceWarnings.php | 31 +- src/Routes/Objects/DeviceWirelessKeypads.php | 27 +- src/Routes/Objects/DeviceWyzeMetadata.php | 51 +- src/Routes/Objects/EnrollmentAutomation.php | 39 +- src/Routes/Objects/Event.php | 221 +++--- src/Routes/Objects/Network.php | 35 +- src/Routes/Objects/NoiseThreshold.php | 47 +- src/Routes/Objects/Phone.php | 71 +- ...honeAssaAbloyCredentialServiceMetadata.php | 35 +- src/Routes/Objects/PhoneEndpoints.php | 27 +- src/Routes/Objects/PhoneErrors.php | 31 +- src/Routes/Objects/PhoneProperties.php | 51 +- ...oneSaltoSpaceCredentialServiceMetadata.php | 18 +- src/Routes/Objects/PhoneWarnings.php | 31 +- src/Routes/Objects/ThermostatSchedule.php | 67 +- .../Objects/ThermostatScheduleErrors.php | 31 +- src/Routes/Objects/UnmanagedAccessCode.php | 79 +-- .../Objects/UnmanagedAccessCodeErrors.php | 47 +- .../Objects/UnmanagedAccessCodeWarnings.php | 33 +- .../Objects/UnmanagedAcsAccessGroup.php | 73 +- .../UnmanagedAcsAccessGroupWarnings.php | 33 +- src/Routes/Objects/UnmanagedAcsCredential.php | 159 ++--- ...edAcsCredentialAssaAbloyVostioMetadata.php | 43 +- .../Objects/UnmanagedAcsCredentialErrors.php | 33 +- ...managedAcsCredentialVisionlineMetadata.php | 53 +- .../UnmanagedAcsCredentialWarnings.php | 33 +- src/Routes/Objects/UnmanagedAcsUser.php | 141 ++-- .../UnmanagedAcsUserAccessSchedule.php | 29 +- src/Routes/Objects/UnmanagedAcsUserErrors.php | 31 +- .../Objects/UnmanagedAcsUserWarnings.php | 31 +- src/Routes/Objects/UnmanagedDevice.php | 129 ++-- .../UnmanagedDeviceAccessoryKeypad.php | 33 +- src/Routes/Objects/UnmanagedDeviceBattery.php | 16 +- src/Routes/Objects/UnmanagedDeviceErrors.php | 41 +- .../Objects/UnmanagedDeviceLocation.php | 27 +- src/Routes/Objects/UnmanagedDeviceModel.php | 55 +- .../Objects/UnmanagedDeviceProperties.php | 81 +-- .../Objects/UnmanagedDeviceWarnings.php | 31 +- src/Routes/Objects/UserIdentity.php | 51 +- src/Routes/Objects/Webhook.php | 35 +- src/Routes/Objects/Workspace.php | 39 +- src/Routes/Routes.php | 74 +- src/Seam.php | 98 +-- tests/Fixture.php | 26 +- tests/HttpErrorTest.php | 130 ++-- 219 files changed, 8488 insertions(+), 8669 deletions(-) create mode 100644 src/Routes/Clients/AccessCodes.php delete mode 100644 src/Routes/Clients/AccessCodesClient.php create mode 100644 src/Routes/Clients/AccessCodesSimulate.php delete mode 100644 src/Routes/Clients/AccessCodesSimulateClient.php create mode 100644 src/Routes/Clients/AccessCodesUnmanaged.php delete mode 100644 src/Routes/Clients/AccessCodesUnmanagedClient.php create mode 100644 src/Routes/Clients/Acs.php create mode 100644 src/Routes/Clients/AcsAccessGroups.php delete mode 100644 src/Routes/Clients/AcsAccessGroupsClient.php delete mode 100644 src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php delete mode 100644 src/Routes/Clients/AcsClient.php delete mode 100644 src/Routes/Clients/AcsCredentialPoolsClient.php delete mode 100644 src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php create mode 100644 src/Routes/Clients/AcsCredentials.php delete mode 100644 src/Routes/Clients/AcsCredentialsClient.php delete mode 100644 src/Routes/Clients/AcsCredentialsUnmanagedClient.php create mode 100644 src/Routes/Clients/AcsEncoders.php delete mode 100644 src/Routes/Clients/AcsEncodersClient.php create mode 100644 src/Routes/Clients/AcsEncodersSimulate.php delete mode 100644 src/Routes/Clients/AcsEncodersSimulateClient.php create mode 100644 src/Routes/Clients/AcsEntrances.php delete mode 100644 src/Routes/Clients/AcsEntrancesClient.php create mode 100644 src/Routes/Clients/AcsSystems.php delete mode 100644 src/Routes/Clients/AcsSystemsClient.php create mode 100644 src/Routes/Clients/AcsUsers.php delete mode 100644 src/Routes/Clients/AcsUsersClient.php delete mode 100644 src/Routes/Clients/AcsUsersUnmanagedClient.php create mode 100644 src/Routes/Clients/ActionAttempts.php delete mode 100644 src/Routes/Clients/ActionAttemptsClient.php create mode 100644 src/Routes/Clients/Bridges.php delete mode 100644 src/Routes/Clients/BridgesClient.php create mode 100644 src/Routes/Clients/ClientSessions.php delete mode 100644 src/Routes/Clients/ClientSessionsClient.php create mode 100644 src/Routes/Clients/ConnectWebviews.php delete mode 100644 src/Routes/Clients/ConnectWebviewsClient.php create mode 100644 src/Routes/Clients/ConnectedAccounts.php delete mode 100644 src/Routes/Clients/ConnectedAccountsClient.php create mode 100644 src/Routes/Clients/Devices.php delete mode 100644 src/Routes/Clients/DevicesClient.php create mode 100644 src/Routes/Clients/DevicesSimulate.php delete mode 100644 src/Routes/Clients/DevicesSimulateClient.php create mode 100644 src/Routes/Clients/DevicesUnmanaged.php delete mode 100644 src/Routes/Clients/DevicesUnmanagedClient.php create mode 100644 src/Routes/Clients/Events.php delete mode 100644 src/Routes/Clients/EventsClient.php create mode 100644 src/Routes/Clients/Locks.php delete mode 100644 src/Routes/Clients/LocksClient.php create mode 100644 src/Routes/Clients/Networks.php delete mode 100644 src/Routes/Clients/NetworksClient.php create mode 100644 src/Routes/Clients/NoiseSensors.php delete mode 100644 src/Routes/Clients/NoiseSensorsClient.php create mode 100644 src/Routes/Clients/NoiseSensorsNoiseThresholds.php delete mode 100644 src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php create mode 100644 src/Routes/Clients/NoiseSensorsSimulate.php delete mode 100644 src/Routes/Clients/NoiseSensorsSimulateClient.php create mode 100644 src/Routes/Clients/Phones.php delete mode 100644 src/Routes/Clients/PhonesClient.php create mode 100644 src/Routes/Clients/PhonesSimulate.php delete mode 100644 src/Routes/Clients/PhonesSimulateClient.php create mode 100644 src/Routes/Clients/Thermostats.php delete mode 100644 src/Routes/Clients/ThermostatsClient.php create mode 100644 src/Routes/Clients/ThermostatsSchedules.php delete mode 100644 src/Routes/Clients/ThermostatsSchedulesClient.php create mode 100644 src/Routes/Clients/ThermostatsSimulate.php delete mode 100644 src/Routes/Clients/ThermostatsSimulateClient.php create mode 100644 src/Routes/Clients/UserIdentities.php delete mode 100644 src/Routes/Clients/UserIdentitiesClient.php create mode 100644 src/Routes/Clients/UserIdentitiesEnrollmentAutomations.php delete mode 100644 src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php create mode 100644 src/Routes/Clients/Webhooks.php delete mode 100644 src/Routes/Clients/WebhooksClient.php create mode 100644 src/Routes/Clients/Workspaces.php delete mode 100644 src/Routes/Clients/WorkspacesClient.php diff --git a/src/Exceptions/ActionAttemptError.php b/src/Exceptions/ActionAttemptError.php index 2581e3b7..45ef3a41 100644 --- a/src/Exceptions/ActionAttemptError.php +++ b/src/Exceptions/ActionAttemptError.php @@ -2,7 +2,7 @@ namespace Seam; -use Seam\Objects\ActionAttempt; +use Seam\Routes\Objects\ActionAttempt; class ActionAttemptError extends \Exception { diff --git a/src/Exceptions/ActionAttemptFailedError.php b/src/Exceptions/ActionAttemptFailedError.php index cca53385..3b56b4e6 100644 --- a/src/Exceptions/ActionAttemptFailedError.php +++ b/src/Exceptions/ActionAttemptFailedError.php @@ -2,7 +2,7 @@ namespace Seam; -use Seam\Objects\ActionAttempt; +use Seam\Routes\Objects\ActionAttempt; class ActionAttemptFailedError extends ActionAttemptError { diff --git a/src/Exceptions/ActionAttemptTimeoutError.php b/src/Exceptions/ActionAttemptTimeoutError.php index 151dc3b4..90710835 100644 --- a/src/Exceptions/ActionAttemptTimeoutError.php +++ b/src/Exceptions/ActionAttemptTimeoutError.php @@ -2,7 +2,7 @@ namespace Seam; -use Seam\Objects\ActionAttempt; +use Seam\Routes\Objects\ActionAttempt; class ActionAttemptTimeoutError extends ActionAttemptError { diff --git a/src/Http.php b/src/Http.php index b85f5580..3bdebf9f 100644 --- a/src/Http.php +++ b/src/Http.php @@ -12,85 +12,96 @@ class Http { - public static function createClient(array $config): GuzzleHttpClient - { - $baseUrl = $config['base_url']; - $headers = $config['headers'] ?? []; - $timeout = $config['timeout'] ?? 60.0; - - $handlerStack = HandlerStack::create(); - $handlerStack->push(self::createErrorHandlingMiddleware()); - - $clientOptions = [ - 'base_uri' => $baseUrl, - 'timeout' => $timeout, - 'headers' => $headers, - 'handler' => $handlerStack, - 'http_errors' => false, - ]; - - return new GuzzleHttpClient($clientOptions); - } - - public static function createErrorHandlingMiddleware(): callable - { - return function (callable $nextHandler) { - return function ($request, array $options) use ($nextHandler) { - return $nextHandler($request, $options)->then( - function (ResponseInterface $response) use ($request) { - $statusCode = $response->getStatusCode(); - $requestId = trim($response->getHeaderLine('seam-request-id')); - $body = (string)$response->getBody(); - $decodedBody = json_decode($body); - - if ($statusCode === 401) { - throw new HttpUnauthorizedError($requestId); - } - - if (!self::isApiErrorResponse($response, $decodedBody)) { - if ($statusCode >= 400) { - throw RequestException::create($request, $response); - } - - return $response; - } - - $errorData = $decodedBody->error; - if (isset($errorData->type) && $errorData->type === 'invalid_input') { - throw new HttpInvalidInputError($errorData, $statusCode, $requestId); - } - - throw new HttpApiError($errorData, $statusCode, $requestId); - } - ); - }; - }; - } - - public static function isApiErrorResponse(ResponseInterface $response, $decodedBody): bool - { - $contentType = $response->getHeaderLine('Content-Type'); - if (stripos($contentType, 'application/json') !== 0) { - return false; + public static function createClient(array $config): GuzzleHttpClient + { + $baseUrl = $config["base_url"]; + $headers = $config["headers"] ?? []; + $timeout = $config["timeout"] ?? 60.0; + + $handlerStack = HandlerStack::create(); + $handlerStack->push(self::createErrorHandlingMiddleware()); + + $clientOptions = [ + "base_uri" => $baseUrl, + "timeout" => $timeout, + "headers" => $headers, + "handler" => $handlerStack, + "http_errors" => false, + ]; + + return new GuzzleHttpClient($clientOptions); } - if (!is_object($decodedBody) || !isset($decodedBody->error)) { - return false; + public static function createErrorHandlingMiddleware(): callable + { + return function (callable $nextHandler) { + return function ($request, array $options) use ($nextHandler) { + return $nextHandler($request, $options)->then(function ( + ResponseInterface $response + ) use ($request) { + $statusCode = $response->getStatusCode(); + $requestId = trim( + $response->getHeaderLine("seam-request-id") + ); + $body = (string) $response->getBody(); + $decodedBody = json_decode($body); + + if ($statusCode === 401) { + throw new HttpUnauthorizedError($requestId); + } + + if (!self::isApiErrorResponse($response, $decodedBody)) { + if ($statusCode >= 400) { + throw RequestException::create($request, $response); + } + + return $response; + } + + $errorData = $decodedBody->error; + if ( + isset($errorData->type) && + $errorData->type === "invalid_input" + ) { + throw new HttpInvalidInputError( + $errorData, + $statusCode, + $requestId + ); + } + + throw new HttpApiError($errorData, $statusCode, $requestId); + }); + }; + }; } - $error = $decodedBody->error; - if (!is_object($error)) { - return false; + public static function isApiErrorResponse( + ResponseInterface $response, + $decodedBody + ): bool { + $contentType = $response->getHeaderLine("Content-Type"); + if (stripos($contentType, "application/json") !== 0) { + return false; + } + + if (!is_object($decodedBody) || !isset($decodedBody->error)) { + return false; + } + + $error = $decodedBody->error; + if (!is_object($error)) { + return false; + } + + if (!isset($error->type) || !is_string($error->type)) { + return false; + } + + if (!isset($error->message) || !is_string($error->message)) { + return false; + } + + return true; } - - if (!isset($error->type) || !is_string($error->type)) { - return false; - } - - if (!isset($error->message) || !is_string($error->message)) { - return false; - } - - return true; - } } diff --git a/src/Routes/Clients/AccessCodes.php b/src/Routes/Clients/AccessCodes.php new file mode 100644 index 00000000..685533b7 --- /dev/null +++ b/src/Routes/Clients/AccessCodes.php @@ -0,0 +1,444 @@ +seam = $seam; + $this->simulate = new AccessCodesSimulate($seam); + $this->unmanaged = new AccessCodesUnmanaged($seam); + } + + public function create( + string $device_id, + ?string $name = null, + ?string $starts_at = null, + ?string $ends_at = null, + ?string $code = null, + ?bool $sync = null, + ?bool $attempt_for_offline_device = null, + ?string $common_code_key = null, + ?bool $prefer_native_scheduling = null, + ?bool $use_backup_access_code_pool = null, + ?bool $allow_external_modification = null, + ?bool $is_external_modification_allowed = null, + ?float $preferred_code_length = null, + ?bool $use_offline_access_code = null, + ?bool $is_offline_access_code = null, + ?bool $is_one_time_use = null, + ?string $max_time_rounding = null + ): AccessCode { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($attempt_for_offline_device !== null) { + $request_payload[ + "attempt_for_offline_device" + ] = $attempt_for_offline_device; + } + if ($common_code_key !== null) { + $request_payload["common_code_key"] = $common_code_key; + } + if ($prefer_native_scheduling !== null) { + $request_payload[ + "prefer_native_scheduling" + ] = $prefer_native_scheduling; + } + if ($use_backup_access_code_pool !== null) { + $request_payload[ + "use_backup_access_code_pool" + ] = $use_backup_access_code_pool; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($preferred_code_length !== null) { + $request_payload["preferred_code_length"] = $preferred_code_length; + } + if ($use_offline_access_code !== null) { + $request_payload[ + "use_offline_access_code" + ] = $use_offline_access_code; + } + if ($is_offline_access_code !== null) { + $request_payload[ + "is_offline_access_code" + ] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + + $res = $this->seam->client->post("/access_codes/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AccessCode::from_json($json->access_code); + } + + public function create_multiple( + array $device_ids, + ?string $behavior_when_code_cannot_be_shared = null, + ?float $preferred_code_length = null, + ?string $name = null, + ?string $starts_at = null, + ?string $ends_at = null, + ?string $code = null, + ?bool $attempt_for_offline_device = null, + ?bool $prefer_native_scheduling = null, + ?bool $use_backup_access_code_pool = null, + ?bool $allow_external_modification = null, + ?bool $is_external_modification_allowed = null, + ?bool $use_offline_access_code = null, + ?bool $is_offline_access_code = null, + ?bool $is_one_time_use = null, + ?string $max_time_rounding = null + ): array { + $request_payload = []; + + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($behavior_when_code_cannot_be_shared !== null) { + $request_payload[ + "behavior_when_code_cannot_be_shared" + ] = $behavior_when_code_cannot_be_shared; + } + if ($preferred_code_length !== null) { + $request_payload["preferred_code_length"] = $preferred_code_length; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($attempt_for_offline_device !== null) { + $request_payload[ + "attempt_for_offline_device" + ] = $attempt_for_offline_device; + } + if ($prefer_native_scheduling !== null) { + $request_payload[ + "prefer_native_scheduling" + ] = $prefer_native_scheduling; + } + if ($use_backup_access_code_pool !== null) { + $request_payload[ + "use_backup_access_code_pool" + ] = $use_backup_access_code_pool; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($use_offline_access_code !== null) { + $request_payload[ + "use_offline_access_code" + ] = $use_offline_access_code; + } + if ($is_offline_access_code !== null) { + $request_payload[ + "is_offline_access_code" + ] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + + $res = $this->seam->client->post("/access_codes/create_multiple", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AccessCode::from_json($r), + $json->access_codes + ); + } + + public function delete( + string $access_code_id, + ?string $device_id = null, + ?bool $sync = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->client->post("/access_codes/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function generate_code(string $device_id): AccessCode + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->client->post("/access_codes/generate_code", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AccessCode::from_json($json->generated_code); + } + + public function get( + ?string $device_id = null, + ?string $access_code_id = null, + ?string $code = null + ): AccessCode { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + + $res = $this->seam->client->post("/access_codes/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AccessCode::from_json($json->access_code); + } + + public function list( + ?string $device_id = null, + ?array $access_code_ids = null, + ?string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($access_code_ids !== null) { + $request_payload["access_code_ids"] = $access_code_ids; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->client->post("/access_codes/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AccessCode::from_json($r), + $json->access_codes + ); + } + + public function pull_backup_access_code(string $access_code_id): AccessCode + { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + + $res = $this->seam->client->post( + "/access_codes/pull_backup_access_code", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return AccessCode::from_json($json->access_code); + } + + public function update( + string $access_code_id, + ?string $name = null, + ?string $starts_at = null, + ?string $ends_at = null, + ?string $code = null, + ?bool $sync = null, + ?bool $attempt_for_offline_device = null, + ?bool $prefer_native_scheduling = null, + ?bool $use_backup_access_code_pool = null, + ?bool $allow_external_modification = null, + ?bool $is_external_modification_allowed = null, + ?float $preferred_code_length = null, + ?bool $use_offline_access_code = null, + ?bool $is_offline_access_code = null, + ?bool $is_one_time_use = null, + ?string $max_time_rounding = null, + ?string $device_id = null, + ?string $type = null, + ?bool $is_managed = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($attempt_for_offline_device !== null) { + $request_payload[ + "attempt_for_offline_device" + ] = $attempt_for_offline_device; + } + if ($prefer_native_scheduling !== null) { + $request_payload[ + "prefer_native_scheduling" + ] = $prefer_native_scheduling; + } + if ($use_backup_access_code_pool !== null) { + $request_payload[ + "use_backup_access_code_pool" + ] = $use_backup_access_code_pool; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($preferred_code_length !== null) { + $request_payload["preferred_code_length"] = $preferred_code_length; + } + if ($use_offline_access_code !== null) { + $request_payload[ + "use_offline_access_code" + ] = $use_offline_access_code; + } + if ($is_offline_access_code !== null) { + $request_payload[ + "is_offline_access_code" + ] = $is_offline_access_code; + } + if ($is_one_time_use !== null) { + $request_payload["is_one_time_use"] = $is_one_time_use; + } + if ($max_time_rounding !== null) { + $request_payload["max_time_rounding"] = $max_time_rounding; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($type !== null) { + $request_payload["type"] = $type; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + + $this->seam->client->post("/access_codes/update", [ + "json" => (object) $request_payload, + ]); + } + + public function update_multiple( + string $common_code_key, + ?string $ends_at = null, + ?string $starts_at = null, + ?string $name = null + ): void { + $request_payload = []; + + if ($common_code_key !== null) { + $request_payload["common_code_key"] = $common_code_key; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $this->seam->client->post("/access_codes/update_multiple", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/AccessCodesClient.php b/src/Routes/Clients/AccessCodesClient.php deleted file mode 100644 index e9653218..00000000 --- a/src/Routes/Clients/AccessCodesClient.php +++ /dev/null @@ -1,411 +0,0 @@ -seam = $seam; - $this->simulate = new AccessCodesSimulateClient($seam); - $this->unmanaged = new AccessCodesUnmanagedClient($seam); - } - - public function create( - string $device_id, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $code = null, - string $common_code_key = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - float $preferred_code_length = null, - string $starts_at = null, - bool $sync = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): AccessCode { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($common_code_key !== null) { - $request_payload["common_code_key"] = $common_code_key; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($is_offline_access_code !== null) { - $request_payload["is_offline_access_code"] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; - } - if ($preferred_code_length !== null) { - $request_payload["preferred_code_length"] = $preferred_code_length; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - if ($use_backup_access_code_pool !== null) { - $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload["use_offline_access_code"] = $use_offline_access_code; - } - - $res = $this->seam->request( - "POST", - "/access_codes/create", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return AccessCode::from_json($res); - } - - public function create_multiple( - array $device_ids, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $behavior_when_code_cannot_be_shared = null, - string $code = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - float $preferred_code_length = null, - string $starts_at = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): array { - $request_payload = []; - - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; - } - if ($behavior_when_code_cannot_be_shared !== null) { - $request_payload["behavior_when_code_cannot_be_shared"] = $behavior_when_code_cannot_be_shared; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($is_offline_access_code !== null) { - $request_payload["is_offline_access_code"] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; - } - if ($preferred_code_length !== null) { - $request_payload["preferred_code_length"] = $preferred_code_length; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($use_backup_access_code_pool !== null) { - $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload["use_offline_access_code"] = $use_offline_access_code; - } - - $res = $this->seam->request( - "POST", - "/access_codes/create_multiple", - json: (object) $request_payload, - inner_object: "access_codes" - ); - - return array_map(fn($r) => AccessCode::from_json($r), $res); - } - - public function delete( - string $access_code_id, - string $device_id = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/delete", - json: (object) $request_payload - ); - } - - public function generate_code(string $device_id): AccessCode - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/generate_code", - json: (object) $request_payload, - inner_object: "generated_code" - ); - - return AccessCode::from_json($res); - } - - public function get( - string $access_code_id = null, - string $code = null, - string $device_id = null - ): AccessCode { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/get", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return AccessCode::from_json($res); - } - - public function list( - array $access_code_ids = null, - string $device_id = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($access_code_ids !== null) { - $request_payload["access_code_ids"] = $access_code_ids; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/access_codes/list", - json: (object) $request_payload, - inner_object: "access_codes" - ); - - return array_map(fn($r) => AccessCode::from_json($r), $res); - } - - public function pull_backup_access_code(string $access_code_id): AccessCode - { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/pull_backup_access_code", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return AccessCode::from_json($res); - } - - public function update( - string $access_code_id, - bool $allow_external_modification = null, - bool $attempt_for_offline_device = null, - string $code = null, - string $device_id = null, - string $ends_at = null, - bool $is_external_modification_allowed = null, - bool $is_managed = null, - bool $is_offline_access_code = null, - bool $is_one_time_use = null, - string $max_time_rounding = null, - string $name = null, - bool $prefer_native_scheduling = null, - float $preferred_code_length = null, - string $starts_at = null, - bool $sync = null, - string $type = null, - bool $use_backup_access_code_pool = null, - bool $use_offline_access_code = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($attempt_for_offline_device !== null) { - $request_payload["attempt_for_offline_device"] = $attempt_for_offline_device; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($is_offline_access_code !== null) { - $request_payload["is_offline_access_code"] = $is_offline_access_code; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($max_time_rounding !== null) { - $request_payload["max_time_rounding"] = $max_time_rounding; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($prefer_native_scheduling !== null) { - $request_payload["prefer_native_scheduling"] = $prefer_native_scheduling; - } - if ($preferred_code_length !== null) { - $request_payload["preferred_code_length"] = $preferred_code_length; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - if ($type !== null) { - $request_payload["type"] = $type; - } - if ($use_backup_access_code_pool !== null) { - $request_payload["use_backup_access_code_pool"] = $use_backup_access_code_pool; - } - if ($use_offline_access_code !== null) { - $request_payload["use_offline_access_code"] = $use_offline_access_code; - } - - $this->seam->request( - "POST", - "/access_codes/update", - json: (object) $request_payload - ); - } - - public function update_multiple( - string $common_code_key, - string $ends_at = null, - string $name = null, - string $starts_at = null - ): void { - $request_payload = []; - - if ($common_code_key !== null) { - $request_payload["common_code_key"] = $common_code_key; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - - $this->seam->request( - "POST", - "/access_codes/update_multiple", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/AccessCodesSimulate.php b/src/Routes/Clients/AccessCodesSimulate.php new file mode 100644 index 00000000..101e1c77 --- /dev/null +++ b/src/Routes/Clients/AccessCodesSimulate.php @@ -0,0 +1,42 @@ +seam = $seam; + } + + public function create_unmanaged_access_code( + string $device_id, + string $name, + string $code + ): UnmanagedAccessCode { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + + $res = $this->seam->client->post( + "/access_codes/simulate/create_unmanaged_access_code", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return UnmanagedAccessCode::from_json($json->access_code); + } +} diff --git a/src/Routes/Clients/AccessCodesSimulateClient.php b/src/Routes/Clients/AccessCodesSimulateClient.php deleted file mode 100644 index af863b67..00000000 --- a/src/Routes/Clients/AccessCodesSimulateClient.php +++ /dev/null @@ -1,43 +0,0 @@ -seam = $seam; - } - - public function create_unmanaged_access_code( - string $code, - string $device_id, - string $name - ): UnmanagedAccessCode { - $request_payload = []; - - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/access_codes/simulate/create_unmanaged_access_code", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return UnmanagedAccessCode::from_json($res); - } -} diff --git a/src/Routes/Clients/AccessCodesUnmanaged.php b/src/Routes/Clients/AccessCodesUnmanaged.php new file mode 100644 index 00000000..dfeed702 --- /dev/null +++ b/src/Routes/Clients/AccessCodesUnmanaged.php @@ -0,0 +1,150 @@ +seam = $seam; + } + + public function convert_to_managed( + string $access_code_id, + ?bool $is_external_modification_allowed = null, + ?bool $allow_external_modification = null, + ?bool $force = null, + ?bool $sync = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($force !== null) { + $request_payload["force"] = $force; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->client->post( + "/access_codes/unmanaged/convert_to_managed", + ["json" => (object) $request_payload] + ); + } + + public function delete(string $access_code_id, ?bool $sync = null): void + { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->client->post("/access_codes/unmanaged/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get( + ?string $device_id = null, + ?string $access_code_id = null, + ?string $code = null + ): UnmanagedAccessCode { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + + $res = $this->seam->client->post("/access_codes/unmanaged/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return UnmanagedAccessCode::from_json($json->access_code); + } + + public function list( + string $device_id, + ?string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->client->post("/access_codes/unmanaged/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => UnmanagedAccessCode::from_json($r), + $json->access_codes + ); + } + + public function update( + string $access_code_id, + bool $is_managed, + ?bool $allow_external_modification = null, + ?bool $is_external_modification_allowed = null, + ?bool $force = null + ): void { + $request_payload = []; + + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($allow_external_modification !== null) { + $request_payload[ + "allow_external_modification" + ] = $allow_external_modification; + } + if ($is_external_modification_allowed !== null) { + $request_payload[ + "is_external_modification_allowed" + ] = $is_external_modification_allowed; + } + if ($force !== null) { + $request_payload["force"] = $force; + } + + $this->seam->client->post("/access_codes/unmanaged/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/AccessCodesUnmanagedClient.php b/src/Routes/Clients/AccessCodesUnmanagedClient.php deleted file mode 100644 index 046c3d1d..00000000 --- a/src/Routes/Clients/AccessCodesUnmanagedClient.php +++ /dev/null @@ -1,148 +0,0 @@ -seam = $seam; - } - - public function convert_to_managed( - string $access_code_id, - bool $allow_external_modification = null, - bool $force = null, - bool $is_external_modification_allowed = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($force !== null) { - $request_payload["force"] = $force; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/convert_to_managed", - json: (object) $request_payload - ); - } - - public function delete(string $access_code_id, bool $sync = null): void - { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/delete", - json: (object) $request_payload - ); - } - - public function get( - string $access_code_id = null, - string $code = null, - string $device_id = null - ): UnmanagedAccessCode { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/access_codes/unmanaged/get", - json: (object) $request_payload, - inner_object: "access_code" - ); - - return UnmanagedAccessCode::from_json($res); - } - - public function list( - string $device_id, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/access_codes/unmanaged/list", - json: (object) $request_payload, - inner_object: "access_codes" - ); - - return array_map(fn($r) => UnmanagedAccessCode::from_json($r), $res); - } - - public function update( - string $access_code_id, - bool $is_managed, - bool $allow_external_modification = null, - bool $force = null, - bool $is_external_modification_allowed = null - ): void { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($allow_external_modification !== null) { - $request_payload["allow_external_modification"] = $allow_external_modification; - } - if ($force !== null) { - $request_payload["force"] = $force; - } - if ($is_external_modification_allowed !== null) { - $request_payload["is_external_modification_allowed"] = $is_external_modification_allowed; - } - - $this->seam->request( - "POST", - "/access_codes/unmanaged/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/Acs.php b/src/Routes/Clients/Acs.php new file mode 100644 index 00000000..f19b9c76 --- /dev/null +++ b/src/Routes/Clients/Acs.php @@ -0,0 +1,26 @@ +seam = $seam; + $this->access_groups = new AcsAccessGroups($seam); + $this->credentials = new AcsCredentials($seam); + $this->encoders = new AcsEncoders($seam); + $this->entrances = new AcsEntrances($seam); + $this->systems = new AcsSystems($seam); + $this->users = new AcsUsers($seam); + } +} diff --git a/src/Routes/Clients/AcsAccessGroups.php b/src/Routes/Clients/AcsAccessGroups.php new file mode 100644 index 00000000..e1865387 --- /dev/null +++ b/src/Routes/Clients/AcsAccessGroups.php @@ -0,0 +1,131 @@ +seam = $seam; + } + + public function add_user( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/acs/access_groups/add_user", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $acs_access_group_id): AcsAccessGroup + { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $res = $this->seam->client->post("/acs/access_groups/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AcsAccessGroup::from_json($json->acs_access_group); + } + + public function list( + ?string $acs_system_id = null, + ?string $acs_user_id = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->client->post("/acs/access_groups/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsAccessGroup::from_json($r), + $json->acs_access_groups + ); + } + + public function list_accessible_entrances( + string $acs_access_group_id + ): array { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $res = $this->seam->client->post( + "/acs/access_groups/list_accessible_entrances", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsEntrance::from_json($r), + $json->acs_entrances + ); + } + + public function list_users(string $acs_access_group_id): array + { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $res = $this->seam->client->post("/acs/access_groups/list_users", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => AcsUser::from_json($r), $json->acs_users); + } + + public function remove_user( + string $acs_access_group_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/acs/access_groups/remove_user", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/AcsAccessGroupsClient.php b/src/Routes/Clients/AcsAccessGroupsClient.php deleted file mode 100644 index eb72f20d..00000000 --- a/src/Routes/Clients/AcsAccessGroupsClient.php +++ /dev/null @@ -1,136 +0,0 @@ -seam = $seam; - } - - public function add_user( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/access_groups/add_user", - json: (object) $request_payload - ); - } - - public function get(string $acs_access_group_id): AcsAccessGroup - { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/get", - json: (object) $request_payload, - inner_object: "acs_access_group" - ); - - return AcsAccessGroup::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $acs_user_id = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list", - json: (object) $request_payload, - inner_object: "acs_access_groups" - ); - - return array_map(fn($r) => AcsAccessGroup::from_json($r), $res); - } - - public function list_accessible_entrances( - string $acs_access_group_id - ): array { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list_accessible_entrances", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function list_users(string $acs_access_group_id): array - { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/list_users", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => AcsUser::from_json($r), $res); - } - - public function remove_user( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/access_groups/remove_user", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php b/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php deleted file mode 100644 index ac00e588..00000000 --- a/src/Routes/Clients/AcsAccessGroupsUnmanagedClient.php +++ /dev/null @@ -1,60 +0,0 @@ -seam = $seam; - } - - public function get(string $acs_access_group_id): UnmanagedAcsAccessGroup - { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/unmanaged/get", - json: (object) $request_payload, - inner_object: "acs_access_group" - ); - - return UnmanagedAcsAccessGroup::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $acs_user_id = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/access_groups/unmanaged/list", - json: (object) $request_payload, - inner_object: "acs_access_groups" - ); - - return array_map( - fn($r) => UnmanagedAcsAccessGroup::from_json($r), - $res - ); - } -} diff --git a/src/Routes/Clients/AcsClient.php b/src/Routes/Clients/AcsClient.php deleted file mode 100644 index f2268c2b..00000000 --- a/src/Routes/Clients/AcsClient.php +++ /dev/null @@ -1,32 +0,0 @@ -seam = $seam; - $this->access_groups = new AcsAccessGroupsClient($seam); - $this->credential_pools = new AcsCredentialPoolsClient($seam); - $this->credential_provisioning_automations = new AcsCredentialProvisioningAutomationsClient( - $seam - ); - $this->credentials = new AcsCredentialsClient($seam); - $this->encoders = new AcsEncodersClient($seam); - $this->entrances = new AcsEntrancesClient($seam); - $this->systems = new AcsSystemsClient($seam); - $this->users = new AcsUsersClient($seam); - } -} diff --git a/src/Routes/Clients/AcsCredentialPoolsClient.php b/src/Routes/Clients/AcsCredentialPoolsClient.php deleted file mode 100644 index a5b993d6..00000000 --- a/src/Routes/Clients/AcsCredentialPoolsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -seam = $seam; - } - - public function list(string $acs_system_id): array - { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credential_pools/list", - json: (object) $request_payload, - inner_object: "acs_credential_pools" - ); - - return array_map(fn($r) => AcsCredentialPool::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php b/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php deleted file mode 100644 index 23f66de0..00000000 --- a/src/Routes/Clients/AcsCredentialProvisioningAutomationsClient.php +++ /dev/null @@ -1,51 +0,0 @@ -seam = $seam; - } - - public function launch( - string $credential_manager_acs_system_id, - string $user_identity_id, - string $acs_credential_pool_id = null, - bool $create_credential_manager_user = null, - string $credential_manager_acs_user_id = null - ): AcsCredentialProvisioningAutomation { - $request_payload = []; - - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($acs_credential_pool_id !== null) { - $request_payload["acs_credential_pool_id"] = $acs_credential_pool_id; - } - if ($create_credential_manager_user !== null) { - $request_payload["create_credential_manager_user"] = $create_credential_manager_user; - } - if ($credential_manager_acs_user_id !== null) { - $request_payload["credential_manager_acs_user_id"] = $credential_manager_acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credential_provisioning_automations/launch", - json: (object) $request_payload, - inner_object: "acs_credential_provisioning_automation" - ); - - return AcsCredentialProvisioningAutomation::from_json($res); - } -} diff --git a/src/Routes/Clients/AcsCredentials.php b/src/Routes/Clients/AcsCredentials.php new file mode 100644 index 00000000..bd1f6613 --- /dev/null +++ b/src/Routes/Clients/AcsCredentials.php @@ -0,0 +1,229 @@ +seam = $seam; + } + + public function assign(string $acs_user_id, string $acs_credential_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $this->seam->client->post("/acs/credentials/assign", [ + "json" => (object) $request_payload, + ]); + } + + public function create( + string $acs_user_id, + string $access_method, + ?string $credential_manager_acs_system_id = null, + ?string $code = null, + ?bool $is_multi_phone_sync_credential = null, + ?array $allowed_acs_entrance_ids = null, + mixed $visionline_metadata = null, + mixed $assa_abloy_vostio_metadata = null, + mixed $salto_space_metadata = null, + ?string $starts_at = null, + ?string $ends_at = null + ): AcsCredential { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($access_method !== null) { + $request_payload["access_method"] = $access_method; + } + if ($credential_manager_acs_system_id !== null) { + $request_payload[ + "credential_manager_acs_system_id" + ] = $credential_manager_acs_system_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($is_multi_phone_sync_credential !== null) { + $request_payload[ + "is_multi_phone_sync_credential" + ] = $is_multi_phone_sync_credential; + } + if ($allowed_acs_entrance_ids !== null) { + $request_payload[ + "allowed_acs_entrance_ids" + ] = $allowed_acs_entrance_ids; + } + if ($visionline_metadata !== null) { + $request_payload["visionline_metadata"] = $visionline_metadata; + } + if ($assa_abloy_vostio_metadata !== null) { + $request_payload[ + "assa_abloy_vostio_metadata" + ] = $assa_abloy_vostio_metadata; + } + if ($salto_space_metadata !== null) { + $request_payload["salto_space_metadata"] = $salto_space_metadata; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + + $res = $this->seam->client->post("/acs/credentials/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AcsCredential::from_json($json->acs_credential); + } + + public function delete(string $acs_credential_id): void + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $this->seam->client->post("/acs/credentials/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $acs_credential_id): AcsCredential + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->client->post("/acs/credentials/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AcsCredential::from_json($json->acs_credential); + } + + public function list( + ?string $acs_user_id = null, + ?string $acs_system_id = null, + ?string $user_identity_id = null, + ?float $limit = null, + ?string $created_before = null, + ?bool $is_multi_phone_sync_credential = null + ): array { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($is_multi_phone_sync_credential !== null) { + $request_payload[ + "is_multi_phone_sync_credential" + ] = $is_multi_phone_sync_credential; + } + + $res = $this->seam->client->post("/acs/credentials/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsCredential::from_json($r), + $json->acs_credentials + ); + } + + public function list_accessible_entrances(string $acs_credential_id): array + { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->client->post( + "/acs/credentials/list_accessible_entrances", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsEntrance::from_json($r), + $json->acs_entrances + ); + } + + public function unassign( + string $acs_user_id, + string $acs_credential_id + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $this->seam->client->post("/acs/credentials/unassign", [ + "json" => (object) $request_payload, + ]); + } + + public function update( + string $acs_credential_id, + ?string $code = null, + ?string $ends_at = null + ): void { + $request_payload = []; + + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + if ($code !== null) { + $request_payload["code"] = $code; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + + $this->seam->client->post("/acs/credentials/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/AcsCredentialsClient.php b/src/Routes/Clients/AcsCredentialsClient.php deleted file mode 100644 index 49b646bd..00000000 --- a/src/Routes/Clients/AcsCredentialsClient.php +++ /dev/null @@ -1,263 +0,0 @@ -seam = $seam; - } - - public function assign(string $acs_credential_id, string $acs_user_id): void - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/assign", - json: (object) $request_payload - ); - } - - public function create( - string $access_method, - string $acs_user_id, - array $allowed_acs_entrance_ids = null, - mixed $assa_abloy_vostio_metadata = null, - string $code = null, - string $credential_manager_acs_system_id = null, - string $ends_at = null, - bool $is_multi_phone_sync_credential = null, - mixed $salto_space_metadata = null, - string $starts_at = null, - mixed $visionline_metadata = null - ): AcsCredential { - $request_payload = []; - - if ($access_method !== null) { - $request_payload["access_method"] = $access_method; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($allowed_acs_entrance_ids !== null) { - $request_payload["allowed_acs_entrance_ids"] = $allowed_acs_entrance_ids; - } - if ($assa_abloy_vostio_metadata !== null) { - $request_payload["assa_abloy_vostio_metadata"] = $assa_abloy_vostio_metadata; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_multi_phone_sync_credential !== null) { - $request_payload["is_multi_phone_sync_credential"] = $is_multi_phone_sync_credential; - } - if ($salto_space_metadata !== null) { - $request_payload["salto_space_metadata"] = $salto_space_metadata; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($visionline_metadata !== null) { - $request_payload["visionline_metadata"] = $visionline_metadata; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/create", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return AcsCredential::from_json($res); - } - - public function create_offline_code( - string $acs_user_id, - string $allowed_acs_entrance_id, - string $ends_at = null, - bool $is_one_time_use = null, - string $starts_at = null - ): AcsCredential { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($allowed_acs_entrance_id !== null) { - $request_payload["allowed_acs_entrance_id"] = $allowed_acs_entrance_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_one_time_use !== null) { - $request_payload["is_one_time_use"] = $is_one_time_use; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/create_offline_code", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return AcsCredential::from_json($res); - } - - public function delete(string $acs_credential_id): void - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/delete", - json: (object) $request_payload - ); - } - - public function get(string $acs_credential_id): AcsCredential - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/get", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return AcsCredential::from_json($res); - } - - public function list( - string $acs_user_id = null, - string $acs_system_id = null, - string $user_identity_id = null, - string $created_before = null, - bool $is_multi_phone_sync_credential = null, - float $limit = null - ): array { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($is_multi_phone_sync_credential !== null) { - $request_payload["is_multi_phone_sync_credential"] = $is_multi_phone_sync_credential; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/list", - json: (object) $request_payload, - inner_object: "acs_credentials" - ); - - return array_map(fn($r) => AcsCredential::from_json($r), $res); - } - - public function list_accessible_entrances(string $acs_credential_id): array - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/list_accessible_entrances", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function unassign( - string $acs_credential_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/credentials/unassign", - json: (object) $request_payload - ); - } - - public function update( - string $acs_credential_id, - string $code = null, - string $ends_at = null - ): void { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($code !== null) { - $request_payload["code"] = $code; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - - $this->seam->request( - "POST", - "/acs/credentials/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/AcsCredentialsUnmanagedClient.php b/src/Routes/Clients/AcsCredentialsUnmanagedClient.php deleted file mode 100644 index cf9a671e..00000000 --- a/src/Routes/Clients/AcsCredentialsUnmanagedClient.php +++ /dev/null @@ -1,61 +0,0 @@ -seam = $seam; - } - - public function get(string $acs_credential_id): UnmanagedAcsCredential - { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/unmanaged/get", - json: (object) $request_payload, - inner_object: "acs_credential" - ); - - return UnmanagedAcsCredential::from_json($res); - } - - public function list( - string $acs_user_id = null, - string $acs_system_id = null, - string $user_identity_id = null - ): array { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/acs/credentials/unmanaged/list", - json: (object) $request_payload, - inner_object: "acs_credentials" - ); - - return array_map(fn($r) => UnmanagedAcsCredential::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/AcsEncoders.php b/src/Routes/Clients/AcsEncoders.php new file mode 100644 index 00000000..bf374542 --- /dev/null +++ b/src/Routes/Clients/AcsEncoders.php @@ -0,0 +1,105 @@ +seam = $seam; + } + + public function encode_credential( + string $acs_encoder_id, + string $acs_credential_id, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->client->post("/acs/encoders/encode_credential", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function list( + ?string $acs_system_id = null, + ?float $limit = null, + ?array $acs_system_ids = null, + ?array $acs_encoder_ids = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($acs_system_ids !== null) { + $request_payload["acs_system_ids"] = $acs_system_ids; + } + if ($acs_encoder_ids !== null) { + $request_payload["acs_encoder_ids"] = $acs_encoder_ids; + } + + $res = $this->seam->client->post("/acs/encoders/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsEncoder::from_json($r), + $json->acs_encoders + ); + } + + public function scan_credential( + string $acs_encoder_id, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + + $res = $this->seam->client->post("/acs/encoders/scan_credential", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } +} diff --git a/src/Routes/Clients/AcsEncodersClient.php b/src/Routes/Clients/AcsEncodersClient.php deleted file mode 100644 index bd62ec1a..00000000 --- a/src/Routes/Clients/AcsEncodersClient.php +++ /dev/null @@ -1,108 +0,0 @@ -seam = $seam; - } - - public function encode_credential( - string $acs_credential_id, - string $acs_encoder_id, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - - $res = $this->seam->request( - "POST", - "/acs/encoders/encode_credential", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function list( - string $acs_system_id = null, - float $limit = null, - array $acs_system_ids = null, - array $acs_encoder_ids = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($acs_system_ids !== null) { - $request_payload["acs_system_ids"] = $acs_system_ids; - } - if ($acs_encoder_ids !== null) { - $request_payload["acs_encoder_ids"] = $acs_encoder_ids; - } - - $res = $this->seam->request( - "POST", - "/acs/encoders/list", - json: (object) $request_payload, - inner_object: "acs_encoders" - ); - - return array_map(fn($r) => AcsEncoder::from_json($r), $res); - } - - public function scan_credential( - string $acs_encoder_id, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - - $res = $this->seam->request( - "POST", - "/acs/encoders/scan_credential", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } -} diff --git a/src/Routes/Clients/AcsEncodersSimulate.php b/src/Routes/Clients/AcsEncodersSimulate.php new file mode 100644 index 00000000..1e22d7e4 --- /dev/null +++ b/src/Routes/Clients/AcsEncodersSimulate.php @@ -0,0 +1,107 @@ +seam = $seam; + } + + public function next_credential_encode_will_fail( + string $acs_encoder_id, + ?string $error_code = null, + ?string $acs_credential_id = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($error_code !== null) { + $request_payload["error_code"] = $error_code; + } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $this->seam->client->post( + "/acs/encoders/simulate/next_credential_encode_will_fail", + ["json" => (object) $request_payload] + ); + } + + public function next_credential_encode_will_succeed( + string $acs_encoder_id, + ?string $scenario = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($scenario !== null) { + $request_payload["scenario"] = $scenario; + } + + $this->seam->client->post( + "/acs/encoders/simulate/next_credential_encode_will_succeed", + ["json" => (object) $request_payload] + ); + } + + public function next_credential_scan_will_fail( + string $acs_encoder_id, + ?string $error_code = null, + ?string $acs_credential_id_on_seam = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($error_code !== null) { + $request_payload["error_code"] = $error_code; + } + if ($acs_credential_id_on_seam !== null) { + $request_payload[ + "acs_credential_id_on_seam" + ] = $acs_credential_id_on_seam; + } + + $this->seam->client->post( + "/acs/encoders/simulate/next_credential_scan_will_fail", + ["json" => (object) $request_payload] + ); + } + + public function next_credential_scan_will_succeed( + string $acs_encoder_id, + ?string $scenario = null, + ?string $acs_credential_id_on_seam = null + ): void { + $request_payload = []; + + if ($acs_encoder_id !== null) { + $request_payload["acs_encoder_id"] = $acs_encoder_id; + } + if ($scenario !== null) { + $request_payload["scenario"] = $scenario; + } + if ($acs_credential_id_on_seam !== null) { + $request_payload[ + "acs_credential_id_on_seam" + ] = $acs_credential_id_on_seam; + } + + $this->seam->client->post( + "/acs/encoders/simulate/next_credential_scan_will_succeed", + ["json" => (object) $request_payload] + ); + } +} diff --git a/src/Routes/Clients/AcsEncodersSimulateClient.php b/src/Routes/Clients/AcsEncodersSimulateClient.php deleted file mode 100644 index b5d24ceb..00000000 --- a/src/Routes/Clients/AcsEncodersSimulateClient.php +++ /dev/null @@ -1,107 +0,0 @@ -seam = $seam; - } - - public function next_credential_encode_will_fail( - string $acs_encoder_id, - string $error_code = null, - string $acs_credential_id = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($error_code !== null) { - $request_payload["error_code"] = $error_code; - } - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_encode_will_fail", - json: (object) $request_payload - ); - } - - public function next_credential_encode_will_succeed( - string $acs_encoder_id, - string $scenario = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($scenario !== null) { - $request_payload["scenario"] = $scenario; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_encode_will_succeed", - json: (object) $request_payload - ); - } - - public function next_credential_scan_will_fail( - string $acs_encoder_id, - string $error_code = null, - string $acs_credential_id_on_seam = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($error_code !== null) { - $request_payload["error_code"] = $error_code; - } - if ($acs_credential_id_on_seam !== null) { - $request_payload["acs_credential_id_on_seam"] = $acs_credential_id_on_seam; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_scan_will_fail", - json: (object) $request_payload - ); - } - - public function next_credential_scan_will_succeed( - string $acs_encoder_id, - string $acs_credential_id_on_seam = null, - string $scenario = null - ): void { - $request_payload = []; - - if ($acs_encoder_id !== null) { - $request_payload["acs_encoder_id"] = $acs_encoder_id; - } - if ($acs_credential_id_on_seam !== null) { - $request_payload["acs_credential_id_on_seam"] = $acs_credential_id_on_seam; - } - if ($scenario !== null) { - $request_payload["scenario"] = $scenario; - } - - $this->seam->request( - "POST", - "/acs/encoders/simulate/next_credential_scan_will_succeed", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/AcsEntrances.php b/src/Routes/Clients/AcsEntrances.php new file mode 100644 index 00000000..75373d57 --- /dev/null +++ b/src/Routes/Clients/AcsEntrances.php @@ -0,0 +1,100 @@ +seam = $seam; + } + + public function get(string $acs_entrance_id): AcsEntrance + { + $request_payload = []; + + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + + $res = $this->seam->client->post("/acs/entrances/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AcsEntrance::from_json($json->acs_entrance); + } + + public function grant_access( + string $acs_entrance_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/acs/entrances/grant_access", [ + "json" => (object) $request_payload, + ]); + } + + public function list( + ?string $acs_system_id = null, + ?string $acs_credential_id = null + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->client->post("/acs/entrances/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsEntrance::from_json($r), + $json->acs_entrances + ); + } + + public function list_credentials_with_access( + string $acs_entrance_id, + ?array $include_if = null + ): array { + $request_payload = []; + + if ($acs_entrance_id !== null) { + $request_payload["acs_entrance_id"] = $acs_entrance_id; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + + $res = $this->seam->client->post( + "/acs/entrances/list_credentials_with_access", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsCredential::from_json($r), + $json->acs_credentials + ); + } +} diff --git a/src/Routes/Clients/AcsEntrancesClient.php b/src/Routes/Clients/AcsEntrancesClient.php deleted file mode 100644 index 20934b0d..00000000 --- a/src/Routes/Clients/AcsEntrancesClient.php +++ /dev/null @@ -1,101 +0,0 @@ -seam = $seam; - } - - public function get(string $acs_entrance_id): AcsEntrance - { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/get", - json: (object) $request_payload, - inner_object: "acs_entrance" - ); - - return AcsEntrance::from_json($res); - } - - public function grant_access( - string $acs_entrance_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/entrances/grant_access", - json: (object) $request_payload - ); - } - - public function list( - string $acs_credential_id = null, - string $acs_system_id = null - ): array { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/list", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function list_credentials_with_access( - string $acs_entrance_id, - array $include_if = null - ): array { - $request_payload = []; - - if ($acs_entrance_id !== null) { - $request_payload["acs_entrance_id"] = $acs_entrance_id; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - - $res = $this->seam->request( - "POST", - "/acs/entrances/list_credentials_with_access", - json: (object) $request_payload, - inner_object: "acs_credentials" - ); - - return array_map(fn($r) => AcsCredential::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/AcsSystems.php b/src/Routes/Clients/AcsSystems.php new file mode 100644 index 00000000..012120c2 --- /dev/null +++ b/src/Routes/Clients/AcsSystems.php @@ -0,0 +1,72 @@ +seam = $seam; + } + + public function get(string $acs_system_id): AcsSystem + { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + + $res = $this->seam->client->post("/acs/systems/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AcsSystem::from_json($json->acs_system); + } + + public function list(?string $connected_account_id = null): array + { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + + $res = $this->seam->client->post("/acs/systems/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsSystem::from_json($r), + $json->acs_systems + ); + } + + public function list_compatible_credential_manager_acs_systems( + string $acs_system_id + ): array { + $request_payload = []; + + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + + $res = $this->seam->client->post( + "/acs/systems/list_compatible_credential_manager_acs_systems", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsSystem::from_json($r), + $json->acs_systems + ); + } +} diff --git a/src/Routes/Clients/AcsSystemsClient.php b/src/Routes/Clients/AcsSystemsClient.php deleted file mode 100644 index c03d9a69..00000000 --- a/src/Routes/Clients/AcsSystemsClient.php +++ /dev/null @@ -1,71 +0,0 @@ -seam = $seam; - } - - public function get(string $acs_system_id): AcsSystem - { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/get", - json: (object) $request_payload, - inner_object: "acs_system" - ); - - return AcsSystem::from_json($res); - } - - public function list(string $connected_account_id = null): array - { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/list", - json: (object) $request_payload, - inner_object: "acs_systems" - ); - - return array_map(fn($r) => AcsSystem::from_json($r), $res); - } - - public function list_compatible_credential_manager_acs_systems( - string $acs_system_id - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/acs/systems/list_compatible_credential_manager_acs_systems", - json: (object) $request_payload, - inner_object: "acs_systems" - ); - - return array_map(fn($r) => AcsSystem::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/AcsUsers.php b/src/Routes/Clients/AcsUsers.php new file mode 100644 index 00000000..07a088e8 --- /dev/null +++ b/src/Routes/Clients/AcsUsers.php @@ -0,0 +1,273 @@ +seam = $seam; + } + + public function add_to_access_group( + string $acs_user_id, + string $acs_access_group_id + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $this->seam->client->post("/acs/users/add_to_access_group", [ + "json" => (object) $request_payload, + ]); + } + + public function create( + string $full_name, + string $acs_system_id, + ?array $acs_access_group_ids = null, + ?string $user_identity_id = null, + mixed $access_schedule = null, + ?string $email = null, + ?string $phone_number = null, + ?string $email_address = null + ): AcsUser { + $request_payload = []; + + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_access_group_ids !== null) { + $request_payload["acs_access_group_ids"] = $acs_access_group_ids; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($access_schedule !== null) { + $request_payload["access_schedule"] = $access_schedule; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + + $res = $this->seam->client->post("/acs/users/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AcsUser::from_json($json->acs_user); + } + + public function delete(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/acs/users/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $acs_user_id): AcsUser + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->client->post("/acs/users/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return AcsUser::from_json($json->acs_user); + } + + public function list( + ?string $user_identity_id = null, + ?string $user_identity_phone_number = null, + ?string $user_identity_email_address = null, + ?string $acs_system_id = null, + ?string $search = null, + mixed $limit = null, + ?string $created_before = null, + ?string $page_cursor = null + ): array { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_phone_number !== null) { + $request_payload[ + "user_identity_phone_number" + ] = $user_identity_phone_number; + } + if ($user_identity_email_address !== null) { + $request_payload[ + "user_identity_email_address" + ] = $user_identity_email_address; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($search !== null) { + $request_payload["search"] = $search; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($page_cursor !== null) { + $request_payload["page_cursor"] = $page_cursor; + } + + $res = $this->seam->client->post("/acs/users/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => AcsUser::from_json($r), $json->acs_users); + } + + public function list_accessible_entrances(string $acs_user_id): array + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $res = $this->seam->client->post( + "/acs/users/list_accessible_entrances", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsEntrance::from_json($r), + $json->acs_entrances + ); + } + + public function remove_from_access_group( + string $acs_user_id, + string $acs_access_group_id + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($acs_access_group_id !== null) { + $request_payload["acs_access_group_id"] = $acs_access_group_id; + } + + $this->seam->client->post("/acs/users/remove_from_access_group", [ + "json" => (object) $request_payload, + ]); + } + + public function revoke_access_to_all_entrances(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/acs/users/revoke_access_to_all_entrances", [ + "json" => (object) $request_payload, + ]); + } + + public function suspend(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/acs/users/suspend", [ + "json" => (object) $request_payload, + ]); + } + + public function unsuspend(string $acs_user_id): void + { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/acs/users/unsuspend", [ + "json" => (object) $request_payload, + ]); + } + + public function update( + string $acs_user_id, + mixed $access_schedule = null, + ?string $full_name = null, + ?string $email = null, + ?string $phone_number = null, + ?string $email_address = null, + ?string $hid_acs_system_id = null + ): void { + $request_payload = []; + + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + if ($access_schedule !== null) { + $request_payload["access_schedule"] = $access_schedule; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($hid_acs_system_id !== null) { + $request_payload["hid_acs_system_id"] = $hid_acs_system_id; + } + + $this->seam->client->post("/acs/users/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/AcsUsersClient.php b/src/Routes/Clients/AcsUsersClient.php deleted file mode 100644 index 426c0c94..00000000 --- a/src/Routes/Clients/AcsUsersClient.php +++ /dev/null @@ -1,279 +0,0 @@ -seam = $seam; - } - - public function add_to_access_group( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/add_to_access_group", - json: (object) $request_payload - ); - } - - public function create( - string $acs_system_id, - string $full_name, - mixed $access_schedule = null, - array $acs_access_group_ids = null, - string $email = null, - string $email_address = null, - string $phone_number = null, - string $user_identity_id = null - ): AcsUser { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($access_schedule !== null) { - $request_payload["access_schedule"] = $access_schedule; - } - if ($acs_access_group_ids !== null) { - $request_payload["acs_access_group_ids"] = $acs_access_group_ids; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/create", - json: (object) $request_payload, - inner_object: "acs_user" - ); - - return AcsUser::from_json($res); - } - - public function delete(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/delete", - json: (object) $request_payload - ); - } - - public function get(string $acs_user_id): AcsUser - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/get", - json: (object) $request_payload, - inner_object: "acs_user" - ); - - return AcsUser::from_json($res); - } - - public function list( - string $acs_system_id = null, - string $created_before = null, - float $limit = null, - string $user_identity_email_address = null, - string $user_identity_id = null, - string $user_identity_phone_number = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($user_identity_email_address !== null) { - $request_payload["user_identity_email_address"] = $user_identity_email_address; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_phone_number !== null) { - $request_payload["user_identity_phone_number"] = $user_identity_phone_number; - } - - $res = $this->seam->request( - "POST", - "/acs/users/list", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => AcsUser::from_json($r), $res); - } - - public function list_accessible_entrances(string $acs_user_id): array - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/list_accessible_entrances", - json: (object) $request_payload, - inner_object: "acs_entrances" - ); - - return array_map(fn($r) => AcsEntrance::from_json($r), $res); - } - - public function remove_from_access_group( - string $acs_access_group_id, - string $acs_user_id - ): void { - $request_payload = []; - - if ($acs_access_group_id !== null) { - $request_payload["acs_access_group_id"] = $acs_access_group_id; - } - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/remove_from_access_group", - json: (object) $request_payload - ); - } - - public function revoke_access_to_all_entrances(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/revoke_access_to_all_entrances", - json: (object) $request_payload - ); - } - - public function suspend(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/suspend", - json: (object) $request_payload - ); - } - - public function unsuspend(string $acs_user_id): void - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $this->seam->request( - "POST", - "/acs/users/unsuspend", - json: (object) $request_payload - ); - } - - public function update( - string $acs_user_id, - mixed $access_schedule = null, - string $email = null, - string $email_address = null, - string $full_name = null, - string $hid_acs_system_id = null, - string $phone_number = null - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($access_schedule !== null) { - $request_payload["access_schedule"] = $access_schedule; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($hid_acs_system_id !== null) { - $request_payload["hid_acs_system_id"] = $hid_acs_system_id; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - - $this->seam->request( - "POST", - "/acs/users/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/AcsUsersUnmanagedClient.php b/src/Routes/Clients/AcsUsersUnmanagedClient.php deleted file mode 100644 index 182f9bcd..00000000 --- a/src/Routes/Clients/AcsUsersUnmanagedClient.php +++ /dev/null @@ -1,69 +0,0 @@ -seam = $seam; - } - - public function get(string $acs_user_id): UnmanagedAcsUser - { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - - $res = $this->seam->request( - "POST", - "/acs/users/unmanaged/get", - json: (object) $request_payload, - inner_object: "acs_user" - ); - - return UnmanagedAcsUser::from_json($res); - } - - public function list( - string $acs_system_id = null, - float $limit = null, - string $user_identity_email_address = null, - string $user_identity_id = null, - string $user_identity_phone_number = null - ): array { - $request_payload = []; - - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($user_identity_email_address !== null) { - $request_payload["user_identity_email_address"] = $user_identity_email_address; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_phone_number !== null) { - $request_payload["user_identity_phone_number"] = $user_identity_phone_number; - } - - $res = $this->seam->request( - "POST", - "/acs/users/unmanaged/list", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => UnmanagedAcsUser::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/ActionAttempts.php b/src/Routes/Clients/ActionAttempts.php new file mode 100644 index 00000000..0fc0d0a3 --- /dev/null +++ b/src/Routes/Clients/ActionAttempts.php @@ -0,0 +1,79 @@ +seam = $seam; + } + + public function get(string $action_attempt_id): ActionAttempt + { + $request_payload = []; + + if ($action_attempt_id !== null) { + $request_payload["action_attempt_id"] = $action_attempt_id; + } + + $res = $this->seam->client->post("/action_attempts/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ActionAttempt::from_json($json->action_attempt); + } + + public function list(array $action_attempt_ids): array + { + $request_payload = []; + + if ($action_attempt_ids !== null) { + $request_payload["action_attempt_ids"] = $action_attempt_ids; + } + + $res = $this->seam->client->post("/action_attempts/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => ActionAttempt::from_json($r), + $json->action_attempts + ); + } + public function poll_until_ready( + string $action_attempt_id, + float $timeout = 20.0 + ): ActionAttempt { + $seam = $this->seam; + $time_waiting = 0.0; + $polling_interval = 0.4; + $action_attempt = $seam->action_attempts->get($action_attempt_id); + + while ($action_attempt->status == "pending") { + $action_attempt = $seam->action_attempts->get( + $action_attempt->action_attempt_id + ); + if ($time_waiting > $timeout) { + throw new ActionAttemptTimeoutError($action_attempt, $timeout); + } + $time_waiting += $polling_interval; + usleep($polling_interval * 1000000); + } + + if ($action_attempt->status == "error") { + throw new ActionAttemptFailedError($action_attempt); + } + + return $action_attempt; + } +} diff --git a/src/Routes/Clients/ActionAttemptsClient.php b/src/Routes/Clients/ActionAttemptsClient.php deleted file mode 100644 index 360d3dfb..00000000 --- a/src/Routes/Clients/ActionAttemptsClient.php +++ /dev/null @@ -1,80 +0,0 @@ -seam = $seam; - } - - public function get(string $action_attempt_id): ActionAttempt - { - $request_payload = []; - - if ($action_attempt_id !== null) { - $request_payload["action_attempt_id"] = $action_attempt_id; - } - - $res = $this->seam->request( - "POST", - "/action_attempts/get", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - return ActionAttempt::from_json($res); - } - - public function list(array $action_attempt_ids): array - { - $request_payload = []; - - if ($action_attempt_ids !== null) { - $request_payload["action_attempt_ids"] = $action_attempt_ids; - } - - $res = $this->seam->request( - "POST", - "/action_attempts/list", - json: (object) $request_payload, - inner_object: "action_attempts" - ); - - return array_map(fn($r) => ActionAttempt::from_json($r), $res); - } - public function poll_until_ready( - string $action_attempt_id, - float $timeout = 20.0 - ): ActionAttempt { - $seam = $this->seam; - $time_waiting = 0.0; - $polling_interval = 0.4; - $action_attempt = $seam->action_attempts->get($action_attempt_id); - - while ($action_attempt->status == "pending") { - $action_attempt = $seam->action_attempts->get( - $action_attempt->action_attempt_id - ); - if ($time_waiting > $timeout) { - throw new ActionAttemptTimeoutError($action_attempt, $timeout); - } - $time_waiting += $polling_interval; - usleep($polling_interval * 1000000); - } - - if ($action_attempt->status == "error") { - throw new ActionAttemptFailedError($action_attempt); - } - - return $action_attempt; - } -} diff --git a/src/Routes/Clients/Bridges.php b/src/Routes/Clients/Bridges.php new file mode 100644 index 00000000..9290f607 --- /dev/null +++ b/src/Routes/Clients/Bridges.php @@ -0,0 +1,37 @@ +seam = $seam; + } + + public function get(string $bridge_id): void + { + $request_payload = []; + + if ($bridge_id !== null) { + $request_payload["bridge_id"] = $bridge_id; + } + + $this->seam->client->post("/bridges/get", [ + "json" => (object) $request_payload, + ]); + } + + public function list(): void + { + $request_payload = []; + + $this->seam->client->post("/bridges/list", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/BridgesClient.php b/src/Routes/Clients/BridgesClient.php deleted file mode 100644 index 22ac4cf1..00000000 --- a/src/Routes/Clients/BridgesClient.php +++ /dev/null @@ -1,43 +0,0 @@ -seam = $seam; - } - - public function get(string $bridge_id): void - { - $request_payload = []; - - if ($bridge_id !== null) { - $request_payload["bridge_id"] = $bridge_id; - } - - $this->seam->request( - "POST", - "/bridges/get", - json: (object) $request_payload, - inner_object: "bridge" - ); - } - - public function list(): void - { - $request_payload = []; - - $this->seam->request( - "POST", - "/bridges/list", - json: (object) $request_payload, - inner_object: "bridges" - ); - } -} diff --git a/src/Routes/Clients/ClientSessions.php b/src/Routes/Clients/ClientSessions.php new file mode 100644 index 00000000..c95d895e --- /dev/null +++ b/src/Routes/Clients/ClientSessions.php @@ -0,0 +1,197 @@ +seam = $seam; + } + + public function create( + ?string $user_identifier_key = null, + ?array $connect_webview_ids = null, + ?array $connected_account_ids = null, + ?array $user_identity_ids = null, + ?string $expires_at = null + ): ClientSession { + $request_payload = []; + + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + if ($expires_at !== null) { + $request_payload["expires_at"] = $expires_at; + } + + $res = $this->seam->client->post("/client_sessions/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ClientSession::from_json($json->client_session); + } + + public function delete(string $client_session_id): void + { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + + $this->seam->client->post("/client_sessions/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get( + ?string $client_session_id = null, + ?string $user_identifier_key = null + ): ClientSession { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->client->post("/client_sessions/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ClientSession::from_json($json->client_session); + } + + public function get_or_create( + ?string $user_identifier_key = null, + ?array $connect_webview_ids = null, + ?array $connected_account_ids = null, + ?array $user_identity_ids = null, + ?string $expires_at = null + ): ClientSession { + $request_payload = []; + + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + if ($expires_at !== null) { + $request_payload["expires_at"] = $expires_at; + } + + $res = $this->seam->client->post("/client_sessions/get_or_create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ClientSession::from_json($json->client_session); + } + + public function grant_access( + ?string $client_session_id = null, + ?string $user_identifier_key = null, + ?array $connected_account_ids = null, + ?array $connect_webview_ids = null, + ?array $user_identity_ids = null + ): void { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($connect_webview_ids !== null) { + $request_payload["connect_webview_ids"] = $connect_webview_ids; + } + if ($user_identity_ids !== null) { + $request_payload["user_identity_ids"] = $user_identity_ids; + } + + $this->seam->client->post("/client_sessions/grant_access", [ + "json" => (object) $request_payload, + ]); + } + + public function list( + ?string $client_session_id = null, + ?string $user_identifier_key = null, + ?string $connect_webview_id = null, + ?bool $without_user_identifier_key = null, + ?string $user_identity_id = null + ): array { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($without_user_identifier_key !== null) { + $request_payload[ + "without_user_identifier_key" + ] = $without_user_identifier_key; + } + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->client->post("/client_sessions/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => ClientSession::from_json($r), + $json->client_sessions + ); + } + + public function revoke(string $client_session_id): void + { + $request_payload = []; + + if ($client_session_id !== null) { + $request_payload["client_session_id"] = $client_session_id; + } + + $this->seam->client->post("/client_sessions/revoke", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/ClientSessionsClient.php b/src/Routes/Clients/ClientSessionsClient.php deleted file mode 100644 index 26b25fa7..00000000 --- a/src/Routes/Clients/ClientSessionsClient.php +++ /dev/null @@ -1,206 +0,0 @@ -seam = $seam; - } - - public function create( - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $expires_at = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): ClientSession { - $request_payload = []; - - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($expires_at !== null) { - $request_payload["expires_at"] = $expires_at; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/create", - json: (object) $request_payload, - inner_object: "client_session" - ); - - return ClientSession::from_json($res); - } - - public function delete(string $client_session_id): void - { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - - $this->seam->request( - "POST", - "/client_sessions/delete", - json: (object) $request_payload - ); - } - - public function get( - string $client_session_id = null, - string $user_identifier_key = null - ): ClientSession { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/get", - json: (object) $request_payload, - inner_object: "client_session" - ); - - return ClientSession::from_json($res); - } - - public function get_or_create( - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $expires_at = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): ClientSession { - $request_payload = []; - - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($expires_at !== null) { - $request_payload["expires_at"] = $expires_at; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/get_or_create", - json: (object) $request_payload, - inner_object: "client_session" - ); - - return ClientSession::from_json($res); - } - - public function grant_access( - string $client_session_id = null, - array $connect_webview_ids = null, - array $connected_account_ids = null, - string $user_identifier_key = null, - array $user_identity_ids = null - ): void { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($connect_webview_ids !== null) { - $request_payload["connect_webview_ids"] = $connect_webview_ids; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_ids !== null) { - $request_payload["user_identity_ids"] = $user_identity_ids; - } - - $this->seam->request( - "POST", - "/client_sessions/grant_access", - json: (object) $request_payload - ); - } - - public function list( - string $client_session_id = null, - string $connect_webview_id = null, - string $user_identifier_key = null, - string $user_identity_id = null, - bool $without_user_identifier_key = null - ): array { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($without_user_identifier_key !== null) { - $request_payload["without_user_identifier_key"] = $without_user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/client_sessions/list", - json: (object) $request_payload, - inner_object: "client_sessions" - ); - - return array_map(fn($r) => ClientSession::from_json($r), $res); - } - - public function revoke(string $client_session_id): void - { - $request_payload = []; - - if ($client_session_id !== null) { - $request_payload["client_session_id"] = $client_session_id; - } - - $this->seam->request( - "POST", - "/client_sessions/revoke", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/ConnectWebviews.php b/src/Routes/Clients/ConnectWebviews.php new file mode 100644 index 00000000..37389a0a --- /dev/null +++ b/src/Routes/Clients/ConnectWebviews.php @@ -0,0 +1,124 @@ +seam = $seam; + } + + public function create( + ?string $device_selection_mode = null, + ?string $custom_redirect_url = null, + ?string $custom_redirect_failure_url = null, + ?array $accepted_providers = null, + ?string $provider_category = null, + mixed $custom_metadata = null, + ?bool $automatically_manage_new_devices = null, + ?bool $wait_for_device_creation = null + ): ConnectWebview { + $request_payload = []; + + if ($device_selection_mode !== null) { + $request_payload["device_selection_mode"] = $device_selection_mode; + } + if ($custom_redirect_url !== null) { + $request_payload["custom_redirect_url"] = $custom_redirect_url; + } + if ($custom_redirect_failure_url !== null) { + $request_payload[ + "custom_redirect_failure_url" + ] = $custom_redirect_failure_url; + } + if ($accepted_providers !== null) { + $request_payload["accepted_providers"] = $accepted_providers; + } + if ($provider_category !== null) { + $request_payload["provider_category"] = $provider_category; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + if ($automatically_manage_new_devices !== null) { + $request_payload[ + "automatically_manage_new_devices" + ] = $automatically_manage_new_devices; + } + if ($wait_for_device_creation !== null) { + $request_payload[ + "wait_for_device_creation" + ] = $wait_for_device_creation; + } + + $res = $this->seam->client->post("/connect_webviews/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ConnectWebview::from_json($json->connect_webview); + } + + public function delete(string $connect_webview_id): void + { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + + $this->seam->client->post("/connect_webviews/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $connect_webview_id): ConnectWebview + { + $request_payload = []; + + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + + $res = $this->seam->client->post("/connect_webviews/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ConnectWebview::from_json($json->connect_webview); + } + + public function list( + ?string $user_identifier_key = null, + mixed $custom_metadata_has = null, + ?float $limit = null + ): array { + $request_payload = []; + + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + + $res = $this->seam->client->post("/connect_webviews/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => ConnectWebview::from_json($r), + $json->connect_webviews + ); + } +} diff --git a/src/Routes/Clients/ConnectWebviewsClient.php b/src/Routes/Clients/ConnectWebviewsClient.php deleted file mode 100644 index 6dfe36d1..00000000 --- a/src/Routes/Clients/ConnectWebviewsClient.php +++ /dev/null @@ -1,123 +0,0 @@ -seam = $seam; - } - - public function create( - array $accepted_providers = null, - bool $automatically_manage_new_devices = null, - mixed $custom_metadata = null, - string $custom_redirect_failure_url = null, - string $custom_redirect_url = null, - string $device_selection_mode = null, - string $provider_category = null, - bool $wait_for_device_creation = null - ): ConnectWebview { - $request_payload = []; - - if ($accepted_providers !== null) { - $request_payload["accepted_providers"] = $accepted_providers; - } - if ($automatically_manage_new_devices !== null) { - $request_payload["automatically_manage_new_devices"] = $automatically_manage_new_devices; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - if ($custom_redirect_failure_url !== null) { - $request_payload["custom_redirect_failure_url"] = $custom_redirect_failure_url; - } - if ($custom_redirect_url !== null) { - $request_payload["custom_redirect_url"] = $custom_redirect_url; - } - if ($device_selection_mode !== null) { - $request_payload["device_selection_mode"] = $device_selection_mode; - } - if ($provider_category !== null) { - $request_payload["provider_category"] = $provider_category; - } - if ($wait_for_device_creation !== null) { - $request_payload["wait_for_device_creation"] = $wait_for_device_creation; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/create", - json: (object) $request_payload, - inner_object: "connect_webview" - ); - - return ConnectWebview::from_json($res); - } - - public function delete(string $connect_webview_id): void - { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - - $this->seam->request( - "POST", - "/connect_webviews/delete", - json: (object) $request_payload - ); - } - - public function get(string $connect_webview_id): ConnectWebview - { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/get", - json: (object) $request_payload, - inner_object: "connect_webview" - ); - - return ConnectWebview::from_json($res); - } - - public function list( - mixed $custom_metadata_has = null, - float $limit = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/connect_webviews/list", - json: (object) $request_payload, - inner_object: "connect_webviews" - ); - - return array_map(fn($r) => ConnectWebview::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/ConnectedAccounts.php b/src/Routes/Clients/ConnectedAccounts.php new file mode 100644 index 00000000..b2738601 --- /dev/null +++ b/src/Routes/Clients/ConnectedAccounts.php @@ -0,0 +1,103 @@ +seam = $seam; + } + + public function delete( + string $connected_account_id, + ?bool $sync = null + ): void { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->client->post("/connected_accounts/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get( + ?string $connected_account_id = null, + ?string $email = null + ): ConnectedAccount { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($email !== null) { + $request_payload["email"] = $email; + } + + $res = $this->seam->client->post("/connected_accounts/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ConnectedAccount::from_json($json->connected_account); + } + + public function list( + ?string $user_identifier_key = null, + mixed $custom_metadata_has = null + ): array { + $request_payload = []; + + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + + $res = $this->seam->client->post("/connected_accounts/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => ConnectedAccount::from_json($r), + $json->connected_accounts + ); + } + + public function update( + string $connected_account_id, + ?bool $automatically_manage_new_devices = null, + mixed $custom_metadata = null + ): void { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($automatically_manage_new_devices !== null) { + $request_payload[ + "automatically_manage_new_devices" + ] = $automatically_manage_new_devices; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + + $this->seam->client->post("/connected_accounts/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/ConnectedAccountsClient.php b/src/Routes/Clients/ConnectedAccountsClient.php deleted file mode 100644 index 1124d0fa..00000000 --- a/src/Routes/Clients/ConnectedAccountsClient.php +++ /dev/null @@ -1,106 +0,0 @@ -seam = $seam; - } - - public function delete( - string $connected_account_id, - bool $sync = null - ): void { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/connected_accounts/delete", - json: (object) $request_payload - ); - } - - public function get( - string $connected_account_id = null, - string $email = null - ): ConnectedAccount { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($email !== null) { - $request_payload["email"] = $email; - } - - $res = $this->seam->request( - "POST", - "/connected_accounts/get", - json: (object) $request_payload, - inner_object: "connected_account" - ); - - return ConnectedAccount::from_json($res); - } - - public function list( - mixed $custom_metadata_has = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/connected_accounts/list", - json: (object) $request_payload, - inner_object: "connected_accounts" - ); - - return array_map(fn($r) => ConnectedAccount::from_json($r), $res); - } - - public function update( - string $connected_account_id, - bool $automatically_manage_new_devices = null, - mixed $custom_metadata = null - ): void { - $request_payload = []; - - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($automatically_manage_new_devices !== null) { - $request_payload["automatically_manage_new_devices"] = $automatically_manage_new_devices; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - - $this->seam->request( - "POST", - "/connected_accounts/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/Devices.php b/src/Routes/Clients/Devices.php new file mode 100644 index 00000000..426d76ca --- /dev/null +++ b/src/Routes/Clients/Devices.php @@ -0,0 +1,158 @@ +seam = $seam; + $this->simulate = new DevicesSimulate($seam); + $this->unmanaged = new DevicesUnmanaged($seam); + } + + public function get(?string $device_id = null, ?string $name = null): Device + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->client->post("/devices/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Device::from_json($json->device); + } + + public function list( + ?string $connected_account_id = null, + ?array $connected_account_ids = null, + ?string $connect_webview_id = null, + ?string $device_type = null, + ?array $device_types = null, + ?string $manufacturer = null, + ?array $device_ids = null, + ?float $limit = null, + ?string $created_before = null, + ?string $user_identifier_key = null, + mixed $custom_metadata_has = null, + ?array $include_if = null, + ?array $exclude_if = null, + ?string $unstable_location_id = null + ): array { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($unstable_location_id !== null) { + $request_payload["unstable_location_id"] = $unstable_location_id; + } + + $res = $this->seam->client->post("/devices/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Device::from_json($r), $json->devices); + } + + public function list_device_providers( + ?string $provider_category = null + ): array { + $request_payload = []; + + if ($provider_category !== null) { + $request_payload["provider_category"] = $provider_category; + } + + $res = $this->seam->client->post("/devices/list_device_providers", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => DeviceProvider::from_json($r), + $json->device_providers + ); + } + + public function update( + string $device_id, + mixed $properties = null, + ?string $name = null, + ?bool $is_managed = null, + mixed $custom_metadata = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($properties !== null) { + $request_payload["properties"] = $properties; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + if ($custom_metadata !== null) { + $request_payload["custom_metadata"] = $custom_metadata; + } + + $this->seam->client->post("/devices/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/DevicesClient.php b/src/Routes/Clients/DevicesClient.php deleted file mode 100644 index b0a22fd2..00000000 --- a/src/Routes/Clients/DevicesClient.php +++ /dev/null @@ -1,174 +0,0 @@ -seam = $seam; - $this->simulate = new DevicesSimulateClient($seam); - $this->unmanaged = new DevicesUnmanagedClient($seam); - } - - public function delete(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/delete", - json: (object) $request_payload - ); - } - - public function get(string $device_id = null, string $name = null): Device - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/devices/get", - json: (object) $request_payload, - inner_object: "device" - ); - - return Device::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/devices/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function list_device_providers( - string $provider_category = null - ): array { - $request_payload = []; - - if ($provider_category !== null) { - $request_payload["provider_category"] = $provider_category; - } - - $res = $this->seam->request( - "POST", - "/devices/list_device_providers", - json: (object) $request_payload, - inner_object: "device_providers" - ); - - return array_map(fn($r) => DeviceProvider::from_json($r), $res); - } - - public function update( - string $device_id, - mixed $custom_metadata = null, - bool $is_managed = null, - string $name = null, - mixed $properties = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($custom_metadata !== null) { - $request_payload["custom_metadata"] = $custom_metadata; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($properties !== null) { - $request_payload["properties"] = $properties; - } - - $this->seam->request( - "POST", - "/devices/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/DevicesSimulate.php b/src/Routes/Clients/DevicesSimulate.php new file mode 100644 index 00000000..afe36f86 --- /dev/null +++ b/src/Routes/Clients/DevicesSimulate.php @@ -0,0 +1,54 @@ +seam = $seam; + } + + public function connect(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->client->post("/devices/simulate/connect", [ + "json" => (object) $request_payload, + ]); + } + + public function disconnect(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->client->post("/devices/simulate/disconnect", [ + "json" => (object) $request_payload, + ]); + } + + public function remove(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->client->post("/devices/simulate/remove", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/DevicesSimulateClient.php b/src/Routes/Clients/DevicesSimulateClient.php deleted file mode 100644 index e09fcb20..00000000 --- a/src/Routes/Clients/DevicesSimulateClient.php +++ /dev/null @@ -1,60 +0,0 @@ -seam = $seam; - } - - public function connect(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/simulate/connect", - json: (object) $request_payload - ); - } - - public function disconnect(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/simulate/disconnect", - json: (object) $request_payload - ); - } - - public function remove(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/devices/simulate/remove", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/DevicesUnmanaged.php b/src/Routes/Clients/DevicesUnmanaged.php new file mode 100644 index 00000000..76d7e559 --- /dev/null +++ b/src/Routes/Clients/DevicesUnmanaged.php @@ -0,0 +1,125 @@ +seam = $seam; + } + + public function get( + ?string $device_id = null, + ?string $name = null + ): UnmanagedDevice { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->client->post("/devices/unmanaged/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return UnmanagedDevice::from_json($json->device); + } + + public function list( + ?string $connected_account_id = null, + ?array $connected_account_ids = null, + ?string $connect_webview_id = null, + ?string $device_type = null, + ?array $device_types = null, + ?string $manufacturer = null, + ?array $device_ids = null, + ?float $limit = null, + ?string $created_before = null, + ?string $user_identifier_key = null, + mixed $custom_metadata_has = null, + ?array $include_if = null, + ?array $exclude_if = null, + ?string $unstable_location_id = null + ): array { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($unstable_location_id !== null) { + $request_payload["unstable_location_id"] = $unstable_location_id; + } + + $res = $this->seam->client->post("/devices/unmanaged/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => UnmanagedDevice::from_json($r), + $json->devices + ); + } + + public function update(string $device_id, bool $is_managed): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($is_managed !== null) { + $request_payload["is_managed"] = $is_managed; + } + + $this->seam->client->post("/devices/unmanaged/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/DevicesUnmanagedClient.php b/src/Routes/Clients/DevicesUnmanagedClient.php deleted file mode 100644 index 87d9438f..00000000 --- a/src/Routes/Clients/DevicesUnmanagedClient.php +++ /dev/null @@ -1,124 +0,0 @@ -seam = $seam; - } - - public function get( - string $device_id = null, - string $name = null - ): UnmanagedDevice { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/devices/unmanaged/get", - json: (object) $request_payload, - inner_object: "device" - ); - - return UnmanagedDevice::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/devices/unmanaged/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => UnmanagedDevice::from_json($r), $res); - } - - public function update(string $device_id, bool $is_managed): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($is_managed !== null) { - $request_payload["is_managed"] = $is_managed; - } - - $this->seam->request( - "POST", - "/devices/unmanaged/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/Events.php b/src/Routes/Clients/Events.php new file mode 100644 index 00000000..c1d11fd8 --- /dev/null +++ b/src/Routes/Clients/Events.php @@ -0,0 +1,114 @@ +seam = $seam; + } + + public function get( + ?string $event_id = null, + ?string $event_type = null, + ?string $device_id = null + ): Event { + $request_payload = []; + + if ($event_id !== null) { + $request_payload["event_id"] = $event_id; + } + if ($event_type !== null) { + $request_payload["event_type"] = $event_type; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->client->post("/events/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Event::from_json($json->event); + } + + public function list( + ?float $unstable_offset = null, + ?string $since = null, + ?array $between = null, + ?string $device_id = null, + ?array $device_ids = null, + ?string $acs_system_id = null, + ?array $acs_system_ids = null, + ?string $access_code_id = null, + ?array $access_code_ids = null, + ?string $event_type = null, + ?array $event_types = null, + ?string $connected_account_id = null, + ?string $connect_webview_id = null, + ?float $limit = null, + ?array $event_ids = null + ): array { + $request_payload = []; + + if ($unstable_offset !== null) { + $request_payload["unstable_offset"] = $unstable_offset; + } + if ($since !== null) { + $request_payload["since"] = $since; + } + if ($between !== null) { + $request_payload["between"] = $between; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($acs_system_id !== null) { + $request_payload["acs_system_id"] = $acs_system_id; + } + if ($acs_system_ids !== null) { + $request_payload["acs_system_ids"] = $acs_system_ids; + } + if ($access_code_id !== null) { + $request_payload["access_code_id"] = $access_code_id; + } + if ($access_code_ids !== null) { + $request_payload["access_code_ids"] = $access_code_ids; + } + if ($event_type !== null) { + $request_payload["event_type"] = $event_type; + } + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($event_ids !== null) { + $request_payload["event_ids"] = $event_ids; + } + + $res = $this->seam->client->post("/events/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Event::from_json($r), $json->events); + } +} diff --git a/src/Routes/Clients/EventsClient.php b/src/Routes/Clients/EventsClient.php deleted file mode 100644 index 038d222a..00000000 --- a/src/Routes/Clients/EventsClient.php +++ /dev/null @@ -1,114 +0,0 @@ -seam = $seam; - } - - public function get( - string $device_id = null, - string $event_id = null, - string $event_type = null - ): Event { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($event_id !== null) { - $request_payload["event_id"] = $event_id; - } - if ($event_type !== null) { - $request_payload["event_type"] = $event_type; - } - - $res = $this->seam->request( - "POST", - "/events/get", - json: (object) $request_payload, - inner_object: "event" - ); - - return Event::from_json($res); - } - - public function list( - string $access_code_id = null, - array $access_code_ids = null, - string $acs_system_id = null, - array $acs_system_ids = null, - array $between = null, - string $connect_webview_id = null, - string $connected_account_id = null, - string $device_id = null, - array $device_ids = null, - string $event_type = null, - array $event_types = null, - float $limit = null, - string $since = null, - float $unstable_offset = null - ): array { - $request_payload = []; - - if ($access_code_id !== null) { - $request_payload["access_code_id"] = $access_code_id; - } - if ($access_code_ids !== null) { - $request_payload["access_code_ids"] = $access_code_ids; - } - if ($acs_system_id !== null) { - $request_payload["acs_system_id"] = $acs_system_id; - } - if ($acs_system_ids !== null) { - $request_payload["acs_system_ids"] = $acs_system_ids; - } - if ($between !== null) { - $request_payload["between"] = $between; - } - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($event_type !== null) { - $request_payload["event_type"] = $event_type; - } - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($since !== null) { - $request_payload["since"] = $since; - } - if ($unstable_offset !== null) { - $request_payload["unstable_offset"] = $unstable_offset; - } - - $res = $this->seam->request( - "POST", - "/events/list", - json: (object) $request_payload, - inner_object: "events" - ); - - return array_map(fn($r) => Event::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/Locks.php b/src/Routes/Clients/Locks.php new file mode 100644 index 00000000..b10d2c50 --- /dev/null +++ b/src/Routes/Clients/Locks.php @@ -0,0 +1,165 @@ +seam = $seam; + } + + public function get(?string $device_id = null, ?string $name = null): Device + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + + $res = $this->seam->client->post("/locks/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Device::from_json($json->device); + } + + public function list( + ?string $connected_account_id = null, + ?array $connected_account_ids = null, + ?string $connect_webview_id = null, + ?string $device_type = null, + ?array $device_types = null, + ?string $manufacturer = null, + ?array $device_ids = null, + ?float $limit = null, + ?string $created_before = null, + ?string $user_identifier_key = null, + mixed $custom_metadata_has = null, + ?array $include_if = null, + ?array $exclude_if = null, + ?string $unstable_location_id = null + ): array { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($unstable_location_id !== null) { + $request_payload["unstable_location_id"] = $unstable_location_id; + } + + $res = $this->seam->client->post("/locks/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Device::from_json($r), $json->devices); + } + + public function lock_door( + string $device_id, + ?bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->client->post("/locks/lock_door", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function unlock_door( + string $device_id, + ?bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->client->post("/locks/unlock_door", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } +} diff --git a/src/Routes/Clients/LocksClient.php b/src/Routes/Clients/LocksClient.php deleted file mode 100644 index 004ce86b..00000000 --- a/src/Routes/Clients/LocksClient.php +++ /dev/null @@ -1,169 +0,0 @@ -seam = $seam; - } - - public function get(string $device_id = null, string $name = null): Device - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/locks/get", - json: (object) $request_payload, - inner_object: "device" - ); - - return Device::from_json($res); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/locks/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function lock_door( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/locks/lock_door", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function unlock_door( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/locks/unlock_door", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } -} diff --git a/src/Routes/Clients/Networks.php b/src/Routes/Clients/Networks.php new file mode 100644 index 00000000..5812f44e --- /dev/null +++ b/src/Routes/Clients/Networks.php @@ -0,0 +1,44 @@ +seam = $seam; + } + + public function get(string $network_id): Network + { + $request_payload = []; + + if ($network_id !== null) { + $request_payload["network_id"] = $network_id; + } + + $res = $this->seam->client->post("/networks/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Network::from_json($json->network); + } + + public function list(): array + { + $request_payload = []; + + $res = $this->seam->client->post("/networks/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Network::from_json($r), $json->networks); + } +} diff --git a/src/Routes/Clients/NetworksClient.php b/src/Routes/Clients/NetworksClient.php deleted file mode 100644 index 1308ddcd..00000000 --- a/src/Routes/Clients/NetworksClient.php +++ /dev/null @@ -1,48 +0,0 @@ -seam = $seam; - } - - public function get(string $network_id): Network - { - $request_payload = []; - - if ($network_id !== null) { - $request_payload["network_id"] = $network_id; - } - - $res = $this->seam->request( - "POST", - "/networks/get", - json: (object) $request_payload, - inner_object: "network" - ); - - return Network::from_json($res); - } - - public function list(): array - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/networks/list", - json: (object) $request_payload, - inner_object: "networks" - ); - - return array_map(fn($r) => Network::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/NoiseSensors.php b/src/Routes/Clients/NoiseSensors.php new file mode 100644 index 00000000..7c45fc77 --- /dev/null +++ b/src/Routes/Clients/NoiseSensors.php @@ -0,0 +1,88 @@ +seam = $seam; + $this->noise_thresholds = new NoiseSensorsNoiseThresholds($seam); + $this->simulate = new NoiseSensorsSimulate($seam); + } + + public function list( + ?string $connected_account_id = null, + ?array $connected_account_ids = null, + ?string $connect_webview_id = null, + ?string $device_type = null, + ?array $device_types = null, + ?string $manufacturer = null, + ?array $device_ids = null, + ?float $limit = null, + ?string $created_before = null, + ?string $user_identifier_key = null, + mixed $custom_metadata_has = null, + ?array $include_if = null, + ?array $exclude_if = null, + ?string $unstable_location_id = null + ): array { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($unstable_location_id !== null) { + $request_payload["unstable_location_id"] = $unstable_location_id; + } + + $res = $this->seam->client->post("/noise_sensors/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Device::from_json($r), $json->devices); + } +} diff --git a/src/Routes/Clients/NoiseSensorsClient.php b/src/Routes/Clients/NoiseSensorsClient.php deleted file mode 100644 index 22ea7016..00000000 --- a/src/Routes/Clients/NoiseSensorsClient.php +++ /dev/null @@ -1,86 +0,0 @@ -seam = $seam; - $this->noise_thresholds = new NoiseSensorsNoiseThresholdsClient($seam); - $this->simulate = new NoiseSensorsSimulateClient($seam); - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/NoiseSensorsNoiseThresholds.php b/src/Routes/Clients/NoiseSensorsNoiseThresholds.php new file mode 100644 index 00000000..3ab27a04 --- /dev/null +++ b/src/Routes/Clients/NoiseSensorsNoiseThresholds.php @@ -0,0 +1,166 @@ +seam = $seam; + } + + public function create( + string $device_id, + string $starts_daily_at, + string $ends_daily_at, + ?bool $sync = null, + ?string $name = null, + ?float $noise_threshold_decibels = null, + ?float $noise_threshold_nrs = null + ): NoiseThreshold { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($starts_daily_at !== null) { + $request_payload["starts_daily_at"] = $starts_daily_at; + } + if ($ends_daily_at !== null) { + $request_payload["ends_daily_at"] = $ends_daily_at; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($noise_threshold_decibels !== null) { + $request_payload[ + "noise_threshold_decibels" + ] = $noise_threshold_decibels; + } + if ($noise_threshold_nrs !== null) { + $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; + } + + $res = $this->seam->client->post( + "/noise_sensors/noise_thresholds/create", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return NoiseThreshold::from_json($json->noise_threshold); + } + + public function delete( + string $noise_threshold_id, + string $device_id, + ?bool $sync = null + ): void { + $request_payload = []; + + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $this->seam->client->post("/noise_sensors/noise_thresholds/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $noise_threshold_id): NoiseThreshold + { + $request_payload = []; + + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + + $res = $this->seam->client->post( + "/noise_sensors/noise_thresholds/get", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return NoiseThreshold::from_json($json->noise_threshold); + } + + public function list(string $device_id, ?bool $is_programmed = null): array + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($is_programmed !== null) { + $request_payload["is_programmed"] = $is_programmed; + } + + $res = $this->seam->client->post( + "/noise_sensors/noise_thresholds/list", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => NoiseThreshold::from_json($r), + $json->noise_thresholds + ); + } + + public function update( + string $noise_threshold_id, + string $device_id, + ?bool $sync = null, + ?string $name = null, + ?string $starts_daily_at = null, + ?string $ends_daily_at = null, + ?float $noise_threshold_decibels = null, + ?float $noise_threshold_nrs = null + ): void { + $request_payload = []; + + if ($noise_threshold_id !== null) { + $request_payload["noise_threshold_id"] = $noise_threshold_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($starts_daily_at !== null) { + $request_payload["starts_daily_at"] = $starts_daily_at; + } + if ($ends_daily_at !== null) { + $request_payload["ends_daily_at"] = $ends_daily_at; + } + if ($noise_threshold_decibels !== null) { + $request_payload[ + "noise_threshold_decibels" + ] = $noise_threshold_decibels; + } + if ($noise_threshold_nrs !== null) { + $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; + } + + $this->seam->client->post("/noise_sensors/noise_thresholds/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php b/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php deleted file mode 100644 index 4bf386c2..00000000 --- a/src/Routes/Clients/NoiseSensorsNoiseThresholdsClient.php +++ /dev/null @@ -1,166 +0,0 @@ -seam = $seam; - } - - public function create( - string $device_id, - string $ends_daily_at, - string $starts_daily_at, - string $name = null, - float $noise_threshold_decibels = null, - float $noise_threshold_nrs = null, - bool $sync = null - ): NoiseThreshold { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_daily_at !== null) { - $request_payload["ends_daily_at"] = $ends_daily_at; - } - if ($starts_daily_at !== null) { - $request_payload["starts_daily_at"] = $starts_daily_at; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($noise_threshold_decibels !== null) { - $request_payload["noise_threshold_decibels"] = $noise_threshold_decibels; - } - if ($noise_threshold_nrs !== null) { - $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/create", - json: (object) $request_payload, - inner_object: "noise_threshold" - ); - - return NoiseThreshold::from_json($res); - } - - public function delete( - string $device_id, - string $noise_threshold_id, - bool $sync = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/delete", - json: (object) $request_payload - ); - } - - public function get(string $noise_threshold_id): NoiseThreshold - { - $request_payload = []; - - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/get", - json: (object) $request_payload, - inner_object: "noise_threshold" - ); - - return NoiseThreshold::from_json($res); - } - - public function list(string $device_id, bool $is_programmed = null): array - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($is_programmed !== null) { - $request_payload["is_programmed"] = $is_programmed; - } - - $res = $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/list", - json: (object) $request_payload, - inner_object: "noise_thresholds" - ); - - return array_map(fn($r) => NoiseThreshold::from_json($r), $res); - } - - public function update( - string $device_id, - string $noise_threshold_id, - string $ends_daily_at = null, - string $name = null, - float $noise_threshold_decibels = null, - float $noise_threshold_nrs = null, - string $starts_daily_at = null, - bool $sync = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($noise_threshold_id !== null) { - $request_payload["noise_threshold_id"] = $noise_threshold_id; - } - if ($ends_daily_at !== null) { - $request_payload["ends_daily_at"] = $ends_daily_at; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($noise_threshold_decibels !== null) { - $request_payload["noise_threshold_decibels"] = $noise_threshold_decibels; - } - if ($noise_threshold_nrs !== null) { - $request_payload["noise_threshold_nrs"] = $noise_threshold_nrs; - } - if ($starts_daily_at !== null) { - $request_payload["starts_daily_at"] = $starts_daily_at; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $this->seam->request( - "POST", - "/noise_sensors/noise_thresholds/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/NoiseSensorsSimulate.php b/src/Routes/Clients/NoiseSensorsSimulate.php new file mode 100644 index 00000000..6141cdd6 --- /dev/null +++ b/src/Routes/Clients/NoiseSensorsSimulate.php @@ -0,0 +1,29 @@ +seam = $seam; + } + + public function trigger_noise_threshold(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->client->post( + "/noise_sensors/simulate/trigger_noise_threshold", + ["json" => (object) $request_payload] + ); + } +} diff --git a/src/Routes/Clients/NoiseSensorsSimulateClient.php b/src/Routes/Clients/NoiseSensorsSimulateClient.php deleted file mode 100644 index 9fa77daf..00000000 --- a/src/Routes/Clients/NoiseSensorsSimulateClient.php +++ /dev/null @@ -1,30 +0,0 @@ -seam = $seam; - } - - public function trigger_noise_threshold(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/noise_sensors/simulate/trigger_noise_threshold", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/Phones.php b/src/Routes/Clients/Phones.php new file mode 100644 index 00000000..2e9463f7 --- /dev/null +++ b/src/Routes/Clients/Phones.php @@ -0,0 +1,69 @@ +seam = $seam; + $this->simulate = new PhonesSimulate($seam); + } + + public function deactivate(string $device_id): void + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->client->post("/phones/deactivate", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $device_id): Phone + { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $res = $this->seam->client->post("/phones/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Phone::from_json($json->phone); + } + + public function list( + ?string $owner_user_identity_id = null, + ?string $acs_credential_id = null + ): array { + $request_payload = []; + + if ($owner_user_identity_id !== null) { + $request_payload[ + "owner_user_identity_id" + ] = $owner_user_identity_id; + } + if ($acs_credential_id !== null) { + $request_payload["acs_credential_id"] = $acs_credential_id; + } + + $res = $this->seam->client->post("/phones/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Phone::from_json($r), $json->phones); + } +} diff --git a/src/Routes/Clients/PhonesClient.php b/src/Routes/Clients/PhonesClient.php deleted file mode 100644 index f42809c6..00000000 --- a/src/Routes/Clients/PhonesClient.php +++ /dev/null @@ -1,73 +0,0 @@ -seam = $seam; - $this->simulate = new PhonesSimulateClient($seam); - } - - public function deactivate(string $device_id): void - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/phones/deactivate", - json: (object) $request_payload - ); - } - - public function get(string $device_id): Phone - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/phones/get", - json: (object) $request_payload, - inner_object: "phone" - ); - - return Phone::from_json($res); - } - - public function list( - string $acs_credential_id = null, - string $owner_user_identity_id = null - ): array { - $request_payload = []; - - if ($acs_credential_id !== null) { - $request_payload["acs_credential_id"] = $acs_credential_id; - } - if ($owner_user_identity_id !== null) { - $request_payload["owner_user_identity_id"] = $owner_user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/phones/list", - json: (object) $request_payload, - inner_object: "phones" - ); - - return array_map(fn($r) => Phone::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/PhonesSimulate.php b/src/Routes/Clients/PhonesSimulate.php new file mode 100644 index 00000000..a3cd5cba --- /dev/null +++ b/src/Routes/Clients/PhonesSimulate.php @@ -0,0 +1,48 @@ +seam = $seam; + } + + public function create_sandbox_phone( + string $user_identity_id, + ?string $custom_sdk_installation_id = null, + mixed $phone_metadata = null, + mixed $assa_abloy_metadata = null + ): Phone { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($custom_sdk_installation_id !== null) { + $request_payload[ + "custom_sdk_installation_id" + ] = $custom_sdk_installation_id; + } + if ($phone_metadata !== null) { + $request_payload["phone_metadata"] = $phone_metadata; + } + if ($assa_abloy_metadata !== null) { + $request_payload["assa_abloy_metadata"] = $assa_abloy_metadata; + } + + $res = $this->seam->client->post( + "/phones/simulate/create_sandbox_phone", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return Phone::from_json($json->phone); + } +} diff --git a/src/Routes/Clients/PhonesSimulateClient.php b/src/Routes/Clients/PhonesSimulateClient.php deleted file mode 100644 index 127250b5..00000000 --- a/src/Routes/Clients/PhonesSimulateClient.php +++ /dev/null @@ -1,47 +0,0 @@ -seam = $seam; - } - - public function create_sandbox_phone( - string $user_identity_id, - mixed $assa_abloy_metadata = null, - string $custom_sdk_installation_id = null, - mixed $phone_metadata = null - ): Phone { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($assa_abloy_metadata !== null) { - $request_payload["assa_abloy_metadata"] = $assa_abloy_metadata; - } - if ($custom_sdk_installation_id !== null) { - $request_payload["custom_sdk_installation_id"] = $custom_sdk_installation_id; - } - if ($phone_metadata !== null) { - $request_payload["phone_metadata"] = $phone_metadata; - } - - $res = $this->seam->request( - "POST", - "/phones/simulate/create_sandbox_phone", - json: (object) $request_payload, - inner_object: "phone" - ); - - return Phone::from_json($res); - } -} diff --git a/src/Routes/Clients/Thermostats.php b/src/Routes/Clients/Thermostats.php new file mode 100644 index 00000000..48baeaa2 --- /dev/null +++ b/src/Routes/Clients/Thermostats.php @@ -0,0 +1,570 @@ +seam = $seam; + $this->schedules = new ThermostatsSchedules($seam); + $this->simulate = new ThermostatsSimulate($seam); + } + + public function activate_climate_preset( + string $device_id, + string $climate_preset_key, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + + $res = $this->seam->client->post( + "/thermostats/activate_climate_preset", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function cool( + string $device_id, + ?float $cooling_set_point_celsius = null, + ?float $cooling_set_point_fahrenheit = null, + ?bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->client->post("/thermostats/cool", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function create_climate_preset( + string $device_id, + string $climate_preset_key, + ?bool $manual_override_allowed = null, + ?string $name = null, + ?string $fan_mode_setting = null, + ?string $hvac_mode_setting = null, + ?float $cooling_set_point_celsius = null, + ?float $heating_set_point_celsius = null, + ?float $cooling_set_point_fahrenheit = null, + ?float $heating_set_point_fahrenheit = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($manual_override_allowed !== null) { + $request_payload[ + "manual_override_allowed" + ] = $manual_override_allowed; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($fan_mode_setting !== null) { + $request_payload["fan_mode_setting"] = $fan_mode_setting; + } + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + + $this->seam->client->post("/thermostats/create_climate_preset", [ + "json" => (object) $request_payload, + ]); + } + + public function delete_climate_preset( + string $device_id, + string $climate_preset_key + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + + $this->seam->client->post("/thermostats/delete_climate_preset", [ + "json" => (object) $request_payload, + ]); + } + + public function heat( + string $device_id, + ?float $heating_set_point_celsius = null, + ?float $heating_set_point_fahrenheit = null, + ?bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->client->post("/thermostats/heat", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function heat_cool( + string $device_id, + ?float $heating_set_point_celsius = null, + ?float $heating_set_point_fahrenheit = null, + ?float $cooling_set_point_celsius = null, + ?float $cooling_set_point_fahrenheit = null, + ?bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->client->post("/thermostats/heat_cool", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function list( + ?string $connected_account_id = null, + ?array $connected_account_ids = null, + ?string $connect_webview_id = null, + ?string $device_type = null, + ?array $device_types = null, + ?string $manufacturer = null, + ?array $device_ids = null, + ?float $limit = null, + ?string $created_before = null, + ?string $user_identifier_key = null, + mixed $custom_metadata_has = null, + ?array $include_if = null, + ?array $exclude_if = null, + ?string $unstable_location_id = null + ): array { + $request_payload = []; + + if ($connected_account_id !== null) { + $request_payload["connected_account_id"] = $connected_account_id; + } + if ($connected_account_ids !== null) { + $request_payload["connected_account_ids"] = $connected_account_ids; + } + if ($connect_webview_id !== null) { + $request_payload["connect_webview_id"] = $connect_webview_id; + } + if ($device_type !== null) { + $request_payload["device_type"] = $device_type; + } + if ($device_types !== null) { + $request_payload["device_types"] = $device_types; + } + if ($manufacturer !== null) { + $request_payload["manufacturer"] = $manufacturer; + } + if ($device_ids !== null) { + $request_payload["device_ids"] = $device_ids; + } + if ($limit !== null) { + $request_payload["limit"] = $limit; + } + if ($created_before !== null) { + $request_payload["created_before"] = $created_before; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + if ($custom_metadata_has !== null) { + $request_payload["custom_metadata_has"] = $custom_metadata_has; + } + if ($include_if !== null) { + $request_payload["include_if"] = $include_if; + } + if ($exclude_if !== null) { + $request_payload["exclude_if"] = $exclude_if; + } + if ($unstable_location_id !== null) { + $request_payload["unstable_location_id"] = $unstable_location_id; + } + + $res = $this->seam->client->post("/thermostats/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Device::from_json($r), $json->devices); + } + + public function off( + string $device_id, + ?bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->client->post("/thermostats/off", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function set_fallback_climate_preset( + string $device_id, + string $climate_preset_key + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + + $this->seam->client->post("/thermostats/set_fallback_climate_preset", [ + "json" => (object) $request_payload, + ]); + } + + public function set_fan_mode( + string $device_id, + ?string $fan_mode = null, + ?string $fan_mode_setting = null, + ?bool $sync = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($fan_mode !== null) { + $request_payload["fan_mode"] = $fan_mode; + } + if ($fan_mode_setting !== null) { + $request_payload["fan_mode_setting"] = $fan_mode_setting; + } + if ($sync !== null) { + $request_payload["sync"] = $sync; + } + + $res = $this->seam->client->post("/thermostats/set_fan_mode", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function set_hvac_mode( + string $hvac_mode_setting, + string $device_id, + ?float $cooling_set_point_celsius = null, + ?float $cooling_set_point_fahrenheit = null, + ?float $heating_set_point_celsius = null, + ?float $heating_set_point_fahrenheit = null, + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + + $res = $this->seam->client->post("/thermostats/set_hvac_mode", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } + + public function set_temperature_threshold( + string $device_id, + ?float $lower_limit_celsius = null, + ?float $lower_limit_fahrenheit = null, + ?float $upper_limit_celsius = null, + ?float $upper_limit_fahrenheit = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($lower_limit_celsius !== null) { + $request_payload["lower_limit_celsius"] = $lower_limit_celsius; + } + if ($lower_limit_fahrenheit !== null) { + $request_payload[ + "lower_limit_fahrenheit" + ] = $lower_limit_fahrenheit; + } + if ($upper_limit_celsius !== null) { + $request_payload["upper_limit_celsius"] = $upper_limit_celsius; + } + if ($upper_limit_fahrenheit !== null) { + $request_payload[ + "upper_limit_fahrenheit" + ] = $upper_limit_fahrenheit; + } + + $this->seam->client->post("/thermostats/set_temperature_threshold", [ + "json" => (object) $request_payload, + ]); + } + + public function update_climate_preset( + string $device_id, + string $climate_preset_key, + bool $manual_override_allowed, + ?string $name = null, + ?string $fan_mode_setting = null, + ?string $hvac_mode_setting = null, + ?float $cooling_set_point_celsius = null, + ?float $heating_set_point_celsius = null, + ?float $cooling_set_point_fahrenheit = null, + ?float $heating_set_point_fahrenheit = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($manual_override_allowed !== null) { + $request_payload[ + "manual_override_allowed" + ] = $manual_override_allowed; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($fan_mode_setting !== null) { + $request_payload["fan_mode_setting"] = $fan_mode_setting; + } + if ($hvac_mode_setting !== null) { + $request_payload["hvac_mode_setting"] = $hvac_mode_setting; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + + $this->seam->client->post("/thermostats/update_climate_preset", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/ThermostatsClient.php b/src/Routes/Clients/ThermostatsClient.php deleted file mode 100644 index e08338c6..00000000 --- a/src/Routes/Clients/ThermostatsClient.php +++ /dev/null @@ -1,564 +0,0 @@ -seam = $seam; - $this->schedules = new ThermostatsSchedulesClient($seam); - $this->simulate = new ThermostatsSimulateClient($seam); - } - - public function activate_climate_preset( - string $climate_preset_key, - string $device_id, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $res = $this->seam->request( - "POST", - "/thermostats/activate_climate_preset", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function cool( - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/cool", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function create_climate_preset( - string $climate_preset_key, - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - string $fan_mode_setting = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - string $hvac_mode_setting = null, - bool $manual_override_allowed = null, - string $name = null - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($fan_mode_setting !== null) { - $request_payload["fan_mode_setting"] = $fan_mode_setting; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($manual_override_allowed !== null) { - $request_payload["manual_override_allowed"] = $manual_override_allowed; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $this->seam->request( - "POST", - "/thermostats/create_climate_preset", - json: (object) $request_payload - ); - } - - public function delete_climate_preset( - string $climate_preset_key, - string $device_id - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/thermostats/delete_climate_preset", - json: (object) $request_payload - ); - } - - public function get(string $device_id = null, string $name = null): Device - { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/thermostats/get", - json: (object) $request_payload, - inner_object: "thermostat" - ); - - return Device::from_json($res); - } - - public function heat( - string $device_id, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/heat", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function heat_cool( - string $device_id, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/heat_cool", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function list( - string $connect_webview_id = null, - string $connected_account_id = null, - array $connected_account_ids = null, - string $created_before = null, - mixed $custom_metadata_has = null, - array $device_ids = null, - string $device_type = null, - array $device_types = null, - array $exclude_if = null, - array $include_if = null, - float $limit = null, - string $manufacturer = null, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($connect_webview_id !== null) { - $request_payload["connect_webview_id"] = $connect_webview_id; - } - if ($connected_account_id !== null) { - $request_payload["connected_account_id"] = $connected_account_id; - } - if ($connected_account_ids !== null) { - $request_payload["connected_account_ids"] = $connected_account_ids; - } - if ($created_before !== null) { - $request_payload["created_before"] = $created_before; - } - if ($custom_metadata_has !== null) { - $request_payload["custom_metadata_has"] = $custom_metadata_has; - } - if ($device_ids !== null) { - $request_payload["device_ids"] = $device_ids; - } - if ($device_type !== null) { - $request_payload["device_type"] = $device_type; - } - if ($device_types !== null) { - $request_payload["device_types"] = $device_types; - } - if ($exclude_if !== null) { - $request_payload["exclude_if"] = $exclude_if; - } - if ($include_if !== null) { - $request_payload["include_if"] = $include_if; - } - if ($limit !== null) { - $request_payload["limit"] = $limit; - } - if ($manufacturer !== null) { - $request_payload["manufacturer"] = $manufacturer; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/thermostats/list", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function off( - string $device_id, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/off", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function set_fallback_climate_preset( - string $climate_preset_key, - string $device_id - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - - $this->seam->request( - "POST", - "/thermostats/set_fallback_climate_preset", - json: (object) $request_payload - ); - } - - public function set_fan_mode( - string $device_id, - string $fan_mode = null, - string $fan_mode_setting = null, - bool $sync = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($fan_mode !== null) { - $request_payload["fan_mode"] = $fan_mode; - } - if ($fan_mode_setting !== null) { - $request_payload["fan_mode_setting"] = $fan_mode_setting; - } - if ($sync !== null) { - $request_payload["sync"] = $sync; - } - - $res = $this->seam->request( - "POST", - "/thermostats/set_fan_mode", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function set_hvac_mode( - string $device_id, - string $hvac_mode_setting, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - - $res = $this->seam->request( - "POST", - "/thermostats/set_hvac_mode", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } - - public function set_temperature_threshold( - string $device_id, - float $lower_limit_celsius = null, - float $lower_limit_fahrenheit = null, - float $upper_limit_celsius = null, - float $upper_limit_fahrenheit = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($lower_limit_celsius !== null) { - $request_payload["lower_limit_celsius"] = $lower_limit_celsius; - } - if ($lower_limit_fahrenheit !== null) { - $request_payload["lower_limit_fahrenheit"] = $lower_limit_fahrenheit; - } - if ($upper_limit_celsius !== null) { - $request_payload["upper_limit_celsius"] = $upper_limit_celsius; - } - if ($upper_limit_fahrenheit !== null) { - $request_payload["upper_limit_fahrenheit"] = $upper_limit_fahrenheit; - } - - $this->seam->request( - "POST", - "/thermostats/set_temperature_threshold", - json: (object) $request_payload - ); - } - - public function update_climate_preset( - string $climate_preset_key, - string $device_id, - bool $manual_override_allowed, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - string $fan_mode_setting = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null, - string $hvac_mode_setting = null, - string $name = null - ): void { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($manual_override_allowed !== null) { - $request_payload["manual_override_allowed"] = $manual_override_allowed; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($fan_mode_setting !== null) { - $request_payload["fan_mode_setting"] = $fan_mode_setting; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - if ($hvac_mode_setting !== null) { - $request_payload["hvac_mode_setting"] = $hvac_mode_setting; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $this->seam->request( - "POST", - "/thermostats/update_climate_preset", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/ThermostatsSchedules.php b/src/Routes/Clients/ThermostatsSchedules.php new file mode 100644 index 00000000..220e205c --- /dev/null +++ b/src/Routes/Clients/ThermostatsSchedules.php @@ -0,0 +1,158 @@ +seam = $seam; + } + + public function create( + string $device_id, + string $climate_preset_key, + string $starts_at, + string $ends_at, + ?string $name = null, + mixed $max_override_period_minutes = null, + ?bool $is_override_allowed = null + ): ThermostatSchedule { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($max_override_period_minutes !== null) { + $request_payload[ + "max_override_period_minutes" + ] = $max_override_period_minutes; + } + if ($is_override_allowed !== null) { + $request_payload["is_override_allowed"] = $is_override_allowed; + } + + $res = $this->seam->client->post("/thermostats/schedules/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ThermostatSchedule::from_json($json->thermostat_schedule); + } + + public function delete(string $thermostat_schedule_id): void + { + $request_payload = []; + + if ($thermostat_schedule_id !== null) { + $request_payload[ + "thermostat_schedule_id" + ] = $thermostat_schedule_id; + } + + $this->seam->client->post("/thermostats/schedules/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $thermostat_schedule_id): ThermostatSchedule + { + $request_payload = []; + + if ($thermostat_schedule_id !== null) { + $request_payload[ + "thermostat_schedule_id" + ] = $thermostat_schedule_id; + } + + $res = $this->seam->client->post("/thermostats/schedules/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return ThermostatSchedule::from_json($json->thermostat_schedule); + } + + public function list( + string $device_id, + ?string $user_identifier_key = null + ): array { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($user_identifier_key !== null) { + $request_payload["user_identifier_key"] = $user_identifier_key; + } + + $res = $this->seam->client->post("/thermostats/schedules/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => ThermostatSchedule::from_json($r), + $json->thermostat_schedules + ); + } + + public function update( + string $thermostat_schedule_id, + ?string $name = null, + ?string $climate_preset_key = null, + mixed $max_override_period_minutes = null, + ?string $starts_at = null, + ?string $ends_at = null, + ?bool $is_override_allowed = null + ): void { + $request_payload = []; + + if ($thermostat_schedule_id !== null) { + $request_payload[ + "thermostat_schedule_id" + ] = $thermostat_schedule_id; + } + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($climate_preset_key !== null) { + $request_payload["climate_preset_key"] = $climate_preset_key; + } + if ($max_override_period_minutes !== null) { + $request_payload[ + "max_override_period_minutes" + ] = $max_override_period_minutes; + } + if ($starts_at !== null) { + $request_payload["starts_at"] = $starts_at; + } + if ($ends_at !== null) { + $request_payload["ends_at"] = $ends_at; + } + if ($is_override_allowed !== null) { + $request_payload["is_override_allowed"] = $is_override_allowed; + } + + $this->seam->client->post("/thermostats/schedules/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/ThermostatsSchedulesClient.php b/src/Routes/Clients/ThermostatsSchedulesClient.php deleted file mode 100644 index 62456101..00000000 --- a/src/Routes/Clients/ThermostatsSchedulesClient.php +++ /dev/null @@ -1,155 +0,0 @@ -seam = $seam; - } - - public function create( - string $climate_preset_key, - string $device_id, - string $ends_at, - string $starts_at, - bool $is_override_allowed = null, - mixed $max_override_period_minutes = null, - string $name = null - ): ThermostatSchedule { - $request_payload = []; - - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - if ($is_override_allowed !== null) { - $request_payload["is_override_allowed"] = $is_override_allowed; - } - if ($max_override_period_minutes !== null) { - $request_payload["max_override_period_minutes"] = $max_override_period_minutes; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - - $res = $this->seam->request( - "POST", - "/thermostats/schedules/create", - json: (object) $request_payload, - inner_object: "thermostat_schedule" - ); - - return ThermostatSchedule::from_json($res); - } - - public function delete(string $thermostat_schedule_id): void - { - $request_payload = []; - - if ($thermostat_schedule_id !== null) { - $request_payload["thermostat_schedule_id"] = $thermostat_schedule_id; - } - - $this->seam->request( - "POST", - "/thermostats/schedules/delete", - json: (object) $request_payload - ); - } - - public function get(string $thermostat_schedule_id): ThermostatSchedule - { - $request_payload = []; - - if ($thermostat_schedule_id !== null) { - $request_payload["thermostat_schedule_id"] = $thermostat_schedule_id; - } - - $res = $this->seam->request( - "POST", - "/thermostats/schedules/get", - json: (object) $request_payload, - inner_object: "thermostat_schedule" - ); - - return ThermostatSchedule::from_json($res); - } - - public function list( - string $device_id, - string $user_identifier_key = null - ): array { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identifier_key !== null) { - $request_payload["user_identifier_key"] = $user_identifier_key; - } - - $res = $this->seam->request( - "POST", - "/thermostats/schedules/list", - json: (object) $request_payload, - inner_object: "thermostat_schedules" - ); - - return array_map(fn($r) => ThermostatSchedule::from_json($r), $res); - } - - public function update( - string $thermostat_schedule_id, - string $climate_preset_key = null, - string $ends_at = null, - bool $is_override_allowed = null, - mixed $max_override_period_minutes = null, - string $name = null, - string $starts_at = null - ): void { - $request_payload = []; - - if ($thermostat_schedule_id !== null) { - $request_payload["thermostat_schedule_id"] = $thermostat_schedule_id; - } - if ($climate_preset_key !== null) { - $request_payload["climate_preset_key"] = $climate_preset_key; - } - if ($ends_at !== null) { - $request_payload["ends_at"] = $ends_at; - } - if ($is_override_allowed !== null) { - $request_payload["is_override_allowed"] = $is_override_allowed; - } - if ($max_override_period_minutes !== null) { - $request_payload["max_override_period_minutes"] = $max_override_period_minutes; - } - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($starts_at !== null) { - $request_payload["starts_at"] = $starts_at; - } - - $this->seam->request( - "POST", - "/thermostats/schedules/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/ThermostatsSimulate.php b/src/Routes/Clients/ThermostatsSimulate.php new file mode 100644 index 00000000..c4aa487d --- /dev/null +++ b/src/Routes/Clients/ThermostatsSimulate.php @@ -0,0 +1,81 @@ +seam = $seam; + } + + public function hvac_mode_adjusted( + string $hvac_mode, + string $device_id, + ?float $cooling_set_point_celsius = null, + ?float $cooling_set_point_fahrenheit = null, + ?float $heating_set_point_celsius = null, + ?float $heating_set_point_fahrenheit = null + ): void { + $request_payload = []; + + if ($hvac_mode !== null) { + $request_payload["hvac_mode"] = $hvac_mode; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($cooling_set_point_celsius !== null) { + $request_payload[ + "cooling_set_point_celsius" + ] = $cooling_set_point_celsius; + } + if ($cooling_set_point_fahrenheit !== null) { + $request_payload[ + "cooling_set_point_fahrenheit" + ] = $cooling_set_point_fahrenheit; + } + if ($heating_set_point_celsius !== null) { + $request_payload[ + "heating_set_point_celsius" + ] = $heating_set_point_celsius; + } + if ($heating_set_point_fahrenheit !== null) { + $request_payload[ + "heating_set_point_fahrenheit" + ] = $heating_set_point_fahrenheit; + } + + $this->seam->client->post("/thermostats/simulate/hvac_mode_adjusted", [ + "json" => (object) $request_payload, + ]); + } + + public function temperature_reached( + string $device_id, + ?float $temperature_celsius = null, + ?float $temperature_fahrenheit = null + ): void { + $request_payload = []; + + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + if ($temperature_celsius !== null) { + $request_payload["temperature_celsius"] = $temperature_celsius; + } + if ($temperature_fahrenheit !== null) { + $request_payload[ + "temperature_fahrenheit" + ] = $temperature_fahrenheit; + } + + $this->seam->client->post("/thermostats/simulate/temperature_reached", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/ThermostatsSimulateClient.php b/src/Routes/Clients/ThermostatsSimulateClient.php deleted file mode 100644 index 77ffeea9..00000000 --- a/src/Routes/Clients/ThermostatsSimulateClient.php +++ /dev/null @@ -1,75 +0,0 @@ -seam = $seam; - } - - public function hvac_mode_adjusted( - string $device_id, - string $hvac_mode, - float $cooling_set_point_celsius = null, - float $cooling_set_point_fahrenheit = null, - float $heating_set_point_celsius = null, - float $heating_set_point_fahrenheit = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($hvac_mode !== null) { - $request_payload["hvac_mode"] = $hvac_mode; - } - if ($cooling_set_point_celsius !== null) { - $request_payload["cooling_set_point_celsius"] = $cooling_set_point_celsius; - } - if ($cooling_set_point_fahrenheit !== null) { - $request_payload["cooling_set_point_fahrenheit"] = $cooling_set_point_fahrenheit; - } - if ($heating_set_point_celsius !== null) { - $request_payload["heating_set_point_celsius"] = $heating_set_point_celsius; - } - if ($heating_set_point_fahrenheit !== null) { - $request_payload["heating_set_point_fahrenheit"] = $heating_set_point_fahrenheit; - } - - $this->seam->request( - "POST", - "/thermostats/simulate/hvac_mode_adjusted", - json: (object) $request_payload - ); - } - - public function temperature_reached( - string $device_id, - float $temperature_celsius = null, - float $temperature_fahrenheit = null - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($temperature_celsius !== null) { - $request_payload["temperature_celsius"] = $temperature_celsius; - } - if ($temperature_fahrenheit !== null) { - $request_payload["temperature_fahrenheit"] = $temperature_fahrenheit; - } - - $this->seam->request( - "POST", - "/thermostats/simulate/temperature_reached", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/UserIdentities.php b/src/Routes/Clients/UserIdentities.php new file mode 100644 index 00000000..87d7bfcc --- /dev/null +++ b/src/Routes/Clients/UserIdentities.php @@ -0,0 +1,261 @@ +seam = $seam; + $this->enrollment_automations = new UserIdentitiesEnrollmentAutomations( + $seam + ); + } + + public function add_acs_user( + string $user_identity_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/user_identities/add_acs_user", [ + "json" => (object) $request_payload, + ]); + } + + public function create( + ?string $user_identity_key = null, + ?string $email_address = null, + ?string $phone_number = null, + ?string $full_name = null + ): UserIdentity { + $request_payload = []; + + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + + $res = $this->seam->client->post("/user_identities/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return UserIdentity::from_json($json->user_identity); + } + + public function delete(string $user_identity_id): void + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $this->seam->client->post("/user_identities/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get( + ?string $user_identity_id = null, + ?string $user_identity_key = null + ): UserIdentity { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + + $res = $this->seam->client->post("/user_identities/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return UserIdentity::from_json($json->user_identity); + } + + public function grant_access_to_device( + string $user_identity_id, + string $device_id + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->client->post("/user_identities/grant_access_to_device", [ + "json" => (object) $request_payload, + ]); + } + + public function list( + ?string $credential_manager_acs_system_id = null + ): array { + $request_payload = []; + + if ($credential_manager_acs_system_id !== null) { + $request_payload[ + "credential_manager_acs_system_id" + ] = $credential_manager_acs_system_id; + } + + $res = $this->seam->client->post("/user_identities/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => UserIdentity::from_json($r), + $json->user_identities + ); + } + + public function list_accessible_devices(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->client->post( + "/user_identities/list_accessible_devices", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Device::from_json($r), $json->devices); + } + + public function list_acs_systems(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->client->post("/user_identities/list_acs_systems", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => AcsSystem::from_json($r), + $json->acs_systems + ); + } + + public function list_acs_users(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->client->post("/user_identities/list_acs_users", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => AcsUser::from_json($r), $json->acs_users); + } + + public function remove_acs_user( + string $user_identity_id, + string $acs_user_id + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($acs_user_id !== null) { + $request_payload["acs_user_id"] = $acs_user_id; + } + + $this->seam->client->post("/user_identities/remove_acs_user", [ + "json" => (object) $request_payload, + ]); + } + + public function revoke_access_to_device( + string $user_identity_id, + string $device_id + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($device_id !== null) { + $request_payload["device_id"] = $device_id; + } + + $this->seam->client->post("/user_identities/revoke_access_to_device", [ + "json" => (object) $request_payload, + ]); + } + + public function update( + string $user_identity_id, + ?string $user_identity_key = null, + ?string $email_address = null, + ?string $phone_number = null, + ?string $full_name = null + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($user_identity_key !== null) { + $request_payload["user_identity_key"] = $user_identity_key; + } + if ($email_address !== null) { + $request_payload["email_address"] = $email_address; + } + if ($phone_number !== null) { + $request_payload["phone_number"] = $phone_number; + } + if ($full_name !== null) { + $request_payload["full_name"] = $full_name; + } + + $this->seam->client->post("/user_identities/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/UserIdentitiesClient.php b/src/Routes/Clients/UserIdentitiesClient.php deleted file mode 100644 index b804e9d0..00000000 --- a/src/Routes/Clients/UserIdentitiesClient.php +++ /dev/null @@ -1,275 +0,0 @@ -seam = $seam; - $this->enrollment_automations = new UserIdentitiesEnrollmentAutomationsClient( - $seam - ); - } - - public function add_acs_user( - string $acs_user_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/add_acs_user", - json: (object) $request_payload - ); - } - - public function create( - string $email_address = null, - string $full_name = null, - string $phone_number = null, - string $user_identity_key = null - ): UserIdentity { - $request_payload = []; - - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; - } - - $res = $this->seam->request( - "POST", - "/user_identities/create", - json: (object) $request_payload, - inner_object: "user_identity" - ); - - return UserIdentity::from_json($res); - } - - public function delete(string $user_identity_id): void - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/delete", - json: (object) $request_payload - ); - } - - public function get( - string $user_identity_id = null, - string $user_identity_key = null - ): UserIdentity { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; - } - - $res = $this->seam->request( - "POST", - "/user_identities/get", - json: (object) $request_payload, - inner_object: "user_identity" - ); - - return UserIdentity::from_json($res); - } - - public function grant_access_to_device( - string $device_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/grant_access_to_device", - json: (object) $request_payload - ); - } - - public function list(string $credential_manager_acs_system_id = null): array - { - $request_payload = []; - - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list", - json: (object) $request_payload, - inner_object: "user_identities" - ); - - return array_map(fn($r) => UserIdentity::from_json($r), $res); - } - - public function list_accessible_devices(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list_accessible_devices", - json: (object) $request_payload, - inner_object: "devices" - ); - - return array_map(fn($r) => Device::from_json($r), $res); - } - - public function list_acs_systems(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list_acs_systems", - json: (object) $request_payload, - inner_object: "acs_systems" - ); - - return array_map(fn($r) => AcsSystem::from_json($r), $res); - } - - public function list_acs_users(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/list_acs_users", - json: (object) $request_payload, - inner_object: "acs_users" - ); - - return array_map(fn($r) => AcsUser::from_json($r), $res); - } - - public function remove_acs_user( - string $acs_user_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($acs_user_id !== null) { - $request_payload["acs_user_id"] = $acs_user_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/remove_acs_user", - json: (object) $request_payload - ); - } - - public function revoke_access_to_device( - string $device_id, - string $user_identity_id - ): void { - $request_payload = []; - - if ($device_id !== null) { - $request_payload["device_id"] = $device_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $this->seam->request( - "POST", - "/user_identities/revoke_access_to_device", - json: (object) $request_payload - ); - } - - public function update( - string $user_identity_id, - string $email_address = null, - string $full_name = null, - string $phone_number = null, - string $user_identity_key = null - ): void { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($email_address !== null) { - $request_payload["email_address"] = $email_address; - } - if ($full_name !== null) { - $request_payload["full_name"] = $full_name; - } - if ($phone_number !== null) { - $request_payload["phone_number"] = $phone_number; - } - if ($user_identity_key !== null) { - $request_payload["user_identity_key"] = $user_identity_key; - } - - $this->seam->request( - "POST", - "/user_identities/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/UserIdentitiesEnrollmentAutomations.php b/src/Routes/Clients/UserIdentitiesEnrollmentAutomations.php new file mode 100644 index 00000000..fb489190 --- /dev/null +++ b/src/Routes/Clients/UserIdentitiesEnrollmentAutomations.php @@ -0,0 +1,110 @@ +seam = $seam; + } + + public function delete(string $enrollment_automation_id): void + { + $request_payload = []; + + if ($enrollment_automation_id !== null) { + $request_payload[ + "enrollment_automation_id" + ] = $enrollment_automation_id; + } + + $this->seam->client->post( + "/user_identities/enrollment_automations/delete", + ["json" => (object) $request_payload] + ); + } + + public function get(string $enrollment_automation_id): EnrollmentAutomation + { + $request_payload = []; + + if ($enrollment_automation_id !== null) { + $request_payload[ + "enrollment_automation_id" + ] = $enrollment_automation_id; + } + + $res = $this->seam->client->post( + "/user_identities/enrollment_automations/get", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return EnrollmentAutomation::from_json($json->enrollment_automation); + } + + public function launch( + string $user_identity_id, + string $credential_manager_acs_system_id, + ?string $acs_credential_pool_id = null, + ?bool $create_credential_manager_user = null, + ?string $credential_manager_acs_user_id = null + ): void { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + if ($credential_manager_acs_system_id !== null) { + $request_payload[ + "credential_manager_acs_system_id" + ] = $credential_manager_acs_system_id; + } + if ($acs_credential_pool_id !== null) { + $request_payload[ + "acs_credential_pool_id" + ] = $acs_credential_pool_id; + } + if ($create_credential_manager_user !== null) { + $request_payload[ + "create_credential_manager_user" + ] = $create_credential_manager_user; + } + if ($credential_manager_acs_user_id !== null) { + $request_payload[ + "credential_manager_acs_user_id" + ] = $credential_manager_acs_user_id; + } + + $this->seam->client->post( + "/user_identities/enrollment_automations/launch", + ["json" => (object) $request_payload] + ); + } + + public function list(string $user_identity_id): array + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->client->post( + "/user_identities/enrollment_automations/list", + ["json" => (object) $request_payload] + ); + $json = json_decode($res->getBody()); + + return array_map( + fn($r) => EnrollmentAutomation::from_json($r), + $json->enrollment_automations + ); + } +} diff --git a/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php b/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php deleted file mode 100644 index 31c4d306..00000000 --- a/src/Routes/Clients/UserIdentitiesEnrollmentAutomationsClient.php +++ /dev/null @@ -1,100 +0,0 @@ -seam = $seam; - } - - public function delete(string $enrollment_automation_id): void - { - $request_payload = []; - - if ($enrollment_automation_id !== null) { - $request_payload["enrollment_automation_id"] = $enrollment_automation_id; - } - - $this->seam->request( - "POST", - "/user_identities/enrollment_automations/delete", - json: (object) $request_payload - ); - } - - public function get(string $enrollment_automation_id): EnrollmentAutomation - { - $request_payload = []; - - if ($enrollment_automation_id !== null) { - $request_payload["enrollment_automation_id"] = $enrollment_automation_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/enrollment_automations/get", - json: (object) $request_payload, - inner_object: "enrollment_automation" - ); - - return EnrollmentAutomation::from_json($res); - } - - public function launch( - string $credential_manager_acs_system_id, - string $user_identity_id, - string $acs_credential_pool_id = null, - bool $create_credential_manager_user = null, - string $credential_manager_acs_user_id = null - ): void { - $request_payload = []; - - if ($credential_manager_acs_system_id !== null) { - $request_payload["credential_manager_acs_system_id"] = $credential_manager_acs_system_id; - } - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - if ($acs_credential_pool_id !== null) { - $request_payload["acs_credential_pool_id"] = $acs_credential_pool_id; - } - if ($create_credential_manager_user !== null) { - $request_payload["create_credential_manager_user"] = $create_credential_manager_user; - } - if ($credential_manager_acs_user_id !== null) { - $request_payload["credential_manager_acs_user_id"] = $credential_manager_acs_user_id; - } - - $this->seam->request( - "POST", - "/user_identities/enrollment_automations/launch", - json: (object) $request_payload, - inner_object: "enrollment_automation" - ); - } - - public function list(string $user_identity_id): array - { - $request_payload = []; - - if ($user_identity_id !== null) { - $request_payload["user_identity_id"] = $user_identity_id; - } - - $res = $this->seam->request( - "POST", - "/user_identities/enrollment_automations/list", - json: (object) $request_payload, - inner_object: "enrollment_automations" - ); - - return array_map(fn($r) => EnrollmentAutomation::from_json($r), $res); - } -} diff --git a/src/Routes/Clients/Webhooks.php b/src/Routes/Clients/Webhooks.php new file mode 100644 index 00000000..d62014ae --- /dev/null +++ b/src/Routes/Clients/Webhooks.php @@ -0,0 +1,92 @@ +seam = $seam; + } + + public function create(string $url, ?array $event_types = null): Webhook + { + $request_payload = []; + + if ($url !== null) { + $request_payload["url"] = $url; + } + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + + $res = $this->seam->client->post("/webhooks/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Webhook::from_json($json->webhook); + } + + public function delete(string $webhook_id): void + { + $request_payload = []; + + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + + $this->seam->client->post("/webhooks/delete", [ + "json" => (object) $request_payload, + ]); + } + + public function get(string $webhook_id): Webhook + { + $request_payload = []; + + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + + $res = $this->seam->client->post("/webhooks/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Webhook::from_json($json->webhook); + } + + public function list(): array + { + $request_payload = []; + + $res = $this->seam->client->post("/webhooks/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Webhook::from_json($r), $json->webhooks); + } + + public function update(string $webhook_id, array $event_types): void + { + $request_payload = []; + + if ($webhook_id !== null) { + $request_payload["webhook_id"] = $webhook_id; + } + if ($event_types !== null) { + $request_payload["event_types"] = $event_types; + } + + $this->seam->client->post("/webhooks/update", [ + "json" => (object) $request_payload, + ]); + } +} diff --git a/src/Routes/Clients/WebhooksClient.php b/src/Routes/Clients/WebhooksClient.php deleted file mode 100644 index a3d55460..00000000 --- a/src/Routes/Clients/WebhooksClient.php +++ /dev/null @@ -1,102 +0,0 @@ -seam = $seam; - } - - public function create(string $url, array $event_types = null): Webhook - { - $request_payload = []; - - if ($url !== null) { - $request_payload["url"] = $url; - } - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - - $res = $this->seam->request( - "POST", - "/webhooks/create", - json: (object) $request_payload, - inner_object: "webhook" - ); - - return Webhook::from_json($res); - } - - public function delete(string $webhook_id): void - { - $request_payload = []; - - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; - } - - $this->seam->request( - "POST", - "/webhooks/delete", - json: (object) $request_payload - ); - } - - public function get(string $webhook_id): Webhook - { - $request_payload = []; - - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; - } - - $res = $this->seam->request( - "POST", - "/webhooks/get", - json: (object) $request_payload, - inner_object: "webhook" - ); - - return Webhook::from_json($res); - } - - public function list(): array - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/webhooks/list", - json: (object) $request_payload, - inner_object: "webhooks" - ); - - return array_map(fn($r) => Webhook::from_json($r), $res); - } - - public function update(array $event_types, string $webhook_id): void - { - $request_payload = []; - - if ($event_types !== null) { - $request_payload["event_types"] = $event_types; - } - if ($webhook_id !== null) { - $request_payload["webhook_id"] = $webhook_id; - } - - $this->seam->request( - "POST", - "/webhooks/update", - json: (object) $request_payload - ); - } -} diff --git a/src/Routes/Clients/Workspaces.php b/src/Routes/Clients/Workspaces.php new file mode 100644 index 00000000..640c2555 --- /dev/null +++ b/src/Routes/Clients/Workspaces.php @@ -0,0 +1,107 @@ +seam = $seam; + } + + public function create( + string $name, + ?string $company_name = null, + ?string $connect_partner_name = null, + ?bool $is_sandbox = null, + ?string $webview_primary_button_color = null, + ?string $webview_primary_button_text_color = null, + ?string $webview_logo_shape = null + ): Workspace { + $request_payload = []; + + if ($name !== null) { + $request_payload["name"] = $name; + } + if ($company_name !== null) { + $request_payload["company_name"] = $company_name; + } + if ($connect_partner_name !== null) { + $request_payload["connect_partner_name"] = $connect_partner_name; + } + if ($is_sandbox !== null) { + $request_payload["is_sandbox"] = $is_sandbox; + } + if ($webview_primary_button_color !== null) { + $request_payload[ + "webview_primary_button_color" + ] = $webview_primary_button_color; + } + if ($webview_primary_button_text_color !== null) { + $request_payload[ + "webview_primary_button_text_color" + ] = $webview_primary_button_text_color; + } + if ($webview_logo_shape !== null) { + $request_payload["webview_logo_shape"] = $webview_logo_shape; + } + + $res = $this->seam->client->post("/workspaces/create", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Workspace::from_json($json->workspace); + } + + public function get(): Workspace + { + $request_payload = []; + + $res = $this->seam->client->post("/workspaces/get", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return Workspace::from_json($json->workspace); + } + + public function list(): array + { + $request_payload = []; + + $res = $this->seam->client->post("/workspaces/list", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + return array_map(fn($r) => Workspace::from_json($r), $json->workspaces); + } + + public function reset_sandbox( + bool $wait_for_action_attempt = true + ): ActionAttempt { + $request_payload = []; + + $res = $this->seam->client->post("/workspaces/reset_sandbox", [ + "json" => (object) $request_payload, + ]); + $json = json_decode($res->getBody()); + + if (!$wait_for_action_attempt) { + return ActionAttempt::from_json($json->action_attempt); + } + + $action_attempt = $this->seam->action_attempts->poll_until_ready( + $json->action_attempt->action_attempt_id + ); + + return $action_attempt; + } +} diff --git a/src/Routes/Clients/WorkspacesClient.php b/src/Routes/Clients/WorkspacesClient.php deleted file mode 100644 index b9503dd1..00000000 --- a/src/Routes/Clients/WorkspacesClient.php +++ /dev/null @@ -1,111 +0,0 @@ -seam = $seam; - } - - public function create( - string $name, - string $company_name = null, - string $connect_partner_name = null, - bool $is_sandbox = null, - string $webview_logo_shape = null, - string $webview_primary_button_color = null, - string $webview_primary_button_text_color = null - ): Workspace { - $request_payload = []; - - if ($name !== null) { - $request_payload["name"] = $name; - } - if ($company_name !== null) { - $request_payload["company_name"] = $company_name; - } - if ($connect_partner_name !== null) { - $request_payload["connect_partner_name"] = $connect_partner_name; - } - if ($is_sandbox !== null) { - $request_payload["is_sandbox"] = $is_sandbox; - } - if ($webview_logo_shape !== null) { - $request_payload["webview_logo_shape"] = $webview_logo_shape; - } - if ($webview_primary_button_color !== null) { - $request_payload["webview_primary_button_color"] = $webview_primary_button_color; - } - if ($webview_primary_button_text_color !== null) { - $request_payload["webview_primary_button_text_color"] = $webview_primary_button_text_color; - } - - $res = $this->seam->request( - "POST", - "/workspaces/create", - json: (object) $request_payload, - inner_object: "workspace" - ); - - return Workspace::from_json($res); - } - - public function get(): Workspace - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/workspaces/get", - json: (object) $request_payload, - inner_object: "workspace" - ); - - return Workspace::from_json($res); - } - - public function list(): array - { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/workspaces/list", - json: (object) $request_payload, - inner_object: "workspaces" - ); - - return array_map(fn($r) => Workspace::from_json($r), $res); - } - - public function reset_sandbox( - bool $wait_for_action_attempt = true - ): ActionAttempt { - $request_payload = []; - - $res = $this->seam->request( - "POST", - "/workspaces/reset_sandbox", - json: (object) $request_payload, - inner_object: "action_attempt" - ); - - if (!$wait_for_action_attempt) { - return ActionAttempt::from_json($res); - } - - $action_attempt = $this->seam->action_attempts->poll_until_ready( - $res->action_attempt_id - ); - - return $action_attempt; - } -} diff --git a/src/Routes/Objects/AccessCode.php b/src/Routes/Objects/AccessCode.php index 54f18ea7..00e5115b 100644 --- a/src/Routes/Objects/AccessCode.php +++ b/src/Routes/Objects/AccessCode.php @@ -4,65 +4,66 @@ class AccessCode { - public static function from_json(mixed $json): AccessCode|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AccessCode|null + { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id, + created_at: $json->created_at, + device_id: $json->device_id, + errors: array_map( + fn($e) => AccessCodeErrors::from_json($e), + $json->errors ?? [] + ), + is_backup_access_code_available: $json->is_backup_access_code_available, + is_external_modification_allowed: $json->is_external_modification_allowed, + is_managed: $json->is_managed, + is_offline_access_code: $json->is_offline_access_code, + is_one_time_use: $json->is_one_time_use, + status: $json->status, + type: $json->type, + warnings: array_map( + fn($w) => AccessCodeWarnings::from_json($w), + $json->warnings ?? [] + ), + is_backup: $json->is_backup ?? null, + is_scheduled_on_device: $json->is_scheduled_on_device ?? null, + is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? + null, + code: $json->code ?? null, + common_code_key: $json->common_code_key ?? null, + name: $json->name ?? null, + ends_at: $json->ends_at ?? null, + pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? + null, + starts_at: $json->starts_at ?? null + ); } - return new self( - access_code_id: $json->access_code_id, - created_at: $json->created_at, - device_id: $json->device_id, - errors: array_map( - fn($e) => AccessCodeErrors::from_json($e), - $json->errors ?? [] - ), - is_backup_access_code_available: $json->is_backup_access_code_available, - is_external_modification_allowed: $json->is_external_modification_allowed, - is_managed: $json->is_managed, - is_offline_access_code: $json->is_offline_access_code, - is_one_time_use: $json->is_one_time_use, - status: $json->status, - type: $json->type, - warnings: array_map( - fn($w) => AccessCodeWarnings::from_json($w), - $json->warnings ?? [] - ), - is_backup: $json->is_backup ?? null, - is_scheduled_on_device: $json->is_scheduled_on_device ?? null, - is_waiting_for_code_assignment: $json->is_waiting_for_code_assignment ?? - null, - code: $json->code ?? null, - common_code_key: $json->common_code_key ?? null, - name: $json->name ?? null, - ends_at: $json->ends_at ?? null, - pulled_backup_access_code_id: $json->pulled_backup_access_code_id ?? - null, - starts_at: $json->starts_at ?? null - ); - } - public function __construct( - public string $access_code_id, - public string $created_at, - public string $device_id, - public array $errors, - public bool $is_backup_access_code_available, - public bool $is_external_modification_allowed, - public bool $is_managed, - public bool $is_offline_access_code, - public bool $is_one_time_use, - public string $status, - public string $type, - public array $warnings, - public bool|null $is_backup, - public bool|null $is_scheduled_on_device, - public bool|null $is_waiting_for_code_assignment, - public string|null $code, - public string|null $common_code_key, - public string|null $name, - public string|null $ends_at, - public string|null $pulled_backup_access_code_id, - public string|null $starts_at - ) {} + public function __construct( + public string $access_code_id, + public string $created_at, + public string $device_id, + public array $errors, + public bool $is_backup_access_code_available, + public bool $is_external_modification_allowed, + public bool $is_managed, + public bool $is_offline_access_code, + public bool $is_one_time_use, + public string $status, + public string $type, + public array $warnings, + public bool|null $is_backup, + public bool|null $is_scheduled_on_device, + public bool|null $is_waiting_for_code_assignment, + public string|null $code, + public string|null $common_code_key, + public string|null $name, + public string|null $ends_at, + public string|null $pulled_backup_access_code_id, + public string|null $starts_at + ) { + } } diff --git a/src/Routes/Objects/AccessCodeErrors.php b/src/Routes/Objects/AccessCodeErrors.php index 0f2c9c71..3cc1f693 100644 --- a/src/Routes/Objects/AccessCodeErrors.php +++ b/src/Routes/Objects/AccessCodeErrors.php @@ -4,28 +4,29 @@ class AccessCodeErrors { - public static function from_json(mixed $json): AccessCodeErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AccessCodeErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_access_code_error: $json->is_access_code_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_access_code_error: $json->is_access_code_error ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_access_code_error, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_access_code_error, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) { + } } diff --git a/src/Routes/Objects/AccessCodeWarnings.php b/src/Routes/Objects/AccessCodeWarnings.php index 61689026..d3cb72ec 100644 --- a/src/Routes/Objects/AccessCodeWarnings.php +++ b/src/Routes/Objects/AccessCodeWarnings.php @@ -4,21 +4,22 @@ class AccessCodeWarnings { - public static function from_json(mixed $json): AccessCodeWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AccessCodeWarnings|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); } - return new self( - message: $json->message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) {} + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/AcsAccessGroup.php b/src/Routes/Objects/AcsAccessGroup.php index 3ca3a222..a18d329a 100644 --- a/src/Routes/Objects/AcsAccessGroup.php +++ b/src/Routes/Objects/AcsAccessGroup.php @@ -4,42 +4,43 @@ class AcsAccessGroup { - public static function from_json(mixed $json): AcsAccessGroup|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsAccessGroup|null + { + if (!$json) { + return null; + } + return new self( + access_group_type: $json->access_group_type, + access_group_type_display_name: $json->access_group_type_display_name, + acs_access_group_id: $json->acs_access_group_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + external_type: $json->external_type, + external_type_display_name: $json->external_type_display_name, + is_managed: $json->is_managed, + name: $json->name, + warnings: array_map( + fn($w) => AcsAccessGroupWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id + ); } - return new self( - access_group_type: $json->access_group_type, - access_group_type_display_name: $json->access_group_type_display_name, - acs_access_group_id: $json->acs_access_group_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - is_managed: $json->is_managed, - name: $json->name, - warnings: array_map( - fn($w) => AcsAccessGroupWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id - ); - } - public function __construct( - public string $access_group_type, - public string $access_group_type_display_name, - public string $acs_access_group_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public string $external_type, - public string $external_type_display_name, - public bool $is_managed, - public string $name, - public array $warnings, - public string $workspace_id - ) {} + public function __construct( + public string $access_group_type, + public string $access_group_type_display_name, + public string $acs_access_group_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public string $external_type, + public string $external_type_display_name, + public bool $is_managed, + public string $name, + public array $warnings, + public string $workspace_id + ) { + } } diff --git a/src/Routes/Objects/AcsAccessGroupWarnings.php b/src/Routes/Objects/AcsAccessGroupWarnings.php index c70a1d51..61cc455c 100644 --- a/src/Routes/Objects/AcsAccessGroupWarnings.php +++ b/src/Routes/Objects/AcsAccessGroupWarnings.php @@ -4,21 +4,22 @@ class AcsAccessGroupWarnings { - public static function from_json(mixed $json): AcsAccessGroupWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsAccessGroupWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + message: $json->message, + warning_code: $json->warning_code + ); } - return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) {} + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) { + } } diff --git a/src/Routes/Objects/AcsCredential.php b/src/Routes/Objects/AcsCredential.php index 75697fd6..39c18bae 100644 --- a/src/Routes/Objects/AcsCredential.php +++ b/src/Routes/Objects/AcsCredential.php @@ -4,85 +4,86 @@ class AcsCredential { - public static function from_json(mixed $json): AcsCredential|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsCredential|null + { + if (!$json) { + return null; + } + return new self( + access_method: $json->access_method, + acs_credential_id: $json->acs_credential_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsCredentialErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => AcsCredentialWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? AcsCredentialAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + ends_at: $json->ends_at ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_issued: $json->is_issued ?? null, + is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? + null, + is_one_time_use: $json->is_one_time_use ?? null, + parent_acs_credential_id: $json->parent_acs_credential_id ?? null, + starts_at: $json->starts_at ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsCredentialVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null + ); } - return new self( - access_method: $json->access_method, - acs_credential_id: $json->acs_credential_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsCredentialErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => AcsCredentialWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? AcsCredentialAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - ends_at: $json->ends_at ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - is_issued: $json->is_issued ?? null, - is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? - null, - is_one_time_use: $json->is_one_time_use ?? null, - parent_acs_credential_id: $json->parent_acs_credential_id ?? null, - starts_at: $json->starts_at ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? AcsCredentialVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null - ); - } - public function __construct( - public string $access_method, - public string $acs_credential_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public string|null $acs_credential_pool_id, - public string|null $acs_user_id, - public AcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public string|null $ends_at, - public string|null $external_type, - public string|null $external_type_display_name, - public bool|null $is_issued, - public bool|null $is_multi_phone_sync_credential, - public bool|null $is_one_time_use, - public string|null $parent_acs_credential_id, - public string|null $starts_at, - public AcsCredentialVisionlineMetadata|null $visionline_metadata, - public string|null $card_number, - public string|null $code, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at - ) {} + public function __construct( + public string $access_method, + public string $acs_credential_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public string|null $acs_credential_pool_id, + public string|null $acs_user_id, + public AcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $ends_at, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_issued, + public bool|null $is_multi_phone_sync_credential, + public bool|null $is_one_time_use, + public string|null $parent_acs_credential_id, + public string|null $starts_at, + public AcsCredentialVisionlineMetadata|null $visionline_metadata, + public string|null $card_number, + public string|null $code, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at + ) { + } } diff --git a/src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php b/src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php index 764a498c..b43336f2 100644 --- a/src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php +++ b/src/Routes/Objects/AcsCredentialAssaAbloyVostioMetadata.php @@ -4,27 +4,28 @@ class AcsCredentialAssaAbloyVostioMetadata { - public static function from_json( - mixed $json - ): AcsCredentialAssaAbloyVostioMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsCredentialAssaAbloyVostioMetadata|null { + if (!$json) { + return null; + } + return new self( + door_names: $json->door_names ?? null, + endpoint_id: $json->endpoint_id ?? null, + key_id: $json->key_id ?? null, + key_issuing_request_id: $json->key_issuing_request_id ?? null, + override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? + null + ); } - return new self( - door_names: $json->door_names ?? null, - endpoint_id: $json->endpoint_id ?? null, - key_id: $json->key_id ?? null, - key_issuing_request_id: $json->key_issuing_request_id ?? null, - override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? - null - ); - } - public function __construct( - public array|null $door_names, - public string|null $endpoint_id, - public string|null $key_id, - public string|null $key_issuing_request_id, - public array|null $override_guest_acs_entrance_ids - ) {} + public function __construct( + public array|null $door_names, + public string|null $endpoint_id, + public string|null $key_id, + public string|null $key_issuing_request_id, + public array|null $override_guest_acs_entrance_ids + ) { + } } diff --git a/src/Routes/Objects/AcsCredentialErrors.php b/src/Routes/Objects/AcsCredentialErrors.php index bc78a3b5..2446dd94 100644 --- a/src/Routes/Objects/AcsCredentialErrors.php +++ b/src/Routes/Objects/AcsCredentialErrors.php @@ -4,21 +4,22 @@ class AcsCredentialErrors { - public static function from_json(mixed $json): AcsCredentialErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsCredentialErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/AcsCredentialPool.php b/src/Routes/Objects/AcsCredentialPool.php index 24545731..7802625e 100644 --- a/src/Routes/Objects/AcsCredentialPool.php +++ b/src/Routes/Objects/AcsCredentialPool.php @@ -4,29 +4,30 @@ class AcsCredentialPool { - public static function from_json(mixed $json): AcsCredentialPool|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsCredentialPool|null + { + if (!$json) { + return null; + } + return new self( + acs_credential_pool_id: $json->acs_credential_pool_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + external_type: $json->external_type, + external_type_display_name: $json->external_type_display_name, + workspace_id: $json->workspace_id + ); } - return new self( - acs_credential_pool_id: $json->acs_credential_pool_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - workspace_id: $json->workspace_id - ); - } - public function __construct( - public string $acs_credential_pool_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public string $external_type, - public string $external_type_display_name, - public string $workspace_id - ) {} + public function __construct( + public string $acs_credential_pool_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public string $external_type, + public string $external_type_display_name, + public string $workspace_id + ) { + } } diff --git a/src/Routes/Objects/AcsCredentialProvisioningAutomation.php b/src/Routes/Objects/AcsCredentialProvisioningAutomation.php index 9ed63855..60fd45a5 100644 --- a/src/Routes/Objects/AcsCredentialProvisioningAutomation.php +++ b/src/Routes/Objects/AcsCredentialProvisioningAutomation.php @@ -4,26 +4,27 @@ class AcsCredentialProvisioningAutomation { - public static function from_json( - mixed $json - ): AcsCredentialProvisioningAutomation|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsCredentialProvisioningAutomation|null { + if (!$json) { + return null; + } + return new self( + acs_credential_provisioning_automation_id: $json->acs_credential_provisioning_automation_id, + created_at: $json->created_at, + credential_manager_acs_system_id: $json->credential_manager_acs_system_id, + user_identity_id: $json->user_identity_id, + workspace_id: $json->workspace_id + ); } - return new self( - acs_credential_provisioning_automation_id: $json->acs_credential_provisioning_automation_id, - created_at: $json->created_at, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id - ); - } - public function __construct( - public string $acs_credential_provisioning_automation_id, - public string $created_at, - public string $credential_manager_acs_system_id, - public string $user_identity_id, - public string $workspace_id - ) {} + public function __construct( + public string $acs_credential_provisioning_automation_id, + public string $created_at, + public string $credential_manager_acs_system_id, + public string $user_identity_id, + public string $workspace_id + ) { + } } diff --git a/src/Routes/Objects/AcsCredentialVisionlineMetadata.php b/src/Routes/Objects/AcsCredentialVisionlineMetadata.php index 61023a63..6ddaed6e 100644 --- a/src/Routes/Objects/AcsCredentialVisionlineMetadata.php +++ b/src/Routes/Objects/AcsCredentialVisionlineMetadata.php @@ -4,32 +4,33 @@ class AcsCredentialVisionlineMetadata { - public static function from_json( - mixed $json - ): AcsCredentialVisionlineMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsCredentialVisionlineMetadata|null { + if (!$json) { + return null; + } + return new self( + card_function_type: $json->card_function_type, + auto_join: $json->auto_join ?? null, + card_id: $json->card_id ?? null, + common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, + credential_id: $json->credential_id ?? null, + guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, + is_valid: $json->is_valid ?? null, + joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null + ); } - return new self( - card_function_type: $json->card_function_type, - auto_join: $json->auto_join ?? null, - card_id: $json->card_id ?? null, - common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, - credential_id: $json->credential_id ?? null, - guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, - is_valid: $json->is_valid ?? null, - joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null - ); - } - public function __construct( - public string $card_function_type, - public bool|null $auto_join, - public string|null $card_id, - public array|null $common_acs_entrance_ids, - public string|null $credential_id, - public array|null $guest_acs_entrance_ids, - public bool|null $is_valid, - public array|null $joiner_acs_credential_ids - ) {} + public function __construct( + public string $card_function_type, + public bool|null $auto_join, + public string|null $card_id, + public array|null $common_acs_entrance_ids, + public string|null $credential_id, + public array|null $guest_acs_entrance_ids, + public bool|null $is_valid, + public array|null $joiner_acs_credential_ids + ) { + } } diff --git a/src/Routes/Objects/AcsCredentialWarnings.php b/src/Routes/Objects/AcsCredentialWarnings.php index 17788c12..18428685 100644 --- a/src/Routes/Objects/AcsCredentialWarnings.php +++ b/src/Routes/Objects/AcsCredentialWarnings.php @@ -4,21 +4,22 @@ class AcsCredentialWarnings { - public static function from_json(mixed $json): AcsCredentialWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsCredentialWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + message: $json->message, + warning_code: $json->warning_code + ); } - return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) {} + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) { + } } diff --git a/src/Routes/Objects/AcsEncoder.php b/src/Routes/Objects/AcsEncoder.php index b39951f1..14799608 100644 --- a/src/Routes/Objects/AcsEncoder.php +++ b/src/Routes/Objects/AcsEncoder.php @@ -4,30 +4,31 @@ class AcsEncoder { - public static function from_json(mixed $json): AcsEncoder|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsEncoder|null + { + if (!$json) { + return null; + } + return new self( + acs_encoder_id: $json->acs_encoder_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsEncoderErrors::from_json($e), + $json->errors ?? [] + ), + workspace_id: $json->workspace_id + ); } - return new self( - acs_encoder_id: $json->acs_encoder_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsEncoderErrors::from_json($e), - $json->errors ?? [] - ), - workspace_id: $json->workspace_id - ); - } - public function __construct( - public string $acs_encoder_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public string $workspace_id - ) {} + public function __construct( + public string $acs_encoder_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public string $workspace_id + ) { + } } diff --git a/src/Routes/Objects/AcsEncoderErrors.php b/src/Routes/Objects/AcsEncoderErrors.php index 1bc7ea13..6c2aedcf 100644 --- a/src/Routes/Objects/AcsEncoderErrors.php +++ b/src/Routes/Objects/AcsEncoderErrors.php @@ -4,21 +4,22 @@ class AcsEncoderErrors { - public static function from_json(mixed $json): AcsEncoderErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsEncoderErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + error_code: $json->error_code, + message: $json->message + ); } - return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message - ); - } - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) {} + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) { + } } diff --git a/src/Routes/Objects/AcsEntrance.php b/src/Routes/Objects/AcsEntrance.php index ea266c26..e2ec1400 100644 --- a/src/Routes/Objects/AcsEntrance.php +++ b/src/Routes/Objects/AcsEntrance.php @@ -4,64 +4,65 @@ class AcsEntrance { - public static function from_json(mixed $json): AcsEntrance|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsEntrance|null + { + if (!$json) { + return null; + } + return new self( + acs_entrance_id: $json->acs_entrance_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsEntranceErrors::from_json($e), + $json->errors ?? [] + ), + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? AcsEntranceAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + dormakaba_community_metadata: isset( + $json->dormakaba_community_metadata + ) + ? AcsEntranceDormakabaCommunityMetadata::from_json( + $json->dormakaba_community_metadata + ) + : null, + latch_metadata: isset($json->latch_metadata) + ? AcsEntranceLatchMetadata::from_json($json->latch_metadata) + : null, + salto_ks_metadata: isset($json->salto_ks_metadata) + ? AcsEntranceSaltoKsMetadata::from_json( + $json->salto_ks_metadata + ) + : null, + salto_space_metadata: isset($json->salto_space_metadata) + ? AcsEntranceSaltoSpaceMetadata::from_json( + $json->salto_space_metadata + ) + : null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsEntranceVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null + ); } - return new self( - acs_entrance_id: $json->acs_entrance_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsEntranceErrors::from_json($e), - $json->errors ?? [] - ), - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? AcsEntranceAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - dormakaba_community_metadata: isset( - $json->dormakaba_community_metadata - ) - ? AcsEntranceDormakabaCommunityMetadata::from_json( - $json->dormakaba_community_metadata - ) - : null, - latch_metadata: isset($json->latch_metadata) - ? AcsEntranceLatchMetadata::from_json($json->latch_metadata) - : null, - salto_ks_metadata: isset($json->salto_ks_metadata) - ? AcsEntranceSaltoKsMetadata::from_json( - $json->salto_ks_metadata - ) - : null, - salto_space_metadata: isset($json->salto_space_metadata) - ? AcsEntranceSaltoSpaceMetadata::from_json( - $json->salto_space_metadata - ) - : null, - visionline_metadata: isset($json->visionline_metadata) - ? AcsEntranceVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null - ); - } - public function __construct( - public string $acs_entrance_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public AcsEntranceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public AcsEntranceDormakabaCommunityMetadata|null $dormakaba_community_metadata, - public AcsEntranceLatchMetadata|null $latch_metadata, - public AcsEntranceSaltoKsMetadata|null $salto_ks_metadata, - public AcsEntranceSaltoSpaceMetadata|null $salto_space_metadata, - public AcsEntranceVisionlineMetadata|null $visionline_metadata - ) {} + public function __construct( + public string $acs_entrance_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public AcsEntranceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public AcsEntranceDormakabaCommunityMetadata|null $dormakaba_community_metadata, + public AcsEntranceLatchMetadata|null $latch_metadata, + public AcsEntranceSaltoKsMetadata|null $salto_ks_metadata, + public AcsEntranceSaltoSpaceMetadata|null $salto_space_metadata, + public AcsEntranceVisionlineMetadata|null $visionline_metadata + ) { + } } diff --git a/src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php b/src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php index fbe7f69e..9b0d491e 100644 --- a/src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php +++ b/src/Routes/Objects/AcsEntranceAssaAbloyVostioMetadata.php @@ -4,26 +4,27 @@ class AcsEntranceAssaAbloyVostioMetadata { - public static function from_json( - mixed $json - ): AcsEntranceAssaAbloyVostioMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsEntranceAssaAbloyVostioMetadata|null { + if (!$json) { + return null; + } + return new self( + door_name: $json->door_name, + door_type: $json->door_type, + door_number: $json->door_number ?? null, + pms_id: $json->pms_id ?? null, + stand_open: $json->stand_open ?? null + ); } - return new self( - door_name: $json->door_name, - door_type: $json->door_type, - door_number: $json->door_number ?? null, - pms_id: $json->pms_id ?? null, - stand_open: $json->stand_open ?? null - ); - } - public function __construct( - public string $door_name, - public string $door_type, - public float|null $door_number, - public string|null $pms_id, - public bool|null $stand_open - ) {} + public function __construct( + public string $door_name, + public string $door_type, + public float|null $door_number, + public string|null $pms_id, + public bool|null $stand_open + ) { + } } diff --git a/src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php b/src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php index 12a286a3..aab73284 100644 --- a/src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php +++ b/src/Routes/Objects/AcsEntranceDormakabaCommunityMetadata.php @@ -4,14 +4,16 @@ class AcsEntranceDormakabaCommunityMetadata { - public static function from_json( - mixed $json - ): AcsEntranceDormakabaCommunityMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsEntranceDormakabaCommunityMetadata|null { + if (!$json) { + return null; + } + return new self(access_point_name: $json->access_point_name); } - return new self(access_point_name: $json->access_point_name); - } - public function __construct(public string $access_point_name) {} + public function __construct(public string $access_point_name) + { + } } diff --git a/src/Routes/Objects/AcsEntranceErrors.php b/src/Routes/Objects/AcsEntranceErrors.php index 9c7f3d0b..b1a07c0f 100644 --- a/src/Routes/Objects/AcsEntranceErrors.php +++ b/src/Routes/Objects/AcsEntranceErrors.php @@ -4,21 +4,22 @@ class AcsEntranceErrors { - public static function from_json(mixed $json): AcsEntranceErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsEntranceErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/AcsEntranceLatchMetadata.php b/src/Routes/Objects/AcsEntranceLatchMetadata.php index 20311523..d88b7131 100644 --- a/src/Routes/Objects/AcsEntranceLatchMetadata.php +++ b/src/Routes/Objects/AcsEntranceLatchMetadata.php @@ -4,23 +4,24 @@ class AcsEntranceLatchMetadata { - public static function from_json(mixed $json): AcsEntranceLatchMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsEntranceLatchMetadata|null + { + if (!$json) { + return null; + } + return new self( + accessibility_type: $json->accessibility_type, + door_name: $json->door_name, + door_type: $json->door_type, + is_connected: $json->is_connected + ); } - return new self( - accessibility_type: $json->accessibility_type, - door_name: $json->door_name, - door_type: $json->door_type, - is_connected: $json->is_connected - ); - } - public function __construct( - public string $accessibility_type, - public string $door_name, - public string $door_type, - public bool $is_connected - ) {} + public function __construct( + public string $accessibility_type, + public string $door_name, + public string $door_type, + public bool $is_connected + ) { + } } diff --git a/src/Routes/Objects/AcsEntranceProfiles.php b/src/Routes/Objects/AcsEntranceProfiles.php index ec5980f5..1173d1bf 100644 --- a/src/Routes/Objects/AcsEntranceProfiles.php +++ b/src/Routes/Objects/AcsEntranceProfiles.php @@ -4,19 +4,20 @@ class AcsEntranceProfiles { - public static function from_json(mixed $json): AcsEntranceProfiles|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsEntranceProfiles|null + { + if (!$json) { + return null; + } + return new self( + visionline_door_profile_id: $json->visionline_door_profile_id, + visionline_door_profile_type: $json->visionline_door_profile_type + ); } - return new self( - visionline_door_profile_id: $json->visionline_door_profile_id, - visionline_door_profile_type: $json->visionline_door_profile_type - ); - } - public function __construct( - public string $visionline_door_profile_id, - public string $visionline_door_profile_type - ) {} + public function __construct( + public string $visionline_door_profile_id, + public string $visionline_door_profile_type + ) { + } } diff --git a/src/Routes/Objects/AcsEntranceSaltoKsMetadata.php b/src/Routes/Objects/AcsEntranceSaltoKsMetadata.php index 66f9e46f..c949d4ef 100644 --- a/src/Routes/Objects/AcsEntranceSaltoKsMetadata.php +++ b/src/Routes/Objects/AcsEntranceSaltoKsMetadata.php @@ -4,32 +4,33 @@ class AcsEntranceSaltoKsMetadata { - public static function from_json( - mixed $json - ): AcsEntranceSaltoKsMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsEntranceSaltoKsMetadata|null { + if (!$json) { + return null; + } + return new self( + battery_level: $json->battery_level, + door_name: $json->door_name, + lock_type: $json->lock_type, + locked_state: $json->locked_state, + intrusion_alarm: $json->intrusion_alarm ?? null, + left_open_alarm: $json->left_open_alarm ?? null, + online: $json->online ?? null, + privacy_mode: $json->privacy_mode ?? null + ); } - return new self( - battery_level: $json->battery_level, - door_name: $json->door_name, - lock_type: $json->lock_type, - locked_state: $json->locked_state, - intrusion_alarm: $json->intrusion_alarm ?? null, - left_open_alarm: $json->left_open_alarm ?? null, - online: $json->online ?? null, - privacy_mode: $json->privacy_mode ?? null - ); - } - public function __construct( - public string $battery_level, - public string $door_name, - public string $lock_type, - public string $locked_state, - public bool|null $intrusion_alarm, - public bool|null $left_open_alarm, - public bool|null $online, - public bool|null $privacy_mode - ) {} + public function __construct( + public string $battery_level, + public string $door_name, + public string $lock_type, + public string $locked_state, + public bool|null $intrusion_alarm, + public bool|null $left_open_alarm, + public bool|null $online, + public bool|null $privacy_mode + ) { + } } diff --git a/src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php b/src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php index e478e6fe..99684348 100644 --- a/src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php +++ b/src/Routes/Objects/AcsEntranceSaltoSpaceMetadata.php @@ -4,22 +4,23 @@ class AcsEntranceSaltoSpaceMetadata { - public static function from_json( - mixed $json - ): AcsEntranceSaltoSpaceMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsEntranceSaltoSpaceMetadata|null { + if (!$json) { + return null; + } + return new self( + door_name: $json->door_name, + ext_door_id: $json->ext_door_id, + door_description: $json->door_description ?? null + ); } - return new self( - door_name: $json->door_name, - ext_door_id: $json->ext_door_id, - door_description: $json->door_description ?? null - ); - } - public function __construct( - public string $door_name, - public string $ext_door_id, - public string|null $door_description - ) {} + public function __construct( + public string $door_name, + public string $ext_door_id, + public string|null $door_description + ) { + } } diff --git a/src/Routes/Objects/AcsEntranceVisionlineMetadata.php b/src/Routes/Objects/AcsEntranceVisionlineMetadata.php index de430a5c..e97ede4e 100644 --- a/src/Routes/Objects/AcsEntranceVisionlineMetadata.php +++ b/src/Routes/Objects/AcsEntranceVisionlineMetadata.php @@ -4,25 +4,26 @@ class AcsEntranceVisionlineMetadata { - public static function from_json( - mixed $json - ): AcsEntranceVisionlineMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsEntranceVisionlineMetadata|null { + if (!$json) { + return null; + } + return new self( + door_category: $json->door_category, + door_name: $json->door_name, + profiles: array_map( + fn($p) => AcsEntranceProfiles::from_json($p), + $json->profiles ?? [] + ) + ); } - return new self( - door_category: $json->door_category, - door_name: $json->door_name, - profiles: array_map( - fn($p) => AcsEntranceProfiles::from_json($p), - $json->profiles ?? [] - ) - ); - } - public function __construct( - public string $door_category, - public string $door_name, - public array|null $profiles - ) {} + public function __construct( + public string $door_category, + public string $door_name, + public array|null $profiles + ) { + } } diff --git a/src/Routes/Objects/AcsSystem.php b/src/Routes/Objects/AcsSystem.php index b5995539..258a6961 100644 --- a/src/Routes/Objects/AcsSystem.php +++ b/src/Routes/Objects/AcsSystem.php @@ -4,74 +4,75 @@ class AcsSystem { - public static function from_json(mixed $json): AcsSystem|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsSystem|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id, + connected_account_id: $json->connected_account_id, + connected_account_ids: $json->connected_account_ids, + created_at: $json->created_at, + errors: array_map( + fn($e) => AcsSystemErrors::from_json($e), + $json->errors ?? [] + ), + image_alt_text: $json->image_alt_text, + image_url: $json->image_url, + is_credential_manager: $json->is_credential_manager, + location: AcsSystemLocation::from_json($json->location), + name: $json->name, + warnings: array_map( + fn($w) => AcsSystemWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + can_add_acs_users_to_acs_access_groups: $json->can_add_acs_users_to_acs_access_groups ?? + null, + can_automate_enrollment: $json->can_automate_enrollment ?? null, + can_create_acs_access_groups: $json->can_create_acs_access_groups ?? + null, + can_remove_acs_users_from_acs_access_groups: $json->can_remove_acs_users_from_acs_access_groups ?? + null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + system_type: $json->system_type ?? null, + system_type_display_name: $json->system_type_display_name ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? AcsSystemVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? + null + ); } - return new self( - acs_system_id: $json->acs_system_id, - connected_account_id: $json->connected_account_id, - connected_account_ids: $json->connected_account_ids, - created_at: $json->created_at, - errors: array_map( - fn($e) => AcsSystemErrors::from_json($e), - $json->errors ?? [] - ), - image_alt_text: $json->image_alt_text, - image_url: $json->image_url, - is_credential_manager: $json->is_credential_manager, - location: AcsSystemLocation::from_json($json->location), - name: $json->name, - warnings: array_map( - fn($w) => AcsSystemWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - can_add_acs_users_to_acs_access_groups: $json->can_add_acs_users_to_acs_access_groups ?? - null, - can_automate_enrollment: $json->can_automate_enrollment ?? null, - can_create_acs_access_groups: $json->can_create_acs_access_groups ?? - null, - can_remove_acs_users_from_acs_access_groups: $json->can_remove_acs_users_from_acs_access_groups ?? - null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - system_type: $json->system_type ?? null, - system_type_display_name: $json->system_type_display_name ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? AcsSystemVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - default_credential_manager_acs_system_id: $json->default_credential_manager_acs_system_id ?? - null - ); - } - public function __construct( - public string $acs_system_id, - public string $connected_account_id, - public array $connected_account_ids, - public string $created_at, - public array $errors, - public string $image_alt_text, - public string $image_url, - public bool $is_credential_manager, - public AcsSystemLocation $location, - public string $name, - public array $warnings, - public string $workspace_id, - public bool|null $can_add_acs_users_to_acs_access_groups, - public bool|null $can_automate_enrollment, - public bool|null $can_create_acs_access_groups, - public bool|null $can_remove_acs_users_from_acs_access_groups, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $system_type, - public string|null $system_type_display_name, - public AcsSystemVisionlineMetadata|null $visionline_metadata, - public string|null $default_credential_manager_acs_system_id - ) {} + public function __construct( + public string $acs_system_id, + public string $connected_account_id, + public array $connected_account_ids, + public string $created_at, + public array $errors, + public string $image_alt_text, + public string $image_url, + public bool $is_credential_manager, + public AcsSystemLocation $location, + public string $name, + public array $warnings, + public string $workspace_id, + public bool|null $can_add_acs_users_to_acs_access_groups, + public bool|null $can_automate_enrollment, + public bool|null $can_create_acs_access_groups, + public bool|null $can_remove_acs_users_from_acs_access_groups, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $system_type, + public string|null $system_type_display_name, + public AcsSystemVisionlineMetadata|null $visionline_metadata, + public string|null $default_credential_manager_acs_system_id + ) { + } } diff --git a/src/Routes/Objects/AcsSystemErrors.php b/src/Routes/Objects/AcsSystemErrors.php index a9f5e041..d7eb9ac5 100644 --- a/src/Routes/Objects/AcsSystemErrors.php +++ b/src/Routes/Objects/AcsSystemErrors.php @@ -4,21 +4,22 @@ class AcsSystemErrors { - public static function from_json(mixed $json): AcsSystemErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsSystemErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + error_code: $json->error_code, + message: $json->message + ); } - return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message - ); - } - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) {} + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) { + } } diff --git a/src/Routes/Objects/AcsSystemLocation.php b/src/Routes/Objects/AcsSystemLocation.php index 1bd18824..17d1d253 100644 --- a/src/Routes/Objects/AcsSystemLocation.php +++ b/src/Routes/Objects/AcsSystemLocation.php @@ -4,13 +4,15 @@ class AcsSystemLocation { - public static function from_json(mixed $json): AcsSystemLocation|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsSystemLocation|null + { + if (!$json) { + return null; + } + return new self(time_zone: $json->time_zone ?? null); } - return new self(time_zone: $json->time_zone ?? null); - } - public function __construct(public string|null $time_zone) {} + public function __construct(public string|null $time_zone) + { + } } diff --git a/src/Routes/Objects/AcsSystemVisionlineMetadata.php b/src/Routes/Objects/AcsSystemVisionlineMetadata.php index 071b76bd..d6fd4c85 100644 --- a/src/Routes/Objects/AcsSystemVisionlineMetadata.php +++ b/src/Routes/Objects/AcsSystemVisionlineMetadata.php @@ -4,22 +4,23 @@ class AcsSystemVisionlineMetadata { - public static function from_json( - mixed $json - ): AcsSystemVisionlineMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): AcsSystemVisionlineMetadata|null { + if (!$json) { + return null; + } + return new self( + lan_address: $json->lan_address, + mobile_access_uuid: $json->mobile_access_uuid, + system_id: $json->system_id + ); } - return new self( - lan_address: $json->lan_address, - mobile_access_uuid: $json->mobile_access_uuid, - system_id: $json->system_id - ); - } - public function __construct( - public string $lan_address, - public string $mobile_access_uuid, - public string $system_id - ) {} + public function __construct( + public string $lan_address, + public string $mobile_access_uuid, + public string $system_id + ) { + } } diff --git a/src/Routes/Objects/AcsSystemWarnings.php b/src/Routes/Objects/AcsSystemWarnings.php index 0fc1a2b7..4d71795d 100644 --- a/src/Routes/Objects/AcsSystemWarnings.php +++ b/src/Routes/Objects/AcsSystemWarnings.php @@ -4,24 +4,25 @@ class AcsSystemWarnings { - public static function from_json(mixed $json): AcsSystemWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsSystemWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + message: $json->message, + warning_code: $json->warning_code, + misconfigured_acs_entrance_ids: $json->misconfigured_acs_entrance_ids ?? + null + ); } - return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code, - misconfigured_acs_entrance_ids: $json->misconfigured_acs_entrance_ids ?? - null - ); - } - public function __construct( - public string $created_at, - public string $message, - public string $warning_code, - public array|null $misconfigured_acs_entrance_ids - ) {} + public function __construct( + public string $created_at, + public string $message, + public string $warning_code, + public array|null $misconfigured_acs_entrance_ids + ) { + } } diff --git a/src/Routes/Objects/AcsUser.php b/src/Routes/Objects/AcsUser.php index c4deca71..b7b8d6c0 100644 --- a/src/Routes/Objects/AcsUser.php +++ b/src/Routes/Objects/AcsUser.php @@ -4,74 +4,75 @@ class AcsUser { - public static function from_json(mixed $json): AcsUser|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsUser|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id, + acs_user_id: $json->acs_user_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => AcsUserErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => AcsUserWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + access_schedule: isset($json->access_schedule) + ? AcsUserAccessSchedule::from_json($json->access_schedule) + : null, + email: $json->email ?? null, + email_address: $json->email_address ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + full_name: $json->full_name ?? null, + hid_acs_system_id: $json->hid_acs_system_id ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + user_identity_id: $json->user_identity_id ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, + user_identity_email_address: $json->user_identity_email_address ?? + null, + user_identity_full_name: $json->user_identity_full_name ?? null, + user_identity_phone_number: $json->user_identity_phone_number ?? + null + ); } - return new self( - acs_system_id: $json->acs_system_id, - acs_user_id: $json->acs_user_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => AcsUserErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => AcsUserWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - access_schedule: isset($json->access_schedule) - ? AcsUserAccessSchedule::from_json($json->access_schedule) - : null, - email: $json->email ?? null, - email_address: $json->email_address ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - full_name: $json->full_name ?? null, - hid_acs_system_id: $json->hid_acs_system_id ?? null, - is_suspended: $json->is_suspended ?? null, - phone_number: $json->phone_number ?? null, - user_identity_id: $json->user_identity_id ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, - user_identity_email_address: $json->user_identity_email_address ?? - null, - user_identity_full_name: $json->user_identity_full_name ?? null, - user_identity_phone_number: $json->user_identity_phone_number ?? - null - ); - } - public function __construct( - public string $acs_system_id, - public string $acs_user_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public AcsUserAccessSchedule|null $access_schedule, - public string|null $email, - public string|null $email_address, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $full_name, - public string|null $hid_acs_system_id, - public bool|null $is_suspended, - public string|null $phone_number, - public string|null $user_identity_id, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $latest_desired_state_synced_with_provider_at, - public string|null $user_identity_email_address, - public string|null $user_identity_full_name, - public string|null $user_identity_phone_number - ) {} + public function __construct( + public string $acs_system_id, + public string $acs_user_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public AcsUserAccessSchedule|null $access_schedule, + public string|null $email, + public string|null $email_address, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $full_name, + public string|null $hid_acs_system_id, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $user_identity_id, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $latest_desired_state_synced_with_provider_at, + public string|null $user_identity_email_address, + public string|null $user_identity_full_name, + public string|null $user_identity_phone_number + ) { + } } diff --git a/src/Routes/Objects/AcsUserAccessSchedule.php b/src/Routes/Objects/AcsUserAccessSchedule.php index 17dca439..332a243d 100644 --- a/src/Routes/Objects/AcsUserAccessSchedule.php +++ b/src/Routes/Objects/AcsUserAccessSchedule.php @@ -4,19 +4,20 @@ class AcsUserAccessSchedule { - public static function from_json(mixed $json): AcsUserAccessSchedule|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsUserAccessSchedule|null + { + if (!$json) { + return null; + } + return new self( + starts_at: $json->starts_at, + ends_at: $json->ends_at ?? null + ); } - return new self( - starts_at: $json->starts_at, - ends_at: $json->ends_at ?? null - ); - } - public function __construct( - public string $starts_at, - public string|null $ends_at - ) {} + public function __construct( + public string $starts_at, + public string|null $ends_at + ) { + } } diff --git a/src/Routes/Objects/AcsUserErrors.php b/src/Routes/Objects/AcsUserErrors.php index c2b4c903..be05ab64 100644 --- a/src/Routes/Objects/AcsUserErrors.php +++ b/src/Routes/Objects/AcsUserErrors.php @@ -4,21 +4,22 @@ class AcsUserErrors { - public static function from_json(mixed $json): AcsUserErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsUserErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + error_code: $json->error_code, + message: $json->message + ); } - return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message - ); - } - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) {} + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) { + } } diff --git a/src/Routes/Objects/AcsUserWarnings.php b/src/Routes/Objects/AcsUserWarnings.php index 2d01c8d2..ace2e508 100644 --- a/src/Routes/Objects/AcsUserWarnings.php +++ b/src/Routes/Objects/AcsUserWarnings.php @@ -4,21 +4,22 @@ class AcsUserWarnings { - public static function from_json(mixed $json): AcsUserWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): AcsUserWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + message: $json->message, + warning_code: $json->warning_code + ); } - return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) {} + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) { + } } diff --git a/src/Routes/Objects/ActionAttempt.php b/src/Routes/Objects/ActionAttempt.php index 1cf13362..869a20b9 100644 --- a/src/Routes/Objects/ActionAttempt.php +++ b/src/Routes/Objects/ActionAttempt.php @@ -4,27 +4,28 @@ class ActionAttempt { - public static function from_json(mixed $json): ActionAttempt|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ActionAttempt|null + { + if (!$json) { + return null; + } + return new self( + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + error: isset($json->error) + ? ActionAttemptError::from_json($json->error) + : null, + status: $json->status ?? null, + result: $json->result ?? null + ); } - return new self( - action_attempt_id: $json->action_attempt_id ?? null, - action_type: $json->action_type ?? null, - error: isset($json->error) - ? ActionAttemptError::from_json($json->error) - : null, - status: $json->status ?? null, - result: $json->result ?? null - ); - } - public function __construct( - public string|null $action_attempt_id, - public string|null $action_type, - public ActionAttemptError|null $error, - public string|null $status, - public mixed $result - ) {} + public function __construct( + public string|null $action_attempt_id, + public string|null $action_type, + public ActionAttemptError|null $error, + public string|null $status, + public mixed $result + ) { + } } diff --git a/src/Routes/Objects/ActionAttemptError.php b/src/Routes/Objects/ActionAttemptError.php index ffc3666a..10e8aee9 100644 --- a/src/Routes/Objects/ActionAttemptError.php +++ b/src/Routes/Objects/ActionAttemptError.php @@ -4,13 +4,15 @@ class ActionAttemptError { - public static function from_json(mixed $json): ActionAttemptError|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ActionAttemptError|null + { + if (!$json) { + return null; + } + return new self(message: $json->message, type: $json->type); } - return new self(message: $json->message, type: $json->type); - } - public function __construct(public string $message, public string $type) {} + public function __construct(public string $message, public string $type) + { + } } diff --git a/src/Routes/Objects/ClientSession.php b/src/Routes/Objects/ClientSession.php index cba4d877..1861c9ff 100644 --- a/src/Routes/Objects/ClientSession.php +++ b/src/Routes/Objects/ClientSession.php @@ -4,35 +4,36 @@ class ClientSession { - public static function from_json(mixed $json): ClientSession|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ClientSession|null + { + if (!$json) { + return null; + } + return new self( + client_session_id: $json->client_session_id, + connect_webview_ids: $json->connect_webview_ids, + connected_account_ids: $json->connected_account_ids, + created_at: $json->created_at, + device_count: $json->device_count, + expires_at: $json->expires_at, + token: $json->token, + user_identity_ids: $json->user_identity_ids, + workspace_id: $json->workspace_id, + user_identifier_key: $json->user_identifier_key ?? null + ); } - return new self( - client_session_id: $json->client_session_id, - connect_webview_ids: $json->connect_webview_ids, - connected_account_ids: $json->connected_account_ids, - created_at: $json->created_at, - device_count: $json->device_count, - expires_at: $json->expires_at, - token: $json->token, - user_identity_ids: $json->user_identity_ids, - workspace_id: $json->workspace_id, - user_identifier_key: $json->user_identifier_key ?? null - ); - } - public function __construct( - public string $client_session_id, - public array $connect_webview_ids, - public array $connected_account_ids, - public string $created_at, - public float $device_count, - public string $expires_at, - public string $token, - public array $user_identity_ids, - public string $workspace_id, - public string|null $user_identifier_key - ) {} + public function __construct( + public string $client_session_id, + public array $connect_webview_ids, + public array $connected_account_ids, + public string $created_at, + public float $device_count, + public string $expires_at, + public string $token, + public array $user_identity_ids, + public string $workspace_id, + public string|null $user_identifier_key + ) { + } } diff --git a/src/Routes/Objects/ConnectWebview.php b/src/Routes/Objects/ConnectWebview.php index 3731cf3c..ee53efc1 100644 --- a/src/Routes/Objects/ConnectWebview.php +++ b/src/Routes/Objects/ConnectWebview.php @@ -4,54 +4,55 @@ class ConnectWebview { - public static function from_json(mixed $json): ConnectWebview|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ConnectWebview|null + { + if (!$json) { + return null; + } + return new self( + accepted_devices: $json->accepted_devices, + accepted_providers: $json->accepted_providers, + any_device_allowed: $json->any_device_allowed, + any_provider_allowed: $json->any_provider_allowed, + automatically_manage_new_devices: $json->automatically_manage_new_devices, + connect_webview_id: $json->connect_webview_id, + created_at: $json->created_at, + custom_metadata: $json->custom_metadata, + device_selection_mode: $json->device_selection_mode, + login_successful: $json->login_successful, + status: $json->status, + url: $json->url, + wait_for_device_creation: $json->wait_for_device_creation, + workspace_id: $json->workspace_id, + authorized_at: $json->authorized_at ?? null, + connected_account_id: $json->connected_account_id ?? null, + custom_redirect_failure_url: $json->custom_redirect_failure_url ?? + null, + custom_redirect_url: $json->custom_redirect_url ?? null, + selected_provider: $json->selected_provider ?? null + ); } - return new self( - accepted_devices: $json->accepted_devices, - accepted_providers: $json->accepted_providers, - any_device_allowed: $json->any_device_allowed, - any_provider_allowed: $json->any_provider_allowed, - automatically_manage_new_devices: $json->automatically_manage_new_devices, - connect_webview_id: $json->connect_webview_id, - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_selection_mode: $json->device_selection_mode, - login_successful: $json->login_successful, - status: $json->status, - url: $json->url, - wait_for_device_creation: $json->wait_for_device_creation, - workspace_id: $json->workspace_id, - authorized_at: $json->authorized_at ?? null, - connected_account_id: $json->connected_account_id ?? null, - custom_redirect_failure_url: $json->custom_redirect_failure_url ?? - null, - custom_redirect_url: $json->custom_redirect_url ?? null, - selected_provider: $json->selected_provider ?? null - ); - } - public function __construct( - public array $accepted_devices, - public array $accepted_providers, - public bool $any_device_allowed, - public bool $any_provider_allowed, - public bool $automatically_manage_new_devices, - public string $connect_webview_id, - public string $created_at, - public mixed $custom_metadata, - public string $device_selection_mode, - public bool $login_successful, - public string $status, - public string $url, - public bool $wait_for_device_creation, - public string $workspace_id, - public string|null $authorized_at, - public string|null $connected_account_id, - public string|null $custom_redirect_failure_url, - public string|null $custom_redirect_url, - public string|null $selected_provider - ) {} + public function __construct( + public array $accepted_devices, + public array $accepted_providers, + public bool $any_device_allowed, + public bool $any_provider_allowed, + public bool $automatically_manage_new_devices, + public string $connect_webview_id, + public string $created_at, + public mixed $custom_metadata, + public string $device_selection_mode, + public bool $login_successful, + public string $status, + public string $url, + public bool $wait_for_device_creation, + public string $workspace_id, + public string|null $authorized_at, + public string|null $connected_account_id, + public string|null $custom_redirect_failure_url, + public string|null $custom_redirect_url, + public string|null $selected_provider + ) { + } } diff --git a/src/Routes/Objects/ConnectedAccount.php b/src/Routes/Objects/ConnectedAccount.php index 17af568e..e2fe3b39 100644 --- a/src/Routes/Objects/ConnectedAccount.php +++ b/src/Routes/Objects/ConnectedAccount.php @@ -4,43 +4,44 @@ class ConnectedAccount { - public static function from_json(mixed $json): ConnectedAccount|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ConnectedAccount|null + { + if (!$json) { + return null; + } + return new self( + account_type_display_name: $json->account_type_display_name, + automatically_manage_new_devices: $json->automatically_manage_new_devices, + custom_metadata: $json->custom_metadata, + errors: array_map( + fn($e) => ConnectedAccountErrors::from_json($e), + $json->errors ?? [] + ), + warnings: array_map( + fn($w) => ConnectedAccountWarnings::from_json($w), + $json->warnings ?? [] + ), + account_type: $json->account_type ?? null, + connected_account_id: $json->connected_account_id ?? null, + created_at: $json->created_at ?? null, + user_identifier: isset($json->user_identifier) + ? ConnectedAccountUserIdentifier::from_json( + $json->user_identifier + ) + : null + ); } - return new self( - account_type_display_name: $json->account_type_display_name, - automatically_manage_new_devices: $json->automatically_manage_new_devices, - custom_metadata: $json->custom_metadata, - errors: array_map( - fn($e) => ConnectedAccountErrors::from_json($e), - $json->errors ?? [] - ), - warnings: array_map( - fn($w) => ConnectedAccountWarnings::from_json($w), - $json->warnings ?? [] - ), - account_type: $json->account_type ?? null, - connected_account_id: $json->connected_account_id ?? null, - created_at: $json->created_at ?? null, - user_identifier: isset($json->user_identifier) - ? ConnectedAccountUserIdentifier::from_json( - $json->user_identifier - ) - : null - ); - } - public function __construct( - public string $account_type_display_name, - public bool $automatically_manage_new_devices, - public mixed $custom_metadata, - public array $errors, - public array $warnings, - public string|null $account_type, - public string|null $connected_account_id, - public string|null $created_at, - public ConnectedAccountUserIdentifier|null $user_identifier - ) {} + public function __construct( + public string $account_type_display_name, + public bool $automatically_manage_new_devices, + public mixed $custom_metadata, + public array $errors, + public array $warnings, + public string|null $account_type, + public string|null $connected_account_id, + public string|null $created_at, + public ConnectedAccountUserIdentifier|null $user_identifier + ) { + } } diff --git a/src/Routes/Objects/ConnectedAccountErrors.php b/src/Routes/Objects/ConnectedAccountErrors.php index 6f297b2a..10c88b28 100644 --- a/src/Routes/Objects/ConnectedAccountErrors.php +++ b/src/Routes/Objects/ConnectedAccountErrors.php @@ -4,23 +4,24 @@ class ConnectedAccountErrors { - public static function from_json(mixed $json): ConnectedAccountErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ConnectedAccountErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + is_connected_account_error: $json->is_connected_account_error, + message: $json->message, + created_at: $json->created_at ?? null + ); } - return new self( - error_code: $json->error_code, - is_connected_account_error: $json->is_connected_account_error, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $error_code, - public bool $is_connected_account_error, - public string $message, - public string|null $created_at - ) {} + public function __construct( + public string $error_code, + public bool $is_connected_account_error, + public string $message, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/ConnectedAccountUserIdentifier.php b/src/Routes/Objects/ConnectedAccountUserIdentifier.php index 95beae1f..4fcedd7e 100644 --- a/src/Routes/Objects/ConnectedAccountUserIdentifier.php +++ b/src/Routes/Objects/ConnectedAccountUserIdentifier.php @@ -4,26 +4,27 @@ class ConnectedAccountUserIdentifier { - public static function from_json( - mixed $json - ): ConnectedAccountUserIdentifier|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): ConnectedAccountUserIdentifier|null { + if (!$json) { + return null; + } + return new self( + api_url: $json->api_url ?? null, + email: $json->email ?? null, + exclusive: $json->exclusive ?? null, + phone: $json->phone ?? null, + username: $json->username ?? null + ); } - return new self( - api_url: $json->api_url ?? null, - email: $json->email ?? null, - exclusive: $json->exclusive ?? null, - phone: $json->phone ?? null, - username: $json->username ?? null - ); - } - public function __construct( - public string|null $api_url, - public string|null $email, - public bool|null $exclusive, - public string|null $phone, - public string|null $username - ) {} + public function __construct( + public string|null $api_url, + public string|null $email, + public bool|null $exclusive, + public string|null $phone, + public string|null $username + ) { + } } diff --git a/src/Routes/Objects/ConnectedAccountWarnings.php b/src/Routes/Objects/ConnectedAccountWarnings.php index d8adcd27..a5157c00 100644 --- a/src/Routes/Objects/ConnectedAccountWarnings.php +++ b/src/Routes/Objects/ConnectedAccountWarnings.php @@ -4,21 +4,22 @@ class ConnectedAccountWarnings { - public static function from_json(mixed $json): ConnectedAccountWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ConnectedAccountWarnings|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); } - return new self( - message: $json->message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) {} + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/Device.php b/src/Routes/Objects/Device.php index 437d8ba9..6dac7872 100644 --- a/src/Routes/Objects/Device.php +++ b/src/Routes/Objects/Device.php @@ -4,76 +4,77 @@ class Device { - public static function from_json(mixed $json): Device|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): Device|null + { + if (!$json) { + return null; + } + return new self( + capabilities_supported: $json->capabilities_supported, + connected_account_id: $json->connected_account_id, + created_at: $json->created_at, + custom_metadata: $json->custom_metadata, + device_id: $json->device_id, + device_type: $json->device_type, + display_name: $json->display_name, + errors: array_map( + fn($e) => DeviceErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + properties: DeviceProperties::from_json($json->properties), + warnings: array_map( + fn($w) => DeviceWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + 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, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, + can_remotely_lock: $json->can_remotely_lock ?? null, + can_remotely_unlock: $json->can_remotely_unlock ?? null, + can_simulate_connection: $json->can_simulate_connection ?? null, + can_simulate_disconnection: $json->can_simulate_disconnection ?? + null, + can_simulate_removal: $json->can_simulate_removal ?? null, + can_turn_off_hvac: $json->can_turn_off_hvac ?? null, + nickname: $json->nickname ?? null, + location: isset($json->location) + ? DeviceLocation::from_json($json->location) + : null + ); } - return new self( - capabilities_supported: $json->capabilities_supported, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_id: $json->device_id, - device_type: $json->device_type, - display_name: $json->display_name, - errors: array_map( - fn($e) => DeviceErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - properties: DeviceProperties::from_json($json->properties), - warnings: array_map( - fn($w) => DeviceWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - 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, - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? - null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? - null, - can_remotely_lock: $json->can_remotely_lock ?? null, - can_remotely_unlock: $json->can_remotely_unlock ?? null, - can_simulate_connection: $json->can_simulate_connection ?? null, - can_simulate_disconnection: $json->can_simulate_disconnection ?? - null, - can_simulate_removal: $json->can_simulate_removal ?? null, - can_turn_off_hvac: $json->can_turn_off_hvac ?? null, - nickname: $json->nickname ?? null, - location: isset($json->location) - ? DeviceLocation::from_json($json->location) - : null - ); - } - public function __construct( - public array $capabilities_supported, - public string $connected_account_id, - public string $created_at, - public mixed $custom_metadata, - public string $device_id, - public string $device_type, - public string $display_name, - public array $errors, - public bool $is_managed, - public DeviceProperties $properties, - public array $warnings, - public string $workspace_id, - public bool|null $can_hvac_cool, - public bool|null $can_hvac_heat, - public bool|null $can_hvac_heat_cool, - public bool|null $can_program_offline_access_codes, - public bool|null $can_program_online_access_codes, - public bool|null $can_remotely_lock, - public bool|null $can_remotely_unlock, - public bool|null $can_simulate_connection, - public bool|null $can_simulate_disconnection, - public bool|null $can_simulate_removal, - public bool|null $can_turn_off_hvac, - public string|null $nickname, - public DeviceLocation|null $location - ) {} + public function __construct( + public array $capabilities_supported, + public string $connected_account_id, + public string $created_at, + public mixed $custom_metadata, + public string $device_id, + public string $device_type, + public string $display_name, + public array $errors, + public bool $is_managed, + public DeviceProperties $properties, + public array $warnings, + public string $workspace_id, + public bool|null $can_hvac_cool, + public bool|null $can_hvac_heat, + public bool|null $can_hvac_heat_cool, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_connection, + public bool|null $can_simulate_disconnection, + public bool|null $can_simulate_removal, + public bool|null $can_turn_off_hvac, + public string|null $nickname, + public DeviceLocation|null $location + ) { + } } diff --git a/src/Routes/Objects/DeviceAccelerometerZ.php b/src/Routes/Objects/DeviceAccelerometerZ.php index f1a673ae..246574a7 100644 --- a/src/Routes/Objects/DeviceAccelerometerZ.php +++ b/src/Routes/Objects/DeviceAccelerometerZ.php @@ -4,13 +4,15 @@ class DeviceAccelerometerZ { - public static function from_json(mixed $json): DeviceAccelerometerZ|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceAccelerometerZ|null + { + if (!$json) { + return null; + } + return new self(time: $json->time, value: $json->value); } - return new self(time: $json->time, value: $json->value); - } - public function __construct(public string $time, public float $value) {} + public function __construct(public string $time, public float $value) + { + } } diff --git a/src/Routes/Objects/DeviceAccessoryKeypad.php b/src/Routes/Objects/DeviceAccessoryKeypad.php index 75f7ee2b..56601d8c 100644 --- a/src/Routes/Objects/DeviceAccessoryKeypad.php +++ b/src/Routes/Objects/DeviceAccessoryKeypad.php @@ -4,21 +4,22 @@ class DeviceAccessoryKeypad { - public static function from_json(mixed $json): DeviceAccessoryKeypad|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceAccessoryKeypad|null + { + if (!$json) { + return null; + } + return new self( + is_connected: $json->is_connected, + battery: isset($json->battery) + ? DeviceBattery::from_json($json->battery) + : null + ); } - return new self( - is_connected: $json->is_connected, - battery: isset($json->battery) - ? DeviceBattery::from_json($json->battery) - : null - ); - } - public function __construct( - public bool $is_connected, - public DeviceBattery|null $battery - ) {} + public function __construct( + public bool $is_connected, + public DeviceBattery|null $battery + ) { + } } diff --git a/src/Routes/Objects/DeviceActiveThermostatSchedule.php b/src/Routes/Objects/DeviceActiveThermostatSchedule.php index 838560d2..05fb48ab 100644 --- a/src/Routes/Objects/DeviceActiveThermostatSchedule.php +++ b/src/Routes/Objects/DeviceActiveThermostatSchedule.php @@ -4,40 +4,41 @@ class DeviceActiveThermostatSchedule { - public static function from_json( - mixed $json - ): DeviceActiveThermostatSchedule|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceActiveThermostatSchedule|null { + if (!$json) { + return null; + } + return new self( + climate_preset_key: $json->climate_preset_key, + created_at: $json->created_at, + device_id: $json->device_id, + ends_at: $json->ends_at, + errors: array_map( + fn($e) => DeviceErrors::from_json($e), + $json->errors ?? [] + ), + max_override_period_minutes: $json->max_override_period_minutes, + starts_at: $json->starts_at, + thermostat_schedule_id: $json->thermostat_schedule_id, + name: $json->name ?? null, + unstable_is_override_allowed: $json->unstable_is_override_allowed ?? + null + ); } - return new self( - climate_preset_key: $json->climate_preset_key, - created_at: $json->created_at, - device_id: $json->device_id, - ends_at: $json->ends_at, - errors: array_map( - fn($e) => DeviceErrors::from_json($e), - $json->errors ?? [] - ), - max_override_period_minutes: $json->max_override_period_minutes, - starts_at: $json->starts_at, - thermostat_schedule_id: $json->thermostat_schedule_id, - name: $json->name ?? null, - unstable_is_override_allowed: $json->unstable_is_override_allowed ?? - null - ); - } - public function __construct( - public string $climate_preset_key, - public string $created_at, - public string $device_id, - public string $ends_at, - public array $errors, - public mixed $max_override_period_minutes, - public string $starts_at, - public string $thermostat_schedule_id, - public string|null $name, - public bool|null $unstable_is_override_allowed - ) {} + public function __construct( + public string $climate_preset_key, + public string $created_at, + public string $device_id, + public string $ends_at, + public array $errors, + public mixed $max_override_period_minutes, + public string $starts_at, + public string $thermostat_schedule_id, + public string|null $name, + public bool|null $unstable_is_override_allowed + ) { + } } diff --git a/src/Routes/Objects/DeviceAkilesMetadata.php b/src/Routes/Objects/DeviceAkilesMetadata.php index 43ad606e..855584a6 100644 --- a/src/Routes/Objects/DeviceAkilesMetadata.php +++ b/src/Routes/Objects/DeviceAkilesMetadata.php @@ -4,23 +4,24 @@ class DeviceAkilesMetadata { - public static function from_json(mixed $json): DeviceAkilesMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceAkilesMetadata|null + { + if (!$json) { + return null; + } + return new self( + gadget_id: $json->gadget_id, + gadget_name: $json->gadget_name, + product_name: $json->product_name, + _member_group_id: $json->_member_group_id ?? null + ); } - return new self( - gadget_id: $json->gadget_id, - gadget_name: $json->gadget_name, - product_name: $json->product_name, - _member_group_id: $json->_member_group_id ?? null - ); - } - public function __construct( - public string $gadget_id, - public string $gadget_name, - public string $product_name, - public string|null $_member_group_id - ) {} + public function __construct( + public string $gadget_id, + public string $gadget_name, + public string $product_name, + public string|null $_member_group_id + ) { + } } diff --git a/src/Routes/Objects/DeviceAppearance.php b/src/Routes/Objects/DeviceAppearance.php index cf784226..aeac634b 100644 --- a/src/Routes/Objects/DeviceAppearance.php +++ b/src/Routes/Objects/DeviceAppearance.php @@ -4,13 +4,15 @@ class DeviceAppearance { - public static function from_json(mixed $json): DeviceAppearance|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceAppearance|null + { + if (!$json) { + return null; + } + return new self(name: $json->name); } - return new self(name: $json->name); - } - public function __construct(public string $name) {} + public function __construct(public string $name) + { + } } diff --git a/src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php b/src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php index 9edb7595..0aaa4af8 100644 --- a/src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php +++ b/src/Routes/Objects/DeviceAssaAbloyCredentialServiceMetadata.php @@ -4,23 +4,24 @@ class DeviceAssaAbloyCredentialServiceMetadata { - public static function from_json( - mixed $json - ): DeviceAssaAbloyCredentialServiceMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceAssaAbloyCredentialServiceMetadata|null { + if (!$json) { + return null; + } + return new self( + endpoints: array_map( + fn($e) => DeviceEndpoints::from_json($e), + $json->endpoints ?? [] + ), + has_active_endpoint: $json->has_active_endpoint + ); } - return new self( - endpoints: array_map( - fn($e) => DeviceEndpoints::from_json($e), - $json->endpoints ?? [] - ), - has_active_endpoint: $json->has_active_endpoint - ); - } - public function __construct( - public array $endpoints, - public bool $has_active_endpoint - ) {} + public function __construct( + public array $endpoints, + public bool $has_active_endpoint + ) { + } } diff --git a/src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php b/src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php index b9c8a5ef..8b735989 100644 --- a/src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php +++ b/src/Routes/Objects/DeviceAssaAbloyVostioMetadata.php @@ -4,14 +4,16 @@ class DeviceAssaAbloyVostioMetadata { - public static function from_json( - mixed $json - ): DeviceAssaAbloyVostioMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceAssaAbloyVostioMetadata|null { + if (!$json) { + return null; + } + return new self(encoder_name: $json->encoder_name); } - return new self(encoder_name: $json->encoder_name); - } - public function __construct(public string $encoder_name) {} + public function __construct(public string $encoder_name) + { + } } diff --git a/src/Routes/Objects/DeviceAugustMetadata.php b/src/Routes/Objects/DeviceAugustMetadata.php index 9b2b6fee..754ea75c 100644 --- a/src/Routes/Objects/DeviceAugustMetadata.php +++ b/src/Routes/Objects/DeviceAugustMetadata.php @@ -4,29 +4,30 @@ class DeviceAugustMetadata { - public static function from_json(mixed $json): DeviceAugustMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceAugustMetadata|null + { + if (!$json) { + return null; + } + return new self( + has_keypad: $json->has_keypad, + house_name: $json->house_name, + lock_id: $json->lock_id, + lock_name: $json->lock_name, + house_id: $json->house_id ?? null, + keypad_battery_level: $json->keypad_battery_level ?? null, + model: $json->model ?? null + ); } - return new self( - has_keypad: $json->has_keypad, - house_name: $json->house_name, - lock_id: $json->lock_id, - lock_name: $json->lock_name, - house_id: $json->house_id ?? null, - keypad_battery_level: $json->keypad_battery_level ?? null, - model: $json->model ?? null - ); - } - public function __construct( - public bool $has_keypad, - public string $house_name, - public string $lock_id, - public string $lock_name, - public string|null $house_id, - public string|null $keypad_battery_level, - public string|null $model - ) {} + public function __construct( + public bool $has_keypad, + public string $house_name, + public string $lock_id, + public string $lock_name, + public string|null $house_id, + public string|null $keypad_battery_level, + public string|null $model + ) { + } } diff --git a/src/Routes/Objects/DeviceAvailableClimatePresets.php b/src/Routes/Objects/DeviceAvailableClimatePresets.php index 1332ff44..f636770d 100644 --- a/src/Routes/Objects/DeviceAvailableClimatePresets.php +++ b/src/Routes/Objects/DeviceAvailableClimatePresets.php @@ -4,42 +4,43 @@ class DeviceAvailableClimatePresets { - public static function from_json( - mixed $json - ): DeviceAvailableClimatePresets|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceAvailableClimatePresets|null { + if (!$json) { + return null; + } + return new self( + can_delete: $json->can_delete, + can_edit: $json->can_edit, + climate_preset_key: $json->climate_preset_key, + display_name: $json->display_name, + manual_override_allowed: $json->manual_override_allowed, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + name: $json->name ?? null + ); } - return new self( - can_delete: $json->can_delete, - can_edit: $json->can_edit, - climate_preset_key: $json->climate_preset_key, - display_name: $json->display_name, - manual_override_allowed: $json->manual_override_allowed, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - name: $json->name ?? null - ); - } - public function __construct( - public bool $can_delete, - public bool $can_edit, - public string $climate_preset_key, - public string $display_name, - public bool $manual_override_allowed, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public string|null $name - ) {} + public function __construct( + public bool $can_delete, + public bool $can_edit, + public string $climate_preset_key, + public string $display_name, + public bool $manual_override_allowed, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public string|null $name + ) { + } } diff --git a/src/Routes/Objects/DeviceAvigilonAltaMetadata.php b/src/Routes/Objects/DeviceAvigilonAltaMetadata.php index 8ccc3b32..86fe4752 100644 --- a/src/Routes/Objects/DeviceAvigilonAltaMetadata.php +++ b/src/Routes/Objects/DeviceAvigilonAltaMetadata.php @@ -4,30 +4,31 @@ class DeviceAvigilonAltaMetadata { - public static function from_json( - mixed $json - ): DeviceAvigilonAltaMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceAvigilonAltaMetadata|null { + if (!$json) { + return null; + } + return new self( + entry_name: $json->entry_name, + entry_relays_total_count: $json->entry_relays_total_count, + org_name: $json->org_name, + site_id: $json->site_id, + site_name: $json->site_name, + zone_id: $json->zone_id, + zone_name: $json->zone_name + ); } - return new self( - entry_name: $json->entry_name, - entry_relays_total_count: $json->entry_relays_total_count, - org_name: $json->org_name, - site_id: $json->site_id, - site_name: $json->site_name, - zone_id: $json->zone_id, - zone_name: $json->zone_name - ); - } - public function __construct( - public string $entry_name, - public float $entry_relays_total_count, - public string $org_name, - public float $site_id, - public string $site_name, - public float $zone_id, - public string $zone_name - ) {} + public function __construct( + public string $entry_name, + public float $entry_relays_total_count, + public string $org_name, + public float $site_id, + public string $site_name, + public float $zone_id, + public string $zone_name + ) { + } } diff --git a/src/Routes/Objects/DeviceBattery.php b/src/Routes/Objects/DeviceBattery.php index 1a4fae6b..34a329a1 100644 --- a/src/Routes/Objects/DeviceBattery.php +++ b/src/Routes/Objects/DeviceBattery.php @@ -4,13 +4,15 @@ class DeviceBattery { - public static function from_json(mixed $json): DeviceBattery|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceBattery|null + { + if (!$json) { + return null; + } + return new self(level: $json->level); } - return new self(level: $json->level); - } - public function __construct(public float $level) {} + public function __construct(public float $level) + { + } } diff --git a/src/Routes/Objects/DeviceBrivoMetadata.php b/src/Routes/Objects/DeviceBrivoMetadata.php index f4a8be60..b98f4315 100644 --- a/src/Routes/Objects/DeviceBrivoMetadata.php +++ b/src/Routes/Objects/DeviceBrivoMetadata.php @@ -4,13 +4,15 @@ class DeviceBrivoMetadata { - public static function from_json(mixed $json): DeviceBrivoMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceBrivoMetadata|null + { + if (!$json) { + return null; + } + return new self(device_name: $json->device_name); } - return new self(device_name: $json->device_name); - } - public function __construct(public string $device_name) {} + public function __construct(public string $device_name) + { + } } diff --git a/src/Routes/Objects/DeviceCodeConstraints.php b/src/Routes/Objects/DeviceCodeConstraints.php index fe95be55..43b43aa4 100644 --- a/src/Routes/Objects/DeviceCodeConstraints.php +++ b/src/Routes/Objects/DeviceCodeConstraints.php @@ -4,21 +4,22 @@ class DeviceCodeConstraints { - public static function from_json(mixed $json): DeviceCodeConstraints|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceCodeConstraints|null + { + if (!$json) { + return null; + } + return new self( + constraint_type: $json->constraint_type, + max_length: $json->max_length ?? null, + min_length: $json->min_length ?? null + ); } - return new self( - constraint_type: $json->constraint_type, - max_length: $json->max_length ?? null, - min_length: $json->min_length ?? null - ); - } - public function __construct( - public string $constraint_type, - public float|null $max_length, - public float|null $min_length - ) {} + public function __construct( + public string $constraint_type, + public float|null $max_length, + public float|null $min_length + ) { + } } diff --git a/src/Routes/Objects/DeviceControlbywebMetadata.php b/src/Routes/Objects/DeviceControlbywebMetadata.php index 8f79f596..34d9211e 100644 --- a/src/Routes/Objects/DeviceControlbywebMetadata.php +++ b/src/Routes/Objects/DeviceControlbywebMetadata.php @@ -4,22 +4,23 @@ class DeviceControlbywebMetadata { - public static function from_json( - mixed $json - ): DeviceControlbywebMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceControlbywebMetadata|null { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + relay_name: $json->relay_name ?? null + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - relay_name: $json->relay_name ?? null - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public string|null $relay_name - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public string|null $relay_name + ) { + } } diff --git a/src/Routes/Objects/DeviceCurrentClimateSetting.php b/src/Routes/Objects/DeviceCurrentClimateSetting.php index 19754d7b..b25a0d3a 100644 --- a/src/Routes/Objects/DeviceCurrentClimateSetting.php +++ b/src/Routes/Objects/DeviceCurrentClimateSetting.php @@ -4,42 +4,43 @@ class DeviceCurrentClimateSetting { - public static function from_json( - mixed $json - ): DeviceCurrentClimateSetting|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceCurrentClimateSetting|null { + if (!$json) { + return null; + } + return new self( + can_delete: $json->can_delete ?? null, + can_edit: $json->can_edit ?? null, + climate_preset_key: $json->climate_preset_key ?? null, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + display_name: $json->display_name ?? null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + manual_override_allowed: $json->manual_override_allowed ?? null, + name: $json->name ?? null + ); } - return new self( - can_delete: $json->can_delete ?? null, - can_edit: $json->can_edit ?? null, - climate_preset_key: $json->climate_preset_key ?? null, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - display_name: $json->display_name ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - manual_override_allowed: $json->manual_override_allowed ?? null, - name: $json->name ?? null - ); - } - public function __construct( - public bool|null $can_delete, - public bool|null $can_edit, - public string|null $climate_preset_key, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $display_name, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public bool|null $manual_override_allowed, - public string|null $name - ) {} + public function __construct( + public bool|null $can_delete, + public bool|null $can_edit, + public string|null $climate_preset_key, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $display_name, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $manual_override_allowed, + public string|null $name + ) { + } } diff --git a/src/Routes/Objects/DeviceDefaultClimateSetting.php b/src/Routes/Objects/DeviceDefaultClimateSetting.php index a84003ac..2de24e9d 100644 --- a/src/Routes/Objects/DeviceDefaultClimateSetting.php +++ b/src/Routes/Objects/DeviceDefaultClimateSetting.php @@ -4,42 +4,43 @@ class DeviceDefaultClimateSetting { - public static function from_json( - mixed $json - ): DeviceDefaultClimateSetting|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceDefaultClimateSetting|null { + if (!$json) { + return null; + } + return new self( + can_delete: $json->can_delete ?? null, + can_edit: $json->can_edit ?? null, + climate_preset_key: $json->climate_preset_key ?? null, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + display_name: $json->display_name ?? null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + manual_override_allowed: $json->manual_override_allowed ?? null, + name: $json->name ?? null + ); } - return new self( - can_delete: $json->can_delete ?? null, - can_edit: $json->can_edit ?? null, - climate_preset_key: $json->climate_preset_key ?? null, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - display_name: $json->display_name ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - manual_override_allowed: $json->manual_override_allowed ?? null, - name: $json->name ?? null - ); - } - public function __construct( - public bool|null $can_delete, - public bool|null $can_edit, - public string|null $climate_preset_key, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $display_name, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public bool|null $manual_override_allowed, - public string|null $name - ) {} + public function __construct( + public bool|null $can_delete, + public bool|null $can_edit, + public string|null $climate_preset_key, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $display_name, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $manual_override_allowed, + public string|null $name + ) { + } } diff --git a/src/Routes/Objects/DeviceDormakabaOracodeMetadata.php b/src/Routes/Objects/DeviceDormakabaOracodeMetadata.php index 71f9e5d4..5541e416 100644 --- a/src/Routes/Objects/DeviceDormakabaOracodeMetadata.php +++ b/src/Routes/Objects/DeviceDormakabaOracodeMetadata.php @@ -4,35 +4,36 @@ class DeviceDormakabaOracodeMetadata { - public static function from_json( - mixed $json - ): DeviceDormakabaOracodeMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceDormakabaOracodeMetadata|null { + if (!$json) { + return null; + } + return new self( + door_is_wireless: $json->door_is_wireless, + door_name: $json->door_name, + site_name: $json->site_name, + device_id: $json->device_id ?? null, + door_id: $json->door_id ?? null, + iana_timezone: $json->iana_timezone ?? null, + predefined_time_slots: array_map( + fn($p) => DevicePredefinedTimeSlots::from_json($p), + $json->predefined_time_slots ?? [] + ), + site_id: $json->site_id ?? null + ); } - return new self( - door_is_wireless: $json->door_is_wireless, - door_name: $json->door_name, - site_name: $json->site_name, - device_id: $json->device_id ?? null, - door_id: $json->door_id ?? null, - iana_timezone: $json->iana_timezone ?? null, - predefined_time_slots: array_map( - fn($p) => DevicePredefinedTimeSlots::from_json($p), - $json->predefined_time_slots ?? [] - ), - site_id: $json->site_id ?? null - ); - } - public function __construct( - public bool $door_is_wireless, - public string $door_name, - public string $site_name, - public float|null $device_id, - public float|null $door_id, - public string|null $iana_timezone, - public array|null $predefined_time_slots, - public float|null $site_id - ) {} + public function __construct( + public bool $door_is_wireless, + public string $door_name, + public string $site_name, + public float|null $device_id, + public float|null $door_id, + public string|null $iana_timezone, + public array|null $predefined_time_slots, + public float|null $site_id + ) { + } } diff --git a/src/Routes/Objects/DeviceEcobeeMetadata.php b/src/Routes/Objects/DeviceEcobeeMetadata.php index e6ac9a7a..e8b6f86a 100644 --- a/src/Routes/Objects/DeviceEcobeeMetadata.php +++ b/src/Routes/Objects/DeviceEcobeeMetadata.php @@ -4,19 +4,20 @@ class DeviceEcobeeMetadata { - public static function from_json(mixed $json): DeviceEcobeeMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceEcobeeMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_name: $json->device_name, + ecobee_device_id: $json->ecobee_device_id + ); } - return new self( - device_name: $json->device_name, - ecobee_device_id: $json->ecobee_device_id - ); - } - public function __construct( - public string $device_name, - public string $ecobee_device_id - ) {} + public function __construct( + public string $device_name, + public string $ecobee_device_id + ) { + } } diff --git a/src/Routes/Objects/DeviceEndpoints.php b/src/Routes/Objects/DeviceEndpoints.php index 6d0c8ed7..04a591e3 100644 --- a/src/Routes/Objects/DeviceEndpoints.php +++ b/src/Routes/Objects/DeviceEndpoints.php @@ -4,19 +4,20 @@ class DeviceEndpoints { - public static function from_json(mixed $json): DeviceEndpoints|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceEndpoints|null + { + if (!$json) { + return null; + } + return new self( + endpoint_id: $json->endpoint_id, + is_active: $json->is_active + ); } - return new self( - endpoint_id: $json->endpoint_id, - is_active: $json->is_active - ); - } - public function __construct( - public string $endpoint_id, - public bool $is_active - ) {} + public function __construct( + public string $endpoint_id, + public bool $is_active + ) { + } } diff --git a/src/Routes/Objects/DeviceErrors.php b/src/Routes/Objects/DeviceErrors.php index b13b5e91..29bce023 100644 --- a/src/Routes/Objects/DeviceErrors.php +++ b/src/Routes/Objects/DeviceErrors.php @@ -4,26 +4,27 @@ class DeviceErrors { - public static function from_json(mixed $json): DeviceErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) { + } } diff --git a/src/Routes/Objects/DeviceFeatures.php b/src/Routes/Objects/DeviceFeatures.php index 772c3102..b096fb55 100644 --- a/src/Routes/Objects/DeviceFeatures.php +++ b/src/Routes/Objects/DeviceFeatures.php @@ -4,25 +4,26 @@ class DeviceFeatures { - public static function from_json(mixed $json): DeviceFeatures|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceFeatures|null + { + if (!$json) { + return null; + } + return new self( + incomplete_keyboard_passcode: $json->incomplete_keyboard_passcode, + lock_command: $json->lock_command, + passcode: $json->passcode, + passcode_management: $json->passcode_management, + unlock_via_gateway: $json->unlock_via_gateway + ); } - return new self( - incomplete_keyboard_passcode: $json->incomplete_keyboard_passcode, - lock_command: $json->lock_command, - passcode: $json->passcode, - passcode_management: $json->passcode_management, - unlock_via_gateway: $json->unlock_via_gateway - ); - } - public function __construct( - public bool $incomplete_keyboard_passcode, - public bool $lock_command, - public bool $passcode, - public bool $passcode_management, - public bool $unlock_via_gateway - ) {} + public function __construct( + public bool $incomplete_keyboard_passcode, + public bool $lock_command, + public bool $passcode, + public bool $passcode_management, + public bool $unlock_via_gateway + ) { + } } diff --git a/src/Routes/Objects/DeviceFourSuitesMetadata.php b/src/Routes/Objects/DeviceFourSuitesMetadata.php index b5ef6fe6..3caf1a2d 100644 --- a/src/Routes/Objects/DeviceFourSuitesMetadata.php +++ b/src/Routes/Objects/DeviceFourSuitesMetadata.php @@ -4,21 +4,22 @@ class DeviceFourSuitesMetadata { - public static function from_json(mixed $json): DeviceFourSuitesMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceFourSuitesMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + reclose_delay_in_seconds: $json->reclose_delay_in_seconds + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - reclose_delay_in_seconds: $json->reclose_delay_in_seconds - ); - } - public function __construct( - public float $device_id, - public string $device_name, - public float $reclose_delay_in_seconds - ) {} + public function __construct( + public float $device_id, + public string $device_name, + public float $reclose_delay_in_seconds + ) { + } } diff --git a/src/Routes/Objects/DeviceGenieMetadata.php b/src/Routes/Objects/DeviceGenieMetadata.php index 961d54a1..c464f213 100644 --- a/src/Routes/Objects/DeviceGenieMetadata.php +++ b/src/Routes/Objects/DeviceGenieMetadata.php @@ -4,19 +4,20 @@ class DeviceGenieMetadata { - public static function from_json(mixed $json): DeviceGenieMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceGenieMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_name: $json->device_name, + door_name: $json->door_name + ); } - return new self( - device_name: $json->device_name, - door_name: $json->door_name - ); - } - public function __construct( - public string $device_name, - public string $door_name - ) {} + public function __construct( + public string $device_name, + public string $door_name + ) { + } } diff --git a/src/Routes/Objects/DeviceHoneywellResideoMetadata.php b/src/Routes/Objects/DeviceHoneywellResideoMetadata.php index 67e969fe..335f6b6a 100644 --- a/src/Routes/Objects/DeviceHoneywellResideoMetadata.php +++ b/src/Routes/Objects/DeviceHoneywellResideoMetadata.php @@ -4,20 +4,21 @@ class DeviceHoneywellResideoMetadata { - public static function from_json( - mixed $json - ): DeviceHoneywellResideoMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceHoneywellResideoMetadata|null { + if (!$json) { + return null; + } + return new self( + device_name: $json->device_name, + honeywell_resideo_device_id: $json->honeywell_resideo_device_id + ); } - return new self( - device_name: $json->device_name, - honeywell_resideo_device_id: $json->honeywell_resideo_device_id - ); - } - public function __construct( - public string $device_name, - public string $honeywell_resideo_device_id - ) {} + public function __construct( + public string $device_name, + public string $honeywell_resideo_device_id + ) { + } } diff --git a/src/Routes/Objects/DeviceHubitatMetadata.php b/src/Routes/Objects/DeviceHubitatMetadata.php index b36079c8..4f5775b5 100644 --- a/src/Routes/Objects/DeviceHubitatMetadata.php +++ b/src/Routes/Objects/DeviceHubitatMetadata.php @@ -4,21 +4,22 @@ class DeviceHubitatMetadata { - public static function from_json(mixed $json): DeviceHubitatMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceHubitatMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_label: $json->device_label, + device_name: $json->device_name + ); } - return new self( - device_id: $json->device_id, - device_label: $json->device_label, - device_name: $json->device_name - ); - } - public function __construct( - public string $device_id, - public string $device_label, - public string $device_name - ) {} + public function __construct( + public string $device_id, + public string $device_label, + public string $device_name + ) { + } } diff --git a/src/Routes/Objects/DeviceHumidity.php b/src/Routes/Objects/DeviceHumidity.php index 2d6d1f82..d22ae280 100644 --- a/src/Routes/Objects/DeviceHumidity.php +++ b/src/Routes/Objects/DeviceHumidity.php @@ -4,13 +4,15 @@ class DeviceHumidity { - public static function from_json(mixed $json): DeviceHumidity|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceHumidity|null + { + if (!$json) { + return null; + } + return new self(time: $json->time, value: $json->value); } - return new self(time: $json->time, value: $json->value); - } - public function __construct(public string $time, public float $value) {} + public function __construct(public string $time, public float $value) + { + } } diff --git a/src/Routes/Objects/DeviceIglooMetadata.php b/src/Routes/Objects/DeviceIglooMetadata.php index a9da74cb..173d8b3c 100644 --- a/src/Routes/Objects/DeviceIglooMetadata.php +++ b/src/Routes/Objects/DeviceIglooMetadata.php @@ -4,21 +4,22 @@ class DeviceIglooMetadata { - public static function from_json(mixed $json): DeviceIglooMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceIglooMetadata|null + { + if (!$json) { + return null; + } + return new self( + bridge_id: $json->bridge_id, + device_id: $json->device_id, + model: $json->model ?? null + ); } - return new self( - bridge_id: $json->bridge_id, - device_id: $json->device_id, - model: $json->model ?? null - ); - } - public function __construct( - public string $bridge_id, - public string $device_id, - public string|null $model - ) {} + public function __construct( + public string $bridge_id, + public string $device_id, + public string|null $model + ) { + } } diff --git a/src/Routes/Objects/DeviceIgloohomeMetadata.php b/src/Routes/Objects/DeviceIgloohomeMetadata.php index 48201eb0..cff42175 100644 --- a/src/Routes/Objects/DeviceIgloohomeMetadata.php +++ b/src/Routes/Objects/DeviceIgloohomeMetadata.php @@ -4,25 +4,26 @@ class DeviceIgloohomeMetadata { - public static function from_json(mixed $json): DeviceIgloohomeMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceIgloohomeMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + bridge_id: $json->bridge_id ?? null, + bridge_name: $json->bridge_name ?? null, + keypad_id: $json->keypad_id ?? null + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - bridge_id: $json->bridge_id ?? null, - bridge_name: $json->bridge_name ?? null, - keypad_id: $json->keypad_id ?? null - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public string|null $bridge_id, - public string|null $bridge_name, - public string|null $keypad_id - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public string|null $bridge_id, + public string|null $bridge_name, + public string|null $keypad_id + ) { + } } diff --git a/src/Routes/Objects/DeviceKeypadBattery.php b/src/Routes/Objects/DeviceKeypadBattery.php index f8d72647..9b259806 100644 --- a/src/Routes/Objects/DeviceKeypadBattery.php +++ b/src/Routes/Objects/DeviceKeypadBattery.php @@ -4,13 +4,15 @@ class DeviceKeypadBattery { - public static function from_json(mixed $json): DeviceKeypadBattery|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceKeypadBattery|null + { + if (!$json) { + return null; + } + return new self(level: $json->level); } - return new self(level: $json->level); - } - public function __construct(public float $level) {} + public function __construct(public float $level) + { + } } diff --git a/src/Routes/Objects/DeviceKwiksetMetadata.php b/src/Routes/Objects/DeviceKwiksetMetadata.php index 6bcf5e7d..941b8d6b 100644 --- a/src/Routes/Objects/DeviceKwiksetMetadata.php +++ b/src/Routes/Objects/DeviceKwiksetMetadata.php @@ -4,21 +4,22 @@ class DeviceKwiksetMetadata { - public static function from_json(mixed $json): DeviceKwiksetMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceKwiksetMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + model_number: $json->model_number + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - model_number: $json->model_number - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public string $model_number - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public string $model_number + ) { + } } diff --git a/src/Routes/Objects/DeviceLatestSensorValues.php b/src/Routes/Objects/DeviceLatestSensorValues.php index 67e200c7..599840ac 100644 --- a/src/Routes/Objects/DeviceLatestSensorValues.php +++ b/src/Routes/Objects/DeviceLatestSensorValues.php @@ -4,27 +4,28 @@ class DeviceLatestSensorValues { - public static function from_json(mixed $json): DeviceLatestSensorValues|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceLatestSensorValues|null + { + if (!$json) { + return null; + } + return new self( + accelerometer_z: DeviceAccelerometerZ::from_json( + $json->accelerometer_z + ), + humidity: DeviceHumidity::from_json($json->humidity), + pressure: DevicePressure::from_json($json->pressure), + sound: DeviceSound::from_json($json->sound), + temperature: DeviceTemperature::from_json($json->temperature) + ); } - return new self( - accelerometer_z: DeviceAccelerometerZ::from_json( - $json->accelerometer_z - ), - humidity: DeviceHumidity::from_json($json->humidity), - pressure: DevicePressure::from_json($json->pressure), - sound: DeviceSound::from_json($json->sound), - temperature: DeviceTemperature::from_json($json->temperature) - ); - } - public function __construct( - public DeviceAccelerometerZ $accelerometer_z, - public DeviceHumidity $humidity, - public DevicePressure $pressure, - public DeviceSound $sound, - public DeviceTemperature $temperature - ) {} + public function __construct( + public DeviceAccelerometerZ $accelerometer_z, + public DeviceHumidity $humidity, + public DevicePressure $pressure, + public DeviceSound $sound, + public DeviceTemperature $temperature + ) { + } } diff --git a/src/Routes/Objects/DeviceLocation.php b/src/Routes/Objects/DeviceLocation.php index f0dc22b2..22559b8e 100644 --- a/src/Routes/Objects/DeviceLocation.php +++ b/src/Routes/Objects/DeviceLocation.php @@ -4,19 +4,20 @@ class DeviceLocation { - public static function from_json(mixed $json): DeviceLocation|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceLocation|null + { + if (!$json) { + return null; + } + return new self( + location_name: $json->location_name ?? null, + timezone: $json->timezone ?? null + ); } - return new self( - location_name: $json->location_name ?? null, - timezone: $json->timezone ?? null - ); - } - public function __construct( - public string|null $location_name, - public string|null $timezone - ) {} + public function __construct( + public string|null $location_name, + public string|null $timezone + ) { + } } diff --git a/src/Routes/Objects/DeviceLocklyMetadata.php b/src/Routes/Objects/DeviceLocklyMetadata.php index 4f624013..d80ad2ea 100644 --- a/src/Routes/Objects/DeviceLocklyMetadata.php +++ b/src/Routes/Objects/DeviceLocklyMetadata.php @@ -4,21 +4,22 @@ class DeviceLocklyMetadata { - public static function from_json(mixed $json): DeviceLocklyMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceLocklyMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + model: $json->model ?? null + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - model: $json->model ?? null - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public string|null $model - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public string|null $model + ) { + } } diff --git a/src/Routes/Objects/DeviceMinutMetadata.php b/src/Routes/Objects/DeviceMinutMetadata.php index 3d471932..55529141 100644 --- a/src/Routes/Objects/DeviceMinutMetadata.php +++ b/src/Routes/Objects/DeviceMinutMetadata.php @@ -4,23 +4,24 @@ class DeviceMinutMetadata { - public static function from_json(mixed $json): DeviceMinutMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceMinutMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + latest_sensor_values: DeviceLatestSensorValues::from_json( + $json->latest_sensor_values + ) + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - latest_sensor_values: DeviceLatestSensorValues::from_json( - $json->latest_sensor_values - ) - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public DeviceLatestSensorValues $latest_sensor_values - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public DeviceLatestSensorValues $latest_sensor_values + ) { + } } diff --git a/src/Routes/Objects/DeviceModel.php b/src/Routes/Objects/DeviceModel.php index f5348e1f..018fefea 100644 --- a/src/Routes/Objects/DeviceModel.php +++ b/src/Routes/Objects/DeviceModel.php @@ -4,33 +4,34 @@ class DeviceModel { - public static function from_json(mixed $json): DeviceModel|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceModel|null + { + if (!$json) { + return null; + } + return new self( + display_name: $json->display_name, + manufacturer_display_name: $json->manufacturer_display_name, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, + has_built_in_keypad: $json->has_built_in_keypad ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? + null + ); } - return new self( - display_name: $json->display_name, - manufacturer_display_name: $json->manufacturer_display_name, - accessory_keypad_supported: $json->accessory_keypad_supported ?? - null, - can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? - null, - has_built_in_keypad: $json->has_built_in_keypad ?? null, - offline_access_codes_supported: $json->offline_access_codes_supported ?? - null, - online_access_codes_supported: $json->online_access_codes_supported ?? - null - ); - } - public function __construct( - public string $display_name, - public string $manufacturer_display_name, - public bool|null $accessory_keypad_supported, - public bool|null $can_connect_accessory_keypad, - public bool|null $has_built_in_keypad, - public bool|null $offline_access_codes_supported, - public bool|null $online_access_codes_supported - ) {} + public function __construct( + public string $display_name, + public string $manufacturer_display_name, + public bool|null $accessory_keypad_supported, + public bool|null $can_connect_accessory_keypad, + public bool|null $has_built_in_keypad, + public bool|null $offline_access_codes_supported, + public bool|null $online_access_codes_supported + ) { + } } diff --git a/src/Routes/Objects/DeviceNestMetadata.php b/src/Routes/Objects/DeviceNestMetadata.php index a7c984a4..7ca6aa41 100644 --- a/src/Routes/Objects/DeviceNestMetadata.php +++ b/src/Routes/Objects/DeviceNestMetadata.php @@ -4,23 +4,24 @@ class DeviceNestMetadata { - public static function from_json(mixed $json): DeviceNestMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceNestMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_custom_name: $json->device_custom_name, + device_name: $json->device_name, + nest_device_id: $json->nest_device_id, + display_name: $json->display_name ?? null + ); } - return new self( - device_custom_name: $json->device_custom_name, - device_name: $json->device_name, - nest_device_id: $json->nest_device_id, - display_name: $json->display_name ?? null - ); - } - public function __construct( - public string $device_custom_name, - public string $device_name, - public string $nest_device_id, - public string|null $display_name - ) {} + public function __construct( + public string $device_custom_name, + public string $device_name, + public string $nest_device_id, + public string|null $display_name + ) { + } } diff --git a/src/Routes/Objects/DeviceNoiseawareMetadata.php b/src/Routes/Objects/DeviceNoiseawareMetadata.php index 7c526c07..77bc4bd8 100644 --- a/src/Routes/Objects/DeviceNoiseawareMetadata.php +++ b/src/Routes/Objects/DeviceNoiseawareMetadata.php @@ -4,25 +4,26 @@ class DeviceNoiseawareMetadata { - public static function from_json(mixed $json): DeviceNoiseawareMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceNoiseawareMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_model: $json->device_model, + device_name: $json->device_name, + noise_level_decibel: $json->noise_level_decibel, + noise_level_nrs: $json->noise_level_nrs + ); } - return new self( - device_id: $json->device_id, - device_model: $json->device_model, - device_name: $json->device_name, - noise_level_decibel: $json->noise_level_decibel, - noise_level_nrs: $json->noise_level_nrs - ); - } - public function __construct( - public string $device_id, - public string $device_model, - public string $device_name, - public float $noise_level_decibel, - public float $noise_level_nrs - ) {} + public function __construct( + public string $device_id, + public string $device_model, + public string $device_name, + public float $noise_level_decibel, + public float $noise_level_nrs + ) { + } } diff --git a/src/Routes/Objects/DeviceNukiMetadata.php b/src/Routes/Objects/DeviceNukiMetadata.php index 4e87e7e4..324f778f 100644 --- a/src/Routes/Objects/DeviceNukiMetadata.php +++ b/src/Routes/Objects/DeviceNukiMetadata.php @@ -4,25 +4,26 @@ class DeviceNukiMetadata { - public static function from_json(mixed $json): DeviceNukiMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceNukiMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + keypad_2_paired: $json->keypad_2_paired ?? null, + keypad_battery_critical: $json->keypad_battery_critical ?? null, + keypad_paired: $json->keypad_paired ?? null + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - keypad_2_paired: $json->keypad_2_paired ?? null, - keypad_battery_critical: $json->keypad_battery_critical ?? null, - keypad_paired: $json->keypad_paired ?? null - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public bool|null $keypad_2_paired, - public bool|null $keypad_battery_critical, - public bool|null $keypad_paired - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public bool|null $keypad_2_paired, + public bool|null $keypad_battery_critical, + public bool|null $keypad_paired + ) { + } } diff --git a/src/Routes/Objects/DevicePredefinedTimeSlots.php b/src/Routes/Objects/DevicePredefinedTimeSlots.php index b4d5f73f..7033638e 100644 --- a/src/Routes/Objects/DevicePredefinedTimeSlots.php +++ b/src/Routes/Objects/DevicePredefinedTimeSlots.php @@ -4,36 +4,37 @@ class DevicePredefinedTimeSlots { - public static function from_json( - mixed $json - ): DevicePredefinedTimeSlots|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DevicePredefinedTimeSlots|null { + if (!$json) { + return null; + } + return new self( + check_in_time: $json->check_in_time, + check_out_time: $json->check_out_time, + dormakaba_oracode_user_level_id: $json->dormakaba_oracode_user_level_id, + ext_dormakaba_oracode_user_level_prefix: $json->ext_dormakaba_oracode_user_level_prefix, + is_24_hour: $json->is_24_hour, + is_biweekly_mode: $json->is_biweekly_mode, + is_master: $json->is_master, + is_one_shot: $json->is_one_shot, + name: $json->name, + prefix: $json->prefix + ); } - return new self( - check_in_time: $json->check_in_time, - check_out_time: $json->check_out_time, - dormakaba_oracode_user_level_id: $json->dormakaba_oracode_user_level_id, - ext_dormakaba_oracode_user_level_prefix: $json->ext_dormakaba_oracode_user_level_prefix, - is_24_hour: $json->is_24_hour, - is_biweekly_mode: $json->is_biweekly_mode, - is_master: $json->is_master, - is_one_shot: $json->is_one_shot, - name: $json->name, - prefix: $json->prefix - ); - } - public function __construct( - public string $check_in_time, - public string $check_out_time, - public string $dormakaba_oracode_user_level_id, - public float $ext_dormakaba_oracode_user_level_prefix, - public bool $is_24_hour, - public bool $is_biweekly_mode, - public bool $is_master, - public bool $is_one_shot, - public string $name, - public float $prefix - ) {} + public function __construct( + public string $check_in_time, + public string $check_out_time, + public string $dormakaba_oracode_user_level_id, + public float $ext_dormakaba_oracode_user_level_prefix, + public bool $is_24_hour, + public bool $is_biweekly_mode, + public bool $is_master, + public bool $is_one_shot, + public string $name, + public float $prefix + ) { + } } diff --git a/src/Routes/Objects/DevicePressure.php b/src/Routes/Objects/DevicePressure.php index 69ec3481..b47c1625 100644 --- a/src/Routes/Objects/DevicePressure.php +++ b/src/Routes/Objects/DevicePressure.php @@ -4,13 +4,15 @@ class DevicePressure { - public static function from_json(mixed $json): DevicePressure|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DevicePressure|null + { + if (!$json) { + return null; + } + return new self(time: $json->time, value: $json->value); } - return new self(time: $json->time, value: $json->value); - } - public function __construct(public string $time, public float $value) {} + public function __construct(public string $time, public float $value) + { + } } diff --git a/src/Routes/Objects/DeviceProperties.php b/src/Routes/Objects/DeviceProperties.php index fcd5f79e..b4b499cc 100644 --- a/src/Routes/Objects/DeviceProperties.php +++ b/src/Routes/Objects/DeviceProperties.php @@ -4,330 +4,331 @@ class DeviceProperties { - public static function from_json(mixed $json): DeviceProperties|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceProperties|null + { + if (!$json) { + return null; + } + return new self( + appearance: DeviceAppearance::from_json($json->appearance), + model: DeviceModel::from_json($json->model), + name: $json->name, + online: $json->online, + _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? + null, + accessory_keypad: isset($json->accessory_keypad) + ? DeviceAccessoryKeypad::from_json($json->accessory_keypad) + : null, + active_thermostat_schedule: isset($json->active_thermostat_schedule) + ? DeviceActiveThermostatSchedule::from_json( + $json->active_thermostat_schedule + ) + : null, + akiles_metadata: isset($json->akiles_metadata) + ? DeviceAkilesMetadata::from_json($json->akiles_metadata) + : null, + assa_abloy_credential_service_metadata: isset( + $json->assa_abloy_credential_service_metadata + ) + ? DeviceAssaAbloyCredentialServiceMetadata::from_json( + $json->assa_abloy_credential_service_metadata + ) + : null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? DeviceAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + august_metadata: isset($json->august_metadata) + ? DeviceAugustMetadata::from_json($json->august_metadata) + : null, + available_climate_presets: array_map( + fn($a) => DeviceAvailableClimatePresets::from_json($a), + $json->available_climate_presets ?? [] + ), + available_fan_mode_settings: $json->available_fan_mode_settings ?? + null, + available_hvac_mode_settings: $json->available_hvac_mode_settings ?? + null, + avigilon_alta_metadata: isset($json->avigilon_alta_metadata) + ? DeviceAvigilonAltaMetadata::from_json( + $json->avigilon_alta_metadata + ) + : null, + battery: isset($json->battery) + ? DeviceBattery::from_json($json->battery) + : null, + battery_level: $json->battery_level ?? null, + brivo_metadata: isset($json->brivo_metadata) + ? DeviceBrivoMetadata::from_json($json->brivo_metadata) + : null, + code_constraints: array_map( + fn($c) => DeviceCodeConstraints::from_json($c), + $json->code_constraints ?? [] + ), + controlbyweb_metadata: isset($json->controlbyweb_metadata) + ? DeviceControlbywebMetadata::from_json( + $json->controlbyweb_metadata + ) + : null, + current_climate_setting: isset($json->current_climate_setting) + ? DeviceCurrentClimateSetting::from_json( + $json->current_climate_setting + ) + : null, + currently_triggering_noise_threshold_ids: $json->currently_triggering_noise_threshold_ids ?? + null, + default_climate_setting: isset($json->default_climate_setting) + ? DeviceDefaultClimateSetting::from_json( + $json->default_climate_setting + ) + : null, + door_open: $json->door_open ?? null, + dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) + ? DeviceDormakabaOracodeMetadata::from_json( + $json->dormakaba_oracode_metadata + ) + : null, + ecobee_metadata: isset($json->ecobee_metadata) + ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) + : null, + fan_mode_setting: $json->fan_mode_setting ?? null, + four_suites_metadata: isset($json->four_suites_metadata) + ? DeviceFourSuitesMetadata::from_json( + $json->four_suites_metadata + ) + : null, + genie_metadata: isset($json->genie_metadata) + ? DeviceGenieMetadata::from_json($json->genie_metadata) + : null, + has_direct_power: $json->has_direct_power ?? null, + has_native_entry_events: $json->has_native_entry_events ?? null, + honeywell_resideo_metadata: isset($json->honeywell_resideo_metadata) + ? DeviceHoneywellResideoMetadata::from_json( + $json->honeywell_resideo_metadata + ) + : null, + hubitat_metadata: isset($json->hubitat_metadata) + ? DeviceHubitatMetadata::from_json($json->hubitat_metadata) + : null, + igloo_metadata: isset($json->igloo_metadata) + ? DeviceIglooMetadata::from_json($json->igloo_metadata) + : null, + igloohome_metadata: isset($json->igloohome_metadata) + ? DeviceIgloohomeMetadata::from_json($json->igloohome_metadata) + : null, + image_alt_text: $json->image_alt_text ?? null, + image_url: $json->image_url ?? null, + is_cooling: $json->is_cooling ?? null, + is_fan_running: $json->is_fan_running ?? null, + is_heating: $json->is_heating ?? null, + is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? + null, + keypad_battery: isset($json->keypad_battery) + ? DeviceKeypadBattery::from_json($json->keypad_battery) + : null, + kwikset_metadata: isset($json->kwikset_metadata) + ? DeviceKwiksetMetadata::from_json($json->kwikset_metadata) + : null, + locked: $json->locked ?? null, + lockly_metadata: isset($json->lockly_metadata) + ? DeviceLocklyMetadata::from_json($json->lockly_metadata) + : null, + manufacturer: $json->manufacturer ?? null, + max_active_codes_supported: $json->max_active_codes_supported ?? + null, + max_cooling_set_point_celsius: $json->max_cooling_set_point_celsius ?? + null, + max_cooling_set_point_fahrenheit: $json->max_cooling_set_point_fahrenheit ?? + null, + max_heating_set_point_celsius: $json->max_heating_set_point_celsius ?? + null, + max_heating_set_point_fahrenheit: $json->max_heating_set_point_fahrenheit ?? + null, + min_cooling_set_point_celsius: $json->min_cooling_set_point_celsius ?? + null, + min_cooling_set_point_fahrenheit: $json->min_cooling_set_point_fahrenheit ?? + null, + min_heating_cooling_delta_celsius: $json->min_heating_cooling_delta_celsius ?? + null, + min_heating_cooling_delta_fahrenheit: $json->min_heating_cooling_delta_fahrenheit ?? + null, + min_heating_set_point_celsius: $json->min_heating_set_point_celsius ?? + null, + min_heating_set_point_fahrenheit: $json->min_heating_set_point_fahrenheit ?? + null, + minut_metadata: isset($json->minut_metadata) + ? DeviceMinutMetadata::from_json($json->minut_metadata) + : null, + nest_metadata: isset($json->nest_metadata) + ? DeviceNestMetadata::from_json($json->nest_metadata) + : null, + noise_level_decibels: $json->noise_level_decibels ?? null, + noiseaware_metadata: isset($json->noiseaware_metadata) + ? DeviceNoiseawareMetadata::from_json( + $json->noiseaware_metadata + ) + : null, + nuki_metadata: isset($json->nuki_metadata) + ? DeviceNukiMetadata::from_json($json->nuki_metadata) + : null, + offline_access_codes_enabled: $json->offline_access_codes_enabled ?? + null, + online_access_codes_enabled: $json->online_access_codes_enabled ?? + null, + relative_humidity: $json->relative_humidity ?? null, + salto_ks_metadata: isset($json->salto_ks_metadata) + ? DeviceSaltoKsMetadata::from_json($json->salto_ks_metadata) + : null, + salto_metadata: isset($json->salto_metadata) + ? DeviceSaltoMetadata::from_json($json->salto_metadata) + : null, + salto_space_credential_service_metadata: isset( + $json->salto_space_credential_service_metadata + ) + ? DeviceSaltoSpaceCredentialServiceMetadata::from_json( + $json->salto_space_credential_service_metadata + ) + : null, + schlage_metadata: isset($json->schlage_metadata) + ? DeviceSchlageMetadata::from_json($json->schlage_metadata) + : null, + seam_bridge_metadata: isset($json->seam_bridge_metadata) + ? DeviceSeamBridgeMetadata::from_json( + $json->seam_bridge_metadata + ) + : null, + serial_number: $json->serial_number ?? null, + smartthings_metadata: isset($json->smartthings_metadata) + ? DeviceSmartthingsMetadata::from_json( + $json->smartthings_metadata + ) + : null, + supported_code_lengths: $json->supported_code_lengths ?? null, + supports_accessory_keypad: $json->supports_accessory_keypad ?? null, + supports_backup_access_code_pool: $json->supports_backup_access_code_pool ?? + null, + supports_offline_access_codes: $json->supports_offline_access_codes ?? + null, + tado_metadata: isset($json->tado_metadata) + ? DeviceTadoMetadata::from_json($json->tado_metadata) + : null, + tedee_metadata: isset($json->tedee_metadata) + ? DeviceTedeeMetadata::from_json($json->tedee_metadata) + : null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + temperature_threshold: isset($json->temperature_threshold) + ? DeviceTemperatureThreshold::from_json( + $json->temperature_threshold + ) + : null, + ttlock_metadata: isset($json->ttlock_metadata) + ? DeviceTtlockMetadata::from_json($json->ttlock_metadata) + : null, + two_n_metadata: isset($json->two_n_metadata) + ? DeviceTwoNMetadata::from_json($json->two_n_metadata) + : null, + visionline_metadata: isset($json->visionline_metadata) + ? DeviceVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + wyze_metadata: isset($json->wyze_metadata) + ? DeviceWyzeMetadata::from_json($json->wyze_metadata) + : null, + fallback_climate_preset_key: $json->fallback_climate_preset_key ?? + null + ); } - return new self( - appearance: DeviceAppearance::from_json($json->appearance), - model: DeviceModel::from_json($json->model), - name: $json->name, - online: $json->online, - _experimental_supported_code_from_access_codes_lengths: $json->_experimental_supported_code_from_access_codes_lengths ?? - null, - accessory_keypad: isset($json->accessory_keypad) - ? DeviceAccessoryKeypad::from_json($json->accessory_keypad) - : null, - active_thermostat_schedule: isset($json->active_thermostat_schedule) - ? DeviceActiveThermostatSchedule::from_json( - $json->active_thermostat_schedule - ) - : null, - akiles_metadata: isset($json->akiles_metadata) - ? DeviceAkilesMetadata::from_json($json->akiles_metadata) - : null, - assa_abloy_credential_service_metadata: isset( - $json->assa_abloy_credential_service_metadata - ) - ? DeviceAssaAbloyCredentialServiceMetadata::from_json( - $json->assa_abloy_credential_service_metadata - ) - : null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? DeviceAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - august_metadata: isset($json->august_metadata) - ? DeviceAugustMetadata::from_json($json->august_metadata) - : null, - available_climate_presets: array_map( - fn($a) => DeviceAvailableClimatePresets::from_json($a), - $json->available_climate_presets ?? [] - ), - available_fan_mode_settings: $json->available_fan_mode_settings ?? - null, - available_hvac_mode_settings: $json->available_hvac_mode_settings ?? - null, - avigilon_alta_metadata: isset($json->avigilon_alta_metadata) - ? DeviceAvigilonAltaMetadata::from_json( - $json->avigilon_alta_metadata - ) - : null, - battery: isset($json->battery) - ? DeviceBattery::from_json($json->battery) - : null, - battery_level: $json->battery_level ?? null, - brivo_metadata: isset($json->brivo_metadata) - ? DeviceBrivoMetadata::from_json($json->brivo_metadata) - : null, - code_constraints: array_map( - fn($c) => DeviceCodeConstraints::from_json($c), - $json->code_constraints ?? [] - ), - controlbyweb_metadata: isset($json->controlbyweb_metadata) - ? DeviceControlbywebMetadata::from_json( - $json->controlbyweb_metadata - ) - : null, - current_climate_setting: isset($json->current_climate_setting) - ? DeviceCurrentClimateSetting::from_json( - $json->current_climate_setting - ) - : null, - currently_triggering_noise_threshold_ids: $json->currently_triggering_noise_threshold_ids ?? - null, - default_climate_setting: isset($json->default_climate_setting) - ? DeviceDefaultClimateSetting::from_json( - $json->default_climate_setting - ) - : null, - door_open: $json->door_open ?? null, - dormakaba_oracode_metadata: isset($json->dormakaba_oracode_metadata) - ? DeviceDormakabaOracodeMetadata::from_json( - $json->dormakaba_oracode_metadata - ) - : null, - ecobee_metadata: isset($json->ecobee_metadata) - ? DeviceEcobeeMetadata::from_json($json->ecobee_metadata) - : null, - fan_mode_setting: $json->fan_mode_setting ?? null, - four_suites_metadata: isset($json->four_suites_metadata) - ? DeviceFourSuitesMetadata::from_json( - $json->four_suites_metadata - ) - : null, - genie_metadata: isset($json->genie_metadata) - ? DeviceGenieMetadata::from_json($json->genie_metadata) - : null, - has_direct_power: $json->has_direct_power ?? null, - has_native_entry_events: $json->has_native_entry_events ?? null, - honeywell_resideo_metadata: isset($json->honeywell_resideo_metadata) - ? DeviceHoneywellResideoMetadata::from_json( - $json->honeywell_resideo_metadata - ) - : null, - hubitat_metadata: isset($json->hubitat_metadata) - ? DeviceHubitatMetadata::from_json($json->hubitat_metadata) - : null, - igloo_metadata: isset($json->igloo_metadata) - ? DeviceIglooMetadata::from_json($json->igloo_metadata) - : null, - igloohome_metadata: isset($json->igloohome_metadata) - ? DeviceIgloohomeMetadata::from_json($json->igloohome_metadata) - : null, - image_alt_text: $json->image_alt_text ?? null, - image_url: $json->image_url ?? null, - is_cooling: $json->is_cooling ?? null, - is_fan_running: $json->is_fan_running ?? null, - is_heating: $json->is_heating ?? null, - is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? - null, - keypad_battery: isset($json->keypad_battery) - ? DeviceKeypadBattery::from_json($json->keypad_battery) - : null, - kwikset_metadata: isset($json->kwikset_metadata) - ? DeviceKwiksetMetadata::from_json($json->kwikset_metadata) - : null, - locked: $json->locked ?? null, - lockly_metadata: isset($json->lockly_metadata) - ? DeviceLocklyMetadata::from_json($json->lockly_metadata) - : null, - manufacturer: $json->manufacturer ?? null, - max_active_codes_supported: $json->max_active_codes_supported ?? - null, - max_cooling_set_point_celsius: $json->max_cooling_set_point_celsius ?? - null, - max_cooling_set_point_fahrenheit: $json->max_cooling_set_point_fahrenheit ?? - null, - max_heating_set_point_celsius: $json->max_heating_set_point_celsius ?? - null, - max_heating_set_point_fahrenheit: $json->max_heating_set_point_fahrenheit ?? - null, - min_cooling_set_point_celsius: $json->min_cooling_set_point_celsius ?? - null, - min_cooling_set_point_fahrenheit: $json->min_cooling_set_point_fahrenheit ?? - null, - min_heating_cooling_delta_celsius: $json->min_heating_cooling_delta_celsius ?? - null, - min_heating_cooling_delta_fahrenheit: $json->min_heating_cooling_delta_fahrenheit ?? - null, - min_heating_set_point_celsius: $json->min_heating_set_point_celsius ?? - null, - min_heating_set_point_fahrenheit: $json->min_heating_set_point_fahrenheit ?? - null, - minut_metadata: isset($json->minut_metadata) - ? DeviceMinutMetadata::from_json($json->minut_metadata) - : null, - nest_metadata: isset($json->nest_metadata) - ? DeviceNestMetadata::from_json($json->nest_metadata) - : null, - noise_level_decibels: $json->noise_level_decibels ?? null, - noiseaware_metadata: isset($json->noiseaware_metadata) - ? DeviceNoiseawareMetadata::from_json( - $json->noiseaware_metadata - ) - : null, - nuki_metadata: isset($json->nuki_metadata) - ? DeviceNukiMetadata::from_json($json->nuki_metadata) - : null, - offline_access_codes_enabled: $json->offline_access_codes_enabled ?? - null, - online_access_codes_enabled: $json->online_access_codes_enabled ?? - null, - relative_humidity: $json->relative_humidity ?? null, - salto_ks_metadata: isset($json->salto_ks_metadata) - ? DeviceSaltoKsMetadata::from_json($json->salto_ks_metadata) - : null, - salto_metadata: isset($json->salto_metadata) - ? DeviceSaltoMetadata::from_json($json->salto_metadata) - : null, - salto_space_credential_service_metadata: isset( - $json->salto_space_credential_service_metadata - ) - ? DeviceSaltoSpaceCredentialServiceMetadata::from_json( - $json->salto_space_credential_service_metadata - ) - : null, - schlage_metadata: isset($json->schlage_metadata) - ? DeviceSchlageMetadata::from_json($json->schlage_metadata) - : null, - seam_bridge_metadata: isset($json->seam_bridge_metadata) - ? DeviceSeamBridgeMetadata::from_json( - $json->seam_bridge_metadata - ) - : null, - serial_number: $json->serial_number ?? null, - smartthings_metadata: isset($json->smartthings_metadata) - ? DeviceSmartthingsMetadata::from_json( - $json->smartthings_metadata - ) - : null, - supported_code_lengths: $json->supported_code_lengths ?? null, - supports_accessory_keypad: $json->supports_accessory_keypad ?? null, - supports_backup_access_code_pool: $json->supports_backup_access_code_pool ?? - null, - supports_offline_access_codes: $json->supports_offline_access_codes ?? - null, - tado_metadata: isset($json->tado_metadata) - ? DeviceTadoMetadata::from_json($json->tado_metadata) - : null, - tedee_metadata: isset($json->tedee_metadata) - ? DeviceTedeeMetadata::from_json($json->tedee_metadata) - : null, - temperature_celsius: $json->temperature_celsius ?? null, - temperature_fahrenheit: $json->temperature_fahrenheit ?? null, - temperature_threshold: isset($json->temperature_threshold) - ? DeviceTemperatureThreshold::from_json( - $json->temperature_threshold - ) - : null, - ttlock_metadata: isset($json->ttlock_metadata) - ? DeviceTtlockMetadata::from_json($json->ttlock_metadata) - : null, - two_n_metadata: isset($json->two_n_metadata) - ? DeviceTwoNMetadata::from_json($json->two_n_metadata) - : null, - visionline_metadata: isset($json->visionline_metadata) - ? DeviceVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - wyze_metadata: isset($json->wyze_metadata) - ? DeviceWyzeMetadata::from_json($json->wyze_metadata) - : null, - fallback_climate_preset_key: $json->fallback_climate_preset_key ?? - null - ); - } - public function __construct( - public DeviceAppearance $appearance, - public DeviceModel $model, - public string $name, - public bool $online, - public array|null $_experimental_supported_code_from_access_codes_lengths, - public DeviceAccessoryKeypad|null $accessory_keypad, - public DeviceActiveThermostatSchedule|null $active_thermostat_schedule, - public DeviceAkilesMetadata|null $akiles_metadata, - public DeviceAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, - public DeviceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public DeviceAugustMetadata|null $august_metadata, - public array|null $available_climate_presets, - public array|null $available_fan_mode_settings, - public array|null $available_hvac_mode_settings, - public DeviceAvigilonAltaMetadata|null $avigilon_alta_metadata, - public DeviceBattery|null $battery, - public float|null $battery_level, - public DeviceBrivoMetadata|null $brivo_metadata, - public array|null $code_constraints, - public DeviceControlbywebMetadata|null $controlbyweb_metadata, - public DeviceCurrentClimateSetting|null $current_climate_setting, - public array|null $currently_triggering_noise_threshold_ids, - public DeviceDefaultClimateSetting|null $default_climate_setting, - public bool|null $door_open, - public DeviceDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, - public DeviceEcobeeMetadata|null $ecobee_metadata, - public string|null $fan_mode_setting, - public DeviceFourSuitesMetadata|null $four_suites_metadata, - public DeviceGenieMetadata|null $genie_metadata, - public bool|null $has_direct_power, - public bool|null $has_native_entry_events, - public DeviceHoneywellResideoMetadata|null $honeywell_resideo_metadata, - public DeviceHubitatMetadata|null $hubitat_metadata, - public DeviceIglooMetadata|null $igloo_metadata, - public DeviceIgloohomeMetadata|null $igloohome_metadata, - public string|null $image_alt_text, - public string|null $image_url, - public bool|null $is_cooling, - public bool|null $is_fan_running, - public bool|null $is_heating, - public bool|null $is_temporary_manual_override_active, - public DeviceKeypadBattery|null $keypad_battery, - public DeviceKwiksetMetadata|null $kwikset_metadata, - public bool|null $locked, - public DeviceLocklyMetadata|null $lockly_metadata, - public string|null $manufacturer, - public float|null $max_active_codes_supported, - public float|null $max_cooling_set_point_celsius, - public float|null $max_cooling_set_point_fahrenheit, - public float|null $max_heating_set_point_celsius, - public float|null $max_heating_set_point_fahrenheit, - public float|null $min_cooling_set_point_celsius, - public float|null $min_cooling_set_point_fahrenheit, - public float|null $min_heating_cooling_delta_celsius, - public float|null $min_heating_cooling_delta_fahrenheit, - public float|null $min_heating_set_point_celsius, - public float|null $min_heating_set_point_fahrenheit, - public DeviceMinutMetadata|null $minut_metadata, - public DeviceNestMetadata|null $nest_metadata, - public float|null $noise_level_decibels, - public DeviceNoiseawareMetadata|null $noiseaware_metadata, - public DeviceNukiMetadata|null $nuki_metadata, - public bool|null $offline_access_codes_enabled, - public bool|null $online_access_codes_enabled, - public float|null $relative_humidity, - public DeviceSaltoKsMetadata|null $salto_ks_metadata, - public DeviceSaltoMetadata|null $salto_metadata, - public DeviceSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata, - public DeviceSchlageMetadata|null $schlage_metadata, - public DeviceSeamBridgeMetadata|null $seam_bridge_metadata, - public string|null $serial_number, - public DeviceSmartthingsMetadata|null $smartthings_metadata, - public array|null $supported_code_lengths, - public bool|null $supports_accessory_keypad, - public bool|null $supports_backup_access_code_pool, - public bool|null $supports_offline_access_codes, - public DeviceTadoMetadata|null $tado_metadata, - public DeviceTedeeMetadata|null $tedee_metadata, - public float|null $temperature_celsius, - public float|null $temperature_fahrenheit, - public DeviceTemperatureThreshold|null $temperature_threshold, - public DeviceTtlockMetadata|null $ttlock_metadata, - public DeviceTwoNMetadata|null $two_n_metadata, - public DeviceVisionlineMetadata|null $visionline_metadata, - public DeviceWyzeMetadata|null $wyze_metadata, - public string|null $fallback_climate_preset_key - ) {} + public function __construct( + public DeviceAppearance $appearance, + public DeviceModel $model, + public string $name, + public bool $online, + public array|null $_experimental_supported_code_from_access_codes_lengths, + public DeviceAccessoryKeypad|null $accessory_keypad, + public DeviceActiveThermostatSchedule|null $active_thermostat_schedule, + public DeviceAkilesMetadata|null $akiles_metadata, + public DeviceAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, + public DeviceAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public DeviceAugustMetadata|null $august_metadata, + public array|null $available_climate_presets, + public array|null $available_fan_mode_settings, + public array|null $available_hvac_mode_settings, + public DeviceAvigilonAltaMetadata|null $avigilon_alta_metadata, + public DeviceBattery|null $battery, + public float|null $battery_level, + public DeviceBrivoMetadata|null $brivo_metadata, + public array|null $code_constraints, + public DeviceControlbywebMetadata|null $controlbyweb_metadata, + public DeviceCurrentClimateSetting|null $current_climate_setting, + public array|null $currently_triggering_noise_threshold_ids, + public DeviceDefaultClimateSetting|null $default_climate_setting, + public bool|null $door_open, + public DeviceDormakabaOracodeMetadata|null $dormakaba_oracode_metadata, + public DeviceEcobeeMetadata|null $ecobee_metadata, + public string|null $fan_mode_setting, + public DeviceFourSuitesMetadata|null $four_suites_metadata, + public DeviceGenieMetadata|null $genie_metadata, + public bool|null $has_direct_power, + public bool|null $has_native_entry_events, + public DeviceHoneywellResideoMetadata|null $honeywell_resideo_metadata, + public DeviceHubitatMetadata|null $hubitat_metadata, + public DeviceIglooMetadata|null $igloo_metadata, + public DeviceIgloohomeMetadata|null $igloohome_metadata, + public string|null $image_alt_text, + public string|null $image_url, + public bool|null $is_cooling, + public bool|null $is_fan_running, + public bool|null $is_heating, + public bool|null $is_temporary_manual_override_active, + public DeviceKeypadBattery|null $keypad_battery, + public DeviceKwiksetMetadata|null $kwikset_metadata, + public bool|null $locked, + public DeviceLocklyMetadata|null $lockly_metadata, + public string|null $manufacturer, + public float|null $max_active_codes_supported, + public float|null $max_cooling_set_point_celsius, + public float|null $max_cooling_set_point_fahrenheit, + public float|null $max_heating_set_point_celsius, + public float|null $max_heating_set_point_fahrenheit, + public float|null $min_cooling_set_point_celsius, + public float|null $min_cooling_set_point_fahrenheit, + public float|null $min_heating_cooling_delta_celsius, + public float|null $min_heating_cooling_delta_fahrenheit, + public float|null $min_heating_set_point_celsius, + public float|null $min_heating_set_point_fahrenheit, + public DeviceMinutMetadata|null $minut_metadata, + public DeviceNestMetadata|null $nest_metadata, + public float|null $noise_level_decibels, + public DeviceNoiseawareMetadata|null $noiseaware_metadata, + public DeviceNukiMetadata|null $nuki_metadata, + public bool|null $offline_access_codes_enabled, + public bool|null $online_access_codes_enabled, + public float|null $relative_humidity, + public DeviceSaltoKsMetadata|null $salto_ks_metadata, + public DeviceSaltoMetadata|null $salto_metadata, + public DeviceSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata, + public DeviceSchlageMetadata|null $schlage_metadata, + public DeviceSeamBridgeMetadata|null $seam_bridge_metadata, + public string|null $serial_number, + public DeviceSmartthingsMetadata|null $smartthings_metadata, + public array|null $supported_code_lengths, + public bool|null $supports_accessory_keypad, + public bool|null $supports_backup_access_code_pool, + public bool|null $supports_offline_access_codes, + public DeviceTadoMetadata|null $tado_metadata, + public DeviceTedeeMetadata|null $tedee_metadata, + public float|null $temperature_celsius, + public float|null $temperature_fahrenheit, + public DeviceTemperatureThreshold|null $temperature_threshold, + public DeviceTtlockMetadata|null $ttlock_metadata, + public DeviceTwoNMetadata|null $two_n_metadata, + public DeviceVisionlineMetadata|null $visionline_metadata, + public DeviceWyzeMetadata|null $wyze_metadata, + public string|null $fallback_climate_preset_key + ) { + } } diff --git a/src/Routes/Objects/DeviceProvider.php b/src/Routes/Objects/DeviceProvider.php index 92aa892a..d099cbb9 100644 --- a/src/Routes/Objects/DeviceProvider.php +++ b/src/Routes/Objects/DeviceProvider.php @@ -4,48 +4,49 @@ class DeviceProvider { - public static function from_json(mixed $json): DeviceProvider|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceProvider|null + { + if (!$json) { + return null; + } + return new self( + device_provider_name: $json->device_provider_name, + display_name: $json->display_name, + image_url: $json->image_url, + provider_categories: $json->provider_categories, + 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, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, + can_remotely_lock: $json->can_remotely_lock ?? null, + can_remotely_unlock: $json->can_remotely_unlock ?? null, + can_simulate_connection: $json->can_simulate_connection ?? null, + can_simulate_disconnection: $json->can_simulate_disconnection ?? + null, + can_simulate_removal: $json->can_simulate_removal ?? null, + can_turn_off_hvac: $json->can_turn_off_hvac ?? null + ); } - return new self( - device_provider_name: $json->device_provider_name, - display_name: $json->display_name, - image_url: $json->image_url, - provider_categories: $json->provider_categories, - 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, - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? - null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? - null, - can_remotely_lock: $json->can_remotely_lock ?? null, - can_remotely_unlock: $json->can_remotely_unlock ?? null, - can_simulate_connection: $json->can_simulate_connection ?? null, - can_simulate_disconnection: $json->can_simulate_disconnection ?? - null, - can_simulate_removal: $json->can_simulate_removal ?? null, - can_turn_off_hvac: $json->can_turn_off_hvac ?? null - ); - } - public function __construct( - public string $device_provider_name, - public string $display_name, - public string $image_url, - public array $provider_categories, - public bool|null $can_hvac_cool, - public bool|null $can_hvac_heat, - public bool|null $can_hvac_heat_cool, - public bool|null $can_program_offline_access_codes, - public bool|null $can_program_online_access_codes, - public bool|null $can_remotely_lock, - public bool|null $can_remotely_unlock, - public bool|null $can_simulate_connection, - public bool|null $can_simulate_disconnection, - public bool|null $can_simulate_removal, - public bool|null $can_turn_off_hvac - ) {} + public function __construct( + public string $device_provider_name, + public string $display_name, + public string $image_url, + public array $provider_categories, + public bool|null $can_hvac_cool, + public bool|null $can_hvac_heat, + public bool|null $can_hvac_heat_cool, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_connection, + public bool|null $can_simulate_disconnection, + public bool|null $can_simulate_removal, + public bool|null $can_turn_off_hvac + ) { + } } diff --git a/src/Routes/Objects/DeviceSaltoKsMetadata.php b/src/Routes/Objects/DeviceSaltoKsMetadata.php index 0e91a223..b551ae16 100644 --- a/src/Routes/Objects/DeviceSaltoKsMetadata.php +++ b/src/Routes/Objects/DeviceSaltoKsMetadata.php @@ -4,27 +4,28 @@ class DeviceSaltoKsMetadata { - public static function from_json(mixed $json): DeviceSaltoKsMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceSaltoKsMetadata|null + { + if (!$json) { + return null; + } + return new self( + battery_level: $json->battery_level, + customer_reference: $json->customer_reference, + lock_id: $json->lock_id, + lock_type: $json->lock_type, + locked_state: $json->locked_state, + model: $json->model ?? null + ); } - return new self( - battery_level: $json->battery_level, - customer_reference: $json->customer_reference, - lock_id: $json->lock_id, - lock_type: $json->lock_type, - locked_state: $json->locked_state, - model: $json->model ?? null - ); - } - public function __construct( - public string $battery_level, - public string $customer_reference, - public string $lock_id, - public string $lock_type, - public string $locked_state, - public string|null $model - ) {} + public function __construct( + public string $battery_level, + public string $customer_reference, + public string $lock_id, + public string $lock_type, + public string $locked_state, + public string|null $model + ) { + } } diff --git a/src/Routes/Objects/DeviceSaltoMetadata.php b/src/Routes/Objects/DeviceSaltoMetadata.php index 3c9fd629..a281936d 100644 --- a/src/Routes/Objects/DeviceSaltoMetadata.php +++ b/src/Routes/Objects/DeviceSaltoMetadata.php @@ -4,27 +4,28 @@ class DeviceSaltoMetadata { - public static function from_json(mixed $json): DeviceSaltoMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceSaltoMetadata|null + { + if (!$json) { + return null; + } + return new self( + battery_level: $json->battery_level, + customer_reference: $json->customer_reference, + lock_id: $json->lock_id, + lock_type: $json->lock_type, + locked_state: $json->locked_state, + model: $json->model ?? null + ); } - return new self( - battery_level: $json->battery_level, - customer_reference: $json->customer_reference, - lock_id: $json->lock_id, - lock_type: $json->lock_type, - locked_state: $json->locked_state, - model: $json->model ?? null - ); - } - public function __construct( - public string $battery_level, - public string $customer_reference, - public string $lock_id, - public string $lock_type, - public string $locked_state, - public string|null $model - ) {} + public function __construct( + public string $battery_level, + public string $customer_reference, + public string $lock_id, + public string $lock_type, + public string $locked_state, + public string|null $model + ) { + } } diff --git a/src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php b/src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php index 38224c03..2dbe8e83 100644 --- a/src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php +++ b/src/Routes/Objects/DeviceSaltoSpaceCredentialServiceMetadata.php @@ -4,14 +4,16 @@ class DeviceSaltoSpaceCredentialServiceMetadata { - public static function from_json( - mixed $json - ): DeviceSaltoSpaceCredentialServiceMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceSaltoSpaceCredentialServiceMetadata|null { + if (!$json) { + return null; + } + return new self(has_active_phone: $json->has_active_phone); } - return new self(has_active_phone: $json->has_active_phone); - } - public function __construct(public bool $has_active_phone) {} + public function __construct(public bool $has_active_phone) + { + } } diff --git a/src/Routes/Objects/DeviceSchlageMetadata.php b/src/Routes/Objects/DeviceSchlageMetadata.php index 9301f752..046cd985 100644 --- a/src/Routes/Objects/DeviceSchlageMetadata.php +++ b/src/Routes/Objects/DeviceSchlageMetadata.php @@ -4,23 +4,24 @@ class DeviceSchlageMetadata { - public static function from_json(mixed $json): DeviceSchlageMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceSchlageMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + model: $json->model ?? null, + access_code_length: $json->access_code_length ?? null + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - model: $json->model ?? null, - access_code_length: $json->access_code_length ?? null - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public string|null $model, - public float|null $access_code_length - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public string|null $model, + public float|null $access_code_length + ) { + } } diff --git a/src/Routes/Objects/DeviceSeamBridgeMetadata.php b/src/Routes/Objects/DeviceSeamBridgeMetadata.php index da836870..c37afb9e 100644 --- a/src/Routes/Objects/DeviceSeamBridgeMetadata.php +++ b/src/Routes/Objects/DeviceSeamBridgeMetadata.php @@ -4,21 +4,22 @@ class DeviceSeamBridgeMetadata { - public static function from_json(mixed $json): DeviceSeamBridgeMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceSeamBridgeMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_num: $json->device_num, + name: $json->name, + unlock_method: $json->unlock_method ?? null + ); } - return new self( - device_num: $json->device_num, - name: $json->name, - unlock_method: $json->unlock_method ?? null - ); - } - public function __construct( - public float $device_num, - public string $name, - public string|null $unlock_method - ) {} + public function __construct( + public float $device_num, + public string $name, + public string|null $unlock_method + ) { + } } diff --git a/src/Routes/Objects/DeviceSmartthingsMetadata.php b/src/Routes/Objects/DeviceSmartthingsMetadata.php index a31c1eec..8da4d7d1 100644 --- a/src/Routes/Objects/DeviceSmartthingsMetadata.php +++ b/src/Routes/Objects/DeviceSmartthingsMetadata.php @@ -4,24 +4,25 @@ class DeviceSmartthingsMetadata { - public static function from_json( - mixed $json - ): DeviceSmartthingsMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceSmartthingsMetadata|null { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name, + location_id: $json->location_id ?? null, + model: $json->model ?? null + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name, - location_id: $json->location_id ?? null, - model: $json->model ?? null - ); - } - public function __construct( - public string $device_id, - public string $device_name, - public string|null $location_id, - public string|null $model - ) {} + public function __construct( + public string $device_id, + public string $device_name, + public string|null $location_id, + public string|null $model + ) { + } } diff --git a/src/Routes/Objects/DeviceSound.php b/src/Routes/Objects/DeviceSound.php index cc3e4d43..24d02102 100644 --- a/src/Routes/Objects/DeviceSound.php +++ b/src/Routes/Objects/DeviceSound.php @@ -4,13 +4,15 @@ class DeviceSound { - public static function from_json(mixed $json): DeviceSound|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceSound|null + { + if (!$json) { + return null; + } + return new self(time: $json->time, value: $json->value); } - return new self(time: $json->time, value: $json->value); - } - public function __construct(public string $time, public float $value) {} + public function __construct(public string $time, public float $value) + { + } } diff --git a/src/Routes/Objects/DeviceTadoMetadata.php b/src/Routes/Objects/DeviceTadoMetadata.php index d3430356..8066e8ad 100644 --- a/src/Routes/Objects/DeviceTadoMetadata.php +++ b/src/Routes/Objects/DeviceTadoMetadata.php @@ -4,19 +4,20 @@ class DeviceTadoMetadata { - public static function from_json(mixed $json): DeviceTadoMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceTadoMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_type: $json->device_type, + serial_no: $json->serial_no + ); } - return new self( - device_type: $json->device_type, - serial_no: $json->serial_no - ); - } - public function __construct( - public string $device_type, - public string $serial_no - ) {} + public function __construct( + public string $device_type, + public string $serial_no + ) { + } } diff --git a/src/Routes/Objects/DeviceTedeeMetadata.php b/src/Routes/Objects/DeviceTedeeMetadata.php index 4dc3ba7b..febd7d2e 100644 --- a/src/Routes/Objects/DeviceTedeeMetadata.php +++ b/src/Routes/Objects/DeviceTedeeMetadata.php @@ -4,29 +4,30 @@ class DeviceTedeeMetadata { - public static function from_json(mixed $json): DeviceTedeeMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceTedeeMetadata|null + { + if (!$json) { + return null; + } + return new self( + bridge_id: $json->bridge_id, + bridge_name: $json->bridge_name, + device_id: $json->device_id, + device_model: $json->device_model, + device_name: $json->device_name, + serial_number: $json->serial_number, + keypad_id: $json->keypad_id ?? null + ); } - return new self( - bridge_id: $json->bridge_id, - bridge_name: $json->bridge_name, - device_id: $json->device_id, - device_model: $json->device_model, - device_name: $json->device_name, - serial_number: $json->serial_number, - keypad_id: $json->keypad_id ?? null - ); - } - public function __construct( - public float $bridge_id, - public string $bridge_name, - public float $device_id, - public string $device_model, - public string $device_name, - public string $serial_number, - public float|null $keypad_id - ) {} + public function __construct( + public float $bridge_id, + public string $bridge_name, + public float $device_id, + public string $device_model, + public string $device_name, + public string $serial_number, + public float|null $keypad_id + ) { + } } diff --git a/src/Routes/Objects/DeviceTemperature.php b/src/Routes/Objects/DeviceTemperature.php index 4298b1ea..a8775219 100644 --- a/src/Routes/Objects/DeviceTemperature.php +++ b/src/Routes/Objects/DeviceTemperature.php @@ -4,13 +4,15 @@ class DeviceTemperature { - public static function from_json(mixed $json): DeviceTemperature|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceTemperature|null + { + if (!$json) { + return null; + } + return new self(time: $json->time, value: $json->value); } - return new self(time: $json->time, value: $json->value); - } - public function __construct(public string $time, public float $value) {} + public function __construct(public string $time, public float $value) + { + } } diff --git a/src/Routes/Objects/DeviceTemperatureThreshold.php b/src/Routes/Objects/DeviceTemperatureThreshold.php index 989c4fc3..785c0416 100644 --- a/src/Routes/Objects/DeviceTemperatureThreshold.php +++ b/src/Routes/Objects/DeviceTemperatureThreshold.php @@ -4,24 +4,25 @@ class DeviceTemperatureThreshold { - public static function from_json( - mixed $json - ): DeviceTemperatureThreshold|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): DeviceTemperatureThreshold|null { + if (!$json) { + return null; + } + return new self( + lower_limit_celsius: $json->lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null + ); } - return new self( - lower_limit_celsius: $json->lower_limit_celsius ?? null, - lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, - upper_limit_celsius: $json->upper_limit_celsius ?? null, - upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null - ); - } - public function __construct( - public float|null $lower_limit_celsius, - public float|null $lower_limit_fahrenheit, - public float|null $upper_limit_celsius, - public float|null $upper_limit_fahrenheit - ) {} + public function __construct( + public float|null $lower_limit_celsius, + public float|null $lower_limit_fahrenheit, + public float|null $upper_limit_celsius, + public float|null $upper_limit_fahrenheit + ) { + } } diff --git a/src/Routes/Objects/DeviceTtlockMetadata.php b/src/Routes/Objects/DeviceTtlockMetadata.php index 0716e468..3d371189 100644 --- a/src/Routes/Objects/DeviceTtlockMetadata.php +++ b/src/Routes/Objects/DeviceTtlockMetadata.php @@ -4,30 +4,31 @@ class DeviceTtlockMetadata { - public static function from_json(mixed $json): DeviceTtlockMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceTtlockMetadata|null + { + if (!$json) { + return null; + } + return new self( + feature_value: $json->feature_value, + features: DeviceFeatures::from_json($json->features), + lock_alias: $json->lock_alias, + lock_id: $json->lock_id, + has_gateway: $json->has_gateway ?? null, + wireless_keypads: array_map( + fn($w) => DeviceWirelessKeypads::from_json($w), + $json->wireless_keypads ?? [] + ) + ); } - return new self( - feature_value: $json->feature_value, - features: DeviceFeatures::from_json($json->features), - lock_alias: $json->lock_alias, - lock_id: $json->lock_id, - has_gateway: $json->has_gateway ?? null, - wireless_keypads: array_map( - fn($w) => DeviceWirelessKeypads::from_json($w), - $json->wireless_keypads ?? [] - ) - ); - } - public function __construct( - public string $feature_value, - public DeviceFeatures $features, - public string $lock_alias, - public float $lock_id, - public bool|null $has_gateway, - public array|null $wireless_keypads - ) {} + public function __construct( + public string $feature_value, + public DeviceFeatures $features, + public string $lock_alias, + public float $lock_id, + public bool|null $has_gateway, + public array|null $wireless_keypads + ) { + } } diff --git a/src/Routes/Objects/DeviceTwoNMetadata.php b/src/Routes/Objects/DeviceTwoNMetadata.php index 8b3a8fc7..4f8ad538 100644 --- a/src/Routes/Objects/DeviceTwoNMetadata.php +++ b/src/Routes/Objects/DeviceTwoNMetadata.php @@ -4,19 +4,20 @@ class DeviceTwoNMetadata { - public static function from_json(mixed $json): DeviceTwoNMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceTwoNMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_name: $json->device_name + ); } - return new self( - device_id: $json->device_id, - device_name: $json->device_name - ); - } - public function __construct( - public float $device_id, - public string $device_name - ) {} + public function __construct( + public float $device_id, + public string $device_name + ) { + } } diff --git a/src/Routes/Objects/DeviceVisionlineMetadata.php b/src/Routes/Objects/DeviceVisionlineMetadata.php index 8697f5b6..7dfe02ae 100644 --- a/src/Routes/Objects/DeviceVisionlineMetadata.php +++ b/src/Routes/Objects/DeviceVisionlineMetadata.php @@ -4,13 +4,15 @@ class DeviceVisionlineMetadata { - public static function from_json(mixed $json): DeviceVisionlineMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceVisionlineMetadata|null + { + if (!$json) { + return null; + } + return new self(encoder_id: $json->encoder_id); } - return new self(encoder_id: $json->encoder_id); - } - public function __construct(public string $encoder_id) {} + public function __construct(public string $encoder_id) + { + } } diff --git a/src/Routes/Objects/DeviceWarnings.php b/src/Routes/Objects/DeviceWarnings.php index 38f0a30e..edebb9fe 100644 --- a/src/Routes/Objects/DeviceWarnings.php +++ b/src/Routes/Objects/DeviceWarnings.php @@ -4,21 +4,22 @@ class DeviceWarnings { - public static function from_json(mixed $json): DeviceWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); } - return new self( - message: $json->message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) {} + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/DeviceWirelessKeypads.php b/src/Routes/Objects/DeviceWirelessKeypads.php index 59f3592e..9ad08471 100644 --- a/src/Routes/Objects/DeviceWirelessKeypads.php +++ b/src/Routes/Objects/DeviceWirelessKeypads.php @@ -4,19 +4,20 @@ class DeviceWirelessKeypads { - public static function from_json(mixed $json): DeviceWirelessKeypads|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceWirelessKeypads|null + { + if (!$json) { + return null; + } + return new self( + wireless_keypad_id: $json->wireless_keypad_id, + wireless_keypad_name: $json->wireless_keypad_name + ); } - return new self( - wireless_keypad_id: $json->wireless_keypad_id, - wireless_keypad_name: $json->wireless_keypad_name - ); - } - public function __construct( - public float $wireless_keypad_id, - public string $wireless_keypad_name - ) {} + public function __construct( + public float $wireless_keypad_id, + public string $wireless_keypad_name + ) { + } } diff --git a/src/Routes/Objects/DeviceWyzeMetadata.php b/src/Routes/Objects/DeviceWyzeMetadata.php index 6cfc4ffb..159ba4c6 100644 --- a/src/Routes/Objects/DeviceWyzeMetadata.php +++ b/src/Routes/Objects/DeviceWyzeMetadata.php @@ -4,31 +4,32 @@ class DeviceWyzeMetadata { - public static function from_json(mixed $json): DeviceWyzeMetadata|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): DeviceWyzeMetadata|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + device_info_model: $json->device_info_model, + device_name: $json->device_name, + product_model: $json->product_model, + product_name: $json->product_name, + product_type: $json->product_type, + keypad_uuid: $json->keypad_uuid ?? null, + locker_status_hardlock: $json->locker_status_hardlock ?? null + ); } - return new self( - device_id: $json->device_id, - device_info_model: $json->device_info_model, - device_name: $json->device_name, - product_model: $json->product_model, - product_name: $json->product_name, - product_type: $json->product_type, - keypad_uuid: $json->keypad_uuid ?? null, - locker_status_hardlock: $json->locker_status_hardlock ?? null - ); - } - public function __construct( - public string $device_id, - public string $device_info_model, - public string $device_name, - public string $product_model, - public string $product_name, - public string $product_type, - public string|null $keypad_uuid, - public float|null $locker_status_hardlock - ) {} + public function __construct( + public string $device_id, + public string $device_info_model, + public string $device_name, + public string $product_model, + public string $product_name, + public string $product_type, + public string|null $keypad_uuid, + public float|null $locker_status_hardlock + ) { + } } diff --git a/src/Routes/Objects/EnrollmentAutomation.php b/src/Routes/Objects/EnrollmentAutomation.php index 1474faea..3d3bc0b4 100644 --- a/src/Routes/Objects/EnrollmentAutomation.php +++ b/src/Routes/Objects/EnrollmentAutomation.php @@ -4,25 +4,26 @@ class EnrollmentAutomation { - public static function from_json(mixed $json): EnrollmentAutomation|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): EnrollmentAutomation|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + credential_manager_acs_system_id: $json->credential_manager_acs_system_id, + enrollment_automation_id: $json->enrollment_automation_id, + user_identity_id: $json->user_identity_id, + workspace_id: $json->workspace_id + ); } - return new self( - created_at: $json->created_at, - credential_manager_acs_system_id: $json->credential_manager_acs_system_id, - enrollment_automation_id: $json->enrollment_automation_id, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id - ); - } - public function __construct( - public string $created_at, - public string $credential_manager_acs_system_id, - public string $enrollment_automation_id, - public string $user_identity_id, - public string $workspace_id - ) {} + public function __construct( + public string $created_at, + public string $credential_manager_acs_system_id, + public string $enrollment_automation_id, + public string $user_identity_id, + public string $workspace_id + ) { + } } diff --git a/src/Routes/Objects/Event.php b/src/Routes/Objects/Event.php index 6a984f11..e1c14759 100644 --- a/src/Routes/Objects/Event.php +++ b/src/Routes/Objects/Event.php @@ -4,116 +4,117 @@ class Event { - public static function from_json(mixed $json): Event|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): Event|null + { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id ?? null, + acs_access_group_id: $json->acs_access_group_id ?? null, + acs_credential_id: $json->acs_credential_id ?? null, + acs_encoder_id: $json->acs_encoder_id ?? null, + acs_system_id: $json->acs_system_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + action_attempt_id: $json->action_attempt_id ?? null, + action_type: $json->action_type ?? null, + backup_access_code_id: $json->backup_access_code_id ?? null, + battery_level: $json->battery_level ?? null, + battery_status: $json->battery_status ?? null, + client_session_id: $json->client_session_id ?? null, + climate_preset_key: $json->climate_preset_key ?? null, + connect_webview_id: $json->connect_webview_id ?? null, + connected_account_id: $json->connected_account_id ?? null, + cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, + cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? + null, + created_at: $json->created_at ?? null, + desired_temperature_celsius: $json->desired_temperature_celsius ?? + null, + desired_temperature_fahrenheit: $json->desired_temperature_fahrenheit ?? + null, + device_id: $json->device_id ?? null, + enrollment_automation_id: $json->enrollment_automation_id ?? null, + error_code: $json->error_code ?? null, + event_id: $json->event_id ?? null, + event_type: $json->event_type ?? null, + fan_mode_setting: $json->fan_mode_setting ?? null, + heating_set_point_celsius: $json->heating_set_point_celsius ?? null, + heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? + null, + hvac_mode_setting: $json->hvac_mode_setting ?? null, + is_fallback_climate_preset: $json->is_fallback_climate_preset ?? + null, + method: $json->method ?? null, + minut_metadata: $json->minut_metadata ?? null, + noise_level_decibels: $json->noise_level_decibels ?? null, + noise_level_nrs: $json->noise_level_nrs ?? null, + noise_threshold_id: $json->noise_threshold_id ?? null, + noise_threshold_name: $json->noise_threshold_name ?? null, + noiseaware_metadata: $json->noiseaware_metadata ?? null, + occurred_at: $json->occurred_at ?? null, + status: $json->status ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + workspace_id: $json->workspace_id ?? null, + code: $json->code ?? null, + lower_limit_celsius: $json->lower_limit_celsius ?? null, + lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, + thermostat_schedule_id: $json->thermostat_schedule_id ?? null, + upper_limit_celsius: $json->upper_limit_celsius ?? null, + upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null + ); } - return new self( - access_code_id: $json->access_code_id ?? null, - acs_access_group_id: $json->acs_access_group_id ?? null, - acs_credential_id: $json->acs_credential_id ?? null, - acs_encoder_id: $json->acs_encoder_id ?? null, - acs_system_id: $json->acs_system_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - action_attempt_id: $json->action_attempt_id ?? null, - action_type: $json->action_type ?? null, - backup_access_code_id: $json->backup_access_code_id ?? null, - battery_level: $json->battery_level ?? null, - battery_status: $json->battery_status ?? null, - client_session_id: $json->client_session_id ?? null, - climate_preset_key: $json->climate_preset_key ?? null, - connect_webview_id: $json->connect_webview_id ?? null, - connected_account_id: $json->connected_account_id ?? null, - cooling_set_point_celsius: $json->cooling_set_point_celsius ?? null, - cooling_set_point_fahrenheit: $json->cooling_set_point_fahrenheit ?? - null, - created_at: $json->created_at ?? null, - desired_temperature_celsius: $json->desired_temperature_celsius ?? - null, - desired_temperature_fahrenheit: $json->desired_temperature_fahrenheit ?? - null, - device_id: $json->device_id ?? null, - enrollment_automation_id: $json->enrollment_automation_id ?? null, - error_code: $json->error_code ?? null, - event_id: $json->event_id ?? null, - event_type: $json->event_type ?? null, - fan_mode_setting: $json->fan_mode_setting ?? null, - heating_set_point_celsius: $json->heating_set_point_celsius ?? null, - heating_set_point_fahrenheit: $json->heating_set_point_fahrenheit ?? - null, - hvac_mode_setting: $json->hvac_mode_setting ?? null, - is_fallback_climate_preset: $json->is_fallback_climate_preset ?? - null, - method: $json->method ?? null, - minut_metadata: $json->minut_metadata ?? null, - noise_level_decibels: $json->noise_level_decibels ?? null, - noise_level_nrs: $json->noise_level_nrs ?? null, - noise_threshold_id: $json->noise_threshold_id ?? null, - noise_threshold_name: $json->noise_threshold_name ?? null, - noiseaware_metadata: $json->noiseaware_metadata ?? null, - occurred_at: $json->occurred_at ?? null, - status: $json->status ?? null, - temperature_celsius: $json->temperature_celsius ?? null, - temperature_fahrenheit: $json->temperature_fahrenheit ?? null, - workspace_id: $json->workspace_id ?? null, - code: $json->code ?? null, - lower_limit_celsius: $json->lower_limit_celsius ?? null, - lower_limit_fahrenheit: $json->lower_limit_fahrenheit ?? null, - thermostat_schedule_id: $json->thermostat_schedule_id ?? null, - upper_limit_celsius: $json->upper_limit_celsius ?? null, - upper_limit_fahrenheit: $json->upper_limit_fahrenheit ?? null - ); - } - public function __construct( - public string|null $access_code_id, - public string|null $acs_access_group_id, - public string|null $acs_credential_id, - public string|null $acs_encoder_id, - public string|null $acs_system_id, - public string|null $acs_user_id, - public string|null $action_attempt_id, - public string|null $action_type, - public string|null $backup_access_code_id, - public float|null $battery_level, - public string|null $battery_status, - public string|null $client_session_id, - public string|null $climate_preset_key, - public string|null $connect_webview_id, - public string|null $connected_account_id, - public float|null $cooling_set_point_celsius, - public float|null $cooling_set_point_fahrenheit, - public string|null $created_at, - public float|null $desired_temperature_celsius, - public float|null $desired_temperature_fahrenheit, - public string|null $device_id, - public string|null $enrollment_automation_id, - public string|null $error_code, - public string|null $event_id, - public string|null $event_type, - public string|null $fan_mode_setting, - public float|null $heating_set_point_celsius, - public float|null $heating_set_point_fahrenheit, - public string|null $hvac_mode_setting, - public bool|null $is_fallback_climate_preset, - public string|null $method, - public mixed $minut_metadata, - public float|null $noise_level_decibels, - public float|null $noise_level_nrs, - public string|null $noise_threshold_id, - public string|null $noise_threshold_name, - public mixed $noiseaware_metadata, - public string|null $occurred_at, - public string|null $status, - public float|null $temperature_celsius, - public float|null $temperature_fahrenheit, - public string|null $workspace_id, - public string|null $code, - public float|null $lower_limit_celsius, - public float|null $lower_limit_fahrenheit, - public string|null $thermostat_schedule_id, - public float|null $upper_limit_celsius, - public float|null $upper_limit_fahrenheit - ) {} + public function __construct( + public string|null $access_code_id, + public string|null $acs_access_group_id, + public string|null $acs_credential_id, + public string|null $acs_encoder_id, + public string|null $acs_system_id, + public string|null $acs_user_id, + public string|null $action_attempt_id, + public string|null $action_type, + public string|null $backup_access_code_id, + public float|null $battery_level, + public string|null $battery_status, + public string|null $client_session_id, + public string|null $climate_preset_key, + public string|null $connect_webview_id, + public string|null $connected_account_id, + public float|null $cooling_set_point_celsius, + public float|null $cooling_set_point_fahrenheit, + public string|null $created_at, + public float|null $desired_temperature_celsius, + public float|null $desired_temperature_fahrenheit, + public string|null $device_id, + public string|null $enrollment_automation_id, + public string|null $error_code, + public string|null $event_id, + public string|null $event_type, + public string|null $fan_mode_setting, + public float|null $heating_set_point_celsius, + public float|null $heating_set_point_fahrenheit, + public string|null $hvac_mode_setting, + public bool|null $is_fallback_climate_preset, + public string|null $method, + public mixed $minut_metadata, + public float|null $noise_level_decibels, + public float|null $noise_level_nrs, + public string|null $noise_threshold_id, + public string|null $noise_threshold_name, + public mixed $noiseaware_metadata, + public string|null $occurred_at, + public string|null $status, + public float|null $temperature_celsius, + public float|null $temperature_fahrenheit, + public string|null $workspace_id, + public string|null $code, + public float|null $lower_limit_celsius, + public float|null $lower_limit_fahrenheit, + public string|null $thermostat_schedule_id, + public float|null $upper_limit_celsius, + public float|null $upper_limit_fahrenheit + ) { + } } diff --git a/src/Routes/Objects/Network.php b/src/Routes/Objects/Network.php index dab7aec7..53fd79b8 100644 --- a/src/Routes/Objects/Network.php +++ b/src/Routes/Objects/Network.php @@ -4,23 +4,24 @@ class Network { - public static function from_json(mixed $json): Network|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): Network|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + display_name: $json->display_name, + network_id: $json->network_id, + workspace_id: $json->workspace_id + ); } - return new self( - created_at: $json->created_at, - display_name: $json->display_name, - network_id: $json->network_id, - workspace_id: $json->workspace_id - ); - } - public function __construct( - public string $created_at, - public string $display_name, - public string $network_id, - public string $workspace_id - ) {} + public function __construct( + public string $created_at, + public string $display_name, + public string $network_id, + public string $workspace_id + ) { + } } diff --git a/src/Routes/Objects/NoiseThreshold.php b/src/Routes/Objects/NoiseThreshold.php index 9c4b1bfe..cc9f9b6b 100644 --- a/src/Routes/Objects/NoiseThreshold.php +++ b/src/Routes/Objects/NoiseThreshold.php @@ -4,29 +4,30 @@ class NoiseThreshold { - public static function from_json(mixed $json): NoiseThreshold|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): NoiseThreshold|null + { + if (!$json) { + return null; + } + return new self( + device_id: $json->device_id, + ends_daily_at: $json->ends_daily_at, + name: $json->name, + noise_threshold_decibels: $json->noise_threshold_decibels, + noise_threshold_id: $json->noise_threshold_id, + starts_daily_at: $json->starts_daily_at, + noise_threshold_nrs: $json->noise_threshold_nrs ?? null + ); } - return new self( - device_id: $json->device_id, - ends_daily_at: $json->ends_daily_at, - name: $json->name, - noise_threshold_decibels: $json->noise_threshold_decibels, - noise_threshold_id: $json->noise_threshold_id, - starts_daily_at: $json->starts_daily_at, - noise_threshold_nrs: $json->noise_threshold_nrs ?? null - ); - } - public function __construct( - public string $device_id, - public string $ends_daily_at, - public string $name, - public float $noise_threshold_decibels, - public string $noise_threshold_id, - public string $starts_daily_at, - public float|null $noise_threshold_nrs - ) {} + public function __construct( + public string $device_id, + public string $ends_daily_at, + public string $name, + public float $noise_threshold_decibels, + public string $noise_threshold_id, + public string $starts_daily_at, + public float|null $noise_threshold_nrs + ) { + } } diff --git a/src/Routes/Objects/Phone.php b/src/Routes/Objects/Phone.php index 76ace6af..d0586ec3 100644 --- a/src/Routes/Objects/Phone.php +++ b/src/Routes/Objects/Phone.php @@ -4,41 +4,42 @@ class Phone { - public static function from_json(mixed $json): Phone|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): Phone|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + custom_metadata: $json->custom_metadata, + device_id: $json->device_id, + device_type: $json->device_type, + display_name: $json->display_name, + errors: array_map( + fn($e) => PhoneErrors::from_json($e), + $json->errors ?? [] + ), + properties: PhoneProperties::from_json($json->properties), + warnings: array_map( + fn($w) => PhoneWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + nickname: $json->nickname ?? null + ); } - return new self( - created_at: $json->created_at, - custom_metadata: $json->custom_metadata, - device_id: $json->device_id, - device_type: $json->device_type, - display_name: $json->display_name, - errors: array_map( - fn($e) => PhoneErrors::from_json($e), - $json->errors ?? [] - ), - properties: PhoneProperties::from_json($json->properties), - warnings: array_map( - fn($w) => PhoneWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - nickname: $json->nickname ?? null - ); - } - public function __construct( - public string $created_at, - public mixed $custom_metadata, - public string $device_id, - public string $device_type, - public string $display_name, - public array $errors, - public PhoneProperties $properties, - public array $warnings, - public string $workspace_id, - public string|null $nickname - ) {} + public function __construct( + public string $created_at, + public mixed $custom_metadata, + public string $device_id, + public string $device_type, + public string $display_name, + public array $errors, + public PhoneProperties $properties, + public array $warnings, + public string $workspace_id, + public string|null $nickname + ) { + } } diff --git a/src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php b/src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php index 601beb22..2b3d39b8 100644 --- a/src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php +++ b/src/Routes/Objects/PhoneAssaAbloyCredentialServiceMetadata.php @@ -4,23 +4,24 @@ class PhoneAssaAbloyCredentialServiceMetadata { - public static function from_json( - mixed $json - ): PhoneAssaAbloyCredentialServiceMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): PhoneAssaAbloyCredentialServiceMetadata|null { + if (!$json) { + return null; + } + return new self( + endpoints: array_map( + fn($e) => PhoneEndpoints::from_json($e), + $json->endpoints ?? [] + ), + has_active_endpoint: $json->has_active_endpoint + ); } - return new self( - endpoints: array_map( - fn($e) => PhoneEndpoints::from_json($e), - $json->endpoints ?? [] - ), - has_active_endpoint: $json->has_active_endpoint - ); - } - public function __construct( - public array $endpoints, - public bool $has_active_endpoint - ) {} + public function __construct( + public array $endpoints, + public bool $has_active_endpoint + ) { + } } diff --git a/src/Routes/Objects/PhoneEndpoints.php b/src/Routes/Objects/PhoneEndpoints.php index 7ac9888c..96af786a 100644 --- a/src/Routes/Objects/PhoneEndpoints.php +++ b/src/Routes/Objects/PhoneEndpoints.php @@ -4,19 +4,20 @@ class PhoneEndpoints { - public static function from_json(mixed $json): PhoneEndpoints|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): PhoneEndpoints|null + { + if (!$json) { + return null; + } + return new self( + endpoint_id: $json->endpoint_id, + is_active: $json->is_active + ); } - return new self( - endpoint_id: $json->endpoint_id, - is_active: $json->is_active - ); - } - public function __construct( - public string $endpoint_id, - public bool $is_active - ) {} + public function __construct( + public string $endpoint_id, + public bool $is_active + ) { + } } diff --git a/src/Routes/Objects/PhoneErrors.php b/src/Routes/Objects/PhoneErrors.php index 6d4e51c3..96560d87 100644 --- a/src/Routes/Objects/PhoneErrors.php +++ b/src/Routes/Objects/PhoneErrors.php @@ -4,21 +4,22 @@ class PhoneErrors { - public static function from_json(mixed $json): PhoneErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): PhoneErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/PhoneProperties.php b/src/Routes/Objects/PhoneProperties.php index debbdbaf..0960cbf6 100644 --- a/src/Routes/Objects/PhoneProperties.php +++ b/src/Routes/Objects/PhoneProperties.php @@ -4,31 +4,32 @@ class PhoneProperties { - public static function from_json(mixed $json): PhoneProperties|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): PhoneProperties|null + { + if (!$json) { + return null; + } + return new self( + assa_abloy_credential_service_metadata: isset( + $json->assa_abloy_credential_service_metadata + ) + ? PhoneAssaAbloyCredentialServiceMetadata::from_json( + $json->assa_abloy_credential_service_metadata + ) + : null, + salto_space_credential_service_metadata: isset( + $json->salto_space_credential_service_metadata + ) + ? PhoneSaltoSpaceCredentialServiceMetadata::from_json( + $json->salto_space_credential_service_metadata + ) + : null + ); } - return new self( - assa_abloy_credential_service_metadata: isset( - $json->assa_abloy_credential_service_metadata - ) - ? PhoneAssaAbloyCredentialServiceMetadata::from_json( - $json->assa_abloy_credential_service_metadata - ) - : null, - salto_space_credential_service_metadata: isset( - $json->salto_space_credential_service_metadata - ) - ? PhoneSaltoSpaceCredentialServiceMetadata::from_json( - $json->salto_space_credential_service_metadata - ) - : null - ); - } - public function __construct( - public PhoneAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, - public PhoneSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata - ) {} + public function __construct( + public PhoneAssaAbloyCredentialServiceMetadata|null $assa_abloy_credential_service_metadata, + public PhoneSaltoSpaceCredentialServiceMetadata|null $salto_space_credential_service_metadata + ) { + } } diff --git a/src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php b/src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php index f93f553c..b4de6a1e 100644 --- a/src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php +++ b/src/Routes/Objects/PhoneSaltoSpaceCredentialServiceMetadata.php @@ -4,14 +4,16 @@ class PhoneSaltoSpaceCredentialServiceMetadata { - public static function from_json( - mixed $json - ): PhoneSaltoSpaceCredentialServiceMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): PhoneSaltoSpaceCredentialServiceMetadata|null { + if (!$json) { + return null; + } + return new self(has_active_phone: $json->has_active_phone); } - return new self(has_active_phone: $json->has_active_phone); - } - public function __construct(public bool $has_active_phone) {} + public function __construct(public bool $has_active_phone) + { + } } diff --git a/src/Routes/Objects/PhoneWarnings.php b/src/Routes/Objects/PhoneWarnings.php index 6891854f..c3f8bae4 100644 --- a/src/Routes/Objects/PhoneWarnings.php +++ b/src/Routes/Objects/PhoneWarnings.php @@ -4,21 +4,22 @@ class PhoneWarnings { - public static function from_json(mixed $json): PhoneWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): PhoneWarnings|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); } - return new self( - message: $json->message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) {} + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/ThermostatSchedule.php b/src/Routes/Objects/ThermostatSchedule.php index 5d229732..adfb3db9 100644 --- a/src/Routes/Objects/ThermostatSchedule.php +++ b/src/Routes/Objects/ThermostatSchedule.php @@ -4,39 +4,40 @@ class ThermostatSchedule { - public static function from_json(mixed $json): ThermostatSchedule|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ThermostatSchedule|null + { + if (!$json) { + return null; + } + return new self( + climate_preset_key: $json->climate_preset_key, + created_at: $json->created_at, + device_id: $json->device_id, + ends_at: $json->ends_at, + errors: array_map( + fn($e) => ThermostatScheduleErrors::from_json($e), + $json->errors ?? [] + ), + max_override_period_minutes: $json->max_override_period_minutes, + starts_at: $json->starts_at, + thermostat_schedule_id: $json->thermostat_schedule_id, + name: $json->name ?? null, + unstable_is_override_allowed: $json->unstable_is_override_allowed ?? + null + ); } - return new self( - climate_preset_key: $json->climate_preset_key, - created_at: $json->created_at, - device_id: $json->device_id, - ends_at: $json->ends_at, - errors: array_map( - fn($e) => ThermostatScheduleErrors::from_json($e), - $json->errors ?? [] - ), - max_override_period_minutes: $json->max_override_period_minutes, - starts_at: $json->starts_at, - thermostat_schedule_id: $json->thermostat_schedule_id, - name: $json->name ?? null, - unstable_is_override_allowed: $json->unstable_is_override_allowed ?? - null - ); - } - public function __construct( - public string $climate_preset_key, - public string $created_at, - public string $device_id, - public string $ends_at, - public array $errors, - public mixed $max_override_period_minutes, - public string $starts_at, - public string $thermostat_schedule_id, - public string|null $name, - public bool|null $unstable_is_override_allowed - ) {} + public function __construct( + public string $climate_preset_key, + public string $created_at, + public string $device_id, + public string $ends_at, + public array $errors, + public mixed $max_override_period_minutes, + public string $starts_at, + public string $thermostat_schedule_id, + public string|null $name, + public bool|null $unstable_is_override_allowed + ) { + } } diff --git a/src/Routes/Objects/ThermostatScheduleErrors.php b/src/Routes/Objects/ThermostatScheduleErrors.php index 77acd975..934440ec 100644 --- a/src/Routes/Objects/ThermostatScheduleErrors.php +++ b/src/Routes/Objects/ThermostatScheduleErrors.php @@ -4,21 +4,22 @@ class ThermostatScheduleErrors { - public static function from_json(mixed $json): ThermostatScheduleErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): ThermostatScheduleErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAccessCode.php b/src/Routes/Objects/UnmanagedAccessCode.php index b8912840..30f8efd3 100644 --- a/src/Routes/Objects/UnmanagedAccessCode.php +++ b/src/Routes/Objects/UnmanagedAccessCode.php @@ -4,45 +4,46 @@ class UnmanagedAccessCode { - public static function from_json(mixed $json): UnmanagedAccessCode|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedAccessCode|null + { + if (!$json) { + return null; + } + return new self( + access_code_id: $json->access_code_id, + created_at: $json->created_at, + device_id: $json->device_id, + errors: array_map( + fn($e) => UnmanagedAccessCodeErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + status: $json->status, + type: $json->type, + warnings: array_map( + fn($w) => UnmanagedAccessCodeWarnings::from_json($w), + $json->warnings ?? [] + ), + code: $json->code ?? null, + name: $json->name ?? null, + ends_at: $json->ends_at ?? null, + starts_at: $json->starts_at ?? null + ); } - return new self( - access_code_id: $json->access_code_id, - created_at: $json->created_at, - device_id: $json->device_id, - errors: array_map( - fn($e) => UnmanagedAccessCodeErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - status: $json->status, - type: $json->type, - warnings: array_map( - fn($w) => UnmanagedAccessCodeWarnings::from_json($w), - $json->warnings ?? [] - ), - code: $json->code ?? null, - name: $json->name ?? null, - ends_at: $json->ends_at ?? null, - starts_at: $json->starts_at ?? null - ); - } - public function __construct( - public string $access_code_id, - public string $created_at, - public string $device_id, - public array $errors, - public bool $is_managed, - public string $status, - public string $type, - public array $warnings, - public string|null $code, - public string|null $name, - public string|null $ends_at, - public string|null $starts_at - ) {} + public function __construct( + public string $access_code_id, + public string $created_at, + public string $device_id, + public array $errors, + public bool $is_managed, + public string $status, + public string $type, + public array $warnings, + public string|null $code, + public string|null $name, + public string|null $ends_at, + public string|null $starts_at + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAccessCodeErrors.php b/src/Routes/Objects/UnmanagedAccessCodeErrors.php index 86f2c717..d536c743 100644 --- a/src/Routes/Objects/UnmanagedAccessCodeErrors.php +++ b/src/Routes/Objects/UnmanagedAccessCodeErrors.php @@ -4,29 +4,30 @@ class UnmanagedAccessCodeErrors { - public static function from_json( - mixed $json - ): UnmanagedAccessCodeErrors|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAccessCodeErrors|null { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_access_code_error: $json->is_access_code_error ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_access_code_error: $json->is_access_code_error ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_access_code_error, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_access_code_error, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAccessCodeWarnings.php b/src/Routes/Objects/UnmanagedAccessCodeWarnings.php index 472eda49..297128dd 100644 --- a/src/Routes/Objects/UnmanagedAccessCodeWarnings.php +++ b/src/Routes/Objects/UnmanagedAccessCodeWarnings.php @@ -4,22 +4,23 @@ class UnmanagedAccessCodeWarnings { - public static function from_json( - mixed $json - ): UnmanagedAccessCodeWarnings|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAccessCodeWarnings|null { + if (!$json) { + return null; + } + return new self( + message: $json->message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); } - return new self( - message: $json->message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) {} + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsAccessGroup.php b/src/Routes/Objects/UnmanagedAcsAccessGroup.php index f682833d..d2123378 100644 --- a/src/Routes/Objects/UnmanagedAcsAccessGroup.php +++ b/src/Routes/Objects/UnmanagedAcsAccessGroup.php @@ -4,42 +4,43 @@ class UnmanagedAcsAccessGroup { - public static function from_json(mixed $json): UnmanagedAcsAccessGroup|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedAcsAccessGroup|null + { + if (!$json) { + return null; + } + return new self( + access_group_type: $json->access_group_type, + access_group_type_display_name: $json->access_group_type_display_name, + acs_access_group_id: $json->acs_access_group_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + external_type: $json->external_type, + external_type_display_name: $json->external_type_display_name, + is_managed: $json->is_managed, + name: $json->name, + warnings: array_map( + fn($w) => UnmanagedAcsAccessGroupWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id + ); } - return new self( - access_group_type: $json->access_group_type, - access_group_type_display_name: $json->access_group_type_display_name, - acs_access_group_id: $json->acs_access_group_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - external_type: $json->external_type, - external_type_display_name: $json->external_type_display_name, - is_managed: $json->is_managed, - name: $json->name, - warnings: array_map( - fn($w) => UnmanagedAcsAccessGroupWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id - ); - } - public function __construct( - public string $access_group_type, - public string $access_group_type_display_name, - public string $acs_access_group_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public string $external_type, - public string $external_type_display_name, - public bool $is_managed, - public string $name, - public array $warnings, - public string $workspace_id - ) {} + public function __construct( + public string $access_group_type, + public string $access_group_type_display_name, + public string $acs_access_group_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public string $external_type, + public string $external_type_display_name, + public bool $is_managed, + public string $name, + public array $warnings, + public string $workspace_id + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php b/src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php index d976fc14..86af800f 100644 --- a/src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php +++ b/src/Routes/Objects/UnmanagedAcsAccessGroupWarnings.php @@ -4,22 +4,23 @@ class UnmanagedAcsAccessGroupWarnings { - public static function from_json( - mixed $json - ): UnmanagedAcsAccessGroupWarnings|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAcsAccessGroupWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + message: $json->message, + warning_code: $json->warning_code + ); } - return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) {} + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsCredential.php b/src/Routes/Objects/UnmanagedAcsCredential.php index 871d420a..0824085d 100644 --- a/src/Routes/Objects/UnmanagedAcsCredential.php +++ b/src/Routes/Objects/UnmanagedAcsCredential.php @@ -4,85 +4,86 @@ class UnmanagedAcsCredential { - public static function from_json(mixed $json): UnmanagedAcsCredential|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedAcsCredential|null + { + if (!$json) { + return null; + } + return new self( + access_method: $json->access_method, + acs_credential_id: $json->acs_credential_id, + acs_system_id: $json->acs_system_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => UnmanagedAcsCredentialErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => UnmanagedAcsCredentialWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + acs_credential_pool_id: $json->acs_credential_pool_id ?? null, + acs_user_id: $json->acs_user_id ?? null, + assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) + ? UnmanagedAcsCredentialAssaAbloyVostioMetadata::from_json( + $json->assa_abloy_vostio_metadata + ) + : null, + ends_at: $json->ends_at ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + is_issued: $json->is_issued ?? null, + is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? + null, + is_one_time_use: $json->is_one_time_use ?? null, + parent_acs_credential_id: $json->parent_acs_credential_id ?? null, + starts_at: $json->starts_at ?? null, + visionline_metadata: isset($json->visionline_metadata) + ? UnmanagedAcsCredentialVisionlineMetadata::from_json( + $json->visionline_metadata + ) + : null, + card_number: $json->card_number ?? null, + code: $json->code ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + issued_at: $json->issued_at ?? null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null + ); } - return new self( - access_method: $json->access_method, - acs_credential_id: $json->acs_credential_id, - acs_system_id: $json->acs_system_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => UnmanagedAcsCredentialErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => UnmanagedAcsCredentialWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - acs_credential_pool_id: $json->acs_credential_pool_id ?? null, - acs_user_id: $json->acs_user_id ?? null, - assa_abloy_vostio_metadata: isset($json->assa_abloy_vostio_metadata) - ? UnmanagedAcsCredentialAssaAbloyVostioMetadata::from_json( - $json->assa_abloy_vostio_metadata - ) - : null, - ends_at: $json->ends_at ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - is_issued: $json->is_issued ?? null, - is_multi_phone_sync_credential: $json->is_multi_phone_sync_credential ?? - null, - is_one_time_use: $json->is_one_time_use ?? null, - parent_acs_credential_id: $json->parent_acs_credential_id ?? null, - starts_at: $json->starts_at ?? null, - visionline_metadata: isset($json->visionline_metadata) - ? UnmanagedAcsCredentialVisionlineMetadata::from_json( - $json->visionline_metadata - ) - : null, - card_number: $json->card_number ?? null, - code: $json->code ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - issued_at: $json->issued_at ?? null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null - ); - } - public function __construct( - public string $access_method, - public string $acs_credential_id, - public string $acs_system_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public string|null $acs_credential_pool_id, - public string|null $acs_user_id, - public UnmanagedAcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, - public string|null $ends_at, - public string|null $external_type, - public string|null $external_type_display_name, - public bool|null $is_issued, - public bool|null $is_multi_phone_sync_credential, - public bool|null $is_one_time_use, - public string|null $parent_acs_credential_id, - public string|null $starts_at, - public UnmanagedAcsCredentialVisionlineMetadata|null $visionline_metadata, - public string|null $card_number, - public string|null $code, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $issued_at, - public string|null $latest_desired_state_synced_with_provider_at - ) {} + public function __construct( + public string $access_method, + public string $acs_credential_id, + public string $acs_system_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public string|null $acs_credential_pool_id, + public string|null $acs_user_id, + public UnmanagedAcsCredentialAssaAbloyVostioMetadata|null $assa_abloy_vostio_metadata, + public string|null $ends_at, + public string|null $external_type, + public string|null $external_type_display_name, + public bool|null $is_issued, + public bool|null $is_multi_phone_sync_credential, + public bool|null $is_one_time_use, + public string|null $parent_acs_credential_id, + public string|null $starts_at, + public UnmanagedAcsCredentialVisionlineMetadata|null $visionline_metadata, + public string|null $card_number, + public string|null $code, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $issued_at, + public string|null $latest_desired_state_synced_with_provider_at + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php b/src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php index d6b62c71..0c579af8 100644 --- a/src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php +++ b/src/Routes/Objects/UnmanagedAcsCredentialAssaAbloyVostioMetadata.php @@ -4,27 +4,28 @@ class UnmanagedAcsCredentialAssaAbloyVostioMetadata { - public static function from_json( - mixed $json - ): UnmanagedAcsCredentialAssaAbloyVostioMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAcsCredentialAssaAbloyVostioMetadata|null { + if (!$json) { + return null; + } + return new self( + door_names: $json->door_names ?? null, + endpoint_id: $json->endpoint_id ?? null, + key_id: $json->key_id ?? null, + key_issuing_request_id: $json->key_issuing_request_id ?? null, + override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? + null + ); } - return new self( - door_names: $json->door_names ?? null, - endpoint_id: $json->endpoint_id ?? null, - key_id: $json->key_id ?? null, - key_issuing_request_id: $json->key_issuing_request_id ?? null, - override_guest_acs_entrance_ids: $json->override_guest_acs_entrance_ids ?? - null - ); - } - public function __construct( - public array|null $door_names, - public string|null $endpoint_id, - public string|null $key_id, - public string|null $key_issuing_request_id, - public array|null $override_guest_acs_entrance_ids - ) {} + public function __construct( + public array|null $door_names, + public string|null $endpoint_id, + public string|null $key_id, + public string|null $key_issuing_request_id, + public array|null $override_guest_acs_entrance_ids + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsCredentialErrors.php b/src/Routes/Objects/UnmanagedAcsCredentialErrors.php index 8e4cb998..2c50c048 100644 --- a/src/Routes/Objects/UnmanagedAcsCredentialErrors.php +++ b/src/Routes/Objects/UnmanagedAcsCredentialErrors.php @@ -4,22 +4,23 @@ class UnmanagedAcsCredentialErrors { - public static function from_json( - mixed $json - ): UnmanagedAcsCredentialErrors|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAcsCredentialErrors|null { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php b/src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php index 3a34d7c4..037f1d7e 100644 --- a/src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php +++ b/src/Routes/Objects/UnmanagedAcsCredentialVisionlineMetadata.php @@ -4,32 +4,33 @@ class UnmanagedAcsCredentialVisionlineMetadata { - public static function from_json( - mixed $json - ): UnmanagedAcsCredentialVisionlineMetadata|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAcsCredentialVisionlineMetadata|null { + if (!$json) { + return null; + } + return new self( + card_function_type: $json->card_function_type, + auto_join: $json->auto_join ?? null, + card_id: $json->card_id ?? null, + common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, + credential_id: $json->credential_id ?? null, + guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, + is_valid: $json->is_valid ?? null, + joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null + ); } - return new self( - card_function_type: $json->card_function_type, - auto_join: $json->auto_join ?? null, - card_id: $json->card_id ?? null, - common_acs_entrance_ids: $json->common_acs_entrance_ids ?? null, - credential_id: $json->credential_id ?? null, - guest_acs_entrance_ids: $json->guest_acs_entrance_ids ?? null, - is_valid: $json->is_valid ?? null, - joiner_acs_credential_ids: $json->joiner_acs_credential_ids ?? null - ); - } - public function __construct( - public string $card_function_type, - public bool|null $auto_join, - public string|null $card_id, - public array|null $common_acs_entrance_ids, - public string|null $credential_id, - public array|null $guest_acs_entrance_ids, - public bool|null $is_valid, - public array|null $joiner_acs_credential_ids - ) {} + public function __construct( + public string $card_function_type, + public bool|null $auto_join, + public string|null $card_id, + public array|null $common_acs_entrance_ids, + public string|null $credential_id, + public array|null $guest_acs_entrance_ids, + public bool|null $is_valid, + public array|null $joiner_acs_credential_ids + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsCredentialWarnings.php b/src/Routes/Objects/UnmanagedAcsCredentialWarnings.php index 223089d0..255b4d7c 100644 --- a/src/Routes/Objects/UnmanagedAcsCredentialWarnings.php +++ b/src/Routes/Objects/UnmanagedAcsCredentialWarnings.php @@ -4,22 +4,23 @@ class UnmanagedAcsCredentialWarnings { - public static function from_json( - mixed $json - ): UnmanagedAcsCredentialWarnings|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAcsCredentialWarnings|null { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + message: $json->message, + warning_code: $json->warning_code + ); } - return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) {} + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsUser.php b/src/Routes/Objects/UnmanagedAcsUser.php index cf3e205f..1f797407 100644 --- a/src/Routes/Objects/UnmanagedAcsUser.php +++ b/src/Routes/Objects/UnmanagedAcsUser.php @@ -4,76 +4,77 @@ class UnmanagedAcsUser { - public static function from_json(mixed $json): UnmanagedAcsUser|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedAcsUser|null + { + if (!$json) { + return null; + } + return new self( + acs_system_id: $json->acs_system_id, + acs_user_id: $json->acs_user_id, + created_at: $json->created_at, + display_name: $json->display_name, + errors: array_map( + fn($e) => UnmanagedAcsUserErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + warnings: array_map( + fn($w) => UnmanagedAcsUserWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + access_schedule: isset($json->access_schedule) + ? UnmanagedAcsUserAccessSchedule::from_json( + $json->access_schedule + ) + : null, + email: $json->email ?? null, + email_address: $json->email_address ?? null, + external_type: $json->external_type ?? null, + external_type_display_name: $json->external_type_display_name ?? + null, + full_name: $json->full_name ?? null, + hid_acs_system_id: $json->hid_acs_system_id ?? null, + is_suspended: $json->is_suspended ?? null, + phone_number: $json->phone_number ?? null, + user_identity_id: $json->user_identity_id ?? null, + is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? + null, + latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? + null, + user_identity_email_address: $json->user_identity_email_address ?? + null, + user_identity_full_name: $json->user_identity_full_name ?? null, + user_identity_phone_number: $json->user_identity_phone_number ?? + null + ); } - return new self( - acs_system_id: $json->acs_system_id, - acs_user_id: $json->acs_user_id, - created_at: $json->created_at, - display_name: $json->display_name, - errors: array_map( - fn($e) => UnmanagedAcsUserErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - warnings: array_map( - fn($w) => UnmanagedAcsUserWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - access_schedule: isset($json->access_schedule) - ? UnmanagedAcsUserAccessSchedule::from_json( - $json->access_schedule - ) - : null, - email: $json->email ?? null, - email_address: $json->email_address ?? null, - external_type: $json->external_type ?? null, - external_type_display_name: $json->external_type_display_name ?? - null, - full_name: $json->full_name ?? null, - hid_acs_system_id: $json->hid_acs_system_id ?? null, - is_suspended: $json->is_suspended ?? null, - phone_number: $json->phone_number ?? null, - user_identity_id: $json->user_identity_id ?? null, - is_latest_desired_state_synced_with_provider: $json->is_latest_desired_state_synced_with_provider ?? - null, - latest_desired_state_synced_with_provider_at: $json->latest_desired_state_synced_with_provider_at ?? - null, - user_identity_email_address: $json->user_identity_email_address ?? - null, - user_identity_full_name: $json->user_identity_full_name ?? null, - user_identity_phone_number: $json->user_identity_phone_number ?? - null - ); - } - public function __construct( - public string $acs_system_id, - public string $acs_user_id, - public string $created_at, - public string $display_name, - public array $errors, - public bool $is_managed, - public array $warnings, - public string $workspace_id, - public UnmanagedAcsUserAccessSchedule|null $access_schedule, - public string|null $email, - public string|null $email_address, - public string|null $external_type, - public string|null $external_type_display_name, - public string|null $full_name, - public string|null $hid_acs_system_id, - public bool|null $is_suspended, - public string|null $phone_number, - public string|null $user_identity_id, - public bool|null $is_latest_desired_state_synced_with_provider, - public string|null $latest_desired_state_synced_with_provider_at, - public string|null $user_identity_email_address, - public string|null $user_identity_full_name, - public string|null $user_identity_phone_number - ) {} + public function __construct( + public string $acs_system_id, + public string $acs_user_id, + public string $created_at, + public string $display_name, + public array $errors, + public bool $is_managed, + public array $warnings, + public string $workspace_id, + public UnmanagedAcsUserAccessSchedule|null $access_schedule, + public string|null $email, + public string|null $email_address, + public string|null $external_type, + public string|null $external_type_display_name, + public string|null $full_name, + public string|null $hid_acs_system_id, + public bool|null $is_suspended, + public string|null $phone_number, + public string|null $user_identity_id, + public bool|null $is_latest_desired_state_synced_with_provider, + public string|null $latest_desired_state_synced_with_provider_at, + public string|null $user_identity_email_address, + public string|null $user_identity_full_name, + public string|null $user_identity_phone_number + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php b/src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php index 3e23b242..bc9e744c 100644 --- a/src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php +++ b/src/Routes/Objects/UnmanagedAcsUserAccessSchedule.php @@ -4,20 +4,21 @@ class UnmanagedAcsUserAccessSchedule { - public static function from_json( - mixed $json - ): UnmanagedAcsUserAccessSchedule|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedAcsUserAccessSchedule|null { + if (!$json) { + return null; + } + return new self( + starts_at: $json->starts_at, + ends_at: $json->ends_at ?? null + ); } - return new self( - starts_at: $json->starts_at, - ends_at: $json->ends_at ?? null - ); - } - public function __construct( - public string $starts_at, - public string|null $ends_at - ) {} + public function __construct( + public string $starts_at, + public string|null $ends_at + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsUserErrors.php b/src/Routes/Objects/UnmanagedAcsUserErrors.php index e7623cc1..5a67c73e 100644 --- a/src/Routes/Objects/UnmanagedAcsUserErrors.php +++ b/src/Routes/Objects/UnmanagedAcsUserErrors.php @@ -4,21 +4,22 @@ class UnmanagedAcsUserErrors { - public static function from_json(mixed $json): UnmanagedAcsUserErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedAcsUserErrors|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + error_code: $json->error_code, + message: $json->message + ); } - return new self( - created_at: $json->created_at, - error_code: $json->error_code, - message: $json->message - ); - } - public function __construct( - public string $created_at, - public string $error_code, - public string $message - ) {} + public function __construct( + public string $created_at, + public string $error_code, + public string $message + ) { + } } diff --git a/src/Routes/Objects/UnmanagedAcsUserWarnings.php b/src/Routes/Objects/UnmanagedAcsUserWarnings.php index 6f372b02..38e292be 100644 --- a/src/Routes/Objects/UnmanagedAcsUserWarnings.php +++ b/src/Routes/Objects/UnmanagedAcsUserWarnings.php @@ -4,21 +4,22 @@ class UnmanagedAcsUserWarnings { - public static function from_json(mixed $json): UnmanagedAcsUserWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedAcsUserWarnings|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + message: $json->message, + warning_code: $json->warning_code + ); } - return new self( - created_at: $json->created_at, - message: $json->message, - warning_code: $json->warning_code - ); - } - public function __construct( - public string $created_at, - public string $message, - public string $warning_code - ) {} + public function __construct( + public string $created_at, + public string $message, + public string $warning_code + ) { + } } diff --git a/src/Routes/Objects/UnmanagedDevice.php b/src/Routes/Objects/UnmanagedDevice.php index 91d3fb85..ad0d45e3 100644 --- a/src/Routes/Objects/UnmanagedDevice.php +++ b/src/Routes/Objects/UnmanagedDevice.php @@ -4,70 +4,71 @@ class UnmanagedDevice { - public static function from_json(mixed $json): UnmanagedDevice|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedDevice|null + { + if (!$json) { + return null; + } + return new self( + capabilities_supported: $json->capabilities_supported, + connected_account_id: $json->connected_account_id, + created_at: $json->created_at, + device_id: $json->device_id, + device_type: $json->device_type, + errors: array_map( + fn($e) => UnmanagedDeviceErrors::from_json($e), + $json->errors ?? [] + ), + is_managed: $json->is_managed, + properties: UnmanagedDeviceProperties::from_json($json->properties), + warnings: array_map( + fn($w) => UnmanagedDeviceWarnings::from_json($w), + $json->warnings ?? [] + ), + workspace_id: $json->workspace_id, + 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, + can_program_offline_access_codes: $json->can_program_offline_access_codes ?? + null, + can_program_online_access_codes: $json->can_program_online_access_codes ?? + null, + can_remotely_lock: $json->can_remotely_lock ?? null, + can_remotely_unlock: $json->can_remotely_unlock ?? null, + can_simulate_connection: $json->can_simulate_connection ?? null, + can_simulate_disconnection: $json->can_simulate_disconnection ?? + null, + can_simulate_removal: $json->can_simulate_removal ?? null, + can_turn_off_hvac: $json->can_turn_off_hvac ?? null, + location: isset($json->location) + ? UnmanagedDeviceLocation::from_json($json->location) + : null + ); } - return new self( - capabilities_supported: $json->capabilities_supported, - connected_account_id: $json->connected_account_id, - created_at: $json->created_at, - device_id: $json->device_id, - device_type: $json->device_type, - errors: array_map( - fn($e) => UnmanagedDeviceErrors::from_json($e), - $json->errors ?? [] - ), - is_managed: $json->is_managed, - properties: UnmanagedDeviceProperties::from_json($json->properties), - warnings: array_map( - fn($w) => UnmanagedDeviceWarnings::from_json($w), - $json->warnings ?? [] - ), - workspace_id: $json->workspace_id, - 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, - can_program_offline_access_codes: $json->can_program_offline_access_codes ?? - null, - can_program_online_access_codes: $json->can_program_online_access_codes ?? - null, - can_remotely_lock: $json->can_remotely_lock ?? null, - can_remotely_unlock: $json->can_remotely_unlock ?? null, - can_simulate_connection: $json->can_simulate_connection ?? null, - can_simulate_disconnection: $json->can_simulate_disconnection ?? - null, - can_simulate_removal: $json->can_simulate_removal ?? null, - can_turn_off_hvac: $json->can_turn_off_hvac ?? null, - location: isset($json->location) - ? UnmanagedDeviceLocation::from_json($json->location) - : null - ); - } - public function __construct( - public array $capabilities_supported, - public string $connected_account_id, - public string $created_at, - public string $device_id, - public string $device_type, - public array $errors, - public bool $is_managed, - public UnmanagedDeviceProperties $properties, - public array $warnings, - public string $workspace_id, - public bool|null $can_hvac_cool, - public bool|null $can_hvac_heat, - public bool|null $can_hvac_heat_cool, - public bool|null $can_program_offline_access_codes, - public bool|null $can_program_online_access_codes, - public bool|null $can_remotely_lock, - public bool|null $can_remotely_unlock, - public bool|null $can_simulate_connection, - public bool|null $can_simulate_disconnection, - public bool|null $can_simulate_removal, - public bool|null $can_turn_off_hvac, - public UnmanagedDeviceLocation|null $location - ) {} + public function __construct( + public array $capabilities_supported, + public string $connected_account_id, + public string $created_at, + public string $device_id, + public string $device_type, + public array $errors, + public bool $is_managed, + public UnmanagedDeviceProperties $properties, + public array $warnings, + public string $workspace_id, + public bool|null $can_hvac_cool, + public bool|null $can_hvac_heat, + public bool|null $can_hvac_heat_cool, + public bool|null $can_program_offline_access_codes, + public bool|null $can_program_online_access_codes, + public bool|null $can_remotely_lock, + public bool|null $can_remotely_unlock, + public bool|null $can_simulate_connection, + public bool|null $can_simulate_disconnection, + public bool|null $can_simulate_removal, + public bool|null $can_turn_off_hvac, + public UnmanagedDeviceLocation|null $location + ) { + } } diff --git a/src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php b/src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php index 32070626..f79bfe4d 100644 --- a/src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php +++ b/src/Routes/Objects/UnmanagedDeviceAccessoryKeypad.php @@ -4,22 +4,23 @@ class UnmanagedDeviceAccessoryKeypad { - public static function from_json( - mixed $json - ): UnmanagedDeviceAccessoryKeypad|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedDeviceAccessoryKeypad|null { + if (!$json) { + return null; + } + return new self( + is_connected: $json->is_connected, + battery: isset($json->battery) + ? UnmanagedDeviceBattery::from_json($json->battery) + : null + ); } - return new self( - is_connected: $json->is_connected, - battery: isset($json->battery) - ? UnmanagedDeviceBattery::from_json($json->battery) - : null - ); - } - public function __construct( - public bool $is_connected, - public UnmanagedDeviceBattery|null $battery - ) {} + public function __construct( + public bool $is_connected, + public UnmanagedDeviceBattery|null $battery + ) { + } } diff --git a/src/Routes/Objects/UnmanagedDeviceBattery.php b/src/Routes/Objects/UnmanagedDeviceBattery.php index 06a3f94c..c7b6692e 100644 --- a/src/Routes/Objects/UnmanagedDeviceBattery.php +++ b/src/Routes/Objects/UnmanagedDeviceBattery.php @@ -4,13 +4,15 @@ class UnmanagedDeviceBattery { - public static function from_json(mixed $json): UnmanagedDeviceBattery|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedDeviceBattery|null + { + if (!$json) { + return null; + } + return new self(level: $json->level); } - return new self(level: $json->level); - } - public function __construct(public float $level) {} + public function __construct(public float $level) + { + } } diff --git a/src/Routes/Objects/UnmanagedDeviceErrors.php b/src/Routes/Objects/UnmanagedDeviceErrors.php index 6693298f..6de035d1 100644 --- a/src/Routes/Objects/UnmanagedDeviceErrors.php +++ b/src/Routes/Objects/UnmanagedDeviceErrors.php @@ -4,26 +4,27 @@ class UnmanagedDeviceErrors { - public static function from_json(mixed $json): UnmanagedDeviceErrors|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedDeviceErrors|null + { + if (!$json) { + return null; + } + return new self( + error_code: $json->error_code, + message: $json->message, + created_at: $json->created_at ?? null, + is_connected_account_error: $json->is_connected_account_error ?? + null, + is_device_error: $json->is_device_error ?? null + ); } - return new self( - error_code: $json->error_code, - message: $json->message, - created_at: $json->created_at ?? null, - is_connected_account_error: $json->is_connected_account_error ?? - null, - is_device_error: $json->is_device_error ?? null - ); - } - public function __construct( - public string $error_code, - public string $message, - public string|null $created_at, - public bool|null $is_connected_account_error, - public bool|null $is_device_error - ) {} + public function __construct( + public string $error_code, + public string $message, + public string|null $created_at, + public bool|null $is_connected_account_error, + public bool|null $is_device_error + ) { + } } diff --git a/src/Routes/Objects/UnmanagedDeviceLocation.php b/src/Routes/Objects/UnmanagedDeviceLocation.php index cfb22819..01a8b41a 100644 --- a/src/Routes/Objects/UnmanagedDeviceLocation.php +++ b/src/Routes/Objects/UnmanagedDeviceLocation.php @@ -4,19 +4,20 @@ class UnmanagedDeviceLocation { - public static function from_json(mixed $json): UnmanagedDeviceLocation|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedDeviceLocation|null + { + if (!$json) { + return null; + } + return new self( + location_name: $json->location_name ?? null, + timezone: $json->timezone ?? null + ); } - return new self( - location_name: $json->location_name ?? null, - timezone: $json->timezone ?? null - ); - } - public function __construct( - public string|null $location_name, - public string|null $timezone - ) {} + public function __construct( + public string|null $location_name, + public string|null $timezone + ) { + } } diff --git a/src/Routes/Objects/UnmanagedDeviceModel.php b/src/Routes/Objects/UnmanagedDeviceModel.php index c24000d2..3147fb88 100644 --- a/src/Routes/Objects/UnmanagedDeviceModel.php +++ b/src/Routes/Objects/UnmanagedDeviceModel.php @@ -4,33 +4,34 @@ class UnmanagedDeviceModel { - public static function from_json(mixed $json): UnmanagedDeviceModel|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedDeviceModel|null + { + if (!$json) { + return null; + } + return new self( + display_name: $json->display_name, + manufacturer_display_name: $json->manufacturer_display_name, + accessory_keypad_supported: $json->accessory_keypad_supported ?? + null, + can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? + null, + has_built_in_keypad: $json->has_built_in_keypad ?? null, + offline_access_codes_supported: $json->offline_access_codes_supported ?? + null, + online_access_codes_supported: $json->online_access_codes_supported ?? + null + ); } - return new self( - display_name: $json->display_name, - manufacturer_display_name: $json->manufacturer_display_name, - accessory_keypad_supported: $json->accessory_keypad_supported ?? - null, - can_connect_accessory_keypad: $json->can_connect_accessory_keypad ?? - null, - has_built_in_keypad: $json->has_built_in_keypad ?? null, - offline_access_codes_supported: $json->offline_access_codes_supported ?? - null, - online_access_codes_supported: $json->online_access_codes_supported ?? - null - ); - } - public function __construct( - public string $display_name, - public string $manufacturer_display_name, - public bool|null $accessory_keypad_supported, - public bool|null $can_connect_accessory_keypad, - public bool|null $has_built_in_keypad, - public bool|null $offline_access_codes_supported, - public bool|null $online_access_codes_supported - ) {} + public function __construct( + public string $display_name, + public string $manufacturer_display_name, + public bool|null $accessory_keypad_supported, + public bool|null $can_connect_accessory_keypad, + public bool|null $has_built_in_keypad, + public bool|null $offline_access_codes_supported, + public bool|null $online_access_codes_supported + ) { + } } diff --git a/src/Routes/Objects/UnmanagedDeviceProperties.php b/src/Routes/Objects/UnmanagedDeviceProperties.php index b31bb597..77c24929 100644 --- a/src/Routes/Objects/UnmanagedDeviceProperties.php +++ b/src/Routes/Objects/UnmanagedDeviceProperties.php @@ -4,46 +4,47 @@ class UnmanagedDeviceProperties { - public static function from_json( - mixed $json - ): UnmanagedDeviceProperties|null { - if (!$json) { - return null; + public static function from_json( + mixed $json + ): UnmanagedDeviceProperties|null { + if (!$json) { + return null; + } + return new self( + model: UnmanagedDeviceModel::from_json($json->model), + name: $json->name, + online: $json->online, + accessory_keypad: isset($json->accessory_keypad) + ? UnmanagedDeviceAccessoryKeypad::from_json( + $json->accessory_keypad + ) + : null, + battery: isset($json->battery) + ? UnmanagedDeviceBattery::from_json($json->battery) + : null, + battery_level: $json->battery_level ?? null, + image_alt_text: $json->image_alt_text ?? null, + image_url: $json->image_url ?? null, + manufacturer: $json->manufacturer ?? null, + offline_access_codes_enabled: $json->offline_access_codes_enabled ?? + null, + online_access_codes_enabled: $json->online_access_codes_enabled ?? + null + ); } - return new self( - model: UnmanagedDeviceModel::from_json($json->model), - name: $json->name, - online: $json->online, - accessory_keypad: isset($json->accessory_keypad) - ? UnmanagedDeviceAccessoryKeypad::from_json( - $json->accessory_keypad - ) - : null, - battery: isset($json->battery) - ? UnmanagedDeviceBattery::from_json($json->battery) - : null, - battery_level: $json->battery_level ?? null, - image_alt_text: $json->image_alt_text ?? null, - image_url: $json->image_url ?? null, - manufacturer: $json->manufacturer ?? null, - offline_access_codes_enabled: $json->offline_access_codes_enabled ?? - null, - online_access_codes_enabled: $json->online_access_codes_enabled ?? - null - ); - } - public function __construct( - public UnmanagedDeviceModel $model, - public string $name, - public bool $online, - public UnmanagedDeviceAccessoryKeypad|null $accessory_keypad, - public UnmanagedDeviceBattery|null $battery, - public float|null $battery_level, - public string|null $image_alt_text, - public string|null $image_url, - public string|null $manufacturer, - public bool|null $offline_access_codes_enabled, - public bool|null $online_access_codes_enabled - ) {} + public function __construct( + public UnmanagedDeviceModel $model, + public string $name, + public bool $online, + public UnmanagedDeviceAccessoryKeypad|null $accessory_keypad, + public UnmanagedDeviceBattery|null $battery, + public float|null $battery_level, + public string|null $image_alt_text, + public string|null $image_url, + public string|null $manufacturer, + public bool|null $offline_access_codes_enabled, + public bool|null $online_access_codes_enabled + ) { + } } diff --git a/src/Routes/Objects/UnmanagedDeviceWarnings.php b/src/Routes/Objects/UnmanagedDeviceWarnings.php index 51f5730d..c93d6b68 100644 --- a/src/Routes/Objects/UnmanagedDeviceWarnings.php +++ b/src/Routes/Objects/UnmanagedDeviceWarnings.php @@ -4,21 +4,22 @@ class UnmanagedDeviceWarnings { - public static function from_json(mixed $json): UnmanagedDeviceWarnings|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UnmanagedDeviceWarnings|null + { + if (!$json) { + return null; + } + return new self( + message: $json->message, + warning_code: $json->warning_code, + created_at: $json->created_at ?? null + ); } - return new self( - message: $json->message, - warning_code: $json->warning_code, - created_at: $json->created_at ?? null - ); - } - public function __construct( - public string $message, - public string $warning_code, - public string|null $created_at - ) {} + public function __construct( + public string $message, + public string $warning_code, + public string|null $created_at + ) { + } } diff --git a/src/Routes/Objects/UserIdentity.php b/src/Routes/Objects/UserIdentity.php index 807870ee..fd59e4f4 100644 --- a/src/Routes/Objects/UserIdentity.php +++ b/src/Routes/Objects/UserIdentity.php @@ -4,31 +4,32 @@ class UserIdentity { - public static function from_json(mixed $json): UserIdentity|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): UserIdentity|null + { + if (!$json) { + return null; + } + return new self( + created_at: $json->created_at, + display_name: $json->display_name, + user_identity_id: $json->user_identity_id, + workspace_id: $json->workspace_id, + email_address: $json->email_address ?? null, + full_name: $json->full_name ?? null, + phone_number: $json->phone_number ?? null, + user_identity_key: $json->user_identity_key ?? null + ); } - return new self( - created_at: $json->created_at, - display_name: $json->display_name, - user_identity_id: $json->user_identity_id, - workspace_id: $json->workspace_id, - email_address: $json->email_address ?? null, - full_name: $json->full_name ?? null, - phone_number: $json->phone_number ?? null, - user_identity_key: $json->user_identity_key ?? null - ); - } - public function __construct( - public string $created_at, - public string $display_name, - public string $user_identity_id, - public string $workspace_id, - public string|null $email_address, - public string|null $full_name, - public string|null $phone_number, - public string|null $user_identity_key - ) {} + public function __construct( + public string $created_at, + public string $display_name, + public string $user_identity_id, + public string $workspace_id, + public string|null $email_address, + public string|null $full_name, + public string|null $phone_number, + public string|null $user_identity_key + ) { + } } diff --git a/src/Routes/Objects/Webhook.php b/src/Routes/Objects/Webhook.php index 9435ed2f..aa0b81f6 100644 --- a/src/Routes/Objects/Webhook.php +++ b/src/Routes/Objects/Webhook.php @@ -4,23 +4,24 @@ class Webhook { - public static function from_json(mixed $json): Webhook|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): Webhook|null + { + if (!$json) { + return null; + } + return new self( + url: $json->url, + webhook_id: $json->webhook_id, + event_types: $json->event_types ?? null, + secret: $json->secret ?? null + ); } - return new self( - url: $json->url, - webhook_id: $json->webhook_id, - event_types: $json->event_types ?? null, - secret: $json->secret ?? null - ); - } - public function __construct( - public string $url, - public string $webhook_id, - public array|null $event_types, - public string|null $secret - ) {} + public function __construct( + public string $url, + public string $webhook_id, + public array|null $event_types, + public string|null $secret + ) { + } } diff --git a/src/Routes/Objects/Workspace.php b/src/Routes/Objects/Workspace.php index 14b4b358..343ae8b9 100644 --- a/src/Routes/Objects/Workspace.php +++ b/src/Routes/Objects/Workspace.php @@ -4,25 +4,26 @@ class Workspace { - public static function from_json(mixed $json): Workspace|null - { - if (!$json) { - return null; + public static function from_json(mixed $json): Workspace|null + { + if (!$json) { + return null; + } + return new self( + company_name: $json->company_name, + is_sandbox: $json->is_sandbox, + name: $json->name, + workspace_id: $json->workspace_id, + connect_partner_name: $json->connect_partner_name ?? null + ); } - return new self( - company_name: $json->company_name, - is_sandbox: $json->is_sandbox, - name: $json->name, - workspace_id: $json->workspace_id, - connect_partner_name: $json->connect_partner_name ?? null - ); - } - public function __construct( - public string $company_name, - public bool $is_sandbox, - public string $name, - public string $workspace_id, - public string|null $connect_partner_name - ) {} + public function __construct( + public string $company_name, + public bool $is_sandbox, + public string $name, + public string $workspace_id, + public string|null $connect_partner_name + ) { + } } diff --git a/src/Routes/Routes.php b/src/Routes/Routes.php index 43a82e03..0818b64b 100644 --- a/src/Routes/Routes.php +++ b/src/Routes/Routes.php @@ -23,42 +23,42 @@ class Routes { - public AccessCodesClient $access_codes; - public AcsClient $acs; - public ActionAttemptsClient $action_attempts; - public BridgesClient $bridges; - public ClientSessionsClient $client_sessions; - public ConnectWebviewsClient $connect_webviews; - public ConnectedAccountsClient $connected_accounts; - public DevicesClient $devices; - public EventsClient $events; - public LocksClient $locks; - public NetworksClient $networks; - public NoiseSensorsClient $noise_sensors; - public PhonesClient $phones; - public ThermostatsClient $thermostats; - public UserIdentitiesClient $user_identities; - public WebhooksClient $webhooks; - public WorkspacesClient $workspaces; + public AccessCodesClient $access_codes; + public AcsClient $acs; + public ActionAttemptsClient $action_attempts; + public BridgesClient $bridges; + public ClientSessionsClient $client_sessions; + public ConnectWebviewsClient $connect_webviews; + public ConnectedAccountsClient $connected_accounts; + public DevicesClient $devices; + public EventsClient $events; + public LocksClient $locks; + public NetworksClient $networks; + public NoiseSensorsClient $noise_sensors; + public PhonesClient $phones; + public ThermostatsClient $thermostats; + public UserIdentitiesClient $user_identities; + public WebhooksClient $webhooks; + public WorkspacesClient $workspaces; - public function __construct(Seam $seam) - { - $this->access_codes = new AccessCodesClient($seam); - $this->acs = new AcsClient($seam); - $this->action_attempts = new ActionAttemptsClient($seam); - $this->bridges = new BridgesClient($seam); - $this->client_sessions = new ClientSessionsClient($seam); - $this->connect_webviews = new ConnectWebviewsClient($seam); - $this->connected_accounts = new ConnectedAccountsClient($seam); - $this->devices = new DevicesClient($seam); - $this->events = new EventsClient($seam); - $this->locks = new LocksClient($seam); - $this->networks = new NetworksClient($seam); - $this->noise_sensors = new NoiseSensorsClient($seam); - $this->phones = new PhonesClient($seam); - $this->thermostats = new ThermostatsClient($seam); - $this->user_identities = new UserIdentitiesClient($seam); - $this->webhooks = new WebhooksClient($seam); - $this->workspaces = new WorkspacesClient($seam); - } + public function __construct(Seam $seam) + { + $this->access_codes = new AccessCodesClient($seam); + $this->acs = new AcsClient($seam); + $this->action_attempts = new ActionAttemptsClient($seam); + $this->bridges = new BridgesClient($seam); + $this->client_sessions = new ClientSessionsClient($seam); + $this->connect_webviews = new ConnectWebviewsClient($seam); + $this->connected_accounts = new ConnectedAccountsClient($seam); + $this->devices = new DevicesClient($seam); + $this->events = new EventsClient($seam); + $this->locks = new LocksClient($seam); + $this->networks = new NetworksClient($seam); + $this->noise_sensors = new NoiseSensorsClient($seam); + $this->phones = new PhonesClient($seam); + $this->thermostats = new ThermostatsClient($seam); + $this->user_identities = new UserIdentitiesClient($seam); + $this->webhooks = new WebhooksClient($seam); + $this->workspaces = new WorkspacesClient($seam); + } } diff --git a/src/Seam.php b/src/Seam.php index 0a65752d..cdfac88c 100644 --- a/src/Seam.php +++ b/src/Seam.php @@ -10,63 +10,63 @@ class Seam { - private Routes $routes; - public string $api_key; - public GuzzleHttpClient $client; - public string $ltsVersion = LTS_VERSION; + private Routes $routes; + public string $api_key; + public GuzzleHttpClient $client; + public string $ltsVersion = LTS_VERSION; - public function __construct( - $api_key = null, - $endpoint = "https://connect.getseam.com" - ) { - $this->api_key = $api_key ?: (getenv("SEAM_API_KEY") ?: null); - $seam_sdk_version = PackageVersion::get(); + public function __construct( + $api_key = null, + $endpoint = "https://connect.getseam.com" + ) { + $this->api_key = $api_key ?: (getenv("SEAM_API_KEY") ?: null); + $seam_sdk_version = PackageVersion::get(); - $headers = [ - "Authorization" => "Bearer " . $this->api_key, - "User-Agent" => "Seam PHP Client " . $seam_sdk_version, - "seam-sdk-name" => "seamapi/php", - "seam-sdk-version" => $seam_sdk_version, - "seam-lts-version" => $this->ltsVersion, - ]; + $headers = [ + "Authorization" => "Bearer " . $this->api_key, + "User-Agent" => "Seam PHP Client " . $seam_sdk_version, + "seam-sdk-name" => "seamapi/php", + "seam-sdk-version" => $seam_sdk_version, + "seam-lts-version" => $this->ltsVersion, + ]; - $this->client = Http::createClient([ - 'base_url' => $endpoint, - 'headers' => $headers - ]); - $this->routes = new Routes($this); - } + $this->client = Http::createClient([ + "base_url" => $endpoint, + "headers" => $headers, + ]); + $this->routes = new Routes($this); + } - public function __get(string $name): mixed - { - return $this->routes->$name; - } + public function __get(string $name): mixed + { + return $this->routes->$name; + } - public function request( - $method, - $path, - $json = null, - $query = null, - $inner_object = null - ) { - $options = []; + public function request( + $method, + $path, + $json = null, + $query = null, + $inner_object = null + ) { + $options = []; - if ($json !== null) { - $options['json'] = $json; - } + if ($json !== null) { + $options["json"] = $json; + } - if ($query !== null) { - $options['query'] = $query; - } + if ($query !== null) { + $options["query"] = $query; + } - $response = $this->client->request($method, $path, $options); - $body = json_decode($response->getBody()); + $response = $this->client->request($method, $path, $options); + $body = json_decode($response->getBody()); - // Handle inner_object extraction if needed - if ($inner_object && isset($body->$inner_object)) { - return $body->$inner_object; - } + // Handle inner_object extraction if needed + if ($inner_object && isset($body->$inner_object)) { + return $body->$inner_object; + } - return $body; - } + return $body; + } } diff --git a/tests/Fixture.php b/tests/Fixture.php index 183c1b84..adf85845 100644 --- a/tests/Fixture.php +++ b/tests/Fixture.php @@ -6,19 +6,19 @@ final class Fixture { - public static function getTestServer() - { - $random_string = substr( - str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"), - 0, - 10 - ); - echo $random_string; - $api_url = "https://{$random_string}.fakeseamconnect.seam.vc"; - $api_key = "seam_apikey1_token"; + public static function getTestServer() + { + $random_string = substr( + str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"), + 0, + 10 + ); + echo $random_string; + $api_url = "https://{$random_string}.fakeseamconnect.seam.vc"; + $api_key = "seam_apikey1_token"; - $seam = new Seam($api_key, $api_url); + $seam = new Seam($api_key, $api_url); - return $seam; - } + return $seam; + } } diff --git a/tests/HttpErrorTest.php b/tests/HttpErrorTest.php index 2c7654f4..f30fa740 100644 --- a/tests/HttpErrorTest.php +++ b/tests/HttpErrorTest.php @@ -8,81 +8,81 @@ final class HttpErrorTest extends TestCase { - public function testInvalidInputError(): void - { - $seam = Fixture::getTestServer(); + public function testInvalidInputError(): void + { + $seam = Fixture::getTestServer(); - try { - $seam->request( - "POST", - "/devices/list", - json: [ - "device_ids" => 1234, - ] - ); - $this->fail("Expected InvalidInputError"); - } catch (\Seam\HttpInvalidInputError $e) { - $this->assertEquals(400, $e->getStatusCode()); - $this->assertNotEmpty($e->getRequestId()); - $this->assertEquals("invalid_input", $e->getErrorCode()); - $this->assertEquals( - ["Expected array, received number"], - $e->getValidationErrorMessages("device_ids") - ); + try { + $seam->request( + "POST", + "/devices/list", + json: [ + "device_ids" => 1234, + ] + ); + $this->fail("Expected InvalidInputError"); + } catch (\Seam\HttpInvalidInputError $e) { + $this->assertEquals(400, $e->getStatusCode()); + $this->assertNotEmpty($e->getRequestId()); + $this->assertEquals("invalid_input", $e->getErrorCode()); + $this->assertEquals( + ["Expected array, received number"], + $e->getValidationErrorMessages("device_ids") + ); + } } - } - public function testUnauthorizedError(): void - { - $test_server = Fixture::getTestServer(); - $seam = new Seam( - "invalid_api_key", - $test_server->client->getConfig("base_uri")->__toString() - ); + public function testUnauthorizedError(): void + { + $test_server = Fixture::getTestServer(); + $seam = new Seam( + "invalid_api_key", + $test_server->client->getConfig("base_uri")->__toString() + ); - try { - $seam->devices->list(); - $this->fail("Expected UnauthorizedError"); - } catch (\Seam\HttpUnauthorizedError $e) { - $this->assertNotEmpty($e->getRequestId()); + try { + $seam->devices->list(); + $this->fail("Expected UnauthorizedError"); + } catch (\Seam\HttpUnauthorizedError $e) { + $this->assertNotEmpty($e->getRequestId()); + } } - } - public function testApiError(): void - { - $seam = Fixture::getTestServer(); + public function testApiError(): void + { + $seam = Fixture::getTestServer(); - try { - $seam->devices->get(device_id: "nonexistent_device_id"); - $this->fail("Expected ApiError"); - } catch (\Seam\HttpApiError $e) { - $this->assertEquals(404, $e->getStatusCode()); - $this->assertNotEmpty($e->getRequestId()); - $this->assertEquals("device_not_found", $e->getErrorCode()); + try { + $seam->devices->get(device_id: "nonexistent_device_id"); + $this->fail("Expected ApiError"); + } catch (\Seam\HttpApiError $e) { + $this->assertEquals(404, $e->getStatusCode()); + $this->assertNotEmpty($e->getRequestId()); + $this->assertEquals("device_not_found", $e->getErrorCode()); + } } - } - public function testNonSeamError(): void - { - $seam = Fixture::getTestServer(); + public function testNonSeamError(): void + { + $seam = Fixture::getTestServer(); - $seam = new Seam( - "seam_apikey1_token", - "https://nonexistent.example.com" - ); + $seam = new Seam( + "seam_apikey1_token", + "https://nonexistent.example.com" + ); - try { - $seam->devices->list(); - $this->fail("Expected GuzzleHttp ConnectException"); - } catch (\GuzzleHttp\Exception\ConnectException $e) { - $this->assertInstanceOf( - \GuzzleHttp\Exception\ConnectException::class, - $e - ); - $this->assertStringContainsString( - "Could not resolve host", - $e->getMessage() - ); + try { + $seam->devices->list(); + $this->fail("Expected GuzzleHttp ConnectException"); + } catch (\GuzzleHttp\Exception\ConnectException $e) { + $this->assertInstanceOf( + \GuzzleHttp\Exception\ConnectException::class, + $e + ); + $this->assertStringContainsString( + "Could not resolve host", + $e->getMessage() + ); + } } - } } From 038c397ce2dd6438cf9be12866fa22ab3deb136d Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 19 Mar 2025 13:13:43 +0100 Subject: [PATCH 08/13] Fix src/Routes/Routes.php client names --- src/Routes/Routes.php | 102 +++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/Routes/Routes.php b/src/Routes/Routes.php index 0818b64b..b3ff7bc2 100644 --- a/src/Routes/Routes.php +++ b/src/Routes/Routes.php @@ -3,62 +3,62 @@ namespace Seam\Routes; use Seam\Seam; -use Seam\Routes\Clients\AccessCodesClient; -use Seam\Routes\Clients\AcsClient; -use Seam\Routes\Clients\ActionAttemptsClient; -use Seam\Routes\Clients\BridgesClient; -use Seam\Routes\Clients\ClientSessionsClient; -use Seam\Routes\Clients\ConnectWebviewsClient; -use Seam\Routes\Clients\ConnectedAccountsClient; -use Seam\Routes\Clients\DevicesClient; -use Seam\Routes\Clients\EventsClient; -use Seam\Routes\Clients\LocksClient; -use Seam\Routes\Clients\NetworksClient; -use Seam\Routes\Clients\NoiseSensorsClient; -use Seam\Routes\Clients\PhonesClient; -use Seam\Routes\Clients\ThermostatsClient; -use Seam\Routes\Clients\UserIdentitiesClient; -use Seam\Routes\Clients\WebhooksClient; -use Seam\Routes\Clients\WorkspacesClient; +use Seam\Routes\Clients\AccessCodes; +use Seam\Routes\Clients\Acs; +use Seam\Routes\Clients\ActionAttempts; +use Seam\Routes\Clients\Bridges; +use Seam\Routes\Clients\ClientSessions; +use Seam\Routes\Clients\ConnectWebviews; +use Seam\Routes\Clients\ConnectedAccounts; +use Seam\Routes\Clients\Devices; +use Seam\Routes\Clients\Events; +use Seam\Routes\Clients\Locks; +use Seam\Routes\Clients\Networks; +use Seam\Routes\Clients\NoiseSensors; +use Seam\Routes\Clients\Phones; +use Seam\Routes\Clients\Thermostats; +use Seam\Routes\Clients\UserIdentities; +use Seam\Routes\Clients\Webhooks; +use Seam\Routes\Clients\Workspaces; class Routes { - public AccessCodesClient $access_codes; - public AcsClient $acs; - public ActionAttemptsClient $action_attempts; - public BridgesClient $bridges; - public ClientSessionsClient $client_sessions; - public ConnectWebviewsClient $connect_webviews; - public ConnectedAccountsClient $connected_accounts; - public DevicesClient $devices; - public EventsClient $events; - public LocksClient $locks; - public NetworksClient $networks; - public NoiseSensorsClient $noise_sensors; - public PhonesClient $phones; - public ThermostatsClient $thermostats; - public UserIdentitiesClient $user_identities; - public WebhooksClient $webhooks; - public WorkspacesClient $workspaces; + public AccessCodes $access_codes; + public Acs $acs; + public ActionAttempts $action_attempts; + public Bridges $bridges; + public ClientSessions $client_sessions; + public ConnectWebviews $connect_webviews; + public ConnectedAccounts $connected_accounts; + public Devices $devices; + public Events $events; + public Locks $locks; + public Networks $networks; + public NoiseSensors $noise_sensors; + public Phones $phones; + public Thermostats $thermostats; + public UserIdentities $user_identities; + public Webhooks $webhooks; + public Workspaces $workspaces; public function __construct(Seam $seam) { - $this->access_codes = new AccessCodesClient($seam); - $this->acs = new AcsClient($seam); - $this->action_attempts = new ActionAttemptsClient($seam); - $this->bridges = new BridgesClient($seam); - $this->client_sessions = new ClientSessionsClient($seam); - $this->connect_webviews = new ConnectWebviewsClient($seam); - $this->connected_accounts = new ConnectedAccountsClient($seam); - $this->devices = new DevicesClient($seam); - $this->events = new EventsClient($seam); - $this->locks = new LocksClient($seam); - $this->networks = new NetworksClient($seam); - $this->noise_sensors = new NoiseSensorsClient($seam); - $this->phones = new PhonesClient($seam); - $this->thermostats = new ThermostatsClient($seam); - $this->user_identities = new UserIdentitiesClient($seam); - $this->webhooks = new WebhooksClient($seam); - $this->workspaces = new WorkspacesClient($seam); + $this->access_codes = new AccessCodes($seam); + $this->acs = new Acs($seam); + $this->action_attempts = new ActionAttempts($seam); + $this->bridges = new Bridges($seam); + $this->client_sessions = new ClientSessions($seam); + $this->connect_webviews = new ConnectWebviews($seam); + $this->connected_accounts = new ConnectedAccounts($seam); + $this->devices = new Devices($seam); + $this->events = new Events($seam); + $this->locks = new Locks($seam); + $this->networks = new Networks($seam); + $this->noise_sensors = new NoiseSensors($seam); + $this->phones = new Phones($seam); + $this->thermostats = new Thermostats($seam); + $this->user_identities = new UserIdentities($seam); + $this->webhooks = new Webhooks($seam); + $this->workspaces = new Workspaces($seam); } } From 8cd8aad2232d19d8fdf73102979da405c48d8ae1 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 19 Mar 2025 13:18:19 +0100 Subject: [PATCH 09/13] Remove request method from Seam class --- src/Seam.php | 28 ---------------------------- tests/ActionAttemptsTest.php | 20 ++++++++------------ tests/HttpErrorTest.php | 10 ++++------ 3 files changed, 12 insertions(+), 46 deletions(-) diff --git a/src/Seam.php b/src/Seam.php index cdfac88c..85cb402b 100644 --- a/src/Seam.php +++ b/src/Seam.php @@ -41,32 +41,4 @@ public function __get(string $name): mixed { return $this->routes->$name; } - - public function request( - $method, - $path, - $json = null, - $query = null, - $inner_object = null - ) { - $options = []; - - if ($json !== null) { - $options["json"] = $json; - } - - if ($query !== null) { - $options["query"] = $query; - } - - $response = $this->client->request($method, $path, $options); - $body = json_decode($response->getBody()); - - // Handle inner_object extraction if needed - if ($inner_object && isset($body->$inner_object)) { - return $body->$inner_object; - } - - return $body; - } } diff --git a/tests/ActionAttemptsTest.php b/tests/ActionAttemptsTest.php index d6c45d7e..2c78174d 100644 --- a/tests/ActionAttemptsTest.php +++ b/tests/ActionAttemptsTest.php @@ -43,18 +43,16 @@ public function testFailedActionAttempt(): void $this->assertEquals("pending", $action_attempt->status); - $seam->request( - "POST", - "/_fake/update_action_attempt", - json: [ + $seam->client->post("/_fake/update_action_attempt", [ + "json" => [ "action_attempt_id" => $action_attempt->action_attempt_id, "status" => "error", "error" => [ "message" => "Failed", "type" => "failed_attempt", ], - ] - ); + ], + ]); try { $seam->action_attempts->poll_until_ready( @@ -84,14 +82,12 @@ public function testTimeoutActionAttempt(): void $this->assertEquals("pending", $action_attempt->status); - $seam->request( - "POST", - "/_fake/update_action_attempt", - json: [ + $seam->client->post("/_fake/update_action_attempt", [ + "json" => [ "action_attempt_id" => $action_attempt->action_attempt_id, "status" => "pending", - ] - ); + ], + ]); try { $seam->action_attempts->poll_until_ready( diff --git a/tests/HttpErrorTest.php b/tests/HttpErrorTest.php index f30fa740..232edda7 100644 --- a/tests/HttpErrorTest.php +++ b/tests/HttpErrorTest.php @@ -13,13 +13,11 @@ public function testInvalidInputError(): void $seam = Fixture::getTestServer(); try { - $seam->request( - "POST", - "/devices/list", - json: [ + $seam->client->post("/devices/list", [ + "json" => [ "device_ids" => 1234, - ] - ); + ], + ]); $this->fail("Expected InvalidInputError"); } catch (\Seam\HttpInvalidInputError $e) { $this->assertEquals(400, $e->getStatusCode()); From 30716d32cc90b31e0327413e3d51c4294135e57e Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Wed, 19 Mar 2025 14:08:44 +0100 Subject: [PATCH 10/13] Fix tests/DevicesTest.php --- tests/DevicesTest.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/DevicesTest.php b/tests/DevicesTest.php index eff72cd4..6a3156f5 100644 --- a/tests/DevicesTest.php +++ b/tests/DevicesTest.php @@ -41,17 +41,6 @@ public function testGetAndListDevices(): void $device = $seam->devices->get(name: $device_name); $this->assertTrue($device->properties->manufacturer === $manufacturer); - $seam->devices->delete(device_id: $device_id); - try { - $seam->devices->get(device_id: $device_id); - - $this->fail("Expected the device to be deleted"); - } catch (\Seam\HttpApiError $exception) { - $this->assertTrue( - str_contains($exception->getErrorCode(), "device_not_found") - ); - } - $stable_device_providers = $seam->devices->list_device_providers( provider_category: "stable" ); From 47d2985e72874fe6deb43be55bf31a84b4732ee7 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Thu, 20 Mar 2025 13:10:33 +0100 Subject: [PATCH 11/13] Parse Seam options, add factory methods --- src/Auth.php | 197 ++++++++++++++++++++++++++++++++++++++++++++++++ src/Config.php | 9 +++ src/Http.php | 3 + src/Options.php | 117 ++++++++++++++++++++++++++++ src/Seam.php | 77 ++++++++++++++----- 5 files changed, 383 insertions(+), 20 deletions(-) create mode 100644 src/Auth.php create mode 100644 src/Config.php create mode 100644 src/Options.php diff --git a/src/Auth.php b/src/Auth.php new file mode 100644 index 00000000..e8a084df --- /dev/null +++ b/src/Auth.php @@ -0,0 +1,197 @@ + "Bearer {$api_key}"]; + } + + public static function getAuthHeadersForPersonalAccessToken( + string $personal_access_token, + string $workspace_id + ): array { + if (self::isJwt($personal_access_token)) { + throw new SeamInvalidTokenError( + "A JWT cannot be used as a personal_access_token" + ); + } + + if (self::isClientSessionToken($personal_access_token)) { + throw new SeamInvalidTokenError( + "A Client Session Token cannot be used as a personal_access_token" + ); + } + + if (self::isPublishableKey($personal_access_token)) { + throw new SeamInvalidTokenError( + "A Publishable Key cannot be used as a personal_access_token" + ); + } + + if (!self::isAccessToken($personal_access_token)) { + throw new SeamInvalidTokenError( + "Unknown or invalid personal_access_token format, expected token to start with " . + self::ACCESS_TOKEN_PREFIX + ); + } + + return [ + "Authorization" => "Bearer {$personal_access_token}", + "Seam-Workspace-Id" => $workspace_id, + ]; + } + + public static function getAuthHeadersForMultiWorkspacePersonalAccessToken( + string $personal_access_token + ): array { + if (self::isJwt($personal_access_token)) { + throw new SeamInvalidTokenError( + "A JWT cannot be used as a personal_access_token" + ); + } + + if (self::isClientSessionToken($personal_access_token)) { + throw new SeamInvalidTokenError( + "A Client Session Token cannot be used as a personal_access_token" + ); + } + + if (self::isPublishableKey($personal_access_token)) { + throw new SeamInvalidTokenError( + "A Publishable Key cannot be used as a personal_access_token" + ); + } + + if (!self::isAccessToken($personal_access_token)) { + throw new SeamInvalidTokenError( + "Unknown or invalid personal_access_token format, expected token to start with " . + self::ACCESS_TOKEN_PREFIX + ); + } + + return ["Authorization" => "Bearer {$personal_access_token}"]; + } + + public static function isAccessToken(string $token): bool + { + return str_starts_with($token, self::ACCESS_TOKEN_PREFIX); + } + + public static function isJwt(string $token): bool + { + return str_starts_with($token, self::JWT_PREFIX); + } + + public static function isSeamToken(string $token): bool + { + return str_starts_with($token, self::TOKEN_PREFIX); + } + + public static function isApiKey(string $token): bool + { + return !self::isClientSessionToken($token) && + !self::isJwt($token) && + !self::isAccessToken($token) && + !self::isPublishableKey($token) && + self::isSeamToken($token); + } + + public static function isClientSessionToken(string $token): bool + { + return str_starts_with($token, self::CLIENT_SESSION_TOKEN_PREFIX); + } + + public static function isPublishableKey(string $token): bool + { + return str_starts_with($token, self::PUBLISHABLE_KEY_TOKEN_PREFIX); + } + + public static function isConsoleSessionToken(string $token): bool + { + return self::isJwt($token); + } + + public static function isPersonalAccessToken(string $token): bool + { + return self::isAccessToken($token); + } +} diff --git a/src/Config.php b/src/Config.php new file mode 100644 index 00000000..03bff3aa --- /dev/null +++ b/src/Config.php @@ -0,0 +1,9 @@ + false, ]; + $guzzleOptions = $config["guzzle_options"] ?? []; + $clientOptions = array_merge($clientOptions, $guzzleOptions); + return new GuzzleHttpClient($clientOptions); } diff --git a/src/Options.php b/src/Options.php new file mode 100644 index 00000000..7d68d886 --- /dev/null +++ b/src/Options.php @@ -0,0 +1,117 @@ + "Seam PHP Client " . $sdk_version, + "seam-sdk-name" => "seamapi/php", + "seam-sdk-version" => $sdk_version, + ]); + + $endpoint = self::getEndpoint($endpoint); + + return [ + "headers" => $headers, + "endpoint" => $endpoint, + ]; + } + + public static function getEndpoint(?string $endpoint = null): string + { + return $endpoint ?? (self::getEndpointFromEnv() ?? DEFAULT_ENDPOINT); + } + + public static function getEndpointFromEnv(): ?string + { + $seam_api_url = getenv("SEAM_API_URL"); + $seam_endpoint = getenv("SEAM_ENDPOINT"); + + if ($seam_api_url) { + trigger_error( + "Using the SEAM_API_URL environment variable is deprecated. Support will be removed in a later major version. Use SEAM_ENDPOINT instead.", + E_USER_DEPRECATED + ); + } + + if ($seam_api_url && $seam_endpoint) { + trigger_error( + "Detected both the SEAM_API_URL and SEAM_ENDPOINT environment variables. Using SEAM_ENDPOINT.", + E_USER_NOTICE + ); + } + + return $seam_endpoint ?: $seam_api_url; + } + + public static function isSeamOptionsWithApiKey( + ?string $api_key, + ?string $personal_access_token + ): bool { + if ($api_key === null) { + return false; + } + + if ($personal_access_token !== null) { + throw new SeamInvalidOptionsError( + "The personal_access_token option cannot be used with the api_key option" + ); + } + + return true; + } + + public static function isSeamOptionsWithPersonalAccessToken( + ?string $personal_access_token, + ?string $api_key, + ?string $workspace_id + ): bool { + if ($personal_access_token === null) { + return false; + } + + if ($api_key !== null) { + throw new SeamInvalidOptionsError( + "The api_key option cannot be used with the personal_access_token option" + ); + } + + if ($workspace_id === null) { + throw new SeamInvalidOptionsError( + "Must pass a workspace_id when using a personal_access_token" + ); + } + + return true; + } +} diff --git a/src/Seam.php b/src/Seam.php index 85cb402b..f9877f20 100644 --- a/src/Seam.php +++ b/src/Seam.php @@ -4,36 +4,43 @@ use Seam\Routes\Routes; use GuzzleHttp\Client as GuzzleHttpClient; -use Seam\Utils\PackageVersion; - -define("LTS_VERSION", "1.0.0"); class Seam { private Routes $routes; - public string $api_key; public GuzzleHttpClient $client; - public string $ltsVersion = LTS_VERSION; + public readonly array $defaults; + public static string $ltsVersion = Config::LTS_VERSION; public function __construct( - $api_key = null, - $endpoint = "https://connect.getseam.com" + ?GuzzleHttpClient $client = null, + ?string $api_key = null, + ?string $personal_access_token = null, + ?string $workspace_id = null, + ?string $endpoint = null, + ?bool $wait_for_action_attempt = true, + ?array $guzzle_options = [] ) { - $this->api_key = $api_key ?: (getenv("SEAM_API_KEY") ?: null); - $seam_sdk_version = PackageVersion::get(); - - $headers = [ - "Authorization" => "Bearer " . $this->api_key, - "User-Agent" => "Seam PHP Client " . $seam_sdk_version, - "seam-sdk-name" => "seamapi/php", - "seam-sdk-version" => $seam_sdk_version, - "seam-lts-version" => $this->ltsVersion, + $options = Options::parseOptions( + $api_key, + $personal_access_token, + $workspace_id, + $endpoint + ); + + $this->ltsVersion = Config::LTS_VERSION; + $this->defaults = [ + "wait_for_action_attempt" => $wait_for_action_attempt, ]; - $this->client = Http::createClient([ - "base_url" => $endpoint, - "headers" => $headers, - ]); + $this->client = + $client ?? + Http::createClient([ + "base_url" => $options["endpoint"], + "headers" => $options["headers"], + "guzzle_options" => $guzzle_options, + ]); + $this->routes = new Routes($this); } @@ -41,4 +48,34 @@ public function __get(string $name): mixed { return $this->routes->$name; } + + public static function fromApiKey( + string $api_key, + ?string $endpoint = null, + bool $wait_for_action_attempt = true, + array $guzzle_options = [] + ): self { + return new self( + api_key: $api_key, + endpoint: $endpoint, + wait_for_action_attempt: $wait_for_action_attempt, + guzzle_options: $guzzle_options + ); + } + + public static function fromPersonalAccessToken( + string $personal_access_token, + string $workspace_id, + ?string $endpoint = null, + bool $wait_for_action_attempt = true, + array $guzzle_options = [] + ): self { + return new self( + personal_access_token: $personal_access_token, + workspace_id: $workspace_id, + endpoint: $endpoint, + wait_for_action_attempt: $wait_for_action_attempt, + guzzle_options: $guzzle_options + ); + } } From 3a805535f66295af3105622b38c6f65472e6d9f4 Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Thu, 20 Mar 2025 13:13:43 +0100 Subject: [PATCH 12/13] Fix tests --- src/Seam.php | 1 - tests/Fixture.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Seam.php b/src/Seam.php index f9877f20..86ea3071 100644 --- a/src/Seam.php +++ b/src/Seam.php @@ -28,7 +28,6 @@ public function __construct( $endpoint ); - $this->ltsVersion = Config::LTS_VERSION; $this->defaults = [ "wait_for_action_attempt" => $wait_for_action_attempt, ]; diff --git a/tests/Fixture.php b/tests/Fixture.php index adf85845..e2a4a03a 100644 --- a/tests/Fixture.php +++ b/tests/Fixture.php @@ -17,7 +17,7 @@ public static function getTestServer() $api_url = "https://{$random_string}.fakeseamconnect.seam.vc"; $api_key = "seam_apikey1_token"; - $seam = new Seam($api_key, $api_url); + $seam = new Seam(api_key: $api_key, endpoint: $api_url); return $seam; } From 3accf1b356115399e90da4b6d056c099b984496b Mon Sep 17 00:00:00 2001 From: Andrii Balitskyi <10balian10@gmail.com> Date: Thu, 20 Mar 2025 13:32:50 +0100 Subject: [PATCH 13/13] Fix tests --- src/Seam.php | 6 +++--- tests/HttpErrorTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Seam.php b/src/Seam.php index 86ea3071..f1c8cb93 100644 --- a/src/Seam.php +++ b/src/Seam.php @@ -13,13 +13,13 @@ class Seam public static string $ltsVersion = Config::LTS_VERSION; public function __construct( - ?GuzzleHttpClient $client = null, ?string $api_key = null, + ?string $endpoint = null, ?string $personal_access_token = null, ?string $workspace_id = null, - ?string $endpoint = null, ?bool $wait_for_action_attempt = true, - ?array $guzzle_options = [] + ?array $guzzle_options = [], + ?GuzzleHttpClient $client = null ) { $options = Options::parseOptions( $api_key, diff --git a/tests/HttpErrorTest.php b/tests/HttpErrorTest.php index 232edda7..c57469fd 100644 --- a/tests/HttpErrorTest.php +++ b/tests/HttpErrorTest.php @@ -34,7 +34,7 @@ public function testUnauthorizedError(): void { $test_server = Fixture::getTestServer(); $seam = new Seam( - "invalid_api_key", + "seam_invalid_api_key", $test_server->client->getConfig("base_uri")->__toString() ); @@ -66,7 +66,7 @@ public function testNonSeamError(): void $seam = new Seam( "seam_apikey1_token", - "https://nonexistent.example.com" + endpoint: "https://nonexistent.example.com" ); try {