summaryrefslogtreecommitdiff
path: root/matrix-specification/Responses/ClientUserIdFilterPostResponse.php
blob: 0a5d062b5582c142af3835188191f873dcd4ed2a (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
<?php

namespace Matrix\Responses;

use Matrix\Response;

class ClientUserIdFilterPostResponse extends Response
{
  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 getBody(): array
  {
    return [
      "filter_id" => $this->filterId,
    ];
  }
}