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 --- .../Responses/ClientSyncGetResponse.php | 35 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'matrix-specification/Responses/ClientSyncGetResponse.php') diff --git a/matrix-specification/Responses/ClientSyncGetResponse.php b/matrix-specification/Responses/ClientSyncGetResponse.php index 27464c1..ccdc5e6 100644 --- a/matrix-specification/Responses/ClientSyncGetResponse.php +++ b/matrix-specification/Responses/ClientSyncGetResponse.php @@ -2,7 +2,38 @@ namespace Matrix\Responses; -class ClientSyncGetResponse +use Matrix\Data\AccountData; +use Matrix\Data\DeviceLists; +use Matrix\Data\Presence; +use Matrix\Data\Room\Rooms; +use Matrix\Data\ToDevice; + +class ClientSyncGetResponse implements \JsonSerializable { - # TODO + /** + * @param array $deviceOneTimeKeysCount + */ + public function __construct( + private string $nextBatch, + private ?AccountData $accountData = null, + private ?DeviceLists $deviceLists = null, + private ?array $deviceOneTimeKeysCount = null, + private ?Presence $presence = null, + private ?Rooms $rooms = null, + private ?ToDevice $toDevice = null, + ) + {} + + public function jsonSerialize(): array + { + return array_filter([ + "account_data" => $this->accountData, + "device_lists" => $this->deviceLists, + "device_one_time_keys_count" => $this->deviceOneTimeKeysCount, + "next_batch" => $this->nextBatch, + "presence" => $this->presence, + "rooms" => $this->rooms, + "to_device" => $this->toDevice, + ], "is_null"); + } } -- cgit v1.2.3