1
0

IManager.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /**
  3. * @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
  4. *
  5. * @author Georg Ehrke <oc.list@georgehrke.com>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OCP\Calendar;
  24. /**
  25. * This class provides access to the Nextcloud CalDAV backend.
  26. * Use this class exclusively if you want to access calendars.
  27. *
  28. * Events/Journals/Todos in general will be expressed as an array of key-value-pairs.
  29. * The keys will match the property names defined in https://tools.ietf.org/html/rfc5545
  30. *
  31. * [
  32. * 'id' => 123,
  33. * 'type' => 'VEVENT',
  34. * 'calendar-key' => 42,
  35. * 'objects' => [
  36. * [
  37. * 'SUMMARY' => ['FooBar', []],
  38. * 'DTSTART' => ['20171001T123456', ['TZID' => 'EUROPE/BERLIN']],
  39. * 'DURATION' => ['P1D', []],
  40. * 'ATTENDEE' => [
  41. * ['mailto:bla@blub.com', ['CN' => 'Mr. Bla Blub']]
  42. * ],
  43. * 'VALARM' => [
  44. * [
  45. * 'TRIGGER' => ['19980101T050000Z', ['VALUE' => DATE-TIME]]
  46. * ]
  47. * ]
  48. * ],
  49. * ]
  50. * ]
  51. *
  52. * @since 13.0.0
  53. */
  54. interface IManager {
  55. /**
  56. * This function is used to search and find objects within the user's calendars.
  57. * In case $pattern is empty all events/journals/todos will be returned.
  58. *
  59. * @param string $pattern which should match within the $searchProperties
  60. * @param array $searchProperties defines the properties within the query pattern should match
  61. * @param array $options - optional parameters:
  62. * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
  63. * @param integer|null $limit - limit number of search results
  64. * @param integer|null $offset - offset for paging of search results
  65. * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs
  66. * @since 13.0.0
  67. */
  68. public function search($pattern, array $searchProperties=[], array $options=[], $limit=null, $offset=null);
  69. /**
  70. * Check if calendars are available
  71. *
  72. * @return bool true if enabled, false if not
  73. * @since 13.0.0
  74. */
  75. public function isEnabled();
  76. /**
  77. * Registers a calendar
  78. *
  79. * @param ICalendar $calendar
  80. * @return void
  81. * @since 13.0.0
  82. */
  83. public function registerCalendar(ICalendar $calendar);
  84. /**
  85. * Unregisters a calendar
  86. *
  87. * @param ICalendar $calendar
  88. * @return void
  89. * @since 13.0.0
  90. */
  91. public function unregisterCalendar(ICalendar $calendar);
  92. /**
  93. * In order to improve lazy loading a closure can be registered which will be called in case
  94. * calendars are actually requested
  95. *
  96. * @param \Closure $callable
  97. * @return void
  98. * @since 13.0.0
  99. */
  100. public function register(\Closure $callable);
  101. /**
  102. * @return ICalendar[]
  103. * @since 13.0.0
  104. */
  105. public function getCalendars();
  106. /**
  107. * removes all registered calendar instances
  108. * @return void
  109. * @since 13.0.0
  110. */
  111. public function clear();
  112. }