AFilesDocument.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Files_FullTextSearch\Model;
  8. use OC\FullTextSearch\Model\IndexDocument;
  9. use OCP\FullTextSearch\Model\IIndexDocument;
  10. /**
  11. * Abstract Class AFilesDocument
  12. *
  13. * This is mostly used by 3rd party apps that want to complete the IIndexDocument
  14. * with more information about a file before its index:
  15. *
  16. * \OC::$server->getEventDispatcher()->addListener(
  17. * '\OCA\Files_FullTextSearch::onFileIndexing',
  18. * function(GenericEvent $e) {
  19. * //@var \OCP\Files\Node $file
  20. * $file = $e->getArgument('file');
  21. *
  22. * // @var \OCP\Files_FullTextSearch\Model\AFilesDocument $document
  23. * $document = $e->getArgument('document');
  24. * }
  25. * );
  26. *
  27. * @since 15.0.0
  28. *
  29. */
  30. abstract class AFilesDocument extends IndexDocument {
  31. /**
  32. * Returns the owner of the document/file.
  33. *
  34. * @since 15.0.0
  35. *
  36. * @return string
  37. */
  38. abstract public function getOwnerId(): string;
  39. /**
  40. * Returns the current viewer of the document/file.
  41. *
  42. * @since 15.0.0
  43. *
  44. * @return string
  45. */
  46. abstract public function getViewerId(): string;
  47. /**
  48. * Returns the type of the document/file.
  49. *
  50. * @since 15.0.0
  51. *
  52. * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
  53. */
  54. abstract public function getType(): string;
  55. /**
  56. * Returns the mimetype of the document/file.
  57. *
  58. * @since 15.0.0
  59. *
  60. * @return string
  61. */
  62. abstract public function getMimetype(): string;
  63. /**
  64. * Returns the path of the document/file.
  65. *
  66. * @since 15.0.0
  67. *
  68. * @return string
  69. */
  70. abstract public function getPath(): string;
  71. }