blob: 05b2fdecf584a20ea61dab559efb1f2401ab817a (
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
31
32
33
34
35
36
37
38
39
40
41
|
<?php
namespace Matrix\Requests;
use Matrix\Data\DeviceKeys;
use Matrix\Data\KeyObject;
use Matrix\Enums\ApiPathVersion;
use Matrix\Request;
class ClientKeysUploadPostRequest extends Request implements RateLimited, RequiresAuthentication
{
/**
* @param array<string, string|KeyObject> $fallbackKeys
* @param array<string, string|KeyObject> $oneTimeKeys
*/
public function __construct(
private ?DeviceKeys $deviceKeys = null,
private ?array $fallbackKeys = null,
private ?array $oneTimeKeys = null,
)
{}
public function getUri(string $scheme, string $serverName, ApiPathVersion $version): string
{
return "{$scheme}://{$serverName}/_matrix/client/{$version}/keys/upload";
}
public function getQueryParameters(): array
{
return [];
}
public function getBody(): array
{
return array_filter([
"device_keys" => $this->deviceKeys,
"fallback_keys" => $this->fallbackKeys,
"one_time_keys" => $this->oneTimeKeys,
], fn ($value) => ! is_null($value));
}
}
|