From b19a8f63ad727a3633885d3f2b81edf8181a53b9 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 25 Sep 2025 13:38:24 +0200 Subject: matrix-specification split work in progress --- .../ClientDirectoryRoomAliasGetRequest.php | 29 ++++++++++++++++++ .../Requests/ClientKeysUploadPostRequest.php | 29 ++++++++++++++++++ .../Requests/ClientLoginGetRequest.php | 6 ---- .../Requests/ClientLoginPostRequest.php | 2 +- .../Requests/ClientRefreshPostRequest.php | 18 ++++++++++++ .../Requests/ClientSyncGetRequest.php | 34 ++++++++++++++++++++-- .../Requests/ClientUserIdFilterPostRequest.php | 34 ++++++++++++++++++++++ .../Requests/RequiresAuthentication.php | 2 +- 8 files changed, 144 insertions(+), 10 deletions(-) create mode 100644 matrix-specification/Requests/ClientDirectoryRoomAliasGetRequest.php create mode 100644 matrix-specification/Requests/ClientKeysUploadPostRequest.php delete mode 100644 matrix-specification/Requests/ClientLoginGetRequest.php create mode 100644 matrix-specification/Requests/ClientRefreshPostRequest.php create mode 100644 matrix-specification/Requests/ClientUserIdFilterPostRequest.php (limited to 'matrix-specification/Requests') diff --git a/matrix-specification/Requests/ClientDirectoryRoomAliasGetRequest.php b/matrix-specification/Requests/ClientDirectoryRoomAliasGetRequest.php new file mode 100644 index 0000000..174a5c2 --- /dev/null +++ b/matrix-specification/Requests/ClientDirectoryRoomAliasGetRequest.php @@ -0,0 +1,29 @@ +roomAlias}"; + } + + public function getQueryParameters(): array + { + return []; + } + + public function getBody(): array + { + return []; + } +} diff --git a/matrix-specification/Requests/ClientKeysUploadPostRequest.php b/matrix-specification/Requests/ClientKeysUploadPostRequest.php new file mode 100644 index 0000000..40d9eae --- /dev/null +++ b/matrix-specification/Requests/ClientKeysUploadPostRequest.php @@ -0,0 +1,29 @@ + $fallbackKeys + * @param array $oneTimeKeys + */ + public function __construct( + private ?DeviceKeys $deviceKeys = null, + private ?array $fallbackKeys = null, + private ?array $oneTimeKeys = null, + ) + {} + + public function jsonSerialize(): array + { + return array_filter([ + "device_keys" => $this->deviceKeys, + "fallback_keys" => $this->fallbackKeys, + "one_time_keys" => $this->oneTimeKeys, + ], "is_null"); + } +} diff --git a/matrix-specification/Requests/ClientLoginGetRequest.php b/matrix-specification/Requests/ClientLoginGetRequest.php deleted file mode 100644 index 73cc24c..0000000 --- a/matrix-specification/Requests/ClientLoginGetRequest.php +++ /dev/null @@ -1,6 +0,0 @@ - $this->refreshToken, + ]; + } +} diff --git a/matrix-specification/Requests/ClientSyncGetRequest.php b/matrix-specification/Requests/ClientSyncGetRequest.php index 2921fcf..2ab7d9e 100644 --- a/matrix-specification/Requests/ClientSyncGetRequest.php +++ b/matrix-specification/Requests/ClientSyncGetRequest.php @@ -2,7 +2,37 @@ namespace Matrix\Requests; -class ClientSyncGetRequest +use Matrix\Enums\PresenceState; + +class ClientSyncGetRequest implements RequiresAuthentication { - # TODO + public function __construct( + private ?string $filter = null, + private ?bool $fullState = null, + private ?PresenceState $setPresence = null, + private ?string $since = null, + private ?int $timeout = null, + private ?bool $useStateAfter = null, + ) + {} + + public function setDefaults(): void + { + $this->fullState ??= false; + $this->setPresence ??= PresenceState::ONLINE; + $this->timeout ??= 0; + $this->useStateAfter ??= false; + } + + public function getQueryParameters(): array + { + return array_filter([ + "filter" => $this->filter, + "full_state" => $this->fullState, + "set_presence" => $this->setPresence, + "since" => $this->since, + "timeout" => $this->timeout, + "use_state_after" => $this->useStateAfter, + ], "is_null"); + } } diff --git a/matrix-specification/Requests/ClientUserIdFilterPostRequest.php b/matrix-specification/Requests/ClientUserIdFilterPostRequest.php new file mode 100644 index 0000000..2edc4c5 --- /dev/null +++ b/matrix-specification/Requests/ClientUserIdFilterPostRequest.php @@ -0,0 +1,34 @@ + $this->accountData, + "event_fields" => $this->eventFields, + "event_format" => $this->eventFormat, + "presence" => $this->presence, + "room" => $this->room, + ]; + } +} diff --git a/matrix-specification/Requests/RequiresAuthentication.php b/matrix-specification/Requests/RequiresAuthentication.php index c494f13..a762405 100644 --- a/matrix-specification/Requests/RequiresAuthentication.php +++ b/matrix-specification/Requests/RequiresAuthentication.php @@ -4,5 +4,5 @@ namespace Matrix\Requests; interface RequiresAuthentication { - public function authenticateUser(): bool; + //public function authenticateUser(): bool; } -- cgit v1.2.3