Package org.scribe.builder
Class ServiceBuilder
- java.lang.Object
-
- org.scribe.builder.ServiceBuilder
-
public class ServiceBuilder extends java.lang.Object
Implementation of the Builder pattern, with a fluent interface that creates aOAuthService
-
-
Constructor Summary
Constructors Constructor Description ServiceBuilder()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceBuilder
apiKey(java.lang.String apiKey)
Configures the api keyServiceBuilder
apiSecret(java.lang.String apiSecret)
Configures the api secretOAuthService
build()
Returns the fully configuredOAuthService
ServiceBuilder
callback(java.lang.String callback)
Adds an OAuth callback urlServiceBuilder
debug()
ServiceBuilder
debugStream(java.io.OutputStream stream)
ServiceBuilder
provider(java.lang.Class<? extends Api> apiClass)
Configures theApi
ServiceBuilder
provider(Api api)
Configures theApi
Overloaded version.ServiceBuilder
scope(java.lang.String scope)
Configures the OAuth scope.ServiceBuilder
signatureType(SignatureType type)
Configures the signature type, choose between header, querystring, etc.
-
-
-
Method Detail
-
provider
public ServiceBuilder provider(java.lang.Class<? extends Api> apiClass)
Configures theApi
- Parameters:
apiClass
- the class of one of the existentApi
s on org.scribe.api package- Returns:
- the
ServiceBuilder
instance for method chaining
-
provider
public ServiceBuilder provider(Api api)
Configures theApi
Overloaded version. Let's you use an instance instead of a class.- Parameters:
api
- instance ofApi
s- Returns:
- the
ServiceBuilder
instance for method chaining
-
callback
public ServiceBuilder callback(java.lang.String callback)
Adds an OAuth callback url- Parameters:
callback
- callback url. Must be a valid url or 'oob' for out of band OAuth- Returns:
- the
ServiceBuilder
instance for method chaining
-
apiKey
public ServiceBuilder apiKey(java.lang.String apiKey)
Configures the api key- Parameters:
apiKey
- The api key for your application- Returns:
- the
ServiceBuilder
instance for method chaining
-
apiSecret
public ServiceBuilder apiSecret(java.lang.String apiSecret)
Configures the api secret- Parameters:
apiSecret
- The api secret for your application- Returns:
- the
ServiceBuilder
instance for method chaining
-
scope
public ServiceBuilder scope(java.lang.String scope)
Configures the OAuth scope. This is only necessary in some APIs (like Google's).- Parameters:
scope
- The OAuth scope- Returns:
- the
ServiceBuilder
instance for method chaining
-
signatureType
public ServiceBuilder signatureType(SignatureType type)
Configures the signature type, choose between header, querystring, etc. Defaults to Header- Parameters:
scope
- The OAuth scope- Returns:
- the
ServiceBuilder
instance for method chaining
-
debugStream
public ServiceBuilder debugStream(java.io.OutputStream stream)
-
debug
public ServiceBuilder debug()
-
build
public OAuthService build()
Returns the fully configuredOAuthService
- Returns:
- fully configured
OAuthService
-
-