1
0

IShare.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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 display name of the receiver of this share.
  156. *
  157. * @param string $displayName
  158. * @return \OCP\Share\IShare The modified object
  159. * @since 14.0.0
  160. */
  161. public function setSharedWithDisplayName($displayName);
  162. /**
  163. * Get the display name of the receiver of this share.
  164. *
  165. * @return string
  166. * @since 14.0.0
  167. */
  168. public function getSharedWithDisplayName();
  169. /**
  170. * Set the avatar of the receiver of this share.
  171. *
  172. * @param string $src
  173. * @return \OCP\Share\IShare The modified object
  174. * @since 14.0.0
  175. */
  176. public function setSharedWithAvatar($src);
  177. /**
  178. * Get the avatar of the receiver of this share.
  179. *
  180. * @return string
  181. * @since 14.0.0
  182. */
  183. public function getSharedWithAvatar();
  184. /**
  185. * Set the permissions.
  186. * See \OCP\Constants::PERMISSION_*
  187. *
  188. * @param int $permissions
  189. * @return \OCP\Share\IShare The modified object
  190. * @since 9.0.0
  191. */
  192. public function setPermissions($permissions);
  193. /**
  194. * Get the share permissions
  195. * See \OCP\Constants::PERMISSION_*
  196. *
  197. * @return int
  198. * @since 9.0.0
  199. */
  200. public function getPermissions();
  201. /**
  202. * Attach a note to a share
  203. *
  204. * @param string $note
  205. * @return \OCP\Share\IShare The modified object
  206. * @since 14.0.0
  207. */
  208. public function setNote($note);
  209. /**
  210. * Get note attached to a share
  211. *
  212. * @return string
  213. * @since 14.0.0
  214. */
  215. public function getNote();
  216. /**
  217. * Set the expiration date
  218. *
  219. * @param null|\DateTime $expireDate
  220. * @return \OCP\Share\IShare The modified object
  221. * @since 9.0.0
  222. */
  223. public function setExpirationDate($expireDate);
  224. /**
  225. * Get the expiration date
  226. *
  227. * @return \DateTime
  228. * @since 9.0.0
  229. */
  230. public function getExpirationDate();
  231. /**
  232. * set a label for a share, some shares, e.g. public links can have a label
  233. *
  234. * @param string $label
  235. * @return \OCP\Share\IShare The modified object
  236. * @since 15.0.0
  237. */
  238. public function setLabel($label);
  239. /**
  240. * get label for the share, some shares, e.g. public links can have a label
  241. *
  242. * @return string
  243. * @since 15.0.0
  244. */
  245. public function getLabel();
  246. /**
  247. * Set the sharer of the path.
  248. *
  249. * @param string $sharedBy
  250. * @return \OCP\Share\IShare The modified object
  251. * @since 9.0.0
  252. */
  253. public function setSharedBy($sharedBy);
  254. /**
  255. * Get share sharer
  256. *
  257. * @return string
  258. * @since 9.0.0
  259. */
  260. public function getSharedBy();
  261. /**
  262. * Set the original share owner (who owns the path that is shared)
  263. *
  264. * @param string $shareOwner
  265. * @return \OCP\Share\IShare The modified object
  266. * @since 9.0.0
  267. */
  268. public function setShareOwner($shareOwner);
  269. /**
  270. * Get the original share owner (who owns the path that is shared)
  271. *
  272. * @return string
  273. * @since 9.0.0
  274. */
  275. public function getShareOwner();
  276. /**
  277. * Set the password for this share.
  278. * When the share is passed to the share manager to be created
  279. * or updated the password will be hashed.
  280. *
  281. * @param string $password
  282. * @return \OCP\Share\IShare The modified object
  283. * @since 9.0.0
  284. */
  285. public function setPassword($password);
  286. /**
  287. * Get the password of this share.
  288. * If this share is obtained via a shareprovider the password is
  289. * hashed.
  290. *
  291. * @return string
  292. * @since 9.0.0
  293. */
  294. public function getPassword();
  295. /**
  296. * Set if the recipient can start a conversation with the owner to get the
  297. * password using Nextcloud Talk.
  298. *
  299. * @param bool $sendPasswordByTalk
  300. * @return \OCP\Share\IShare The modified object
  301. * @since 14.0.0
  302. */
  303. public function setSendPasswordByTalk(bool $sendPasswordByTalk);
  304. /**
  305. * Get if the recipient can start a conversation with the owner to get the
  306. * password using Nextcloud Talk.
  307. * The returned value does not take into account other factors, like Talk
  308. * being enabled for the owner of the share or not; it just cover whether
  309. * the option is enabled for the share itself or not.
  310. *
  311. * @return bool
  312. * @since 14.0.0
  313. */
  314. public function getSendPasswordByTalk(): bool;
  315. /**
  316. * Set the public link token.
  317. *
  318. * @param string $token
  319. * @return \OCP\Share\IShare The modified object
  320. * @since 9.0.0
  321. */
  322. public function setToken($token);
  323. /**
  324. * Get the public link token.
  325. *
  326. * @return string
  327. * @since 9.0.0
  328. */
  329. public function getToken();
  330. /**
  331. * Set the target path of this share relative to the recipients user folder.
  332. *
  333. * @param string $target
  334. * @return \OCP\Share\IShare The modified object
  335. * @since 9.0.0
  336. */
  337. public function setTarget($target);
  338. /**
  339. * Get the target path of this share relative to the recipients user folder.
  340. *
  341. * @return string
  342. * @since 9.0.0
  343. */
  344. public function getTarget();
  345. /**
  346. * Set the time this share was created
  347. *
  348. * @param \DateTime $shareTime
  349. * @return \OCP\Share\IShare The modified object
  350. * @since 9.0.0
  351. */
  352. public function setShareTime(\DateTime $shareTime);
  353. /**
  354. * Get the timestamp this share was created
  355. *
  356. * @return \DateTime
  357. * @since 9.0.0
  358. */
  359. public function getShareTime();
  360. /**
  361. * Set if the recipient is informed by mail about the share.
  362. *
  363. * @param bool $mailSend
  364. * @return \OCP\Share\IShare The modified object
  365. * @since 9.0.0
  366. */
  367. public function setMailSend($mailSend);
  368. /**
  369. * Get if the recipient informed by mail about the share.
  370. *
  371. * @return bool
  372. * @since 9.0.0
  373. */
  374. public function getMailSend();
  375. /**
  376. * Set the cache entry for the shared node
  377. *
  378. * @param ICacheEntry $entry
  379. * @since 11.0.0
  380. */
  381. public function setNodeCacheEntry(ICacheEntry $entry);
  382. /**
  383. * Get the cache entry for the shared node
  384. *
  385. * @return null|ICacheEntry
  386. * @since 11.0.0
  387. */
  388. public function getNodeCacheEntry();
  389. /**
  390. * Sets a shares hide download state
  391. * This is mainly for public shares. It will signal that the share page should
  392. * hide download buttons etc.
  393. *
  394. * @param bool $ro
  395. * @return IShare
  396. * @since 15.0.0
  397. */
  398. public function setHideDownload(bool $hide): IShare;
  399. /**
  400. * Gets a shares hide download state
  401. * This is mainly for public shares. It will signal that the share page should
  402. * hide download buttons etc.
  403. *
  404. * @return bool
  405. * @since 15.0.0
  406. */
  407. public function getHideDownload(): bool;
  408. }