1
0

IBroker.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at>
  5. *
  6. * @author 2021 Christoph Wurst <christoph@winzerhof-wurst.at>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  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
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. */
  23. namespace OCP\Talk;
  24. use OCP\IUser;
  25. use OCP\Talk\Exceptions\NoBackendException;
  26. /**
  27. * Abstraction over the optional Talk backend
  28. *
  29. * http://software-pattern.org/Broker
  30. *
  31. * @since 24.0.0
  32. */
  33. interface IBroker {
  34. /**
  35. * Check if the Talk backend is available
  36. *
  37. * @return bool
  38. * @since 24.0.0
  39. */
  40. public function hasBackend(): bool;
  41. /**
  42. * Create a new instance of the objects object for specifics of a new conversation
  43. *
  44. * @return IConversationOptions
  45. * @throws NoBackendException when Talk is not available
  46. * @since 24.0.0
  47. */
  48. public function newConversationOptions(): IConversationOptions;
  49. /**
  50. * Create a new conversation
  51. *
  52. * The conversation is private by default. Use the options parameter to make
  53. * it public.
  54. *
  55. * @param string $name
  56. * @param IUser[] $moderators
  57. * @param IConversationOptions|null $options optional configuration for the conversation
  58. *
  59. * @return IConversation
  60. * @throws NoBackendException when Talk is not available
  61. * @since 24.0.0
  62. */
  63. public function createConversation(string $name,
  64. array $moderators,
  65. ?IConversationOptions $options = null): IConversation;
  66. /**
  67. * Delete a conversation by id
  68. *
  69. * @param string $id conversation id
  70. *
  71. * @return void
  72. * @throws NoBackendException when Talk is not available
  73. * @since 26.0.0
  74. */
  75. public function deleteConversation(string $id): void;
  76. }