IMetadataProvider.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace OC\Metadata;
  3. use OCP\Files\File;
  4. /**
  5. * Interface for the metadata providers. If you want an application to provide
  6. * some metadata, you can use this to store them.
  7. */
  8. interface IMetadataProvider {
  9. /**
  10. * The list of groups that this metadata provider is able to provide.
  11. *
  12. * @return string[]
  13. */
  14. public static function groupsProvided(): array;
  15. /**
  16. * Check if the metadata provider is available. A metadata provider might be
  17. * unavailable due to a php extension not being installed.
  18. */
  19. public static function isAvailable(): bool;
  20. /**
  21. * Get the mimetypes supported as a regex.
  22. */
  23. public static function getMimetypesSupported(): string;
  24. /**
  25. * Execute the extraction on the specified file. The metadata should be
  26. * grouped by metadata
  27. *
  28. * Each group should be json serializable and the string representation
  29. * shouldn't be longer than 4000 characters.
  30. *
  31. * @param File $file The file to extract the metadata from
  32. * @param array<string, FileMetadata> An array containing all the metadata fetched.
  33. */
  34. public function execute(File $file): array;
  35. }