IShare.php 7.1 KB

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