-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathNotificationService.php
86 lines (74 loc) · 2.84 KB
/
NotificationService.php
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace Ibexa\Contracts\Core\Repository;
use Ibexa\Contracts\Core\Repository\Values\Notification\CreateStruct;
use Ibexa\Contracts\Core\Repository\Values\Notification\Notification;
use Ibexa\Contracts\Core\Repository\Values\Notification\NotificationList;
/**
* Service to manager user notifications. It works in the context of a current User (obtained from
* the PermissionResolver).
*/
interface NotificationService
{
/**
* @param string[] $query
*/
public function loadNotifications(int $offset, int $limit, array $query = []): NotificationList;
/**
* Load single notification (by ID).
*
* @param int $notificationId Notification ID
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
*
* @return \Ibexa\Contracts\Core\Repository\Values\Notification\Notification
*/
public function getNotification(int $notificationId): Notification;
/**
* Mark notification as read so it no longer bother the user.
*
* @param \Ibexa\Contracts\Core\Repository\Values\Notification\Notification $notification
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
*/
public function markNotificationAsRead(Notification $notification): void;
/**
* Marks the given notification as unread so it is shown again as new to the user.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
*/
public function markNotificationAsUnread(Notification $notification): void;
/**
* Get count of unread users notifications.
*
* @return int
*/
public function getPendingNotificationCount(): int;
/**
* @param string[] $query
*/
public function getNotificationCount(array $query = []): int;
/**
* Creates a new notification.
*
* @param \Ibexa\Contracts\Core\Repository\Values\Notification\CreateStruct $createStruct
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
*
* @return \Ibexa\Contracts\Core\Repository\Values\Notification\Notification
*/
public function createNotification(CreateStruct $createStruct): Notification;
/**
* Deletes a notification.
*
* @param \Ibexa\Contracts\Core\Repository\Values\Notification\Notification $notification
*/
public function deleteNotification(Notification $notification): void;
}
class_alias(NotificationService::class, 'eZ\Publish\API\Repository\NotificationService');