From ed5f743422898980a1df3a0ab7ca46e47bd2b66d Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Sun, 8 Mar 2020 13:27:27 -0400 Subject: [PATCH] use patch for event dates if possible --- src/gam.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gam.py b/src/gam.py index ea4a68fd..8005f03a 100755 --- a/src/gam.py +++ b/src/gam.py @@ -3641,16 +3641,22 @@ def doCalendarAddOrUpdateEvent(action): # only way for non-Google calendars to get updates is via email timeZone = None kwargs = {} + body = {} if action == 'add': i = 4 - body = {} func = 'insert' else: eventId = sys.argv[4] kwargs = {'eventId': eventId} i = 5 - func = 'update' - body = gapi.call(cal.events(), 'get', calendarId=calendarId, eventId=eventId) + func = 'patch' + requires_full_update = ['attendee', 'optionalattendee', 'removeattendee', + 'replacedescription'] + for arg in sys.argv[i:]: + if arg.replace('_', '').lower() in requires_full_update: + func = 'update' + body = gapi.call(cal.events(), 'get', calendarId=calendarId, eventId=eventId) + break sendUpdates, body = getCalendarEventAttributes(i, cal, body, action) result = gapi.call(cal.events(), func, conferenceDataVersion=1, supportsAttachments=True, calendarId=calendarId,