AbstractNodeEvent.php 783 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Files\Events\Node;
  8. use OCP\EventDispatcher\Event;
  9. use OCP\EventDispatcher\IWebhookCompatibleEvent;
  10. use OCP\EventDispatcher\JsonSerializer;
  11. use OCP\Files\Node;
  12. /**
  13. * @since 20.0.0
  14. */
  15. abstract class AbstractNodeEvent extends Event implements IWebhookCompatibleEvent {
  16. /**
  17. * @since 20.0.0
  18. */
  19. public function __construct(
  20. private Node $node
  21. ) {
  22. }
  23. /**
  24. * @since 20.0.0
  25. */
  26. public function getNode(): Node {
  27. return $this->node;
  28. }
  29. /**
  30. * @since 30.0.0
  31. */
  32. public function getWebhookSerializable(): array {
  33. return [
  34. 'node' => JsonSerializer::serializeFileInfo($this->node),
  35. ];
  36. }
  37. }