1
0

ITrashBackend.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Files_Trashbin\Trash;
  7. use OCP\Files\Node;
  8. use OCP\Files\Storage\IStorage;
  9. use OCP\IUser;
  10. /**
  11. * @since 15.0.0
  12. */
  13. interface ITrashBackend {
  14. /**
  15. * List all trash items in the root of the trashbin
  16. *
  17. * @param IUser $user
  18. * @return ITrashItem[]
  19. * @since 15.0.0
  20. */
  21. public function listTrashRoot(IUser $user): array;
  22. /**
  23. * List all trash items in a subfolder in the trashbin
  24. *
  25. * @param ITrashItem $folder
  26. * @return ITrashItem[]
  27. * @since 15.0.0
  28. */
  29. public function listTrashFolder(ITrashItem $folder): array;
  30. /**
  31. * Restore a trashbin item
  32. *
  33. * @param ITrashItem $item
  34. * @since 15.0.0
  35. */
  36. public function restoreItem(ITrashItem $item);
  37. /**
  38. * Permanently remove an item from trash
  39. *
  40. * @param ITrashItem $item
  41. * @since 15.0.0
  42. */
  43. public function removeItem(ITrashItem $item);
  44. /**
  45. * Move a file or folder to trash
  46. *
  47. * @param IStorage $storage
  48. * @param string $internalPath
  49. * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally
  50. * @since 15.0.0
  51. */
  52. public function moveToTrash(IStorage $storage, string $internalPath): bool;
  53. /**
  54. * @param IUser $user
  55. * @param int $fileId
  56. * @return Node|null
  57. */
  58. public function getTrashNodeById(IUser $user, int $fileId);
  59. }