CalendarShareUpdatedEvent.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2020, Georg Ehrke
  5. *
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCA\DAV\Events;
  25. use OCP\EventDispatcher\Event;
  26. use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp;
  27. use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
  28. /**
  29. * Class CalendarShareUpdatedEvent
  30. *
  31. * @package OCA\DAV\Events
  32. * @since 20.0.0
  33. */
  34. class CalendarShareUpdatedEvent extends Event {
  35. private int $calendarId;
  36. /** @var array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string } */
  37. private array $calendarData;
  38. /** @var list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}> */
  39. private array $oldShares;
  40. /** @var list<array{href: string, commonName: string, readOnly: bool}> */
  41. private array $added;
  42. /** @var list<string> */
  43. private array $removed;
  44. /**
  45. * CalendarShareUpdatedEvent constructor.
  46. *
  47. * @param int $calendarId
  48. * @param array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string } $calendarData
  49. * @param list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}> $oldShares
  50. * @param list<array{href: string, commonName: string, readOnly: bool}> $added
  51. * @param list<string> $removed
  52. * @since 20.0.0
  53. */
  54. public function __construct(int $calendarId,
  55. array $calendarData,
  56. array $oldShares,
  57. array $added,
  58. array $removed) {
  59. parent::__construct();
  60. $this->calendarId = $calendarId;
  61. $this->calendarData = $calendarData;
  62. $this->oldShares = $oldShares;
  63. $this->added = $added;
  64. $this->removed = $removed;
  65. }
  66. /**
  67. * @since 20.0.0
  68. */
  69. public function getCalendarId(): int {
  70. return $this->calendarId;
  71. }
  72. /**
  73. * @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string }
  74. * @since 20.0.0
  75. */
  76. public function getCalendarData(): array {
  77. return $this->calendarData;
  78. }
  79. /**
  80. * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}>
  81. * @since 20.0.0
  82. */
  83. public function getOldShares(): array {
  84. return $this->oldShares;
  85. }
  86. /**
  87. * @return list<array{href: string, commonName: string, readOnly: bool}>
  88. * @since 20.0.0
  89. */
  90. public function getAdded(): array {
  91. return $this->added;
  92. }
  93. /**
  94. * @return list<string>
  95. * @since 20.0.0
  96. */
  97. public function getRemoved(): array {
  98. return $this->removed;
  99. }
  100. }