summaryrefslogtreecommitdiff
path: root/matrix-specification/Data/Filters/RoomFilter.php
diff options
context:
space:
mode:
Diffstat (limited to 'matrix-specification/Data/Filters/RoomFilter.php')
-rw-r--r--matrix-specification/Data/Filters/RoomFilter.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/matrix-specification/Data/Filters/RoomFilter.php b/matrix-specification/Data/Filters/RoomFilter.php
new file mode 100644
index 0000000..dd110bd
--- /dev/null
+++ b/matrix-specification/Data/Filters/RoomFilter.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Matrix\Data\Filters;
+
+class RoomFilter
+{
+ /**
+ * @param string[] $notRooms
+ * @param string[] $rooms
+ */
+ public function __construct(
+ private ?RoomEventFilter $accountData = null,
+ private ?RoomEventFilter $ephemeral = null,
+ private ?bool $includeLeave = null,
+ private ?array $notRooms = null,
+ private ?array $rooms = null,
+ private ?RoomEventFilter $state = null,
+ private ?RoomEventFilter $timeline = null,
+ )
+ {}
+
+ public function setDefaults(): void
+ {
+ $this->includeLeave ??= false;
+ }
+
+ public function jsonSerialize(): array
+ {
+ return array_filter([
+ "account_data" => $this->accountData,
+ "ephemeral" => $this->ephemeral,
+ "include_leave" => $this->includeLeave,
+ "not_rooms" => $this->notRooms,
+ "rooms" => $this->rooms,
+ "state" => $this->state,
+ "timeline" => $this->timeline,
+ ], "is_null");
+ }
+}