Better documentation for the `calendar` plugin.

This commit is contained in:
Fabio Manganiello 2023-09-30 13:31:41 +02:00
parent 7bd721e6a4
commit 4f5ccda353
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 12 additions and 16 deletions

View File

@ -1,3 +1,5 @@
from typing import Collection
import dateutil.parser import dateutil.parser
import importlib import importlib
@ -20,31 +22,25 @@ class CalendarPlugin(Plugin, CalendarInterface):
iCal URLs) and get joined events from all of them. iCal URLs) and get joined events from all of them.
""" """
def __init__(self, calendars=None, *args, **kwargs): def __init__(self, calendars: Collection[dict], *args, **kwargs):
""" """
:param calendars: List of calendars to be queried. Supported types so far: Google Calendar and iCal URLs. :param calendars: List of calendars to be queried. Supported types so far: Google Calendar and iCal URLs.
:type calendars: list
Example format:: Example:
calendars = [ .. code-block:: yaml
{
"type": "platypush.plugins.google.calendar.GoogleCalendarPlugin"
},
{ calendars:
"type": "platypush.plugins.calendar.ical.IcalCalendarPlugin", # Use the Google Calendar integration
"url": "https://www.facebook.com/ical/u.php?uid=USER_ID&key=FB_KEY" - type: platypush.plugins.google.calendar.GoogleCalendarPlugin
},
# Import the Facebook events calendar via iCal URL
- type: platypush.plugins.calendar.ical.IcalCalendarPlugin
url: https://www.facebook.com/ical/u.php?uid=USER_ID&key=FB_KEY
...
]
""" """
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
if calendars is None:
calendars = []
self.calendars = [] self.calendars = []
for calendar in calendars: for calendar in calendars: