node.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OCP\Files;
  9. interface Node {
  10. /**
  11. * Move the file or folder to a new location
  12. *
  13. * @param string $targetPath the absolute target path
  14. * @throws \OCP\Files\NotPermittedException
  15. * @return \OCP\Files\Node
  16. */
  17. public function move($targetPath);
  18. /**
  19. * Delete the file or folder
  20. */
  21. public function delete();
  22. /**
  23. * Cope the file or folder to a new location
  24. *
  25. * @param string $targetPath the absolute target path
  26. * @return \OCP\Files\Node
  27. */
  28. public function copy($targetPath);
  29. /**
  30. * Change the modified date of the file or folder
  31. * If $mtime is omitted the current time will be used
  32. *
  33. * @param int $mtime (optional) modified date as unix timestamp
  34. * @throws \OCP\Files\NotPermittedException
  35. */
  36. public function touch($mtime = null);
  37. /**
  38. * Get the storage backend the file or folder is stored on
  39. *
  40. * @return \OCP\Files\Storage
  41. * @throws \OCP\Files\NotFoundException
  42. */
  43. public function getStorage();
  44. /**
  45. * Get the full path of the file or folder
  46. *
  47. * @return string
  48. */
  49. public function getPath();
  50. /**
  51. * Get the path of the file or folder relative to the mountpoint of it's storage
  52. *
  53. * @return string
  54. */
  55. public function getInternalPath();
  56. /**
  57. * Get the internal file id for the file or folder
  58. *
  59. * @return int
  60. */
  61. public function getId();
  62. /**
  63. * Get metadata of the file or folder
  64. * The returned array contains the following values:
  65. * - mtime
  66. * - size
  67. *
  68. * @return array
  69. */
  70. public function stat();
  71. /**
  72. * Get the modified date of the file or folder as unix timestamp
  73. *
  74. * @return int
  75. */
  76. public function getMTime();
  77. /**
  78. * Get the size of the file or folder in bytes
  79. *
  80. * @return int
  81. */
  82. public function getSize();
  83. /**
  84. * Get the Etag of the file or folder
  85. * The Etag is an string id used to detect changes to a file or folder,
  86. * every time the file or folder is changed the Etag will change to
  87. *
  88. * @return string
  89. */
  90. public function getEtag();
  91. /**
  92. * Get the permissions of the file or folder as a combination of one or more of the following constants:
  93. * - \OCP\PERMISSION_READ
  94. * - \OCP\PERMISSION_UPDATE
  95. * - \OCP\PERMISSION_CREATE
  96. * - \OCP\PERMISSION_DELETE
  97. * - \OCP\PERMISSION_SHARE
  98. *
  99. * @return int
  100. */
  101. public function getPermissions();
  102. /**
  103. * Check if the file or folder is readable
  104. *
  105. * @return bool
  106. */
  107. public function isReadable();
  108. /**
  109. * Check if the file or folder is writable
  110. *
  111. * @return bool
  112. */
  113. public function isUpdateable();
  114. /**
  115. * Check if the file or folder is deletable
  116. *
  117. * @return bool
  118. */
  119. public function isDeletable();
  120. /**
  121. * Check if the file or folder is shareable
  122. *
  123. * @return bool
  124. */
  125. public function isShareable();
  126. /**
  127. * Get the parent folder of the file or folder
  128. *
  129. * @return Folder
  130. */
  131. public function getParent();
  132. /**
  133. * Get the filename of the file or folder
  134. *
  135. * @return string
  136. */
  137. public function getName();
  138. }