1
0

IUserStatus.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 20.0.0
  50. */
  51. public const OFFLINE = 'offline';
  52. /**
  53. * @var string
  54. * @since 20.0.0
  55. */
  56. public const INVISIBLE = 'invisible';
  57. /**
  58. * @var string
  59. * @since 25.0.0
  60. */
  61. public const MESSAGE_CALL = 'call';
  62. /**
  63. * @var string
  64. * @since 25.0.0
  65. */
  66. public const MESSAGE_AVAILABILITY = 'availability';
  67. /**
  68. * Get the user this status is connected to
  69. *
  70. * @return string
  71. * @since 20.0.0
  72. */
  73. public function getUserId():string;
  74. /**
  75. * Get the status
  76. *
  77. * It will return one of the constants defined above.
  78. * It will never return invisible. In case a user marked
  79. * themselves as invisible, it will return offline.
  80. *
  81. * @return string See IUserStatus constants
  82. * @since 20.0.0
  83. */
  84. public function getStatus():string;
  85. /**
  86. * Get a custom message provided by the user
  87. *
  88. * @return string|null
  89. * @since 20.0.0
  90. */
  91. public function getMessage():?string;
  92. /**
  93. * Get a custom icon provided by the user
  94. *
  95. * @return string|null
  96. * @since 20.0.0
  97. */
  98. public function getIcon():?string;
  99. /**
  100. * Gets the time that the custom status will be cleared at
  101. *
  102. * @return DateTimeImmutable|null
  103. * @since 20.0.0
  104. */
  105. public function getClearAt():?DateTimeImmutable;
  106. }