public class GoogleTemplate extends org.springframework.social.oauth2.AbstractOAuth2ApiBinding implements Google
The central class for interacting with Google APIs.
Most of the APIs, specifically all GData APIs and Google+ usage of "me", require OAuth2 authentication.
To use methods that require OAuth2 authentication, GoogleTemplate must be constructed with
an access token which is authorized for the appropriate scope.
For using Google+ without authenticating, GoogleTemplate default constructor can be used.
| Constructor and Description |
|---|
GoogleTemplate()
Creates a new instance of GoogleTemplate.
|
GoogleTemplate(java.lang.String accessToken)
Creates a new instance of GoogleTemplate.
|
| Modifier and Type | Method and Description |
|---|---|
CalendarOperations |
calendarOperations()
Retrieves
CalendarOperations, used for interacting with Google Calendar API. |
DriveOperations |
driveOperations()
Retrieves
DriveOperations, used for interacting with Google Drive
API. |
java.lang.String |
getAccessToken()
Returns the access token, allowing interoperability with other libraries
|
protected java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> |
getMessageConverters() |
protected org.springframework.social.oauth2.OAuth2Version |
getOAuth2Version() |
OAuth2Operations |
oauth2Operations()
Retrieves
OAuth2Operations, used for interacting with Google+ API. |
PlusOperations |
plusOperations()
Retrieves
PlusOperations, used for interacting with Google+ API. |
org.springframework.web.client.RestOperations |
restOperations() |
TaskOperations |
taskOperations()
Retrieves
TaskOperations, used for interacting with Google Tasks
API. |
afterPropertiesSet, configureRestTemplate, getByteArrayMessageConverter, getFormMessageConverter, getJsonMessageConverter, getRestTemplate, isAuthorized, postConstructionConfiguration, postProcess, setRequestFactorypublic GoogleTemplate()
public GoogleTemplate(java.lang.String accessToken)
accessToken - an access token granted by Google after OAuth2 authenticationprotected java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> getMessageConverters()
getMessageConverters in class org.springframework.social.oauth2.AbstractOAuth2ApiBindingprotected org.springframework.social.oauth2.OAuth2Version getOAuth2Version()
getOAuth2Version in class org.springframework.social.oauth2.AbstractOAuth2ApiBindingpublic PlusOperations plusOperations()
GooglePlusOperations, used for interacting with Google+ API.
Some methods require OAuth2 scope https://www.googleapis.com/auth/plus.meplusOperations in interface GooglePlusOperations for the authenticated user if
authenticatedpublic TaskOperations taskOperations()
GoogleTaskOperations, used for interacting with Google Tasks
API. Requires OAuth scope https://www.googleapis.com/auth/tasks or
https://www.googleapis.com/auth/tasks.readonlytaskOperations in interface GoogleTaskOperations for the authenticated userpublic DriveOperations driveOperations()
GoogleDriveOperations, used for interacting with Google Drive
API. Requires OAuth scope(s) from the following:
driveOperations in interface GoogleDriveOperations for the authenticated userpublic CalendarOperations calendarOperations()
GoogleCalendarOperations, used for interacting with Google Calendar API.
Some methods require OAuth2 scope from the following:
calendarOperations in interface GoogleCalendarOperations for the authenticated user if authenticatedpublic java.lang.String getAccessToken()
GooglegetAccessToken in interface Googlepublic OAuth2Operations oauth2Operations()
GoogleOAuth2Operations, used for interacting with Google+ API.oauth2Operations in interface GooglePlusOperations for the authenticated user if
authenticatedpublic org.springframework.web.client.RestOperations restOperations()
restOperations in interface Google