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 <http://opensource.org/licenses/MIT>. |
9
|
|
|
// |
10
|
|
|
// --------------------------------------------------------------------- |
11
|
|
|
|
12
|
|
|
namespace Linode\Internal\Profile; |
13
|
|
|
|
14
|
|
|
use Linode\Entity\Entity; |
15
|
|
|
use Linode\Entity\Profile\TrustedDevice; |
16
|
|
|
use Linode\Internal\AbstractRepository; |
17
|
|
|
use Linode\Repository\Profile\TrustedDeviceRepositoryInterface; |
18
|
|
|
|
19
|
|
|
class TrustedDeviceRepository extends AbstractRepository implements TrustedDeviceRepositoryInterface |
20
|
|
|
{ |
21
|
1 |
|
public function revoke(int $id): void |
22
|
|
|
{ |
23
|
1 |
|
$this->client->api($this->client::REQUEST_DELETE, sprintf('%s/%s', $this->getBaseUri(), $id)); |
24
|
|
|
} |
25
|
|
|
|
26
|
2 |
|
protected function getBaseUri(): string |
27
|
|
|
{ |
28
|
2 |
|
return '/profile/devices'; |
29
|
|
|
} |
30
|
|
|
|
31
|
1 |
|
protected function getSupportedFields(): array |
32
|
|
|
{ |
33
|
1 |
|
return [ |
34
|
1 |
|
TrustedDevice::FIELD_ID, |
35
|
1 |
|
TrustedDevice::FIELD_CREATED, |
36
|
1 |
|
TrustedDevice::FIELD_EXPIRY, |
37
|
1 |
|
TrustedDevice::FIELD_USER_AGENT, |
38
|
1 |
|
TrustedDevice::FIELD_LAST_AUTHENTICATED, |
39
|
1 |
|
TrustedDevice::FIELD_LAST_REMOTE_ADDR, |
40
|
1 |
|
]; |
41
|
|
|
} |
42
|
|
|
|
43
|
1 |
|
protected function jsonToEntity(array $json): Entity |
44
|
|
|
{ |
45
|
1 |
|
return new TrustedDevice($this->client, $json); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|