Chapter 51. GoogleCalendar


GoogleCalendar component

Available as of Camel 2.15

Component Description

The Google Calendar component provides access to Google Calendar via the Google Calendar Web APIs.
Google Calendar uses the OAuth 2.0 protocol for authenticating a Google account and authorizing access to user data. Before you can use this component, you will need to create an account and generate OAuth credentials. Credentials comprise of a clientId, clientSecret, and a refreshToken. A handy resource for generating a long-lived refreshToken is the OAuth playground.
Maven users will need to add the following dependency to their pom.xml for this component:
    <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-google-calendar</artifactId>
            <version>2.15-SNAPSHOT</version>
    </dependency>

URI Format

The GoogleCalendar Component uses the following URI format:
google-calendar://endpoint-prefix/endpoint?[options]
Endpoint prefix can be one of:
  • acl
  • calendars
  • channels
  • colors
  • events
  • freebusy
  • list
  • settings

GoogleCalendarComponent

The GoogleCalendar Component can be configured with the options below. These options can be provided using the component's bean property configuration of type org.apache.camel.component.google.calendar.GoogleCalendarConfiguration.
Option Type
accessToken String OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage.
applicationName String Google calendar application name. Example would be "camel-google-calendar/1.0"
clientId String Client ID of the calendar application
clientSecret String Client secret of the calendar application
refreshToken
String
OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived.
scopes List<String> Specifies the level of permissions you want a calendar application to have to a user account. See https://developers.google.com/google-apps/calendar/auth for more info.

Producer Endpoints

Producer endpoints can use endpoint prefixes followed by endpoint names and associated options described next. A shorthand alias can be used for some endpoints. The endpoint URI MUST contain a prefix.
Endpoint options that are not mandatory are denoted by []. When there are no mandatory options for an endpoint, one of the set of [] options MUST be provided. Producer endpoints can also use a special option inBody that in turn should contain the name of the endpoint option whose value will be contained in the Camel Exchange In message.
Any of the endpoint options can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.<option>. Note that the inBody option overrides message header, i.e. the endpoint option inBody=option would override a CamelGoogleCalendar.option header.

1. Endpoint Prefix acl

The following endpoints can be invoked with the prefix acl as follows:
google-calendar://acl/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete calendarId, ruleId
get calendarId, ruleId com.google.api.services.calendar.model.AclRule
insert calendarId, content com.google.api.services.calendar.model.AclRule
list calendarId com.google.api.services.calendar.model.Acl
patch calendarId, content, ruleId com.google.api.services.calendar.model.AclRule
update calendarId, content, ruleId com.google.api.services.calendar.model.AclRule
watch calendarId, contentChannel com.google.api.services.calendar.model.Channel

URI Options for acl

Name Type
calendarId String
content com.google.api.services.calendar.model.AclRule
contentChannel com.google.api.services.calendar.model.Channel
ruleId String

2. Endpoint Prefix calendars

The following endpoints can be invoked with the prefix calendars as follows:
google-calendar://calendars/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
clear calendarId
delete calendarId
get calendarId com.google.api.services.calendar.Calendar
insert content com.google.api.services.calendar.Calendar
patch calendarId, content com.google.api.services.calendar.Calendar
update calendarId, content com.google.api.services.calendar.Calendar

URI Options for calendars

Name Type
calendarId String
content com.google.api.services.calendar.model.Calendar

3. Endpoint Prefix channels

The following endpoints can be invoked with the prefix channels as follows:
google-calendar://channels/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
stop contentChannel

URI Options for channels

Name Type
contentChannel com.google.api.services.calendar.model.Channel

4. Endpoint Prefix colors

The following endpoints can be invoked with the prefix colors as follows:
google-calendar://colors/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
get com.google.api.services.calendar.model.Colors

URI Options for colors

Name Type

5. Endpoint Prefix events

The following endpoints can be invoked with the prefix events as follows:
        google-calendar://events/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
calendarImport calendarId, content com.google.api.services.calendar.model.Event
delete calendarId, eventId
get calendarId, eventId com.google.api.services.calendar.model.Event
insert calendarId, content com.google.api.services.calendar.model.Event
instances calendarId, eventId com.google.api.services.calendar.model.Events
list calendarId com.google.api.services.calendar.model.Events
move calendarId, destination, eventId com.google.api.services.calendar.model.Event
patch calendarId, content, eventId com.google.api.services.calendar.model.Event
quickAdd calendarId, text com.google.api.services.calendar.model.Event
update calendarId, content, eventId com.google.api.services.calendar.model.Event
watch calendarId, contentChannel com.google.api.services.calendar.model.Channel

URI Options for events

Name Type
calendarId String
content com.google.api.services.calendar.model.Event
contentChannel com.google.api.services.calendar.model.Channel
destination String
eventId String
text String

6. Endpoint Prefix freebusy

The following endpoints can be invoked with the prefix freebusy as follows:
        google-calendar://freebusy/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
query content com.google.api.services.calendar.model.FreeBusyResponse

URI Options for freebusy

Name Type
content com.google.api.services.calendar.model.FreeBusyRequest

7. Endpoint Prefix list

The following endpoints can be invoked with the prefix list as follows:
google-calendar://list/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete calendarId
get calendarId com.google.api.services.calendar.model.CalendarListEntry
insert content com.google.api.services.calendar.model.CalendarListEntry
list com.google.api.services.calendar.model.CalendarList
patch calendarId, content com.google.api.services.calendar.model.CalendarListEntry
update calendarId, content com.google.api.services.calendar.model.CalendarListEntry
watch contentChannel com.google.api.services.calendar.model.Channel

URI Options for list

Name Type
calendarId String
content com.google.api.services.calendar.model.CalendarListEntry
contentChannel com.google.api.services.calendar.model.Channel

8. Endpoint Prefix settings

The following endpoints can be invoked with the prefix settings as follows:
        google-calendar://settings/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
get setting com.google.api.services.calendar.model.Setting
list com.google.api.services.calendar.model.Settings
watch contentChannel com.google.api.services.calendar.model.Channel

URI Options for settings

Name Type
contentChannel com.google.api.services.calendar.model.Channel
setting String

Consumer Endpoints

Any of the producer endpoints can be used as a consumer endpoint. Consumer endpoints can use Scheduled Poll Consumer Options with a consumer. prefix to schedule endpoint invocation. Consumer endpoints that return an array or collection will generate one exchange per element, and their routes will be executed once for each exchange.

Message Headers

Any URI option can be provided in a message header for producer endpoints with a CamelGoogleCalendar. prefix.

Message Body

All result message bodies utilize objects provided by the underlying APIs used by the GoogleCalendarComponent. Producer endpoints can specify the option name for incoming message body in the inBody endpoint URI parameter. For endpoints that return an array or collection, a consumer endpoint will map every element to distinct messages.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.