use of fi.otavanopisto.muikku.plugins.googlecalendar.model.GoogleCalendar in project muikku by otavanopisto.
the class GoogleCalendarClient method listPublicCalendars.
public List<fi.otavanopisto.muikku.calendar.Calendar> listPublicCalendars() throws CalendarServiceException {
try {
Calendar client = getClient();
ArrayList<fi.otavanopisto.muikku.calendar.Calendar> result = new ArrayList<>();
for (CalendarListEntry entry : client.calendarList().list().execute().getItems()) {
result.add(new GoogleCalendar(entry.getSummary(), entry.getDescription(), entry.getId(), isWritable(entry)));
}
return result;
} catch (IOException | GeneralSecurityException ex) {
throw new CalendarServiceException(ex);
}
}
use of fi.otavanopisto.muikku.plugins.googlecalendar.model.GoogleCalendar in project muikku by otavanopisto.
the class GoogleCalendarClient method createCalendar.
public fi.otavanopisto.muikku.calendar.Calendar createCalendar(String summary, String description) throws CalendarServiceException {
com.google.api.services.calendar.model.Calendar calendar = new com.google.api.services.calendar.model.Calendar();
calendar.setSummary(summary);
calendar.setDescription(description);
try {
calendar = getClient().calendars().insert(calendar).execute();
} catch (IOException | GeneralSecurityException ex) {
throw new CalendarServiceException(ex);
}
return new GoogleCalendar(summary, description, calendar.getId(), true);
}
Aggregations