IShare.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Roeland Jago Douma <roeland@famdouma.nl>
  6. *
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OCP\Share;
  23. use OCP\Files\File;
  24. use OCP\Files\Folder;
  25. use OCP\Files\Node;
  26. use OCP\Files\NotFoundException;
  27. use OCP\Share\Exceptions\IllegalIDChangeException;
  28. /**
  29. * Interface IShare
  30. *
  31. * @package OCP\Share
  32. * @since 9.0.0
  33. */
  34. interface IShare {
  35. /**
  36. * Set the internal id of the share
  37. * It is only allowed to set the internal id of a share once.
  38. * Attempts to override the internal id will result in an IllegalIDChangeException
  39. *
  40. * @param string $id
  41. * @return \OCP\Share\IShare
  42. * @throws IllegalIDChangeException
  43. * @throws \InvalidArgumentException
  44. * @since 9.1.0
  45. */
  46. public function setId($id);
  47. /**
  48. * Get the internal id of the share.
  49. *
  50. * @return string
  51. * @since 9.0.0
  52. */
  53. public function getId();
  54. /**
  55. * Get the full share id. This is the <providerid>:<internalid>.
  56. * The full id is unique in the system.
  57. *
  58. * @return string
  59. * @since 9.0.0
  60. * @throws \UnexpectedValueException If the fullId could not be constructed
  61. */
  62. public function getFullId();
  63. /**
  64. * Set the provider id of the share
  65. * It is only allowed to set the provider id of a share once.
  66. * Attempts to override the provider id will result in an IllegalIDChangeException
  67. *
  68. * @param string $id
  69. * @return \OCP\Share\IShare
  70. * @throws IllegalIDChangeException
  71. * @throws \InvalidArgumentException
  72. * @since 9.1.0
  73. */
  74. public function setProviderId($id);
  75. /**
  76. * Set the node of the file/folder that is shared
  77. *
  78. * @param Node $node
  79. * @return \OCP\Share\IShare The modified object
  80. * @since 9.0.0
  81. */
  82. public function setNode(Node $node);
  83. /**
  84. * Get the node of the file/folder that is shared
  85. *
  86. * @return File|Folder
  87. * @since 9.0.0
  88. * @throws NotFoundException
  89. */
  90. public function getNode();
  91. /**
  92. * Set file id for lazy evaluation of the node
  93. * @param int $fileId
  94. * @return \OCP\Share\IShare The modified object
  95. * @since 9.0.0
  96. */
  97. public function setNodeId($fileId);
  98. /**
  99. * Get the fileid of the node of this share
  100. * @return int
  101. * @since 9.0.0
  102. * @throws NotFoundException
  103. */
  104. public function getNodeId();
  105. /**
  106. * Set the type of node (file/folder)
  107. *
  108. * @param string $type
  109. * @return \OCP\Share\IShare The modified object
  110. * @since 9.0.0
  111. */
  112. public function setNodeType($type);
  113. /**
  114. * Get the type of node (file/folder)
  115. *
  116. * @return string
  117. * @since 9.0.0
  118. * @throws NotFoundException
  119. */
  120. public function getNodeType();
  121. /**
  122. * Set the shareType
  123. *
  124. * @param int $shareType
  125. * @return \OCP\Share\IShare The modified object
  126. * @since 9.0.0
  127. */
  128. public function setShareType($shareType);
  129. /**
  130. * Get the shareType
  131. *
  132. * @return int
  133. * @since 9.0.0
  134. */
  135. public function getShareType();
  136. /**
  137. * Set the receiver of this share.
  138. *
  139. * @param string $sharedWith
  140. * @return \OCP\Share\IShare The modified object
  141. * @since 9.0.0
  142. */
  143. public function setSharedWith($sharedWith);
  144. /**
  145. * Get the receiver of this share.
  146. *
  147. * @return string
  148. * @since 9.0.0
  149. */
  150. public function getSharedWith();
  151. /**
  152. * Set the permissions.
  153. * See \OCP\Constants::PERMISSION_*
  154. *
  155. * @param int $permissions
  156. * @return \OCP\Share\IShare The modified object
  157. * @since 9.0.0
  158. */
  159. public function setPermissions($permissions);
  160. /**
  161. * Get the share permissions
  162. * See \OCP\Constants::PERMISSION_*
  163. *
  164. * @return int
  165. * @since 9.0.0
  166. */
  167. public function getPermissions();
  168. /**
  169. * Set the expiration date
  170. *
  171. * @param \DateTime $expireDate
  172. * @return \OCP\Share\IShare The modified object
  173. * @since 9.0.0
  174. */
  175. public function setExpirationDate($expireDate);
  176. /**
  177. * Get the expiration date
  178. *
  179. * @return \DateTime
  180. * @since 9.0.0
  181. */
  182. public function getExpirationDate();
  183. /**
  184. * Set the sharer of the path.
  185. *
  186. * @param string $sharedBy
  187. * @return \OCP\Share\IShare The modified object
  188. * @since 9.0.0
  189. */
  190. public function setSharedBy($sharedBy);
  191. /**
  192. * Get share sharer
  193. *
  194. * @return string
  195. * @since 9.0.0
  196. */
  197. public function getSharedBy();
  198. /**
  199. * Set the original share owner (who owns the path that is shared)
  200. *
  201. * @param string $shareOwner
  202. * @return \OCP\Share\IShare The modified object
  203. * @since 9.0.0
  204. */
  205. public function setShareOwner($shareOwner);
  206. /**
  207. * Get the original share owner (who owns the path that is shared)
  208. *
  209. * @return string
  210. * @since 9.0.0
  211. */
  212. public function getShareOwner();
  213. /**
  214. * Set the password for this share.
  215. * When the share is passed to the share manager to be created
  216. * or updated the password will be hashed.
  217. *
  218. * @param string $password
  219. * @return \OCP\Share\IShare The modified object
  220. * @since 9.0.0
  221. */
  222. public function setPassword($password);
  223. /**
  224. * Get the password of this share.
  225. * If this share is obtained via a shareprovider the password is
  226. * hashed.
  227. *
  228. * @return string
  229. * @since 9.0.0
  230. */
  231. public function getPassword();
  232. /**
  233. * Set the public link token.
  234. *
  235. * @param string $token
  236. * @return \OCP\Share\IShare The modified object
  237. * @since 9.0.0
  238. */
  239. public function setToken($token);
  240. /**
  241. * Get the public link token.
  242. *
  243. * @return string
  244. * @since 9.0.0
  245. */
  246. public function getToken();
  247. /**
  248. * Set the target path of this share relative to the recipients user folder.
  249. *
  250. * @param string $target
  251. * @return \OCP\Share\IShare The modified object
  252. * @since 9.0.0
  253. */
  254. public function setTarget($target);
  255. /**
  256. * Get the target path of this share relative to the recipients user folder.
  257. *
  258. * @return string
  259. * @since 9.0.0
  260. */
  261. public function getTarget();
  262. /**
  263. * Set the time this share was created
  264. *
  265. * @param \DateTime $shareTime
  266. * @return \OCP\Share\IShare The modified object
  267. * @since 9.0.0
  268. */
  269. public function setShareTime(\DateTime $shareTime);
  270. /**
  271. * Get the timestamp this share was created
  272. *
  273. * @return \DateTime
  274. * @since 9.0.0
  275. */
  276. public function getShareTime();
  277. /**
  278. * Set if the recipient is informed by mail about the share.
  279. *
  280. * @param bool $mailSend
  281. * @return \OCP\Share\IShare The modified object
  282. * @since 9.0.0
  283. */
  284. public function setMailSend($mailSend);
  285. /**
  286. * Get if the recipient informed by mail about the share.
  287. *
  288. * @return bool
  289. * @since 9.0.0
  290. */
  291. public function getMailSend();
  292. }