-
Notifications
You must be signed in to change notification settings - Fork 32
Using the Google Calendar API
Vincent Onyango edited this page May 2, 2019
·
6 revisions
Converge integrates with the users' calendar, specifically, the Google Calendar. This raises the need for authorising the application to access data to the user account as explained in the credentials page. The calendar API is used by Converge to achieve various things some of which include:
-
The mrm_api queries all the calendars of the user using the Calendar Api
calendarList().List()method. The result might then be filtered to obtain only those that belong to Andela organisation as shown from one of the code snippets from the codebase. helpers/credentials.pydef get_google_api_calendar_list(pageToken=None): credentials = Credentials() try: service = credentials.set_api_credentials() calendars_list = service.calendarList().list( pageToken=pageToken).execute() except Exception as exception: raise GraphQLError(exception) return calendars_list -
To manipulate, calculate and return user events, mrm_api makes use of the Calendar API
Events.list()method to query for all the user events available in their calendars as in the code snippet below. helpers/credentials.pydef get_all_google_calendar_events(calendarId=None): credentials = Credentials() service = credentials.set_api_credentials() events = service.events().list(calendarId=calendarId).execute() return events
These two functionalities enables achieving the analytics feature, which forms an integral part of Converge as a product.
For in depth detail regarding the Calendar API, go to this presentation.