You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.9 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCP\Notification;
  25. /**
  26. * Interface IManager
  27. *
  28. * @since 9.0.0
  29. */
  30. interface IManager extends IApp, INotifier {
  31. /**
  32. * @param string $appClass The service must implement IApp, otherwise a
  33. * \InvalidArgumentException is thrown later
  34. * @since 17.0.0
  35. */
  36. public function registerApp(string $appClass): void;
  37. /**
  38. * @param \Closure $service The service must implement INotifier, otherwise a
  39. * \InvalidArgumentException is thrown later
  40. * @param \Closure $info An array with the keys 'id' and 'name' containing
  41. * the app id and the app name
  42. * @deprecated 17.0.0 use registerNotifierService instead.
  43. * @since 8.2.0 - Parameter $info was added in 9.0.0
  44. */
  45. public function registerNotifier(\Closure $service, \Closure $info);
  46. /**
  47. * @param string $notifierService The service must implement INotifier, otherwise a
  48. * \InvalidArgumentException is thrown later
  49. * @since 17.0.0
  50. */
  51. public function registerNotifierService(string $notifierService): void;
  52. /**
  53. * @return INotifier[]
  54. * @since 9.0.0
  55. */
  56. public function getNotifiers(): array;
  57. /**
  58. * @return INotification
  59. * @since 9.0.0
  60. */
  61. public function createNotification(): INotification;
  62. /**
  63. * @return bool
  64. * @since 9.0.0
  65. */
  66. public function hasNotifiers(): bool;
  67. /**
  68. * @param bool $preparingPushNotification
  69. * @since 14.0.0
  70. */
  71. public function setPreparingPushNotification(bool $preparingPushNotification): void;
  72. /**
  73. * @return bool
  74. * @since 14.0.0
  75. */
  76. public function isPreparingPushNotification(): bool;
  77. /**
  78. * @since 18.0.0
  79. */
  80. public function dismissNotification(INotification $notification): void;
  81. /**
  82. * Start deferring notifications until `flush()` is called
  83. *
  84. * The calling app should only "flush" when it got returned true on the defer call,
  85. * otherwise another app is deferring the sending already.
  86. * @return bool
  87. * @since 20.0.0
  88. */
  89. public function defer(): bool;
  90. /**
  91. * Send all deferred notifications that have been stored since `defer()` was called
  92. *
  93. * @since 20.0.0
  94. */
  95. public function flush(): void;
  96. }