1
0

ICollection.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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\Collaboration\Resources;
  8. use OCP\IUser;
  9. /**
  10. * @since 16.0.0
  11. */
  12. interface ICollection {
  13. /**
  14. * @return int
  15. * @since 16.0.0
  16. */
  17. public function getId(): int;
  18. /**
  19. * @return string
  20. * @since 16.0.0
  21. */
  22. public function getName(): string;
  23. /**
  24. * @param string $name
  25. * @since 16.0.0
  26. */
  27. public function setName(string $name): void;
  28. /**
  29. * @return IResource[]
  30. * @since 16.0.0
  31. */
  32. public function getResources(): array;
  33. /**
  34. * Adds a resource to a collection
  35. *
  36. * @param IResource $resource
  37. * @throws ResourceException when the resource is already part of the collection
  38. * @since 16.0.0
  39. */
  40. public function addResource(IResource $resource): void;
  41. /**
  42. * Removes a resource from a collection
  43. *
  44. * @param IResource $resource
  45. * @since 16.0.0
  46. */
  47. public function removeResource(IResource $resource): void;
  48. /**
  49. * Can a user/guest access the collection
  50. *
  51. * @param IUser|null $user
  52. * @return bool
  53. * @since 16.0.0
  54. */
  55. public function canAccess(?IUser $user): bool;
  56. }