diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-09-19 17:03:47 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-09-19 17:03:47 +0200 |
commit | b08047ba485f86038f33175162943c0a9878ab1a (patch) | |
tree | 49980e78eb3e641b04ddcc0817f74e89dc07f2b7 /matrix-specification/Responses | |
parent | 2ae0c2fa2a0bb5a7cd1fd9da1c6d2a6090126e67 (diff) |
Diffstat (limited to 'matrix-specification/Responses')
-rw-r--r-- | matrix-specification/Responses/ClientLoginGetResponse.php | 21 | ||||
-rw-r--r-- | matrix-specification/Responses/ClientSyncGetResponse.php | 8 | ||||
-rw-r--r-- | matrix-specification/Responses/LoginFlow.php | 31 |
3 files changed, 60 insertions, 0 deletions
diff --git a/matrix-specification/Responses/ClientLoginGetResponse.php b/matrix-specification/Responses/ClientLoginGetResponse.php new file mode 100644 index 0000000..e0ccc26 --- /dev/null +++ b/matrix-specification/Responses/ClientLoginGetResponse.php @@ -0,0 +1,21 @@ +<?php + +namespace Matrix\Responses; + +class ClientLoginGetResponse implements \JsonSerializable +{ + /** + * @param LoginFlow[] $loginFlows + */ + public function __construct( + private array $loginFlows, + ) + {} + + public function jsonSerialize(): array + { + return [ + "flows" => $this->loginFlows, + ]; + } +} diff --git a/matrix-specification/Responses/ClientSyncGetResponse.php b/matrix-specification/Responses/ClientSyncGetResponse.php new file mode 100644 index 0000000..27464c1 --- /dev/null +++ b/matrix-specification/Responses/ClientSyncGetResponse.php @@ -0,0 +1,8 @@ +<?php + +namespace Matrix\Responses; + +class ClientSyncGetResponse +{ + # TODO +} diff --git a/matrix-specification/Responses/LoginFlow.php b/matrix-specification/Responses/LoginFlow.php new file mode 100644 index 0000000..6ddb703 --- /dev/null +++ b/matrix-specification/Responses/LoginFlow.php @@ -0,0 +1,31 @@ +<?php + +namespace Matrix\Responses; + +use Matrix\Enums\LoginType; + +class LoginFlow implements \JsonSerializable +{ + public function __construct( + private LoginType $type, + private ?bool $getLoginToken = null, + ) + {} + + public function jsonSerialize(): array + { + $loginFlow = [ + "type" => $this->type, + ]; + + $loginFlow += match ($this->type) { + LoginType::TOKEN => [ + "get_login_token" => $this->getLoginToken, + ], + + default => [], + }; + + return $loginFlow; + } +} |