1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// --------------------------------------------------------------------- |
4
|
|
|
// |
5
|
|
|
// Copyright (C) 2018-2024 Artem Rodygin |
6
|
|
|
// |
7
|
|
|
// You should have received a copy of the MIT License along with |
8
|
|
|
// this file. If not, see <https://opensource.org/licenses/MIT>. |
9
|
|
|
// |
10
|
|
|
// --------------------------------------------------------------------- |
11
|
|
|
|
12
|
|
|
namespace Linode\Profile\Repository; |
13
|
|
|
|
14
|
|
|
use Linode\Entity; |
15
|
|
|
use Linode\Internal\AbstractRepository; |
16
|
|
|
use Linode\Profile\TrustedDevice; |
17
|
|
|
use Linode\Profile\TrustedDeviceRepositoryInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @codeCoverageIgnore This class was autogenerated. |
21
|
|
|
*/ |
22
|
|
|
class TrustedDeviceRepository extends AbstractRepository implements TrustedDeviceRepositoryInterface |
23
|
|
|
{ |
24
|
|
|
public function revokeTrustedDevice(int $deviceId): void |
25
|
|
|
{ |
26
|
|
|
$this->client->delete(sprintf('%s/%s', $this->getBaseUri(), $deviceId)); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
protected function getBaseUri(): string |
30
|
|
|
{ |
31
|
|
|
return '/profile/devices'; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
protected function getSupportedFields(): array |
35
|
|
|
{ |
36
|
|
|
return [ |
37
|
|
|
TrustedDevice::FIELD_ID, |
38
|
|
|
TrustedDevice::FIELD_CREATED, |
39
|
|
|
TrustedDevice::FIELD_EXPIRY, |
40
|
|
|
TrustedDevice::FIELD_USER_AGENT, |
41
|
|
|
TrustedDevice::FIELD_LAST_AUTHENTICATED, |
42
|
|
|
TrustedDevice::FIELD_LAST_REMOTE_ADDR, |
43
|
|
|
]; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
protected function jsonToEntity(array $json): Entity |
47
|
|
|
{ |
48
|
|
|
return new TrustedDevice($this->client, $json); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|