1
0

IEvent.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
  6. *
  7. * @author Joas Schilling <coding@schilljs.com>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  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, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. /**
  25. * Public interface of ownCloud for apps to use.
  26. * Activity/IEvent interface
  27. */
  28. // use OCP namespace for all classes that are considered public.
  29. // This means that they should be used by apps instead of the internal ownCloud classes
  30. namespace OCP\Activity;
  31. /**
  32. * Interface IEvent
  33. *
  34. * @package OCP\Activity
  35. * @since 8.2.0
  36. */
  37. interface IEvent {
  38. /**
  39. * Set the app of the activity
  40. *
  41. * @param string $app
  42. * @return IEvent
  43. * @throws \InvalidArgumentException if the app id is invalid
  44. * @since 8.2.0
  45. */
  46. public function setApp(string $app): self;
  47. /**
  48. * Set the type of the activity
  49. *
  50. * @param string $type
  51. * @return IEvent
  52. * @throws \InvalidArgumentException if the type is invalid
  53. * @since 8.2.0
  54. */
  55. public function setType(string $type): self;
  56. /**
  57. * Set the affected user of the activity
  58. *
  59. * @param string $user
  60. * @return IEvent
  61. * @throws \InvalidArgumentException if the affected user is invalid
  62. * @since 8.2.0
  63. */
  64. public function setAffectedUser(string $user): self;
  65. /**
  66. * Set the author of the activity
  67. *
  68. * @param string $author
  69. * @return IEvent
  70. * @throws \InvalidArgumentException if the author is invalid
  71. * @since 8.2.0
  72. */
  73. public function setAuthor(string $author): self;
  74. /**
  75. * Set the author of the activity
  76. *
  77. * @param int $timestamp
  78. * @return IEvent
  79. * @throws \InvalidArgumentException if the timestamp is invalid
  80. * @since 8.2.0
  81. */
  82. public function setTimestamp(int $timestamp): self;
  83. /**
  84. * Set the subject of the activity
  85. *
  86. * @param string $subject
  87. * @param array $parameters
  88. * @return IEvent
  89. * @throws \InvalidArgumentException if the subject or parameters are invalid
  90. * @since 8.2.0
  91. */
  92. public function setSubject(string $subject, array $parameters = []): self;
  93. /**
  94. * @param string $subject
  95. * @return $this
  96. * @throws \InvalidArgumentException if the subject is invalid
  97. * @since 11.0.0
  98. */
  99. public function setParsedSubject(string $subject): self;
  100. /**
  101. * @return string
  102. * @since 11.0.0
  103. */
  104. public function getParsedSubject(): string;
  105. /**
  106. * @param string $subject
  107. * @param array $parameters
  108. * @return $this
  109. * @throws \InvalidArgumentException if the subject or parameters are invalid
  110. * @since 11.0.0
  111. */
  112. public function setRichSubject(string $subject, array $parameters = []): self;
  113. /**
  114. * @return string
  115. * @since 11.0.0
  116. */
  117. public function getRichSubject(): string;
  118. /**
  119. * @return array[]
  120. * @since 11.0.0
  121. */
  122. public function getRichSubjectParameters(): array;
  123. /**
  124. * Set the message of the activity
  125. *
  126. * @param string $message
  127. * @param array $parameters
  128. * @return IEvent
  129. * @throws \InvalidArgumentException if the message or parameters are invalid
  130. * @since 8.2.0
  131. */
  132. public function setMessage(string $message, array $parameters = []): self;
  133. /**
  134. * @param string $message
  135. * @return $this
  136. * @throws \InvalidArgumentException if the message is invalid
  137. * @since 11.0.0
  138. */
  139. public function setParsedMessage(string $message): self;
  140. /**
  141. * @return string
  142. * @since 11.0.0
  143. */
  144. public function getParsedMessage(): string;
  145. /**
  146. * @param string $message
  147. * @param array $parameters
  148. * @return $this
  149. * @throws \InvalidArgumentException if the message or parameters are invalid
  150. * @since 11.0.0
  151. */
  152. public function setRichMessage(string $message, array $parameters = []): self;
  153. /**
  154. * @return string
  155. * @since 11.0.0
  156. */
  157. public function getRichMessage(): string;
  158. /**
  159. * @return array[]
  160. * @since 11.0.0
  161. */
  162. public function getRichMessageParameters(): array;
  163. /**
  164. * Set the object of the activity
  165. *
  166. * @param string $objectType
  167. * @param int $objectId
  168. * @param string $objectName
  169. * @return IEvent
  170. * @throws \InvalidArgumentException if the object is invalid
  171. * @since 8.2.0
  172. */
  173. public function setObject(string $objectType, int $objectId, string $objectName = ''): self;
  174. /**
  175. * Set the link of the activity
  176. *
  177. * @param string $link
  178. * @return IEvent
  179. * @throws \InvalidArgumentException if the link is invalid
  180. * @since 8.2.0
  181. */
  182. public function setLink(string $link): self;
  183. /**
  184. * @return string
  185. * @since 8.2.0
  186. */
  187. public function getApp(): string;
  188. /**
  189. * @return string
  190. * @since 8.2.0
  191. */
  192. public function getType(): string;
  193. /**
  194. * @return string
  195. * @since 8.2.0
  196. */
  197. public function getAffectedUser(): string;
  198. /**
  199. * @return string
  200. * @since 8.2.0
  201. */
  202. public function getAuthor(): string;
  203. /**
  204. * @return int
  205. * @since 8.2.0
  206. */
  207. public function getTimestamp(): int;
  208. /**
  209. * @return string
  210. * @since 8.2.0
  211. */
  212. public function getSubject(): string;
  213. /**
  214. * @return array
  215. * @since 8.2.0
  216. */
  217. public function getSubjectParameters(): array;
  218. /**
  219. * @return string
  220. * @since 8.2.0
  221. */
  222. public function getMessage(): string;
  223. /**
  224. * @return array
  225. * @since 8.2.0
  226. */
  227. public function getMessageParameters(): array;
  228. /**
  229. * @return string
  230. * @since 8.2.0
  231. */
  232. public function getObjectType(): string;
  233. /**
  234. * @return int
  235. * @since 8.2.0
  236. */
  237. public function getObjectId(): int;
  238. /**
  239. * @return string
  240. * @since 8.2.0
  241. */
  242. public function getObjectName(): string;
  243. /**
  244. * @return string
  245. * @since 8.2.0
  246. */
  247. public function getLink(): string;
  248. /**
  249. * @param string $icon
  250. * @return $this
  251. * @throws \InvalidArgumentException if the icon is invalid
  252. * @since 11.0.0
  253. */
  254. public function setIcon(string $icon): self;
  255. /**
  256. * @return string
  257. * @since 11.0.0
  258. */
  259. public function getIcon(): string;
  260. /**
  261. * @param IEvent $child
  262. * @return $this
  263. * @since 11.0.0 - Since 15.0.0 returns $this
  264. */
  265. public function setChildEvent(IEvent $child): self;
  266. /**
  267. * @return IEvent|null
  268. * @since 11.0.0
  269. */
  270. public function getChildEvent();
  271. /**
  272. * @return bool
  273. * @since 11.0.0
  274. */
  275. public function isValid(): bool;
  276. /**
  277. * @return bool
  278. * @since 11.0.0
  279. */
  280. public function isValidParsed(): bool;
  281. }