Search in sources :

Example 16 with CalendarListEntry

use of com.google.api.services.calendar.model.CalendarListEntry 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);
    }
}
Also used : CalendarServiceException(fi.otavanopisto.muikku.calendar.CalendarServiceException) CalendarListEntry(com.google.api.services.calendar.model.CalendarListEntry) GoogleCalendar(fi.otavanopisto.muikku.plugins.googlecalendar.model.GoogleCalendar) Calendar(com.google.api.services.calendar.Calendar) GoogleCalendar(fi.otavanopisto.muikku.plugins.googlecalendar.model.GoogleCalendar) GeneralSecurityException(java.security.GeneralSecurityException) ArrayList(java.util.ArrayList) IOException(java.io.IOException)

Aggregations

CalendarListEntry (com.google.api.services.calendar.model.CalendarListEntry)16 Calendar (com.google.api.services.calendar.Calendar)6 CalendarList (com.google.api.services.calendar.model.CalendarList)6 IOException (java.io.IOException)6 Event (com.google.api.services.calendar.model.Event)5 ArrayList (java.util.ArrayList)4 Events (com.google.api.services.calendar.model.Events)3 Credential (com.google.api.client.auth.oauth2.Credential)2 DateTime (com.google.api.client.util.DateTime)2 AESEncryption (com.cloudcraftgaming.discal.api.crypto.AESEncryption)1 GuildSettings (com.cloudcraftgaming.discal.api.object.GuildSettings)1 CalendarData (com.cloudcraftgaming.discal.api.object.calendar.CalendarData)1 AuthPollResponseError (com.cloudcraftgaming.discal.api.object.json.google.AuthPollResponseError)1 AuthPollResponseGrant (com.cloudcraftgaming.discal.api.object.json.google.AuthPollResponseGrant)1 Booking (com.github.drbookings.core.datamodel.api.Booking)1 BookingBean (com.github.drbookings.core.datamodel.impl.BookingBean)1 FileDataStoreFactory (com.google.api.client.util.store.FileDataStoreFactory)1 Calendar (com.google.api.services.calendar.model.Calendar)1 EventDateTime (com.google.api.services.calendar.model.EventDateTime)1 Gson (com.google.gson.Gson)1