Folder.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <robin@icewind.nl>
  7. * @author Vincent Petry <pvince81@owncloud.com>
  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. /**
  25. * Public interface of ownCloud for apps to use.
  26. * Files/Folder interface
  27. */
  28. // use OCP namespace for all classes that are considered public.
  29. // This means that they should be used by apps instead of the internal ownCloud classes
  30. namespace OCP\Files;
  31. use OCP\Files\Search\ISearchQuery;
  32. /**
  33. * @since 6.0.0
  34. */
  35. interface Folder extends Node {
  36. /**
  37. * Get the full path of an item in the folder within owncloud's filesystem
  38. *
  39. * @param string $path relative path of an item in the folder
  40. * @return string
  41. * @throws \OCP\Files\NotPermittedException
  42. * @since 6.0.0
  43. */
  44. public function getFullPath($path);
  45. /**
  46. * Get the path of an item in the folder relative to the folder
  47. *
  48. * @param string $path absolute path of an item in the folder
  49. * @throws \OCP\Files\NotFoundException
  50. * @return string
  51. * @since 6.0.0
  52. */
  53. public function getRelativePath($path);
  54. /**
  55. * check if a node is a (grand-)child of the folder
  56. *
  57. * @param \OCP\Files\Node $node
  58. * @return bool
  59. * @since 6.0.0
  60. */
  61. public function isSubNode($node);
  62. /**
  63. * get the content of this directory
  64. *
  65. * @throws \OCP\Files\NotFoundException
  66. * @return \OCP\Files\Node[]
  67. * @since 6.0.0
  68. */
  69. public function getDirectoryListing();
  70. /**
  71. * Get the node at $path
  72. *
  73. * @param string $path relative path of the file or folder
  74. * @return \OCP\Files\Node
  75. * @throws \OCP\Files\NotFoundException
  76. * @since 6.0.0
  77. */
  78. public function get($path);
  79. /**
  80. * Check if a file or folder exists in the folder
  81. *
  82. * @param string $path relative path of the file or folder
  83. * @return bool
  84. * @since 6.0.0
  85. */
  86. public function nodeExists($path);
  87. /**
  88. * Create a new folder
  89. *
  90. * @param string $path relative path of the new folder
  91. * @return \OCP\Files\Folder
  92. * @throws \OCP\Files\NotPermittedException
  93. * @since 6.0.0
  94. */
  95. public function newFolder($path);
  96. /**
  97. * Create a new file
  98. *
  99. * @param string $path relative path of the new file
  100. * @return \OCP\Files\File
  101. * @throws \OCP\Files\NotPermittedException
  102. * @since 6.0.0
  103. */
  104. public function newFile($path);
  105. /**
  106. * search for files with the name matching $query
  107. *
  108. * @param string|ISearchQuery $query
  109. * @return \OCP\Files\Node[]
  110. * @since 6.0.0
  111. */
  112. public function search($query);
  113. /**
  114. * search for files by mimetype
  115. * $mimetype can either be a full mimetype (image/png) or a wildcard mimetype (image)
  116. *
  117. * @param string $mimetype
  118. * @return \OCP\Files\Node[]
  119. * @since 6.0.0
  120. */
  121. public function searchByMime($mimetype);
  122. /**
  123. * search for files by tag
  124. *
  125. * @param string|int $tag tag name or tag id
  126. * @param string $userId owner of the tags
  127. * @return \OCP\Files\Node[]
  128. * @since 8.0.0
  129. */
  130. public function searchByTag($tag, $userId);
  131. /**
  132. * get a file or folder inside the folder by it's internal id
  133. *
  134. * @param int $id
  135. * @return \OCP\Files\Node[]
  136. * @since 6.0.0
  137. */
  138. public function getById($id);
  139. /**
  140. * Get the amount of free space inside the folder
  141. *
  142. * @return int
  143. * @since 6.0.0
  144. */
  145. public function getFreeSpace();
  146. /**
  147. * Check if new files or folders can be created within the folder
  148. *
  149. * @return bool
  150. * @since 6.0.0
  151. */
  152. public function isCreatable();
  153. /**
  154. * Add a suffix to the name in case the file exists
  155. *
  156. * @param string $name
  157. * @return string
  158. * @throws NotPermittedException
  159. * @since 8.1.0
  160. */
  161. public function getNonExistingName($name);
  162. /**
  163. * @param int $limit
  164. * @param int $offset
  165. * @return \OCP\Files\Node[]
  166. * @since 9.1.0
  167. */
  168. public function getRecent($limit, $offset = 0);
  169. }