Пример #1
0
def remote_update_event(account, event, db_session):
    provider = GoogleEventsProvider(account.id, account.namespace.id)
    dump = provider.dump_event(event)
    service = provider._get_google_service()
    service.events().update(calendarId=event.calendar.name,
                            eventId=event.uid,
                            body=dump).execute()
Пример #2
0
def remote_create_event(account, event, db_session):
    provider = GoogleEventsProvider(account.id, account.namespace.id)
    dump = provider.dump_event(event)
    service = provider._get_google_service()
    result = service.events().insert(calendarId=event.calendar.name,
                                     body=dump).execute()
    # The events crud API assigns a random uid to an event when creating it.
    # We need to update it to the value returned by the Google calendar API.
    event.uid = result['id']
    db_session.commit()
Пример #3
0
def remote_create_event(account, event, db_session):
    provider = GoogleEventsProvider(account.id, account.namespace.id)
    dump = provider.dump_event(event)
    service = provider._get_google_service()
    result = service.events().insert(calendarId=event.calendar.name,
                                     body=dump).execute()
    # The events crud API assigns a random uid to an event when creating it.
    # We need to update it to the value returned by the Google calendar API.
    event.uid = result['id']
    db_session.commit()
Пример #4
0
def remote_delete_event(account, event, db_session):
    provider = GoogleEventsProvider(account.id, account.namespace.id)
    service = provider._get_google_service()
    service.events().delete(calendarId=event.calendar.name,
                            eventId=event.uid).execute()
Пример #5
0
def remote_update_event(account, event, db_session):
    provider = GoogleEventsProvider(account.id, account.namespace.id)
    dump = provider.dump_event(event)
    service = provider._get_google_service()
    service.events().update(calendarId=event.calendar.name,
                            eventId=event.uid, body=dump).execute()
Пример #6
0
def remote_create(account, event, db_session):
    provider = GoogleEventsProvider(account.id, account.namespace.id)
    dump = provider.dump_event(event)
    service = provider._get_google_service()
    service.events().insert(calendarId='primary', body=dump).execute()
Пример #7
0
def remote_delete_event(account, event, db_session):
    provider = GoogleEventsProvider(account.id, account.namespace.id)
    service = provider._get_google_service()
    service.events().delete(calendarId=event.calendar.name,
                            eventId=event.uid).execute()