Class OneDriveConnectionBuilder

java.lang.Object
com.amilesend.onedrive.connection.OneDriveConnectionBuilder

public class OneDriveConnectionBuilder extends Object
Builder to configure and return a new OneDriveConnection instance.
  • Field Details

    • DEFAULT_NUM_THREADS

      public static final int DEFAULT_NUM_THREADS
  • Method Details

    • newInstance

      public static OneDriveConnectionBuilder newInstance()
      Creates a new OneDriveConnectionBuilder instance.
      Returns:
      the builder
    • userAgent

      public OneDriveConnectionBuilder userAgent(String userAgent)
      Sets the user-agent string that is included in requests.
      Parameters:
      userAgent - the user agent
      Returns:
      this builder
    • httpClient

      public OneDriveConnectionBuilder httpClient(okhttp3.OkHttpClient httpClient)
      The underlying http client. This is optional.
      Parameters:
      httpClient - the http client
      Returns:
      this builder
    • clientId

      public OneDriveConnectionBuilder clientId(String clientId)
      The application client identifier. This is required.
      Parameters:
      clientId - the application client identifier
      Returns:
      this builder
    • clientSecret

      public OneDriveConnectionBuilder clientSecret(String clientSecret)
      The application client secret. This is required.
      Parameters:
      clientSecret - the application client secret
      Returns:
      this builder
    • redirectUrl

      public OneDriveConnectionBuilder redirectUrl(String redirectUrl)
      The OAuth redirect URL. This is required.
      Parameters:
      redirectUrl - the OAuth redirectUrl
      Returns:
      this builder
    • authManager

      public OneDriveConnectionBuilder authManager(OneDriveAuthManager authManager)
      The OneDriveAuthManager used to manage authentication and access tokens.
      Parameters:
      authManager - the auth manager
      Returns:
      this builder
    • retryStrategy

      public OneDriveConnectionBuilder retryStrategy(com.amilesend.client.connection.retry.RetryStrategy retryStrategy)
      The RetryStrategy used for the underyling client connection.
      Parameters:
      retryStrategy - the retry strategy
      Returns:
      this builder
      See Also:
      • RetryStrategy
    • threadPool

      public OneDriveConnectionBuilder threadPool(ExecutorService threadPool)
      The executor service to manage async operations for the client.
      Parameters:
      threadPool - the thread pool
      Returns:
      this builder
    • build

      public OneDriveConnection build(String authCode)
      Builds a new OneDriveConnection instance with the given authCode.
      Parameters:
      authCode - the authorization code obtained from the OAuth handshake.
      Returns:
      the connection
    • build

      public OneDriveConnection build(OneDriveAuthInfo authInfo)
      Builds a new OneDriveConnection instance with the given authInfo.
      Parameters:
      authInfo - the authorization information that contains the refresh token
      Returns:
      the connection