IAction.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OCP\Notification;
  9. /**
  10. * Interface IAction
  11. *
  12. * @since 9.0.0
  13. */
  14. interface IAction {
  15. /**
  16. * @since 17.0.0
  17. */
  18. public const TYPE_GET = 'GET';
  19. /**
  20. * @since 17.0.0
  21. */
  22. public const TYPE_POST = 'POST';
  23. /**
  24. * @since 17.0.0
  25. */
  26. public const TYPE_PUT = 'PUT';
  27. /**
  28. * @since 17.0.0
  29. */
  30. public const TYPE_DELETE = 'DELETE';
  31. /**
  32. * @since 17.0.0
  33. */
  34. public const TYPE_WEB = 'WEB';
  35. /**
  36. * @param string $label
  37. * @return $this
  38. * @throws InvalidValueException if the label is invalid
  39. * @since 9.0.0
  40. * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException
  41. */
  42. public function setLabel(string $label): IAction;
  43. /**
  44. * @return string
  45. * @since 9.0.0
  46. */
  47. public function getLabel(): string;
  48. /**
  49. * @param string $label
  50. * @return $this
  51. * @throws InvalidValueException if the label is invalid
  52. * @since 9.0.0
  53. * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException
  54. */
  55. public function setParsedLabel(string $label): IAction;
  56. /**
  57. * @return string
  58. * @since 9.0.0
  59. */
  60. public function getParsedLabel(): string;
  61. /**
  62. * @param bool $primary
  63. * @return $this
  64. * @since 9.0.0
  65. */
  66. public function setPrimary(bool $primary): IAction;
  67. /**
  68. * @return bool
  69. * @since 9.0.0
  70. */
  71. public function isPrimary(): bool;
  72. /**
  73. * @param string $link
  74. * @param string $requestType
  75. * @return $this
  76. * @throws InvalidValueException if the link is invalid
  77. * @since 9.0.0
  78. * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException
  79. */
  80. public function setLink(string $link, string $requestType): IAction;
  81. /**
  82. * @return string
  83. * @since 9.0.0
  84. */
  85. public function getLink(): string;
  86. /**
  87. * @return string
  88. * @since 9.0.0
  89. */
  90. public function getRequestType(): string;
  91. /**
  92. * @return bool
  93. * @since 9.0.0
  94. */
  95. public function isValid(): bool;
  96. /**
  97. * @return bool
  98. * @since 9.0.0
  99. */
  100. public function isValidParsed(): bool;
  101. }