IToken.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\DirectEditing;
  7. use OCP\Files\File;
  8. use OCP\Files\NotFoundException;
  9. /**
  10. * @since 18.0.0
  11. */
  12. interface IToken {
  13. /**
  14. * Extend the token validity time
  15. *
  16. * @since 18.0.0
  17. */
  18. public function extend(): void;
  19. /**
  20. * Invalidate the token
  21. *
  22. * @since 18.0.0
  23. */
  24. public function invalidate(): void;
  25. /**
  26. * Check if the token has already been used
  27. *
  28. * @since 18.0.0
  29. * @return bool
  30. */
  31. public function hasBeenAccessed(): bool;
  32. /**
  33. * Change to the user scope of the token
  34. *
  35. * @since 18.0.0
  36. */
  37. public function useTokenScope(): void;
  38. /**
  39. * Get the file that is related to the token
  40. *
  41. * @since 18.0.0
  42. * @return File
  43. * @throws NotFoundException
  44. */
  45. public function getFile(): File;
  46. /**
  47. * @since 18.0.0
  48. * @return string
  49. */
  50. public function getEditor(): string;
  51. /**
  52. * @since 18.0.0
  53. * @return string
  54. */
  55. public function getUser(): string;
  56. }