1
0
mirror of https://github.com/b4tman/sync_ics2gcal synced 2024-10-31 18:56:54 +00:00

create/delete calendar

This commit is contained in:
Dmitry Belyaev 2018-04-05 20:37:09 +03:00
parent 26e35c1b68
commit c282cb61e8
Signed by: b4tman
GPG Key ID: 014E87EC54B77673

View File

@ -214,6 +214,33 @@ class GoogleCalendar():
i += 1
batch.execute()
def create(self, summary, timeZone=None):
"""create calendar
Arguments:
summary -- new calendar summary
Keyword Arguments:
timeZone -- new calendar timezone as string (optional)
Returns:
calendar Resource
"""
calendar = {'summary': summary}
if timeZone is not None:
calendar['timeZone'] = timeZone
created_calendar = self.service.calendars().insert(body=calendar).execute()
self.calendarId = created_calendar['id']
return created_calendar
def delete(self):
"""delete calendar
"""
self.service.calendars().delete(calendarId=self.calendarId).execute()
def make_public(self):
"""make calendar puplic
"""