ILinkAction.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2021 Christopher Ng <chrng8@gmail.com>
  5. *
  6. * @author Christopher Ng <chrng8@gmail.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\Profile;
  25. use OCP\IUser;
  26. /**
  27. * @since 23.0.0
  28. */
  29. interface ILinkAction {
  30. /**
  31. * Preload the user specific value required by the action
  32. *
  33. * e.g. the email is loaded for the email action and the userId for the Talk action
  34. *
  35. * @since 23.0.0
  36. */
  37. public function preload(IUser $targetUser): void;
  38. /**
  39. * Returns the app ID of the action
  40. *
  41. * e.g. 'spreed'
  42. *
  43. * @since 23.0.0
  44. */
  45. public function getAppId(): string;
  46. /**
  47. * Returns the unique ID of the action
  48. *
  49. * *For account properties this is the constant defined in lib/public/Accounts/IAccountManager.php*
  50. *
  51. * e.g. 'email'
  52. *
  53. * @since 23.0.0
  54. */
  55. public function getId(): string;
  56. /**
  57. * Returns the translated unique display ID of the action
  58. *
  59. * Should be something short and descriptive of the action
  60. * as this is seen by the end-user when configuring actions
  61. *
  62. * e.g. 'Email'
  63. *
  64. * @since 23.0.0
  65. */
  66. public function getDisplayId(): string;
  67. /**
  68. * Returns the translated title
  69. *
  70. * e.g. 'Mail user@domain.com'
  71. *
  72. * Use the L10N service to translate it
  73. *
  74. * @since 23.0.0
  75. */
  76. public function getTitle(): string;
  77. /**
  78. * Returns the priority
  79. *
  80. * *Actions are sorted in ascending order*
  81. *
  82. * e.g. 60
  83. *
  84. * @since 23.0.0
  85. */
  86. public function getPriority(): int;
  87. /**
  88. * Returns the URL link to the 16*16 SVG icon
  89. *
  90. * @since 23.0.0
  91. */
  92. public function getIcon(): string;
  93. /**
  94. * Returns the target of the action,
  95. * if null is returned the action won't be registered
  96. *
  97. * e.g. 'mailto:user@domain.com'
  98. *
  99. * @since 23.0.0
  100. */
  101. public function getTarget(): ?string;
  102. }