IUserStatus.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. use DateTimeImmutable;
  26. /**
  27. * Interface IUserStatus
  28. *
  29. * @since 20.0.0
  30. */
  31. interface IUserStatus {
  32. /**
  33. * @var string
  34. * @since 20.0.0
  35. */
  36. public const ONLINE = 'online';
  37. /**
  38. * @var string
  39. * @since 20.0.0
  40. */
  41. public const AWAY = 'away';
  42. /**
  43. * @var string
  44. * @since 20.0.0
  45. */
  46. public const DND = 'dnd';
  47. /**
  48. * @var string
  49. * @since 28.0.0
  50. */
  51. public const BUSY = 'busy';
  52. /**
  53. * @var string
  54. * @since 20.0.0
  55. */
  56. public const OFFLINE = 'offline';
  57. /**
  58. * @var string
  59. * @since 20.0.0
  60. */
  61. public const INVISIBLE = 'invisible';
  62. /**
  63. * @var string
  64. * @since 25.0.0
  65. */
  66. public const MESSAGE_CALL = 'call';
  67. /**
  68. * @var string
  69. * @since 25.0.0
  70. */
  71. public const MESSAGE_AVAILABILITY = 'availability';
  72. /**
  73. * @var string
  74. * @since 28.0.0
  75. */
  76. public const MESSAGE_CALENDAR_BUSY = 'meeting';
  77. /**
  78. * @var string
  79. * @since 28.0.0
  80. */
  81. public const MESSAGE_CALENDAR_BUSY_TENTATIVE = 'busy-tentative';
  82. /**
  83. * Get the user this status is connected to
  84. *
  85. * @return string
  86. * @since 20.0.0
  87. */
  88. public function getUserId():string;
  89. /**
  90. * Get the status
  91. *
  92. * It will return one of the constants defined above.
  93. * It will never return invisible. In case a user marked
  94. * themselves as invisible, it will return offline.
  95. *
  96. * @return string See IUserStatus constants
  97. * @since 20.0.0
  98. */
  99. public function getStatus():string;
  100. /**
  101. * Get a custom message provided by the user
  102. *
  103. * @return string|null
  104. * @since 20.0.0
  105. */
  106. public function getMessage():?string;
  107. /**
  108. * Get a custom icon provided by the user
  109. *
  110. * @return string|null
  111. * @since 20.0.0
  112. */
  113. public function getIcon():?string;
  114. /**
  115. * Gets the time that the custom status will be cleared at
  116. *
  117. * @return DateTimeImmutable|null
  118. * @since 20.0.0
  119. */
  120. public function getClearAt():?DateTimeImmutable;
  121. }