apex-google-api
Return to index
Overview
An api wrapper of Google Calendar API for Apex.
Sample
Service Account authentication
SignServer sign = new SignServer('https://YOUR-APPNAME.herokuapp.com/sign'); GoogleCalendarService service = new GoogleCalendarService(sign); JWT jwt = new JWT('YOUR-APPACOUNT@developer.gserviceaccount.com'); service.authenticate(jwt);
Get list of calendars
GoogleCalendarService service; GoogleCalendar cal = null; ListcalList = service.listCalendarList().items; for (GoogleCalendar c : calList) { if (c.summary == 'My Calendar') { cal = c; break; } }
Create event
GoogleCalendarService service; GoogleCalendar cal; GoogleCalendarEvent event = new GoogleCalendarEvent(); event.summary = 'Test Event'; event.setDateAndDuration(Datetime.newInstance(2013, 12, 12, 13, 0, 0), 60);//60 minutes event.location = 'Tokyo'; event.description = 'Test Event'; event.addAttendee('test1@flect.co.jp'); event.addAttendee('test2@flect.co.jp'); service.insertEvent(event);
License
MIT