*/ public function __construct( private ?AccountData $accountData = null, private ?Ephemeral $ephemeral = null, private ?State $state = null, private ?State $stateAfter = null, private ?RoomSummary $summary = null, private ?Timeline $timeline = null, private ?UnreadNotificationCounts $unreadNotifications = null, private ?array $unreadThreadNotifications = null, ) {} public function jsonSerialize(): array { return array_filter([ "account_data" => $this->accountData, "ephemeral" => $this->ephemeral, "state" => $this->state, "state_after" => $this->stateAfter, "summary" => $this->summary, "timeline" => $this->timeline, "unread_notifications" => $this->unreadNotifications, "unreadThreadNotifications" => empty($this->unreadThreadNotifications) ? new \stdClass() : $this->unreadNotifications, ], fn ($value) => ! is_null($value)); } }