IShare.php 7.2 KB

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