IUserStatus.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.1
  75. */
  76. public const MESSAGE_OUT_OF_OFFICE = 'out-of-office';
  77. /**
  78. * @var string
  79. * @since 28.0.0
  80. */
  81. public const MESSAGE_VACATION = 'vacationing';
  82. /**
  83. * @var string
  84. * @since 28.0.0
  85. */
  86. public const MESSAGE_CALENDAR_BUSY = 'meeting';
  87. /**
  88. * @var string
  89. * @since 28.0.0
  90. */
  91. public const MESSAGE_CALENDAR_BUSY_TENTATIVE = 'busy-tentative';
  92. /**
  93. * Get the user this status is connected to
  94. *
  95. * @return string
  96. * @since 20.0.0
  97. */
  98. public function getUserId():string;
  99. /**
  100. * Get the status
  101. *
  102. * It will return one of the constants defined above.
  103. * It will never return invisible. In case a user marked
  104. * themselves as invisible, it will return offline.
  105. *
  106. * @return string See IUserStatus constants
  107. * @since 20.0.0
  108. */
  109. public function getStatus():string;
  110. /**
  111. * Get a custom message provided by the user
  112. *
  113. * @return string|null
  114. * @since 20.0.0
  115. */
  116. public function getMessage():?string;
  117. /**
  118. * Get a custom icon provided by the user
  119. *
  120. * @return string|null
  121. * @since 20.0.0
  122. */
  123. public function getIcon():?string;
  124. /**
  125. * Gets the time that the custom status will be cleared at
  126. *
  127. * @return DateTimeImmutable|null
  128. * @since 20.0.0
  129. */
  130. public function getClearAt():?DateTimeImmutable;
  131. }