summaryrefslogtreecommitdiff
path: root/matrix-specification/Responses/ClientRefreshPostResponse.php
blob: 38519a3cceb66884e972a0dd603ed87c8a5e6fac (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 ClientRefreshPostResponse extends Response
{
  public function __construct(
    private string $accessToken,
    private ?int $expiresInMilliseconds = null,
    private ?string $refreshToken = null,
  )
  {}

  public function getBody(): array
  {
    return array_filter([
      "access_token" => $this->accessToken,
      "expires_in_ms" => $this->expiresInMilliseconds,
      "refresh_token" => $this->refreshToken,
    ], fn ($value) => ! is_null($value));
  }
}