summaryrefslogtreecommitdiff
path: root/matrix-specification/Responses/ClientAccountWhoamiGetResponse.php
blob: 2f7ff81c0b0adb8fad0f4d53465c0852db569a72 (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
<?php

namespace Matrix\Responses;

use Matrix\Response;

class ClientAccountWhoamiGetResponse extends Response
{
  public function __construct(
    private string $userId,
    private ?string $deviceId = null,
    private ?bool $isGuest = null,
  )
  {}

  public function getBody(): array
  {
    return array_filter([
      "device_id" => $this->deviceId,
      "is_guest" => $this->isGuest,
      "user_id" => $this->userId,
    ], fn ($value) => ! is_null($value));
  }
}