INotification.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Roeland Jago Douma <roeland@famdouma.nl>
  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 INotification
  26. *
  27. * @package OCP\Notification
  28. * @since 9.0.0
  29. */
  30. interface INotification {
  31. /**
  32. * @param string $app
  33. * @return $this
  34. * @throws \InvalidArgumentException if the app id is invalid
  35. * @since 9.0.0
  36. */
  37. public function setApp($app);
  38. /**
  39. * @return string
  40. * @since 9.0.0
  41. */
  42. public function getApp();
  43. /**
  44. * @param string $user
  45. * @return $this
  46. * @throws \InvalidArgumentException if the user id is invalid
  47. * @since 9.0.0
  48. */
  49. public function setUser($user);
  50. /**
  51. * @return string
  52. * @since 9.0.0
  53. */
  54. public function getUser();
  55. /**
  56. * @param \DateTime $dateTime
  57. * @return $this
  58. * @throws \InvalidArgumentException if the $dateTime is invalid
  59. * @since 9.0.0
  60. */
  61. public function setDateTime(\DateTime $dateTime);
  62. /**
  63. * @return \DateTime
  64. * @since 9.0.0
  65. */
  66. public function getDateTime();
  67. /**
  68. * @param string $type
  69. * @param string $id
  70. * @return $this
  71. * @throws \InvalidArgumentException if the object type or id is invalid
  72. * @since 9.0.0
  73. */
  74. public function setObject($type, $id);
  75. /**
  76. * @return string
  77. * @since 9.0.0
  78. */
  79. public function getObjectType();
  80. /**
  81. * @return string
  82. * @since 9.0.0
  83. */
  84. public function getObjectId();
  85. /**
  86. * @param string $subject
  87. * @param array $parameters
  88. * @return $this
  89. * @throws \InvalidArgumentException if the subject or parameters are invalid
  90. * @since 9.0.0
  91. */
  92. public function setSubject($subject, array $parameters = []);
  93. /**
  94. * @return string
  95. * @since 9.0.0
  96. */
  97. public function getSubject();
  98. /**
  99. * @return string[]
  100. * @since 9.0.0
  101. */
  102. public function getSubjectParameters();
  103. /**
  104. * Set a parsed subject
  105. *
  106. * HTML is not allowed in the parsed subject and will be escaped
  107. * automatically by the clients. You can use the RichObjectString system
  108. * provided by the Nextcloud server to highlight important parameters via
  109. * the setRichSubject method, but make sure, that a plain text message is
  110. * always set via setParsedSubject, to support clients which can not handle
  111. * rich strings.
  112. *
  113. * See https://github.com/nextcloud/server/issues/1706 for more information.
  114. *
  115. * @param string $subject
  116. * @return $this
  117. * @throws \InvalidArgumentException if the subject is invalid
  118. * @since 9.0.0
  119. */
  120. public function setParsedSubject($subject);
  121. /**
  122. * @return string
  123. * @since 9.0.0
  124. */
  125. public function getParsedSubject();
  126. /**
  127. * Set a RichObjectString subject
  128. *
  129. * HTML is not allowed in the rich subject and will be escaped automatically
  130. * by the clients, but you can use the RichObjectString system provided by
  131. * the Nextcloud server to highlight important parameters.
  132. * Also make sure, that a plain text subject is always set via
  133. * setParsedSubject, to support clients which can not handle rich strings.
  134. *
  135. * See https://github.com/nextcloud/server/issues/1706 for more information.
  136. *
  137. * @param string $subject
  138. * @param array $parameters
  139. * @return $this
  140. * @throws \InvalidArgumentException if the subject or parameters are invalid
  141. * @since 11.0.0
  142. */
  143. public function setRichSubject($subject, array $parameters = []);
  144. /**
  145. * @return string
  146. * @since 11.0.0
  147. */
  148. public function getRichSubject();
  149. /**
  150. * @return array[]
  151. * @since 11.0.0
  152. */
  153. public function getRichSubjectParameters();
  154. /**
  155. * @param string $message
  156. * @param array $parameters
  157. * @return $this
  158. * @throws \InvalidArgumentException if the message or parameters are invalid
  159. * @since 9.0.0
  160. */
  161. public function setMessage($message, array $parameters = []);
  162. /**
  163. * @return string
  164. * @since 9.0.0
  165. */
  166. public function getMessage();
  167. /**
  168. * @return string[]
  169. * @since 9.0.0
  170. */
  171. public function getMessageParameters();
  172. /**
  173. * Set a parsed message
  174. *
  175. * HTML is not allowed in the parsed message and will be escaped
  176. * automatically by the clients. You can use the RichObjectString system
  177. * provided by the Nextcloud server to highlight important parameters via
  178. * the setRichMessage method, but make sure, that a plain text message is
  179. * always set via setParsedMessage, to support clients which can not handle
  180. * rich strings.
  181. *
  182. * See https://github.com/nextcloud/server/issues/1706 for more information.
  183. *
  184. * @param string $message
  185. * @return $this
  186. * @throws \InvalidArgumentException if the message is invalid
  187. * @since 9.0.0
  188. */
  189. public function setParsedMessage($message);
  190. /**
  191. * @return string
  192. * @since 9.0.0
  193. */
  194. public function getParsedMessage();
  195. /**
  196. * Set a RichObjectString message
  197. *
  198. * HTML is not allowed in the rich message and will be escaped automatically
  199. * by the clients, but you can use the RichObjectString system provided by
  200. * the Nextcloud server to highlight important parameters.
  201. * Also make sure, that a plain text message is always set via
  202. * setParsedMessage, to support clients which can not handle rich strings.
  203. *
  204. * See https://github.com/nextcloud/server/issues/1706 for more information.
  205. *
  206. * @param string $message
  207. * @param array $parameters
  208. * @return $this
  209. * @throws \InvalidArgumentException if the message or parameters are invalid
  210. * @since 11.0.0
  211. */
  212. public function setRichMessage($message, array $parameters = []);
  213. /**
  214. * @return string
  215. * @since 11.0.0
  216. */
  217. public function getRichMessage();
  218. /**
  219. * @return array[]
  220. * @since 11.0.0
  221. */
  222. public function getRichMessageParameters();
  223. /**
  224. * @param string $link
  225. * @return $this
  226. * @throws \InvalidArgumentException if the link is invalid
  227. * @since 9.0.0
  228. */
  229. public function setLink($link);
  230. /**
  231. * @return string
  232. * @since 9.0.0
  233. */
  234. public function getLink();
  235. /**
  236. * @param string $icon
  237. * @return $this
  238. * @throws \InvalidArgumentException if the icon is invalid
  239. * @since 11.0.0
  240. */
  241. public function setIcon($icon);
  242. /**
  243. * @return string
  244. * @since 11.0.0
  245. */
  246. public function getIcon();
  247. /**
  248. * @return IAction
  249. * @since 9.0.0
  250. */
  251. public function createAction();
  252. /**
  253. * @param IAction $action
  254. * @return $this
  255. * @throws \InvalidArgumentException if the action is invalid
  256. * @since 9.0.0
  257. */
  258. public function addAction(IAction $action);
  259. /**
  260. * @return IAction[]
  261. * @since 9.0.0
  262. */
  263. public function getActions();
  264. /**
  265. * @param IAction $action
  266. * @return $this
  267. * @throws \InvalidArgumentException if the action is invalid
  268. * @since 9.0.0
  269. */
  270. public function addParsedAction(IAction $action);
  271. /**
  272. * @return IAction[]
  273. * @since 9.0.0
  274. */
  275. public function getParsedActions();
  276. /**
  277. * @return bool
  278. * @since 9.0.0
  279. */
  280. public function isValid();
  281. /**
  282. * @return bool
  283. * @since 9.0.0
  284. */
  285. public function isValidParsed();
  286. }