1
0

ITrashBackend.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
  4. *
  5. * @author Robin Appelman <robin@icewind.nl>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  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
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OCA\Files_Trashbin\Trash;
  24. use OCP\Files\Node;
  25. use OCP\Files\Storage\IStorage;
  26. use OCP\IUser;
  27. /**
  28. * @since 15.0.0
  29. */
  30. interface ITrashBackend {
  31. /**
  32. * List all trash items in the root of the trashbin
  33. *
  34. * @param IUser $user
  35. * @return ITrashItem[]
  36. * @since 15.0.0
  37. */
  38. public function listTrashRoot(IUser $user): array;
  39. /**
  40. * List all trash items in a subfolder in the trashbin
  41. *
  42. * @param ITrashItem $folder
  43. * @return ITrashItem[]
  44. * @since 15.0.0
  45. */
  46. public function listTrashFolder(ITrashItem $folder): array;
  47. /**
  48. * Restore a trashbin item
  49. *
  50. * @param ITrashItem $item
  51. * @since 15.0.0
  52. */
  53. public function restoreItem(ITrashItem $item);
  54. /**
  55. * Permanently remove an item from trash
  56. *
  57. * @param ITrashItem $item
  58. * @since 15.0.0
  59. */
  60. public function removeItem(ITrashItem $item);
  61. /**
  62. * Move a file or folder to trash
  63. *
  64. * @param IStorage $storage
  65. * @param string $internalPath
  66. * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally
  67. * @since 15.0.0
  68. */
  69. public function moveToTrash(IStorage $storage, string $internalPath): bool;
  70. /**
  71. * @param IUser $user
  72. * @param int $fileId
  73. * @return Node|null
  74. */
  75. public function getTrashNodeById(IUser $user, int $fileId);
  76. }