IAction.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. * @since 9.0.0
  28. */
  29. interface IAction {
  30. /**
  31. * @since 17.0.0
  32. */
  33. public const TYPE_GET = 'GET';
  34. /**
  35. * @since 17.0.0
  36. */
  37. public const TYPE_POST = 'POST';
  38. /**
  39. * @since 17.0.0
  40. */
  41. public const TYPE_PUT = 'PUT';
  42. /**
  43. * @since 17.0.0
  44. */
  45. public const TYPE_DELETE = 'DELETE';
  46. /**
  47. * @since 17.0.0
  48. */
  49. public const TYPE_WEB = 'WEB';
  50. /**
  51. * @param string $label
  52. * @return $this
  53. * @throws InvalidValueException if the label is invalid
  54. * @since 9.0.0
  55. * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException
  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 InvalidValueException if the label is invalid
  67. * @since 9.0.0
  68. * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException
  69. */
  70. public function setParsedLabel(string $label): IAction;
  71. /**
  72. * @return string
  73. * @since 9.0.0
  74. */
  75. public function getParsedLabel(): string;
  76. /**
  77. * @param bool $primary
  78. * @return $this
  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 InvalidValueException if the link is invalid
  92. * @since 9.0.0
  93. * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException
  94. */
  95. public function setLink(string $link, string $requestType): IAction;
  96. /**
  97. * @return string
  98. * @since 9.0.0
  99. */
  100. public function getLink(): string;
  101. /**
  102. * @return string
  103. * @since 9.0.0
  104. */
  105. public function getRequestType(): string;
  106. /**
  107. * @return bool
  108. * @since 9.0.0
  109. */
  110. public function isValid(): bool;
  111. /**
  112. * @return bool
  113. * @since 9.0.0
  114. */
  115. public function isValidParsed(): bool;
  116. }