|
| 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 | + |
| 24 | +namespace OCP\Calendar; |
| 25 | + |
| 26 | +/** |
| 27 | + * This class provides access to the Nextcloud CalDAV backend. |
| 28 | + * Use this class exclusively if you want to access calendars. |
| 29 | + * |
| 30 | + * Events/Journals/Todos in general will be expressed as an array of key-value-pairs. |
| 31 | + * The keys will match the property names defined in https://tools.ietf.org/html/rfc5545 |
| 32 | + * |
| 33 | + * [ |
| 34 | + * 'id' => 123, |
| 35 | + * 'type' => 'VEVENT', |
| 36 | + * 'objects' => [ |
| 37 | + * [ |
| 38 | + * 'SUMMARY' => ['FooBar', []], |
| 39 | + * 'DTSTART' => ['20171001T123456', ['TZID' => 'EUROPE/BERLIN']], |
| 40 | + * 'DURATION' => ['P1D', []], |
| 41 | + * 'ATTENDEE' => [ |
| 42 | + * ['mailto:bla@blub.com', ['CN' => 'Mr. Bla Blub']] |
| 43 | + * ], |
| 44 | + * 'VALARM' => [ |
| 45 | + * [ |
| 46 | + * 'TRIGGER' => ['19980101T050000Z', ['VALUE' => DATE-TIME]] |
| 47 | + * ] |
| 48 | + * ] |
| 49 | + * ], |
| 50 | + * ] |
| 51 | + * ] |
| 52 | + * |
| 53 | + * @since 13.0.0 |
| 54 | + */ |
| 55 | +interface IManager { |
| 56 | + |
| 57 | + /** |
| 58 | + * This function is used to search and find objects within the user's calendars. |
| 59 | + * In case $pattern is empty all events/journals/todos will be returned. |
| 60 | + * |
| 61 | + * @param string $pattern which should match within the $searchProperties |
| 62 | + * @param array $searchProperties defines the properties within the query pattern should match |
| 63 | + * @param array $options - optional parameters: |
| 64 | + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] |
| 65 | + * @param integer|null $limit - limit number of search results |
| 66 | + * @param integer $offset - offset for paging of search results |
| 67 | + * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs |
| 68 | + * @since 13.0.0 |
| 69 | + */ |
| 70 | + public function search($pattern, $searchProperties=[], $options=[], $limit = null, $offset = 0); |
| 71 | + |
| 72 | + /** |
| 73 | + * Check if calendars are available |
| 74 | + * |
| 75 | + * @return bool true if enabled, false if not |
| 76 | + * @since 13.0.0 |
| 77 | + */ |
| 78 | + public function isEnabled(); |
| 79 | + |
| 80 | + /** |
| 81 | + * Registers a calendar |
| 82 | + * |
| 83 | + * @param ICalendar $calendar |
| 84 | + * @return void |
| 85 | + * @since 13.0.0 |
| 86 | + */ |
| 87 | + public function registerCalendar(ICalendar $calendar); |
| 88 | + |
| 89 | + /** |
| 90 | + * Unregisters a calendar |
| 91 | + * |
| 92 | + * @param ICalendar $calendar |
| 93 | + * @return void |
| 94 | + * @since 13.0.0 |
| 95 | + */ |
| 96 | + public function unregisterCalendar(ICalendar $calendar); |
| 97 | + |
| 98 | + /** |
| 99 | + * In order to improve lazy loading a closure can be registered which will be called in case |
| 100 | + * calendars are actually requested |
| 101 | + * |
| 102 | + * @param \Closure $callable |
| 103 | + * @return void |
| 104 | + * @since 13.0.0 |
| 105 | + */ |
| 106 | + public function register(\Closure $callable); |
| 107 | + |
| 108 | + /** |
| 109 | + * @return array |
| 110 | + * @since 13.0.0 |
| 111 | + */ |
| 112 | + public function getCalendars(); |
| 113 | + |
| 114 | + /** |
| 115 | + * removes all registered calendar instances |
| 116 | + * @return void |
| 117 | + * @since 13.0.0 |
| 118 | + */ |
| 119 | + public function clear(); |
| 120 | +} |
0 commit comments