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\Account\Repository; |
13
|
|
|
|
14
|
|
|
use Linode\Account\Event; |
15
|
|
|
use Linode\Account\EventRepositoryInterface; |
16
|
|
|
use Linode\Entity; |
17
|
|
|
use Linode\Internal\AbstractRepository; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @codeCoverageIgnore This class was autogenerated. |
21
|
|
|
*/ |
22
|
|
|
class EventRepository extends AbstractRepository implements EventRepositoryInterface |
23
|
|
|
{ |
24
|
|
|
public function eventRead(int $eventId): void |
25
|
|
|
{ |
26
|
|
|
$this->client->post(sprintf('%s/%s/read', $this->getBaseUri(), $eventId)); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function eventSeen(int $eventId): void |
30
|
|
|
{ |
31
|
|
|
$this->client->post(sprintf('%s/%s/seen', $this->getBaseUri(), $eventId)); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
protected function getBaseUri(): string |
35
|
|
|
{ |
36
|
|
|
return '/account/events'; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
protected function getSupportedFields(): array |
40
|
|
|
{ |
41
|
|
|
return [ |
42
|
|
|
Event::FIELD_ID, |
43
|
|
|
Event::FIELD_USERNAME, |
44
|
|
|
Event::FIELD_ACTION, |
45
|
|
|
Event::FIELD_ENTITY, |
46
|
|
|
Event::FIELD_SECONDARY_ENTITY, |
47
|
|
|
Event::FIELD_CREATED, |
48
|
|
|
Event::FIELD_DURATION, |
49
|
|
|
Event::FIELD_PERCENT_COMPLETE, |
50
|
|
|
Event::FIELD_RATE, |
51
|
|
|
Event::FIELD_READ, |
52
|
|
|
Event::FIELD_SEEN, |
53
|
|
|
Event::FIELD_STATUS, |
54
|
|
|
Event::FIELD_TIME_REMAINING, |
55
|
|
|
Event::FIELD_MESSAGE, |
56
|
|
|
]; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
protected function jsonToEntity(array $json): Entity |
60
|
|
|
{ |
61
|
|
|
return new Event($this->client, $json); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|