IAction.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCP\Notification;
  24. /**
  25. * Interface IAction
  26. *
  27. * @package OCP\Notification
  28. * @since 9.0.0
  29. */
  30. interface IAction {
  31. /**
  32. * @since 17.0.0
  33. */
  34. public const TYPE_GET = 'GET';
  35. /**
  36. * @since 17.0.0
  37. */
  38. public const TYPE_POST = 'POST';
  39. /**
  40. * @since 17.0.0
  41. */
  42. public const TYPE_PUT = 'PUT';
  43. /**
  44. * @since 17.0.0
  45. */
  46. public const TYPE_DELETE = 'DELETE';
  47. /**
  48. * @since 17.0.0
  49. */
  50. public const TYPE_WEB = 'WEB';
  51. /**
  52. * @param string $label
  53. * @return $this
  54. * @throws \InvalidArgumentException if the label is invalid
  55. * @since 9.0.0
  56. */
  57. public function setLabel(string $label): IAction;
  58. /**
  59. * @return string
  60. * @since 9.0.0
  61. */
  62. public function getLabel(): string;
  63. /**
  64. * @param string $label
  65. * @return $this
  66. * @throws \InvalidArgumentException if the label is invalid
  67. * @since 9.0.0
  68. */
  69. public function setParsedLabel(string $label): IAction;
  70. /**
  71. * @return string
  72. * @since 9.0.0
  73. */
  74. public function getParsedLabel(): string;
  75. /**
  76. * @param bool $primary
  77. * @return $this
  78. * @throws \InvalidArgumentException if $primary is invalid
  79. * @since 9.0.0
  80. */
  81. public function setPrimary(bool $primary): IAction;
  82. /**
  83. * @return bool
  84. * @since 9.0.0
  85. */
  86. public function isPrimary(): bool;
  87. /**
  88. * @param string $link
  89. * @param string $requestType
  90. * @return $this
  91. * @throws \InvalidArgumentException if the link is invalid
  92. * @since 9.0.0
  93. */
  94. public function setLink(string $link, string $requestType): IAction;
  95. /**
  96. * @return string
  97. * @since 9.0.0
  98. */
  99. public function getLink(): string;
  100. /**
  101. * @return string
  102. * @since 9.0.0
  103. */
  104. public function getRequestType(): string;
  105. /**
  106. * @return bool
  107. * @since 9.0.0
  108. */
  109. public function isValid(): bool;
  110. /**
  111. * @return bool
  112. * @since 9.0.0
  113. */
  114. public function isValidParsed(): bool;
  115. }