IEvent.php 6.2 KB

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