IBroker.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Talk;
  8. use OCP\IUser;
  9. use OCP\Talk\Exceptions\NoBackendException;
  10. /**
  11. * Abstraction over the optional Talk backend
  12. *
  13. * http://software-pattern.org/Broker
  14. *
  15. * @since 24.0.0
  16. */
  17. interface IBroker {
  18. /**
  19. * Check if the Talk backend is available
  20. *
  21. * @return bool
  22. * @since 24.0.0
  23. */
  24. public function hasBackend(): bool;
  25. /**
  26. * Create a new instance of the objects object for specifics of a new conversation
  27. *
  28. * @return IConversationOptions
  29. * @throws NoBackendException when Talk is not available
  30. * @since 24.0.0
  31. */
  32. public function newConversationOptions(): IConversationOptions;
  33. /**
  34. * Create a new conversation
  35. *
  36. * The conversation is private by default. Use the options parameter to make
  37. * it public.
  38. *
  39. * @param string $name
  40. * @param IUser[] $moderators
  41. * @param IConversationOptions|null $options optional configuration for the conversation
  42. *
  43. * @return IConversation
  44. * @throws NoBackendException when Talk is not available
  45. * @since 24.0.0
  46. */
  47. public function createConversation(string $name,
  48. array $moderators,
  49. ?IConversationOptions $options = null): IConversation;
  50. /**
  51. * Delete a conversation by id
  52. *
  53. * @param string $id conversation id
  54. *
  55. * @return void
  56. * @throws NoBackendException when Talk is not available
  57. * @since 26.0.0
  58. */
  59. public function deleteConversation(string $id): void;
  60. }