2015-08-31 06:24:37 -04:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2019-04-10 08:12:10 -04:00
|
|
|
declare(strict_types=1);
|
2015-08-31 06:24:37 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-08-31 06:24:37 -04:00
|
|
|
*/
|
2016-01-14 08:35:24 -05:00
|
|
|
namespace OCP\Notification;
|
2015-08-31 06:24:37 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interface INotifier
|
|
|
|
|
*
|
2016-01-22 04:51:36 -05:00
|
|
|
* @since 9.0.0
|
2015-08-31 06:24:37 -04:00
|
|
|
*/
|
|
|
|
|
interface INotifier {
|
2019-04-10 08:45:33 -04:00
|
|
|
/**
|
|
|
|
|
* Identifier of the notifier, only use [a-z0-9_]
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 17.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getID(): string;
|
|
|
|
|
|
|
|
|
|
/**
|
2024-04-10 10:44:40 -04:00
|
|
|
* Human-readable name describing the notifier
|
2019-04-10 08:45:33 -04:00
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 17.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getName(): string;
|
|
|
|
|
|
2015-08-31 06:24:37 -04:00
|
|
|
/**
|
|
|
|
|
* @param INotification $notification
|
2015-09-01 04:20:54 -04:00
|
|
|
* @param string $languageCode The code of the language that should be used to prepare the notification
|
2015-08-31 06:24:37 -04:00
|
|
|
* @return INotification
|
2024-04-10 10:44:40 -04:00
|
|
|
* @throws UnknownNotificationException When the notification was not prepared by a notifier
|
2019-04-10 08:45:33 -04:00
|
|
|
* @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted
|
2024-04-10 11:12:31 -04:00
|
|
|
* @throws IncompleteParsedNotificationException Only to be thrown by the {@see IManager}
|
2016-01-22 04:51:36 -05:00
|
|
|
* @since 9.0.0
|
2024-04-10 10:44:40 -04:00
|
|
|
* @since 30.0.0 Notifiers should throw {@see UnknownNotificationException} instead of \InvalidArgumentException
|
|
|
|
|
* when they did not handle the notification. Throwing \InvalidArgumentException directly is deprecated and will
|
|
|
|
|
* be logged as an error in Nextcloud 39.
|
2024-04-10 11:12:31 -04:00
|
|
|
* @since 30.0.0 Throws {@see IncompleteParsedNotificationException} when not all required fields
|
|
|
|
|
* are set at the end of the manager or after a INotifier that claimed to have parsed the notification.
|
2015-08-31 06:24:37 -04:00
|
|
|
*/
|
2019-04-10 08:12:10 -04:00
|
|
|
public function prepare(INotification $notification, string $languageCode): INotification;
|
2015-08-31 06:24:37 -04:00
|
|
|
}
|