1
0

IManager.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 IManager
  11. *
  12. * @since 9.0.0
  13. */
  14. interface IManager extends IApp, INotifier {
  15. /**
  16. * @param string $appClass The service must implement IApp, otherwise a
  17. * \InvalidArgumentException is thrown later
  18. * @since 17.0.0
  19. */
  20. public function registerApp(string $appClass): void;
  21. /**
  22. * @param \Closure $service The service must implement INotifier, otherwise a
  23. * \InvalidArgumentException is thrown later
  24. * @param \Closure $info An array with the keys 'id' and 'name' containing
  25. * the app id and the app name
  26. * @deprecated 17.0.0 use registerNotifierService instead.
  27. * @since 8.2.0 - Parameter $info was added in 9.0.0
  28. */
  29. public function registerNotifier(\Closure $service, \Closure $info);
  30. /**
  31. * @param string $notifierService The service must implement INotifier, otherwise a
  32. * \InvalidArgumentException is thrown later
  33. * @since 17.0.0
  34. * @deprecated 22.0.0 use the IBootStrap registration context
  35. */
  36. public function registerNotifierService(string $notifierService): void;
  37. /**
  38. * @return INotifier[]
  39. * @since 9.0.0
  40. */
  41. public function getNotifiers(): array;
  42. /**
  43. * @return INotification
  44. * @since 9.0.0
  45. */
  46. public function createNotification(): INotification;
  47. /**
  48. * @return bool
  49. * @since 9.0.0
  50. */
  51. public function hasNotifiers(): bool;
  52. /**
  53. * @param bool $preparingPushNotification
  54. * @since 14.0.0
  55. */
  56. public function setPreparingPushNotification(bool $preparingPushNotification): void;
  57. /**
  58. * @return bool
  59. * @since 14.0.0
  60. */
  61. public function isPreparingPushNotification(): bool;
  62. /**
  63. * @since 18.0.0
  64. */
  65. public function dismissNotification(INotification $notification): void;
  66. /**
  67. * Start deferring notifications until `flush()` is called
  68. *
  69. * The calling app should only "flush" when it got returned true on the defer call,
  70. * otherwise another app is deferring the sending already.
  71. * @return bool
  72. * @since 20.0.0
  73. */
  74. public function defer(): bool;
  75. /**
  76. * Send all deferred notifications that have been stored since `defer()` was called
  77. *
  78. * @since 20.0.0
  79. */
  80. public function flush(): void;
  81. /**
  82. * Whether the server can use the hosted push notification service
  83. *
  84. * We want to keep offering our push notification service for free, but large
  85. * users overload our infrastructure. For this reason we have to rate-limit the
  86. * use of push notifications. If you need this feature, consider using Nextcloud Enterprise.
  87. *
  88. * @since 23.0.0
  89. */
  90. public function isFairUseOfFreePushService(): bool;
  91. }