@@ -22,104 +22,104 @@ |
||
| 22 | 22 | * } |
| 23 | 23 | */ |
| 24 | 24 | interface ICalendar { |
| 25 | - /** |
|
| 26 | - * @return string defining the technical unique key |
|
| 27 | - * @since 13.0.0 |
|
| 28 | - */ |
|
| 29 | - public function getKey(): string; |
|
| 25 | + /** |
|
| 26 | + * @return string defining the technical unique key |
|
| 27 | + * @since 13.0.0 |
|
| 28 | + */ |
|
| 29 | + public function getKey(): string; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * In comparison to getKey() this function returns a unique uri within the scope of the principal |
|
| 33 | - * @since 24.0.0 |
|
| 34 | - */ |
|
| 35 | - public function getUri(): string; |
|
| 31 | + /** |
|
| 32 | + * In comparison to getKey() this function returns a unique uri within the scope of the principal |
|
| 33 | + * @since 24.0.0 |
|
| 34 | + */ |
|
| 35 | + public function getUri(): string; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
| 39 | - * @return null|string |
|
| 40 | - * @since 13.0.0 |
|
| 41 | - */ |
|
| 42 | - public function getDisplayName(): ?string; |
|
| 37 | + /** |
|
| 38 | + * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
| 39 | + * @return null|string |
|
| 40 | + * @since 13.0.0 |
|
| 41 | + */ |
|
| 42 | + public function getDisplayName(): ?string; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Calendar color |
|
| 46 | - * @return null|string |
|
| 47 | - * @since 13.0.0 |
|
| 48 | - */ |
|
| 49 | - public function getDisplayColor(): ?string; |
|
| 44 | + /** |
|
| 45 | + * Calendar color |
|
| 46 | + * @return null|string |
|
| 47 | + * @since 13.0.0 |
|
| 48 | + */ |
|
| 49 | + public function getDisplayColor(): ?string; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Search the current calendar for matching events. |
|
| 53 | - * |
|
| 54 | - * This method searches for events in the calendar that match a given pattern within specified properties. |
|
| 55 | - * The search is case-insensitive. It supports optional parameters such as a time range, limit, and offset. |
|
| 56 | - * The results are sorted by start date, with the closest events appearing first. |
|
| 57 | - * |
|
| 58 | - * @param string $pattern A string to search for within the events. The search is done case-insensitive. |
|
| 59 | - * @param array $searchProperties Defines the properties within which the pattern should match. |
|
| 60 | - * @param array $options Optional parameters for the search: |
|
| 61 | - * - 'timerange' element that can have 'start' (DateTimeInterface), 'end' (DateTimeInterface), or both. |
|
| 62 | - * - 'uid' element to look for events with a given uid. |
|
| 63 | - * - 'types' element to only return events for a given type (e.g. VEVENT or VTODO) |
|
| 64 | - * @psalm-param CalendarSearchOptions $options |
|
| 65 | - * @param int|null $limit Limit the number of search results. |
|
| 66 | - * @param int|null $offset For paging of search results. |
|
| 67 | - * @return array An array of events/journals/todos which are arrays of key-value-pairs. The events are sorted by start date (closest first, furthest last). |
|
| 68 | - * |
|
| 69 | - * Implementation Details: |
|
| 70 | - * |
|
| 71 | - * An event can consist of many sub-events, typically the case for events with recurrence rules. On a database level, |
|
| 72 | - * there's only one event stored (with a matching first occurrence and last occurrence timestamp). Expanding an event |
|
| 73 | - * into sub-events is done on the backend level. Using limit, offset, and timerange comes with some drawbacks. |
|
| 74 | - * When asking the database for events, the result is ordered by the primary key to guarantee a stable order. |
|
| 75 | - * After expanding the events into sub-events, they are sorted by the date (closest to furthest). |
|
| 76 | - * |
|
| 77 | - * Usage Examples: |
|
| 78 | - * |
|
| 79 | - * 1) Find 7 events within the next two weeks: |
|
| 80 | - * |
|
| 81 | - * $dateTime = (new DateTimeImmutable())->setTimestamp($this->timeFactory->getTime()); |
|
| 82 | - * $inTwoWeeks = $dateTime->add(new DateInterval('P14D')); |
|
| 83 | - * |
|
| 84 | - * $calendar->search( |
|
| 85 | - * '', |
|
| 86 | - * [], |
|
| 87 | - * ['timerange' => ['start' => $dateTime, 'end' => $inTwoWeeks]], |
|
| 88 | - * 7 |
|
| 89 | - * ); |
|
| 90 | - * |
|
| 91 | - * Note: When combining timerange and limit, it's possible that the expected outcome is not in the order you would expect. |
|
| 92 | - * |
|
| 93 | - * Example: Create 7 events for tomorrow, starting from 11:00, 30 minutes each. Then create an 8th event for tomorrow at 10:00. |
|
| 94 | - * The above code will list the event at 11:00 first, missing the event at 10:00. The reason is the ordering by the primary key |
|
| 95 | - * and expanding on the backend level. This is a technical limitation. The easiest workaround is to fetch more events |
|
| 96 | - * than you actually need, with the downside of needing more resources. |
|
| 97 | - * |
|
| 98 | - * Related: |
|
| 99 | - * - https://github.com/nextcloud/server/pull/45222 |
|
| 100 | - * - https://github.com/nextcloud/server/issues/53002 |
|
| 101 | - * |
|
| 102 | - * 2) Find all events where the location property contains the string 'Berlin': |
|
| 103 | - * |
|
| 104 | - * $calendar->search( |
|
| 105 | - * 'Berlin', |
|
| 106 | - * ['LOCATION'] |
|
| 107 | - * ); |
|
| 108 | - * |
|
| 109 | - * @since 13.0.0 |
|
| 110 | - */ |
|
| 111 | - public function search(string $pattern, array $searchProperties = [], array $options = [], ?int $limit = null, ?int $offset = null): array; |
|
| 51 | + /** |
|
| 52 | + * Search the current calendar for matching events. |
|
| 53 | + * |
|
| 54 | + * This method searches for events in the calendar that match a given pattern within specified properties. |
|
| 55 | + * The search is case-insensitive. It supports optional parameters such as a time range, limit, and offset. |
|
| 56 | + * The results are sorted by start date, with the closest events appearing first. |
|
| 57 | + * |
|
| 58 | + * @param string $pattern A string to search for within the events. The search is done case-insensitive. |
|
| 59 | + * @param array $searchProperties Defines the properties within which the pattern should match. |
|
| 60 | + * @param array $options Optional parameters for the search: |
|
| 61 | + * - 'timerange' element that can have 'start' (DateTimeInterface), 'end' (DateTimeInterface), or both. |
|
| 62 | + * - 'uid' element to look for events with a given uid. |
|
| 63 | + * - 'types' element to only return events for a given type (e.g. VEVENT or VTODO) |
|
| 64 | + * @psalm-param CalendarSearchOptions $options |
|
| 65 | + * @param int|null $limit Limit the number of search results. |
|
| 66 | + * @param int|null $offset For paging of search results. |
|
| 67 | + * @return array An array of events/journals/todos which are arrays of key-value-pairs. The events are sorted by start date (closest first, furthest last). |
|
| 68 | + * |
|
| 69 | + * Implementation Details: |
|
| 70 | + * |
|
| 71 | + * An event can consist of many sub-events, typically the case for events with recurrence rules. On a database level, |
|
| 72 | + * there's only one event stored (with a matching first occurrence and last occurrence timestamp). Expanding an event |
|
| 73 | + * into sub-events is done on the backend level. Using limit, offset, and timerange comes with some drawbacks. |
|
| 74 | + * When asking the database for events, the result is ordered by the primary key to guarantee a stable order. |
|
| 75 | + * After expanding the events into sub-events, they are sorted by the date (closest to furthest). |
|
| 76 | + * |
|
| 77 | + * Usage Examples: |
|
| 78 | + * |
|
| 79 | + * 1) Find 7 events within the next two weeks: |
|
| 80 | + * |
|
| 81 | + * $dateTime = (new DateTimeImmutable())->setTimestamp($this->timeFactory->getTime()); |
|
| 82 | + * $inTwoWeeks = $dateTime->add(new DateInterval('P14D')); |
|
| 83 | + * |
|
| 84 | + * $calendar->search( |
|
| 85 | + * '', |
|
| 86 | + * [], |
|
| 87 | + * ['timerange' => ['start' => $dateTime, 'end' => $inTwoWeeks]], |
|
| 88 | + * 7 |
|
| 89 | + * ); |
|
| 90 | + * |
|
| 91 | + * Note: When combining timerange and limit, it's possible that the expected outcome is not in the order you would expect. |
|
| 92 | + * |
|
| 93 | + * Example: Create 7 events for tomorrow, starting from 11:00, 30 minutes each. Then create an 8th event for tomorrow at 10:00. |
|
| 94 | + * The above code will list the event at 11:00 first, missing the event at 10:00. The reason is the ordering by the primary key |
|
| 95 | + * and expanding on the backend level. This is a technical limitation. The easiest workaround is to fetch more events |
|
| 96 | + * than you actually need, with the downside of needing more resources. |
|
| 97 | + * |
|
| 98 | + * Related: |
|
| 99 | + * - https://github.com/nextcloud/server/pull/45222 |
|
| 100 | + * - https://github.com/nextcloud/server/issues/53002 |
|
| 101 | + * |
|
| 102 | + * 2) Find all events where the location property contains the string 'Berlin': |
|
| 103 | + * |
|
| 104 | + * $calendar->search( |
|
| 105 | + * 'Berlin', |
|
| 106 | + * ['LOCATION'] |
|
| 107 | + * ); |
|
| 108 | + * |
|
| 109 | + * @since 13.0.0 |
|
| 110 | + */ |
|
| 111 | + public function search(string $pattern, array $searchProperties = [], array $options = [], ?int $limit = null, ?int $offset = null): array; |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * @return int build up using {@see \OCP\Constants} |
|
| 115 | - * @since 13.0.0 |
|
| 116 | - */ |
|
| 117 | - public function getPermissions(): int; |
|
| 113 | + /** |
|
| 114 | + * @return int build up using {@see \OCP\Constants} |
|
| 115 | + * @since 13.0.0 |
|
| 116 | + */ |
|
| 117 | + public function getPermissions(): int; |
|
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * Indicates whether the calendar is in the trash bin |
|
| 121 | - * |
|
| 122 | - * @since 26.0.0 |
|
| 123 | - */ |
|
| 124 | - public function isDeleted(): bool; |
|
| 119 | + /** |
|
| 120 | + * Indicates whether the calendar is in the trash bin |
|
| 121 | + * |
|
| 122 | + * @since 26.0.0 |
|
| 123 | + */ |
|
| 124 | + public function isDeleted(): bool; |
|
| 125 | 125 | } |