Class ServiceBuilder


  • public class ServiceBuilder
    extends java.lang.Object
    Implementation of the Builder pattern, with a fluent interface that creates a OAuthService
    • Constructor Detail

      • ServiceBuilder

        public ServiceBuilder​(java.lang.String apiKey)
    • Method Detail

      • callback

        public ServiceBuilder callback​(java.lang.String callback)
        Adds an OAuth callback url
        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

        public final 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
      • state

        @Deprecated
        public ServiceBuilder state​(java.lang.String state)
        Deprecated.
        use one of getAuthorizationUrl method in OAuth20Service
        /** Configures the anti forgery session state. This is available in some APIs (like Google's).
        Parameters:
        state - The OAuth state
        Returns:
        the ServiceBuilder instance for method chaining
      • debugStream

        public ServiceBuilder debugStream​(java.io.OutputStream debugStream)
      • responseType

        public ServiceBuilder responseType​(java.lang.String responseType)
      • httpClient

        public ServiceBuilder httpClient​(HttpClient httpClient)
        takes precedence over httpClientConfig
        Parameters:
        httpClient - externally created HTTP client
        Returns:
        the ServiceBuilder instance for method chaining
      • userAgent

        public ServiceBuilder userAgent​(java.lang.String userAgent)
      • build

        public <S extends OAuthService> S build​(BaseApi<S> api)
        Returns the fully configured OAuthService
        Type Parameters:
        S - OAuthService implementation (OAuth1/OAuth2/any API specific)
        Parameters:
        api - will build Service for this API
        Returns:
        fully configured OAuthService