Class GoogleTemplate

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean, org.springframework.social.ApiBinding, Google

    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.

    Author:
    Gabriel Axel
    • Constructor Detail

      • GoogleTemplate

        public GoogleTemplate()
        Creates a new instance of GoogleTemplate. This constructor creates a new GoogleTemplate able to perform unauthenticated operations against Google+.
      • GoogleTemplate

        public GoogleTemplate​(String accessToken)
        Creates a new instance of GoogleTemplate. This constructor creates the FacebookTemplate using a given access token.
        Parameters:
        accessToken - an access token granted by Google after OAuth2 authentication
    • Method Detail

      • getMessageConverters

        protected List<org.springframework.http.converter.HttpMessageConverter<?>> getMessageConverters()
        Overrides:
        getMessageConverters in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
      • getOAuth2Version

        protected org.springframework.social.oauth2.OAuth2Version getOAuth2Version()
        Overrides:
        getOAuth2Version in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
      • plusOperations

        public PlusOperations plusOperations()
        Description copied from interface: Google
        Retrieves PlusOperations, used for interacting with Google+ API. Some methods require OAuth2 scope https://www.googleapis.com/auth/plus.me
        Specified by:
        plusOperations in interface Google
        Returns:
        PlusOperations for the authenticated user if authenticated
      • taskOperations

        public TaskOperations taskOperations()
        Description copied from interface: Google
        Retrieves TaskOperations, used for interacting with Google Tasks API. Requires OAuth scope https://www.googleapis.com/auth/tasks or https://www.googleapis.com/auth/tasks.readonly
        Specified by:
        taskOperations in interface Google
        Returns:
        TaskOperations for the authenticated user
      • driveOperations

        public DriveOperations driveOperations()
        Description copied from interface: Google
        Retrieves DriveOperations, used for interacting with Google Drive API. Requires OAuth scope(s) from the following:
        • https://www.googleapis.com/auth/drive.file
        • https://www.googleapis.com/auth/drive
        • https://www.googleapis.com/auth/drive.apps.readonly
        • https://www.googleapis.com/auth/drive.readonly
        • https://www.googleapis.com/auth/drive.readonly.metadata
        See https://developers .google.com/drive/scopes for details about the different scopes
        Specified by:
        driveOperations in interface Google
        Returns:
        DriveOperations for the authenticated user
      • calendarOperations

        public CalendarOperations calendarOperations()
        Description copied from interface: Google
        Retrieves CalendarOperations, used for interacting with Google Calendar API. Some methods require OAuth2 scope from the following:
        • https://www.googleapis.com/auth/calendar.readonly
        • https://www.googleapis.com/auth/calendar
        Specified by:
        calendarOperations in interface Google
        Returns:
        CalendarOperations for the authenticated user if authenticated
      • restOperations

        public org.springframework.web.client.RestOperations restOperations()
        Specified by:
        restOperations in interface Google