folder.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. /**
  32. * @since 6.0.0
  33. */
  34. interface Folder extends Node {
  35. /**
  36. * Get the full path of an item in the folder within owncloud's filesystem
  37. *
  38. * @param string $path relative path of an item in the folder
  39. * @return string
  40. * @throws \OCP\Files\NotPermittedException
  41. * @since 6.0.0
  42. */
  43. public function getFullPath($path);
  44. /**
  45. * Get the path of an item in the folder relative to the folder
  46. *
  47. * @param string $path absolute path of an item in the folder
  48. * @throws \OCP\Files\NotFoundException
  49. * @return string
  50. * @since 6.0.0
  51. */
  52. public function getRelativePath($path);
  53. /**
  54. * check if a node is a (grand-)child of the folder
  55. *
  56. * @param \OCP\Files\Node $node
  57. * @return bool
  58. * @since 6.0.0
  59. */
  60. public function isSubNode($node);
  61. /**
  62. * get the content of this directory
  63. *
  64. * @throws \OCP\Files\NotFoundException
  65. * @return \OCP\Files\Node[]
  66. * @since 6.0.0
  67. */
  68. public function getDirectoryListing();
  69. /**
  70. * Get the node at $path
  71. *
  72. * @param string $path relative path of the file or folder
  73. * @return \OCP\Files\Node
  74. * @throws \OCP\Files\NotFoundException
  75. * @since 6.0.0
  76. */
  77. public function get($path);
  78. /**
  79. * Check if a file or folder exists in the folder
  80. *
  81. * @param string $path relative path of the file or folder
  82. * @return bool
  83. * @since 6.0.0
  84. */
  85. public function nodeExists($path);
  86. /**
  87. * Create a new folder
  88. *
  89. * @param string $path relative path of the new folder
  90. * @return \OCP\Files\Folder
  91. * @throws \OCP\Files\NotPermittedException
  92. * @since 6.0.0
  93. */
  94. public function newFolder($path);
  95. /**
  96. * Create a new file
  97. *
  98. * @param string $path relative path of the new file
  99. * @return \OCP\Files\File
  100. * @throws \OCP\Files\NotPermittedException
  101. * @since 6.0.0
  102. */
  103. public function newFile($path);
  104. /**
  105. * search for files with the name matching $query
  106. *
  107. * @param string $query
  108. * @return \OCP\Files\Node[]
  109. * @since 6.0.0
  110. */
  111. public function search($query);
  112. /**
  113. * search for files by mimetype
  114. * $mimetype can either be a full mimetype (image/png) or a wildcard mimetype (image)
  115. *
  116. * @param string $mimetype
  117. * @return \OCP\Files\Node[]
  118. * @since 6.0.0
  119. */
  120. public function searchByMime($mimetype);
  121. /**
  122. * search for files by tag
  123. *
  124. * @param string|int $tag tag name or tag id
  125. * @param string $userId owner of the tags
  126. * @return \OCP\Files\Node[]
  127. * @since 8.0.0
  128. */
  129. public function searchByTag($tag, $userId);
  130. /**
  131. * get a file or folder inside the folder by it's internal id
  132. *
  133. * @param int $id
  134. * @return \OCP\Files\Node[]
  135. * @since 6.0.0
  136. */
  137. public function getById($id);
  138. /**
  139. * Get the amount of free space inside the folder
  140. *
  141. * @return int
  142. * @since 6.0.0
  143. */
  144. public function getFreeSpace();
  145. /**
  146. * Check if new files or folders can be created within the folder
  147. *
  148. * @return bool
  149. * @since 6.0.0
  150. */
  151. public function isCreatable();
  152. /**
  153. * Add a suffix to the name in case the file exists
  154. *
  155. * @param string $name
  156. * @return string
  157. * @throws NotPermittedException
  158. * @since 8.1.0
  159. */
  160. public function getNonExistingName($name);
  161. }