IManager.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Calendar;
  8. /**
  9. * This class provides access to the Nextcloud CalDAV backend.
  10. * Use this class exclusively if you want to access calendars.
  11. *
  12. * Events/Journals/Todos in general will be expressed as an array of key-value-pairs.
  13. * The keys will match the property names defined in https://tools.ietf.org/html/rfc5545
  14. *
  15. * [
  16. * 'id' => 123,
  17. * 'type' => 'VEVENT',
  18. * 'calendar-key' => 42,
  19. * 'objects' => [
  20. * [
  21. * 'SUMMARY' => ['FooBar', []],
  22. * 'DTSTART' => ['20171001T123456', ['TZID' => 'EUROPE/BERLIN']],
  23. * 'DURATION' => ['P1D', []],
  24. * 'ATTENDEE' => [
  25. * ['mailto:bla@blub.com', ['CN' => 'Mr. Bla Blub']]
  26. * ],
  27. * 'VALARM' => [
  28. * [
  29. * 'TRIGGER' => ['19980101T050000Z', ['VALUE' => DATE-TIME]]
  30. * ]
  31. * ]
  32. * ],
  33. * ]
  34. * ]
  35. *
  36. * @since 13.0.0
  37. */
  38. interface IManager {
  39. /**
  40. * This function is used to search and find objects within the user's calendars.
  41. * In case $pattern is empty all events/journals/todos will be returned.
  42. *
  43. * @param string $pattern which should match within the $searchProperties
  44. * @param array $searchProperties defines the properties within the query pattern should match
  45. * @param array $options - optional parameters:
  46. * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
  47. * @param integer|null $limit - limit number of search results
  48. * @param integer|null $offset - offset for paging of search results
  49. * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs
  50. * @since 13.0.0
  51. * @deprecated 23.0.0 use \OCP\Calendar\IManager::searchForPrincipal
  52. */
  53. public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null);
  54. /**
  55. * Check if calendars are available
  56. *
  57. * @return bool true if enabled, false if not
  58. * @since 13.0.0
  59. * @deprecated 23.0.0
  60. */
  61. public function isEnabled();
  62. /**
  63. * Registers a calendar
  64. *
  65. * @param ICalendar $calendar
  66. * @return void
  67. * @since 13.0.0
  68. * @deprecated 23.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider
  69. */
  70. public function registerCalendar(ICalendar $calendar);
  71. /**
  72. * Unregisters a calendar
  73. *
  74. * @param ICalendar $calendar
  75. * @return void
  76. * @since 13.0.0
  77. * @deprecated 23.0.0
  78. */
  79. public function unregisterCalendar(ICalendar $calendar);
  80. /**
  81. * In order to improve lazy loading a closure can be registered which will be called in case
  82. * calendars are actually requested
  83. *
  84. * @param \Closure $callable
  85. * @return void
  86. * @since 13.0.0
  87. * @deprecated 23.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider
  88. */
  89. public function register(\Closure $callable);
  90. /**
  91. * @return ICalendar[]
  92. * @since 13.0.0
  93. * @deprecated 23.0.0 use \OCP\Calendar\IManager::getCalendarsForPrincipal
  94. */
  95. public function getCalendars();
  96. /**
  97. * removes all registered calendar instances
  98. *
  99. * @return void
  100. * @since 13.0.0
  101. * @deprecated 23.0.0
  102. */
  103. public function clear();
  104. /**
  105. * @param string $principalUri URI of the principal
  106. * @param string[] $calendarUris optionally specify which calendars to load, or all if this array is empty
  107. *
  108. * @return ICalendar[]
  109. * @since 23.0.0
  110. */
  111. public function getCalendarsForPrincipal(string $principalUri, array $calendarUris = []): array;
  112. /**
  113. * Query a principals calendar(s)
  114. *
  115. * @param ICalendarQuery $query
  116. * @return array[]
  117. * @since 23.0.0
  118. */
  119. public function searchForPrincipal(ICalendarQuery $query): array;
  120. /**
  121. * Build a new query for searchForPrincipal
  122. *
  123. * @return ICalendarQuery
  124. * @since 23.0.0
  125. */
  126. public function newQuery(string $principalUri) : ICalendarQuery;
  127. /**
  128. * Handle a iMip REPLY message
  129. *
  130. * @since 25.0.0
  131. */
  132. public function handleIMipReply(string $principalUri, string $sender, string $recipient, string $calendarData): bool;
  133. /**
  134. * Handle a iMip CANCEL message
  135. *
  136. * @since 25.0.0
  137. */
  138. public function handleIMipCancel(string $principalUri, string $sender, ?string $replyTo, string $recipient, string $calendarData): bool;
  139. }