v2 (revision 9)



com.google.api.services.oauth2
Class Oauth2

java.lang.Object
  extended by com.google.api.client.http.json.JsonHttpClient
      extended by com.google.api.client.googleapis.services.GoogleClient
          extended by com.google.api.services.oauth2.Oauth2

public class Oauth2
extends GoogleClient

Service definition for Oauth2 (v2).

OAuth2 API

For more information about this service, see the API Documentation

This service uses JsonHttpRequestInitializer to initialize global parameters via its Oauth2.Builder. Sample usage:

  public class Oauth2RequestInitializer implements JsonHttpRequestInitializer {
      public void initialize(JsonHttpRequest request) {
        Oauth2Request oauth2Request = (Oauth2Request)request;
        oauth2Request.setPrettyPrint(true);
        oauth2Request.setKey(ClientCredentials.KEY);
    }
  }
 

Since:
1.3.0
Author:
Google, Inc.

Nested Class Summary
static class Oauth2.Builder
          Builder for Oauth2.
 class Oauth2.Tokeninfo
           
 class Oauth2.Userinfo
          The "userinfo" collection of methods.
 
Field Summary
static String DEFAULT_BASE_PATH
          Deprecated. (scheduled to be removed in 1.8) Use "/" + DEFAULT_SERVICE_PATH.
static String DEFAULT_BASE_URL
          The default encoded base URL of the service.
static String DEFAULT_ROOT_URL
          The default encoded root URL of the service.
static String DEFAULT_SERVICE_PATH
          The default encoded service path of the service.
 
Constructor Summary
Oauth2(HttpTransport transport, JsonFactory jsonFactory)
          Deprecated. (scheduled to be removed in 1.8) Use Oauth2(HttpTransport, JsonFactory, HttpRequestInitializer).
Oauth2(HttpTransport transport, JsonFactory jsonFactory, HttpRequestInitializer httpRequestInitializer)
          Construct a Oauth2 instance to connect to the Oauth2 service.
 
Method Summary
static Oauth2.Builder builder(HttpTransport transport, JsonFactory jsonFactory)
          Deprecated. (scheduled to removed in 1.8) Use Builder#Builder(HttpTransport, JsonFactory, HttpRequestInitializer).
protected  void initialize(JsonHttpRequest jsonHttpRequest)
           
 Oauth2.Tokeninfo tokeninfo()
          Create a request for the method "tokeninfo".
 Oauth2.Userinfo userinfo()
          An accessor for creating requests from the Userinfo collection.
 
Methods inherited from class com.google.api.client.googleapis.services.GoogleClient
batch, batch, buildHttpRequest, executeUnparsed, executeUnparsed
 
Methods inherited from class com.google.api.client.http.json.JsonHttpClient
createParser, createSerializer, executeAsInputStream, getApplicationName, getBaseUrl, getJsonFactory, getJsonHttpParser, getJsonHttpRequestInitializer, getJsonObjectParser, getRequestFactory, getRootUrl, getServicePath, isBaseUrlUsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BASE_PATH

@Deprecated
public static final String DEFAULT_BASE_PATH
Deprecated. (scheduled to be removed in 1.8) Use "/" + DEFAULT_SERVICE_PATH.
The default encoded base path of the service. This is determined when the library is generated and normally should not be changed.

See Also:
Constant Field Values

DEFAULT_ROOT_URL

public static final String DEFAULT_ROOT_URL
The default encoded root URL of the service. This is determined when the library is generated and normally should not be changed.

Since:
1.7
See Also:
Constant Field Values

DEFAULT_SERVICE_PATH

public static final String DEFAULT_SERVICE_PATH
The default encoded service path of the service. This is determined when the library is generated and normally should not be changed.

Since:
1.7
See Also:
Constant Field Values

DEFAULT_BASE_URL

public static final String DEFAULT_BASE_URL
The default encoded base URL of the service. This is determined when the library is generated and normally should not be changed.

See Also:
Constant Field Values
Constructor Detail

Oauth2

@Deprecated
public Oauth2(HttpTransport transport,
                         JsonFactory jsonFactory)
Deprecated. (scheduled to be removed in 1.8) Use Oauth2(HttpTransport, JsonFactory, HttpRequestInitializer).

Construct a Oauth2 instance to connect to the Oauth2 service.

Use Oauth2.Builder if you need to specify any of the optional parameters.

Parameters:
transport - The transport to use for requests
jsonFactory - A factory for creating JSON parsers and serializers

Oauth2

public Oauth2(HttpTransport transport,
              JsonFactory jsonFactory,
              HttpRequestInitializer httpRequestInitializer)
Construct a Oauth2 instance to connect to the Oauth2 service.

Use Oauth2.Builder if you need to specify any of the optional parameters.

Parameters:
transport - The transport to use for requests
jsonFactory - A factory for creating JSON parsers and serializers
httpRequestInitializer - The HTTP request initializer or null for none
Since:
1.7
Method Detail

initialize

protected void initialize(JsonHttpRequest jsonHttpRequest)
                   throws IOException
Overrides:
initialize in class JsonHttpClient
Throws:
IOException

builder

@Deprecated
public static Oauth2.Builder builder(HttpTransport transport,
                                                JsonFactory jsonFactory)
Deprecated. (scheduled to removed in 1.8) Use Builder#Builder(HttpTransport, JsonFactory, HttpRequestInitializer).

Returns an instance of a new builder.

Parameters:
transport - The transport to use for requests
jsonFactory - A factory for creating JSON parsers and serializers

userinfo

public Oauth2.Userinfo userinfo()
An accessor for creating requests from the Userinfo collection. The typical use is:
   Oauth2 oauth2 = new Oauth2(...);
   Oauth2.Userinfo.List request = oauth2.userinfo().list(parameters ...)

Returns:
the resource collection

tokeninfo

public Oauth2.Tokeninfo tokeninfo()
                           throws IOException
Create a request for the method "tokeninfo". This request holds the parameters needed by the the oauth2 server. After setting any optional parameters, call the Oauth2.Tokeninfo.execute() method to invoke the remote operation.

Returns:
the request
Throws:
IOException - if the initialization of the request fails