1
0

IManager.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\UserStatus;
  8. /**
  9. * This interface allows to manage the user status.
  10. *
  11. * This interface must not be implemented in your application but
  12. * instead should be used as a service and injected in your code with
  13. * dependency injection.
  14. *
  15. * @since 20.0.0
  16. */
  17. interface IManager {
  18. /**
  19. * Gets the statuses for all users in $users
  20. *
  21. * @param string[] $userIds
  22. * @return array<string, IUserStatus> array key being the userid, users without a status will not be in the returned array
  23. * @since 20.0.0
  24. */
  25. public function getUserStatuses(array $userIds): array;
  26. /**
  27. * Set a new status for the selected user.
  28. *
  29. * @param string $userId The user for which we want to update the status.
  30. * @param string $messageId The id of the predefined message.
  31. * @param string $status The status to assign
  32. * @param bool $createBackup If true, this will store the old status so that it is possible to revert it later (e.g. after a call).
  33. * @param string|null $customMessage
  34. * @since 23.0.0
  35. * @since 28.0.0 Optional parameter $customMessage was added
  36. */
  37. public function setUserStatus(string $userId, string $messageId, string $status, bool $createBackup = false, ?string $customMessage = null): void;
  38. /**
  39. * Revert an automatically set user status. For example after leaving a call,
  40. * change back to the previously set status.
  41. *
  42. * @param string $userId The user for which we want to update the status.
  43. * @param string $messageId The expected current messageId. If the user has already updated their status, this method does nothing.
  44. * @param string $status The expected current status. If the user has already updated their status, this method does nothing.
  45. * @since 23.0.0
  46. */
  47. public function revertUserStatus(string $userId, string $messageId, string $status): void;
  48. /**
  49. * Revert an automatically set user status. For example after leaving a call,
  50. * change back to the previously set status.
  51. *
  52. * @param string[] $userIds The user for which we want to update the status.
  53. * @param string $messageId The expected current messageId. If the user has already updated their status, this method does nothing.
  54. * @param string $status The expected current status. If the user has already updated their status, this method does nothing.
  55. * @since 23.0.0
  56. */
  57. public function revertMultipleUserStatus(array $userIds, string $messageId, string $status): void;
  58. }