summaryrefslogtreecommitdiff
path: root/matrix-specification/Data/Room/Timeline.php
diff options
context:
space:
mode:
Diffstat (limited to 'matrix-specification/Data/Room/Timeline.php')
-rw-r--r--matrix-specification/Data/Room/Timeline.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/matrix-specification/Data/Room/Timeline.php b/matrix-specification/Data/Room/Timeline.php
new file mode 100644
index 0000000..8d70ddd
--- /dev/null
+++ b/matrix-specification/Data/Room/Timeline.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Matrix\Data\Room;
+
+use Matrix\Events\ClientEventWithoutRoomId;
+
+class Timeline implements \JsonSerializable
+{
+ /**
+ * @param ClientEventWithoutRoomId[] $events
+ */
+ public function __construct(
+ private array $events,
+ private ?bool $limited = null,
+ private ?string $previousBatch = null,
+ )
+ {}
+
+ public function jsonSerialize(): array
+ {
+ return array_filter([
+ "events" => $this->events,
+ "limited" => $this->limited,
+ "prev_batch" => $this->previousBatch,
+ ], fn ($value) => ! is_null($value));
+ }
+}