summaryrefslogtreecommitdiff
path: root/matrix-specification/Data/Room/LeftRoom.php
blob: 64b9462db60e846767f5bd0648f374aef4c410ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

namespace Matrix\Data\Room;

use Matrix\Data\AccountData;

/**
 * @see https://spec.matrix.org/v1.16/client-server-api/#get_matrixclientv3sync_response-200_left-room
 * TODO: validate against request. add ValidatesAgainstRequest interface? and MatrixRequest base class?
 */
class LeftRoom implements \JsonSerializable
{
  public function __construct(
    private ?AccountData $accountData = null,
    private ?State $state = null,
    private ?State $stateAfter = null,
    private ?Timeline $timeline = null,
  )
  {}

  public function jsonSerialize(): array
  {
    return array_filter([
      "account_data" => $this->inviteState,
      "state" => $this->state,
      "state_after" => $this->stateAfter,
      "timeline" => $this->timeline,
    ], fn ($value) => ! is_null($value));
  }
}