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.

IManager.php 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2020, Georg Ehrke
  5. *
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  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. */
  24. namespace OCP\UserStatus;
  25. /**
  26. * This interface allows to manage the user status.
  27. *
  28. * This interface must not be implemented in your application but
  29. * instead should be used as a service and injected in your code with
  30. * dependency injection.
  31. *
  32. * @since 20.0.0
  33. */
  34. interface IManager {
  35. /**
  36. * Gets the statuses for all users in $users
  37. *
  38. * @param string[] $userIds
  39. * @return IUserStatus[]
  40. * @since 20.0.0
  41. */
  42. public function getUserStatuses(array $userIds): array;
  43. /**
  44. * Set a new status for the selected user.
  45. *
  46. * @param string $userId The user for which we want to update the status.
  47. * @param string $messageId The id of the predefined message.
  48. * @param string $status The status to assign
  49. * @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).
  50. * @param string|null $customMessage
  51. * @since 23.0.0
  52. * @since 28.0.0 Optional parameter $customMessage was added
  53. */
  54. public function setUserStatus(string $userId, string $messageId, string $status, bool $createBackup = false, ?string $customMessage = null): void;
  55. /**
  56. * Revert an automatically set user status. For example after leaving a call,
  57. * change back to the previously set status.
  58. *
  59. * @param string $userId The user for which we want to update the status.
  60. * @param string $messageId The expected current messageId. If the user has already updated their status, this method does nothing.
  61. * @param string $status The expected current status. If the user has already updated their status, this method does nothing.
  62. * @since 23.0.0
  63. */
  64. public function revertUserStatus(string $userId, string $messageId, string $status): void;
  65. /**
  66. * Revert an automatically set user status. For example after leaving a call,
  67. * change back to the previously set status.
  68. *
  69. * @param string[] $userIds The user for which we want to update the status.
  70. * @param string $messageId The expected current messageId. If the user has already updated their status, this method does nothing.
  71. * @param string $status The expected current status. If the user has already updated their status, this method does nothing.
  72. * @since 23.0.0
  73. */
  74. public function revertMultipleUserStatus(array $userIds, string $messageId, string $status): void;
  75. }