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. |
configureRestTemplate, getByteArrayMessageConverter, getFormMessageConverter, getJsonMessageConverter, getRestTemplate, isAuthorized, setRequestFactory
public 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.AbstractOAuth2ApiBinding
protected org.springframework.social.oauth2.OAuth2Version getOAuth2Version()
getOAuth2Version
in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
public PlusOperations plusOperations()
Google
PlusOperations
, used for interacting with Google+ API.
Some methods require OAuth2 scope https://www.googleapis.com/auth/plus.meplusOperations
in interface Google
PlusOperations
for the authenticated user if
authenticatedpublic TaskOperations taskOperations()
Google
TaskOperations
, 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 Google
TaskOperations
for the authenticated userpublic DriveOperations driveOperations()
Google
DriveOperations
, used for interacting with Google Drive
API. Requires OAuth scope(s) from the following:
driveOperations
in interface Google
DriveOperations
for the authenticated userpublic java.lang.String getAccessToken()
Google
getAccessToken
in interface Google