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 |
|---|---|
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() |
PlusOperations |
plusOperations()
Retrieves
PlusOperations, used for interacting with Google+ API. |
TaskOperations |
taskOperations()
Retrieves
TaskOperations, used for interacting with Google Tasks
API. |
UserInfoOperations |
userOperations()
Retrieves
UserInfoOperations, used for fetching user profile
(predates Google+). |
configureRestTemplate, getByteArrayMessageConverter, getFormMessageConverter, getJsonMessageConverter, getRestTemplate, isAuthorized, 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 UserInfoOperations userOperations()
GoogleUserInfoOperations, used for fetching user profile
(predates Google+). Requires OAuth2 scopes
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/userinfo#emailuserOperations in interface GoogleUserInfoOperations for the authenticated userpublic 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 java.lang.String getAccessToken()
GooglegetAccessToken in interface Google