Add update APIs for Calendar Entities (#1590)

This commit is contained in:
Allen Porter 2022-12-27 12:56:24 -08:00 committed by GitHub
parent 3c8bdb422a
commit f46b511dba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,7 @@ and are combined using the bitwise or (`|`) operator.
| ------------------- | ------------------------------------------------------------------ | | ------------------- | ------------------------------------------------------------------ |
| `CREATE_EVENT` | Entity implements the methods to allow creation of events. | | `CREATE_EVENT` | Entity implements the methods to allow creation of events. |
| `DELETE_EVENT` | Entity implements the methods to allow deletion of events. | | `DELETE_EVENT` | Entity implements the methods to allow deletion of events. |
| `UPDATE_EVENT` | Entity implements the methods to allow update of events. |
## Methods ## Methods
@ -92,6 +93,29 @@ class MyCalendar(CalendarEntity):
"""Delete an event on the calendar.""" """Delete an event on the calendar."""
``` ```
### Update Events
A calendar entity may support deleting events by specifying the `UPDATE_EVENT` supported feature. Integrations that support mutation must support rfc5545 recurring events.
There are three ways that recurring events may be deleted:
- Specifying only the `uid` will update the entire series
- Specifying the `uid` and `recurrence_id` will update the specific event instance in the series
- Specifying `uid`, `recurrence_id`, and a `recurrence_range` value may update a range of events starting at `recurrence_id`. Currently rfc5545 allows the [range](https://www.rfc-editor.org/rfc/rfc5545#section-3.2.13) value of `THISANDFUTURE`.
```python
class MyCalendar(CalendarEntity):
async def async_update_event(
self,
uid: str,
event: dict[str, Any],
recurrence_id: str | None = None,
recurrence_range: str | None = None,
) -> None:
"""Delete an event on the calendar."""
```
## CalendarEvent ## CalendarEvent
A `CalendarEvent` represents an individual event on a calendar. A `CalendarEvent` represents an individual event on a calendar.