INotifier.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OCP\Notification;
  9. /**
  10. * Interface INotifier
  11. *
  12. * @since 9.0.0
  13. */
  14. interface INotifier {
  15. /**
  16. * Identifier of the notifier, only use [a-z0-9_]
  17. *
  18. * @return string
  19. * @since 17.0.0
  20. */
  21. public function getID(): string;
  22. /**
  23. * Human-readable name describing the notifier
  24. *
  25. * @return string
  26. * @since 17.0.0
  27. */
  28. public function getName(): string;
  29. /**
  30. * @param INotification $notification
  31. * @param string $languageCode The code of the language that should be used to prepare the notification
  32. * @return INotification
  33. * @throws UnknownNotificationException When the notification was not prepared by a notifier
  34. * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted
  35. * @throws IncompleteParsedNotificationException Only to be thrown by the {@see IManager}
  36. * @since 9.0.0
  37. * @since 30.0.0 Notifiers should throw {@see UnknownNotificationException} instead of \InvalidArgumentException
  38. * when they did not handle the notification. Throwing \InvalidArgumentException directly is deprecated and will
  39. * be logged as an error in Nextcloud 39.
  40. * @since 30.0.0 Throws {@see IncompleteParsedNotificationException} when not all required fields
  41. * are set at the end of the manager or after a INotifier that claimed to have parsed the notification.
  42. */
  43. public function prepare(INotification $notification, string $languageCode): INotification;
  44. }