node.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. /**
  3. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  4. * @author Joas Schilling <nickvergessen@owncloud.com>
  5. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <icewind@owncloud.com>
  8. *
  9. * @copyright Copyright (c) 2015, ownCloud, Inc.
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. /**
  26. * Public interface of ownCloud for apps to use.
  27. * Files/Node interface
  28. */
  29. // use OCP namespace for all classes that are considered public.
  30. // This means that they should be used by apps instead of the internal ownCloud classes
  31. namespace OCP\Files;
  32. /**
  33. * Interface Node
  34. *
  35. * @package OCP\Files
  36. * @since 6.0.0 - extends FileInfo was added in 8.0.0
  37. */
  38. interface Node extends FileInfo {
  39. /**
  40. * Move the file or folder to a new location
  41. *
  42. * @param string $targetPath the absolute target path
  43. * @throws \OCP\Files\NotPermittedException
  44. * @return \OCP\Files\Node
  45. * @since 6.0.0
  46. */
  47. public function move($targetPath);
  48. /**
  49. * Delete the file or folder
  50. * @return void
  51. * @since 6.0.0
  52. */
  53. public function delete();
  54. /**
  55. * Cope the file or folder to a new location
  56. *
  57. * @param string $targetPath the absolute target path
  58. * @return \OCP\Files\Node
  59. * @since 6.0.0
  60. */
  61. public function copy($targetPath);
  62. /**
  63. * Change the modified date of the file or folder
  64. * If $mtime is omitted the current time will be used
  65. *
  66. * @param int $mtime (optional) modified date as unix timestamp
  67. * @throws \OCP\Files\NotPermittedException
  68. * @return void
  69. * @since 6.0.0
  70. */
  71. public function touch($mtime = null);
  72. /**
  73. * Get the storage backend the file or folder is stored on
  74. *
  75. * @return \OCP\Files\Storage
  76. * @throws \OCP\Files\NotFoundException
  77. * @since 6.0.0
  78. */
  79. public function getStorage();
  80. /**
  81. * Get the full path of the file or folder
  82. *
  83. * @return string
  84. * @since 6.0.0
  85. */
  86. public function getPath();
  87. /**
  88. * Get the path of the file or folder relative to the mountpoint of it's storage
  89. *
  90. * @return string
  91. * @since 6.0.0
  92. */
  93. public function getInternalPath();
  94. /**
  95. * Get the internal file id for the file or folder
  96. *
  97. * @return int
  98. * @throws InvalidPathException
  99. * @throws NotFoundException
  100. * @since 6.0.0
  101. */
  102. public function getId();
  103. /**
  104. * Get metadata of the file or folder
  105. * The returned array contains the following values:
  106. * - mtime
  107. * - size
  108. *
  109. * @return array
  110. * @since 6.0.0
  111. */
  112. public function stat();
  113. /**
  114. * Get the modified date of the file or folder as unix timestamp
  115. *
  116. * @return int
  117. * @throws InvalidPathException
  118. * @throws NotFoundException
  119. * @since 6.0.0
  120. */
  121. public function getMTime();
  122. /**
  123. * Get the size of the file or folder in bytes
  124. *
  125. * @return int
  126. * @throws InvalidPathException
  127. * @throws NotFoundException
  128. * @since 6.0.0
  129. */
  130. public function getSize();
  131. /**
  132. * Get the Etag of the file or folder
  133. * The Etag is an string id used to detect changes to a file or folder,
  134. * every time the file or folder is changed the Etag will change to
  135. *
  136. * @return string
  137. * @throws InvalidPathException
  138. * @throws NotFoundException
  139. * @since 6.0.0
  140. */
  141. public function getEtag();
  142. /**
  143. * Get the permissions of the file or folder as a combination of one or more of the following constants:
  144. * - \OCP\Constants::PERMISSION_READ
  145. * - \OCP\Constants::PERMISSION_UPDATE
  146. * - \OCP\Constants::PERMISSION_CREATE
  147. * - \OCP\Constants::PERMISSION_DELETE
  148. * - \OCP\Constants::PERMISSION_SHARE
  149. *
  150. * @return int
  151. * @throws InvalidPathException
  152. * @throws NotFoundException
  153. * @since 6.0.0 - namespace of constants has changed in 8.0.0
  154. */
  155. public function getPermissions();
  156. /**
  157. * Check if the file or folder is readable
  158. *
  159. * @return bool
  160. * @throws InvalidPathException
  161. * @throws NotFoundException
  162. * @since 6.0.0
  163. */
  164. public function isReadable();
  165. /**
  166. * Check if the file or folder is writable
  167. *
  168. * @return bool
  169. * @throws InvalidPathException
  170. * @throws NotFoundException
  171. * @since 6.0.0
  172. */
  173. public function isUpdateable();
  174. /**
  175. * Check if the file or folder is deletable
  176. *
  177. * @return bool
  178. * @throws InvalidPathException
  179. * @throws NotFoundException
  180. * @since 6.0.0
  181. */
  182. public function isDeletable();
  183. /**
  184. * Check if the file or folder is shareable
  185. *
  186. * @return bool
  187. * @throws InvalidPathException
  188. * @throws NotFoundException
  189. * @since 6.0.0
  190. */
  191. public function isShareable();
  192. /**
  193. * Get the parent folder of the file or folder
  194. *
  195. * @return Folder
  196. * @since 6.0.0
  197. */
  198. public function getParent();
  199. /**
  200. * Get the filename of the file or folder
  201. *
  202. * @return string
  203. * @since 6.0.0
  204. */
  205. public function getName();
  206. }