IManager.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Georg Ehrke <oc.list@georgehrke.com>
  8. * @author Anna Larch <anna.larch@gmx.net>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Calendar;
  27. /**
  28. * This class provides access to the Nextcloud CalDAV backend.
  29. * Use this class exclusively if you want to access calendars.
  30. *
  31. * Events/Journals/Todos in general will be expressed as an array of key-value-pairs.
  32. * The keys will match the property names defined in https://tools.ietf.org/html/rfc5545
  33. *
  34. * [
  35. * 'id' => 123,
  36. * 'type' => 'VEVENT',
  37. * 'calendar-key' => 42,
  38. * 'objects' => [
  39. * [
  40. * 'SUMMARY' => ['FooBar', []],
  41. * 'DTSTART' => ['20171001T123456', ['TZID' => 'EUROPE/BERLIN']],
  42. * 'DURATION' => ['P1D', []],
  43. * 'ATTENDEE' => [
  44. * ['mailto:bla@blub.com', ['CN' => 'Mr. Bla Blub']]
  45. * ],
  46. * 'VALARM' => [
  47. * [
  48. * 'TRIGGER' => ['19980101T050000Z', ['VALUE' => DATE-TIME]]
  49. * ]
  50. * ]
  51. * ],
  52. * ]
  53. * ]
  54. *
  55. * @since 13.0.0
  56. */
  57. interface IManager {
  58. /**
  59. * This function is used to search and find objects within the user's calendars.
  60. * In case $pattern is empty all events/journals/todos will be returned.
  61. *
  62. * @param string $pattern which should match within the $searchProperties
  63. * @param array $searchProperties defines the properties within the query pattern should match
  64. * @param array $options - optional parameters:
  65. * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
  66. * @param integer|null $limit - limit number of search results
  67. * @param integer|null $offset - offset for paging of search results
  68. * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs
  69. * @since 13.0.0
  70. * @deprecated 23.0.0 use \OCP\Calendar\IManager::searchForPrincipal
  71. */
  72. public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null);
  73. /**
  74. * Check if calendars are available
  75. *
  76. * @return bool true if enabled, false if not
  77. * @since 13.0.0
  78. * @deprecated 23.0.0
  79. */
  80. public function isEnabled();
  81. /**
  82. * Registers a calendar
  83. *
  84. * @param ICalendar $calendar
  85. * @return void
  86. * @since 13.0.0
  87. * @deprecated 23.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider
  88. */
  89. public function registerCalendar(ICalendar $calendar);
  90. /**
  91. * Unregisters a calendar
  92. *
  93. * @param ICalendar $calendar
  94. * @return void
  95. * @since 13.0.0
  96. * @deprecated 23.0.0
  97. */
  98. public function unregisterCalendar(ICalendar $calendar);
  99. /**
  100. * In order to improve lazy loading a closure can be registered which will be called in case
  101. * calendars are actually requested
  102. *
  103. * @param \Closure $callable
  104. * @return void
  105. * @since 13.0.0
  106. * @deprecated 23.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarProvider
  107. */
  108. public function register(\Closure $callable);
  109. /**
  110. * @return ICalendar[]
  111. * @since 13.0.0
  112. * @deprecated 23.0.0 use \OCP\Calendar\IManager::getCalendarsForPrincipal
  113. */
  114. public function getCalendars();
  115. /**
  116. * removes all registered calendar instances
  117. *
  118. * @return void
  119. * @since 13.0.0
  120. * @deprecated 23.0.0
  121. */
  122. public function clear();
  123. /**
  124. * @param string $principalUri URI of the principal
  125. * @param string[] $calendarUris optionally specify which calendars to load, or all if this array is empty
  126. *
  127. * @return ICalendar[]
  128. * @since 23.0.0
  129. */
  130. public function getCalendarsForPrincipal(string $principalUri, array $calendarUris = []): array;
  131. /**
  132. * Query a principals calendar(s)
  133. *
  134. * @param ICalendarQuery $query
  135. * @return array[]
  136. * @since 23.0.0
  137. */
  138. public function searchForPrincipal(ICalendarQuery $query): array;
  139. /**
  140. * Build a new query for searchForPrincipal
  141. *
  142. * @return ICalendarQuery
  143. * @since 23.0.0
  144. */
  145. public function newQuery(string $principalUri) : ICalendarQuery;
  146. /**
  147. * Handle a iMip REPLY message
  148. *
  149. * @since 25.0.0
  150. */
  151. public function handleIMipReply(string $principalUri, string $sender, string $recipient, string $calendarData): bool;
  152. /**
  153. * Handle a iMip CANCEL message
  154. *
  155. * @since 25.0.0
  156. */
  157. public function handleIMipCancel(string $principalUri, string $sender, ?string $replyTo, string $recipient, string $calendarData): bool;
  158. }