folder.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. /**
  3. * @author Morris Jobke <hey@morrisjobke.de>
  4. * @author Robin Appelman <icewind@owncloud.com>
  5. * @author Vincent Petry <pvince81@owncloud.com>
  6. *
  7. * @copyright Copyright (c) 2015, ownCloud, Inc.
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. /**
  24. * Public interface of ownCloud for apps to use.
  25. * Files/Folder interface
  26. */
  27. // use OCP namespace for all classes that are considered public.
  28. // This means that they should be used by apps instead of the internal ownCloud classes
  29. namespace OCP\Files;
  30. /**
  31. * @since 6.0.0
  32. */
  33. interface Folder extends Node {
  34. /**
  35. * Get the full path of an item in the folder within owncloud's filesystem
  36. *
  37. * @param string $path relative path of an item in the folder
  38. * @return string
  39. * @throws \OCP\Files\NotPermittedException
  40. * @since 6.0.0
  41. */
  42. public function getFullPath($path);
  43. /**
  44. * Get the path of an item in the folder relative to the folder
  45. *
  46. * @param string $path absolute path of an item in the folder
  47. * @throws \OCP\Files\NotFoundException
  48. * @return string
  49. * @since 6.0.0
  50. */
  51. public function getRelativePath($path);
  52. /**
  53. * check if a node is a (grand-)child of the folder
  54. *
  55. * @param \OCP\Files\Node $node
  56. * @return bool
  57. * @since 6.0.0
  58. */
  59. public function isSubNode($node);
  60. /**
  61. * get the content of this directory
  62. *
  63. * @throws \OCP\Files\NotFoundException
  64. * @return \OCP\Files\Node[]
  65. * @since 6.0.0
  66. */
  67. public function getDirectoryListing();
  68. /**
  69. * Get the node at $path
  70. *
  71. * @param string $path relative path of the file or folder
  72. * @return \OCP\Files\Node
  73. * @throws \OCP\Files\NotFoundException
  74. * @since 6.0.0
  75. */
  76. public function get($path);
  77. /**
  78. * Check if a file or folder exists in the folder
  79. *
  80. * @param string $path relative path of the file or folder
  81. * @return bool
  82. * @since 6.0.0
  83. */
  84. public function nodeExists($path);
  85. /**
  86. * Create a new folder
  87. *
  88. * @param string $path relative path of the new folder
  89. * @return \OCP\Files\Folder
  90. * @throws \OCP\Files\NotPermittedException
  91. * @since 6.0.0
  92. */
  93. public function newFolder($path);
  94. /**
  95. * Create a new file
  96. *
  97. * @param string $path relative path of the new file
  98. * @return \OCP\Files\File
  99. * @throws \OCP\Files\NotPermittedException
  100. * @since 6.0.0
  101. */
  102. public function newFile($path);
  103. /**
  104. * search for files with the name matching $query
  105. *
  106. * @param string $query
  107. * @return \OCP\Files\Node[]
  108. * @since 6.0.0
  109. */
  110. public function search($query);
  111. /**
  112. * search for files by mimetype
  113. * $mimetype can either be a full mimetype (image/png) or a wildcard mimetype (image)
  114. *
  115. * @param string $mimetype
  116. * @return \OCP\Files\Node[]
  117. * @since 6.0.0
  118. */
  119. public function searchByMime($mimetype);
  120. /**
  121. * search for files by tag
  122. *
  123. * @param string|int $tag tag name or tag id
  124. * @param string $userId owner of the tags
  125. * @return \OCP\Files\Node[]
  126. * @since 8.0.0
  127. */
  128. public function searchByTag($tag, $userId);
  129. /**
  130. * get a file or folder inside the folder by it's internal id
  131. *
  132. * @param int $id
  133. * @return \OCP\Files\Node[]
  134. * @since 6.0.0
  135. */
  136. public function getById($id);
  137. /**
  138. * Get the amount of free space inside the folder
  139. *
  140. * @return int
  141. * @since 6.0.0
  142. */
  143. public function getFreeSpace();
  144. /**
  145. * Check if new files or folders can be created within the folder
  146. *
  147. * @return bool
  148. * @since 6.0.0
  149. */
  150. public function isCreatable();
  151. /**
  152. * Add a suffix to the name in case the file exists
  153. *
  154. * @param string $name
  155. * @return string
  156. * @throws NotPermittedException
  157. * @since 8.1.0
  158. */
  159. public function getNonExistingName($name);
  160. }