summaryrefslogtreecommitdiff
path: root/matrix-specification/Responses/ClientUserIdFilterPostResponse.php
blob: ed7ba376eeeed128e3d25a7566bd55acdcf603b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

namespace Matrix\Responses;

class ClientUserIdFilterPostResponse implements \JsonSerializable
{
  public function __construct(
    private string $filterId,
  )
  {
    if (str_starts_with($filterId, "{")) {
      throw new \InvalidArgumentException("filterId cannot start with a { as this character is used to determine if the filter provided is inline JSON or a previously declared filter by homeservers on some APIs");
    }
  }

  public function jsonSerialize(): array
  {
    return [
      "filter_id" => $this->filterId,
    ];
  }
}