diff --git a/src/Contract/Request/RequestInterface.php b/src/Contract/Request/RequestInterface.php index cb85361..f7fcbd2 100644 --- a/src/Contract/Request/RequestInterface.php +++ b/src/Contract/Request/RequestInterface.php @@ -5,6 +5,12 @@ interface RequestInterface { + /** + * Returns class FQDN for exceptions + * @return class-string + */ + public function getExceptionClass(): string; + /** * Returns required configuration bitmask * @return int diff --git a/src/Request/Lock/Delete.php b/src/Request/Lock/Delete.php index be475e5..50a7d8a 100644 --- a/src/Request/Lock/Delete.php +++ b/src/Request/Lock/Delete.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\DeleteInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; final class Delete implements DeleteInterface @@ -46,6 +47,11 @@ public function getRequiredConfiguration(): int return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getEndpointUrl(): string { return '/v3/lock/delete'; diff --git a/src/Request/Lock/GetDetail.php b/src/Request/Lock/GetDetail.php index 4f82901..707eb31 100644 --- a/src/Request/Lock/GetDetail.php +++ b/src/Request/Lock/GetDetail.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\GetDetailInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; final class GetDetail implements GetDetailInterface @@ -41,6 +42,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; @@ -53,7 +59,7 @@ public function getEndpointUrl(): string public function getEndpointMethod(): string { - return Method::POST; + return Method::GET; } public function getRequestParams(): array diff --git a/src/Request/Lock/GetList.php b/src/Request/Lock/GetList.php index 3d64c3a..0da74e2 100644 --- a/src/Request/Lock/GetList.php +++ b/src/Request/Lock/GetList.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\GetListInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -73,6 +74,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; diff --git a/src/Request/Lock/Initialize.php b/src/Request/Lock/Initialize.php index 3a2b138..0293580 100644 --- a/src/Request/Lock/Initialize.php +++ b/src/Request/Lock/Initialize.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\InitializeInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -72,6 +73,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; diff --git a/src/Request/Lock/Rename.php b/src/Request/Lock/Rename.php index 0df8a62..88fbe1f 100644 --- a/src/Request/Lock/Rename.php +++ b/src/Request/Lock/Rename.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\RenameInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -53,6 +54,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; diff --git a/src/Request/Lock/Transfer.php b/src/Request/Lock/Transfer.php index 813be8f..1fb29f9 100644 --- a/src/Request/Lock/Transfer.php +++ b/src/Request/Lock/Transfer.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\TransferInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -55,6 +56,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; diff --git a/src/Request/Lock/UpdateData.php b/src/Request/Lock/UpdateData.php index a67a5a6..3e546a8 100644 --- a/src/Request/Lock/UpdateData.php +++ b/src/Request/Lock/UpdateData.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\UpdateDataInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -53,6 +54,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; diff --git a/src/Request/Lock/UpdateElectricQuantity.php b/src/Request/Lock/UpdateElectricQuantity.php index 343ec6a..5d02b36 100644 --- a/src/Request/Lock/UpdateElectricQuantity.php +++ b/src/Request/Lock/UpdateElectricQuantity.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Lock\UpdateElectricQuantityInterface; use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\LockException; use SunnyPHP\TTLock\Helper\DateTime; final class UpdateElectricQuantity implements UpdateElectricQuantityInterface @@ -50,6 +51,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return LockException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::ACCESS_TOKEN; diff --git a/src/Request/OAuth2/AccessToken.php b/src/Request/OAuth2/AccessToken.php index 53587bc..978ac0b 100644 --- a/src/Request/OAuth2/AccessToken.php +++ b/src/Request/OAuth2/AccessToken.php @@ -6,6 +6,7 @@ use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\OAuth2\AccessTokenInterface; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\CommonException; use Webmozart\Assert\Assert; final class AccessToken implements AccessTokenInterface @@ -43,6 +44,11 @@ public function getPassword(): string return $this->password; } + public function getExceptionClass(): string + { + return CommonException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::CLIENT_SECRET; diff --git a/src/Request/OAuth2/RefreshAccessToken.php b/src/Request/OAuth2/RefreshAccessToken.php index 0b3851f..70b4e57 100644 --- a/src/Request/OAuth2/RefreshAccessToken.php +++ b/src/Request/OAuth2/RefreshAccessToken.php @@ -6,6 +6,7 @@ use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\OAuth2\RefreshAccessTokenInterface; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; +use SunnyPHP\TTLock\Exception\CommonException; use Webmozart\Assert\Assert; final class RefreshAccessToken implements RefreshAccessTokenInterface @@ -38,6 +39,11 @@ public function getGrantType(): string return $this->grantType; } + public function getExceptionClass(): string + { + return CommonException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::CLIENT_SECRET; diff --git a/src/Request/User/Delete.php b/src/Request/User/Delete.php index 143a5a8..103b2bc 100644 --- a/src/Request/User/Delete.php +++ b/src/Request/User/Delete.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; use SunnyPHP\TTLock\Contract\Request\User\DeleteInterface; +use SunnyPHP\TTLock\Exception\CommonException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -45,6 +46,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return CommonException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::CLIENT_SECRET; diff --git a/src/Request/User/GetList.php b/src/Request/User/GetList.php index 16be75d..e44f648 100644 --- a/src/Request/User/GetList.php +++ b/src/Request/User/GetList.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; use SunnyPHP\TTLock\Contract\Request\User\GetListInterface; +use SunnyPHP\TTLock\Exception\CommonException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -82,6 +83,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return CommonException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::CLIENT_SECRET; diff --git a/src/Request/User/Register.php b/src/Request/User/Register.php index 8f65a5e..325bdf1 100644 --- a/src/Request/User/Register.php +++ b/src/Request/User/Register.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; use SunnyPHP\TTLock\Contract\Request\User\RegisterInterface; +use SunnyPHP\TTLock\Exception\CommonException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -59,6 +60,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return CommonException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::CLIENT_SECRET; diff --git a/src/Request/User/ResetPassword.php b/src/Request/User/ResetPassword.php index 20e3d3f..221bbd6 100644 --- a/src/Request/User/ResetPassword.php +++ b/src/Request/User/ResetPassword.php @@ -7,6 +7,7 @@ use SunnyPHP\TTLock\Contract\Request\Method; use SunnyPHP\TTLock\Contract\Request\RequiredConfiguration; use SunnyPHP\TTLock\Contract\Request\User\ResetPasswordInterface; +use SunnyPHP\TTLock\Exception\CommonException; use SunnyPHP\TTLock\Helper\DateTime; use Webmozart\Assert\Assert; @@ -59,6 +60,11 @@ public function getCurrentDateTime(): DateTimeImmutable return $this->currentDateTime; } + public function getExceptionClass(): string + { + return CommonException::class; + } + public function getRequiredConfiguration(): int { return RequiredConfiguration::CLIENT_ID | RequiredConfiguration::CLIENT_SECRET;