Class ServiceBuilder
java.lang.Object
com.github.scribejava.core.builder.ServiceBuilder
- All Implemented Interfaces:
ServiceBuilderCommon
,ServiceBuilderOAuth10a
,ServiceBuilderOAuth20
public class ServiceBuilder extends java.lang.Object implements ServiceBuilderOAuth10a, ServiceBuilderOAuth20
Implementation of the Builder pattern, with a fluent interface that creates a
OAuthService
-
Constructor Summary
Constructors Constructor Description ServiceBuilder(java.lang.String apiKey)
-
Method Summary
Modifier and Type Method Description ServiceBuilder
apiKey(java.lang.String apiKey)
Configures the api keyServiceBuilder
apiSecret(java.lang.String apiSecret)
Configures the api secretServiceBuilder
apiSecretIsEmptyStringUnsafe()
Configures the api secret as "" (empty string).OAuth10aService
build(DefaultApi10a api)
OAuth20Service
build(DefaultApi20 api)
ServiceBuilder
callback(java.lang.String callback)
Adds an OAuth callback urlServiceBuilder
debug()
ServiceBuilder
debugStream(java.io.OutputStream debugStream)
ServiceBuilderOAuth20
defaultScope(ScopeBuilder scopeBuilder)
ServiceBuilderOAuth20
defaultScope(java.lang.String defaultScope)
Configures the default OAuth 2.0 scope.
You can request any uniq scope per each access token request usingAuthorizationUrlBuilder.scope(java.lang.String)
.
In case you're requesting always the same scope,
you can just set it here and do not provide scope param nowhere more.ServiceBuilder
httpClient(HttpClient httpClient)
takes precedence over httpClientConfigServiceBuilder
httpClientConfig(HttpClientConfig httpClientConfig)
ServiceBuilderOAuth20
responseType(java.lang.String responseType)
ServiceBuilder
userAgent(java.lang.String userAgent)
ServiceBuilderOAuth10a
withScope(java.lang.String scope)
Configures the OAuth 1.0a scope.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ServiceBuilder
public ServiceBuilder(java.lang.String apiKey)
-
-
Method Details
-
callback
Description copied from interface:ServiceBuilderCommon
Adds an OAuth callback url- Specified by:
callback
in interfaceServiceBuilderCommon
- Specified by:
callback
in interfaceServiceBuilderOAuth10a
- Specified by:
callback
in interfaceServiceBuilderOAuth20
- Parameters:
callback
- callback url. Must be a valid url or 'oob' (OAuthConstants.OOB
for out of band OAuth- Returns:
- the
ServiceBuilder
instance for method chaining
-
apiKey
Description copied from interface:ServiceBuilderCommon
Configures the api key- Specified by:
apiKey
in interfaceServiceBuilderCommon
- Specified by:
apiKey
in interfaceServiceBuilderOAuth10a
- Specified by:
apiKey
in interfaceServiceBuilderOAuth20
- Parameters:
apiKey
- The api key for your application- Returns:
- the
ServiceBuilder
instance for method chaining
-
apiSecret
Description copied from interface:ServiceBuilderCommon
Configures the api secret- Specified by:
apiSecret
in interfaceServiceBuilderCommon
- Specified by:
apiSecret
in interfaceServiceBuilderOAuth10a
- Specified by:
apiSecret
in interfaceServiceBuilderOAuth20
- Parameters:
apiSecret
- The api secret for your application- Returns:
- the
ServiceBuilder
instance for method chaining
-
apiSecretIsEmptyStringUnsafe
Description copied from interface:ServiceBuilderCommon
Configures the api secret as "" (empty string). Used usually for a test environments or another strange cases. Not all providers support empty string as api key and will throw an Exception in such cases.- Specified by:
apiSecretIsEmptyStringUnsafe
in interfaceServiceBuilderCommon
- Specified by:
apiSecretIsEmptyStringUnsafe
in interfaceServiceBuilderOAuth10a
- Specified by:
apiSecretIsEmptyStringUnsafe
in interfaceServiceBuilderOAuth20
- Returns:
- the
ServiceBuilder
instance for method chaining
-
defaultScope
Description copied from interface:ServiceBuilderOAuth20
Configures the default OAuth 2.0 scope.
You can request any uniq scope per each access token request usingAuthorizationUrlBuilder.scope(java.lang.String)
.
In case you're requesting always the same scope,
you can just set it here and do not provide scope param nowhere more.- Specified by:
defaultScope
in interfaceServiceBuilderOAuth20
- Parameters:
defaultScope
- The OAuth scope, used as deafult- Returns:
- the
ServiceBuilder
instance for method chaining
-
defaultScope
- Specified by:
defaultScope
in interfaceServiceBuilderOAuth20
-
withScope
Description copied from interface:ServiceBuilderOAuth10a
Configures the OAuth 1.0a scope. This is only necessary in some APIs- Specified by:
withScope
in interfaceServiceBuilderOAuth10a
- Parameters:
scope
- The OAuth scope- Returns:
- the
ServiceBuilder
instance for method chaining
-
debugStream
- Specified by:
debugStream
in interfaceServiceBuilderCommon
- Specified by:
debugStream
in interfaceServiceBuilderOAuth10a
- Specified by:
debugStream
in interfaceServiceBuilderOAuth20
-
responseType
- Specified by:
responseType
in interfaceServiceBuilderOAuth20
-
httpClientConfig
- Specified by:
httpClientConfig
in interfaceServiceBuilderCommon
- Specified by:
httpClientConfig
in interfaceServiceBuilderOAuth10a
- Specified by:
httpClientConfig
in interfaceServiceBuilderOAuth20
-
httpClient
Description copied from interface:ServiceBuilderCommon
takes precedence over httpClientConfig- Specified by:
httpClient
in interfaceServiceBuilderCommon
- Specified by:
httpClient
in interfaceServiceBuilderOAuth10a
- Specified by:
httpClient
in interfaceServiceBuilderOAuth20
- Parameters:
httpClient
- externally created HTTP client- Returns:
- the
ServiceBuilder
instance for method chaining
-
userAgent
- Specified by:
userAgent
in interfaceServiceBuilderCommon
- Specified by:
userAgent
in interfaceServiceBuilderOAuth10a
- Specified by:
userAgent
in interfaceServiceBuilderOAuth20
-
debug
- Specified by:
debug
in interfaceServiceBuilderCommon
- Specified by:
debug
in interfaceServiceBuilderOAuth10a
- Specified by:
debug
in interfaceServiceBuilderOAuth20
-
build
- Specified by:
build
in interfaceServiceBuilderOAuth10a
-
build
- Specified by:
build
in interfaceServiceBuilderOAuth20
-