Class DataAPIOptions.DataAPIClientOptionsBuilder

java.lang.Object
com.datastax.astra.client.DataAPIOptions.DataAPIClientOptionsBuilder
Enclosing class:
DataAPIOptions

public static class DataAPIOptions.DataAPIClientOptionsBuilder extends Object
Builder for the DataAPIClientOptions.
  • Constructor Details

    • DataAPIClientOptionsBuilder

      public DataAPIClientOptionsBuilder()
      Default constructor.
  • Method Details

    • withCaller

      public DataAPIOptions.DataAPIClientOptionsBuilder withCaller(String callerName, String callerVersion)
      Builder pattern, update caller information. o
      Parameters:
      callerName - caller name in the user agent
      callerVersion - caller version in the user agent
      Returns:
      self reference
    • withApiVersion

      public DataAPIOptions.DataAPIClientOptionsBuilder withApiVersion(String apiVersion)
      Builder pattern, update api version.
      Parameters:
      apiVersion - api version
      Returns:
      self reference
    • withHttpRedirect

      Builder pattern, update http redirect
      Parameters:
      redirect - http redirect
      Returns:
      self reference
    • withHtpVersion

      Builder pattern, update http version
      Parameters:
      version - http version
      Returns:
      self reference
    • withHttpProxy

      Builder pattern, update http httpProxy
      Parameters:
      httpProxy - http proxy
      Returns:
      self reference
    • withHttpRetryCount

      public DataAPIOptions.DataAPIClientOptionsBuilder withHttpRetryCount(int retryCount)
      Builder pattern, update http retry count
      Parameters:
      retryCount - http retry count
      Returns:
      self reference
    • withMaxTimeMS

      public DataAPIOptions.DataAPIClientOptionsBuilder withMaxTimeMS(long connectTimeout)
      Builder pattern, update http request Timeout in millis
      Parameters:
      connectTimeout - http request timeout in millis
      Returns:
      self reference
    • withEmbeddingAPIKey

      public DataAPIOptions.DataAPIClientOptionsBuilder withEmbeddingAPIKey(String embeddingAPIKey)
      Builder pattern, update http connection Timeout
      Parameters:
      embeddingAPIKey - embedding API Key
      Returns:
      self reference
    • withEmbeddingAuthProvider

      public DataAPIOptions.DataAPIClientOptionsBuilder withEmbeddingAuthProvider(EmbeddingHeadersProvider embeddingAuthProvider)
      Builder pattern, update authentication provider for vectorize.
      Parameters:
      embeddingAuthProvider - embedding authentication provider
      Returns:
      self reference
    • withHttpConnectTimeout

      public DataAPIOptions.DataAPIClientOptionsBuilder withHttpConnectTimeout(int requestTimeout)
      Builder pattern, update http connection Timeout
      Parameters:
      requestTimeout - http request timeout
      Returns:
      self reference
    • withDestination

      Builder pattern, update http connection Timeout
      Parameters:
      destination - data api destination
      Returns:
      self reference
    • withHttpRetryDelayMillis

      public DataAPIOptions.DataAPIClientOptionsBuilder withHttpRetryDelayMillis(int retryDelay)
      Sets the delay between retry attempts when the number of retries is greater than 1. This allows configuring the interval to wait before initiating a subsequent retry after a failed attempt. The delay is specified in milliseconds.

      If not explicitly set, the default delay is defined by DEFAULT_RETRY_DELAY_MILLIS, which is 100 milliseconds.

      Usage of this method is crucial in scenarios where repeated requests are made and a gentle back-off strategy is desired to reduce the load on the server or to handle temporary network issues gracefully.

      Parameters:
      retryDelay - the delay between two retry attempts, expressed in milliseconds. Must be a non-negative number.
      Returns:
      a reference to this builder, allowing for method chaining. Example usage:
       
       DataAPIClientOptions
         .builder()
         .withHttpRetryDelayMillis(200); // Sets a 200ms delay between retries.
       
    • withMaxDocumentCount

      public DataAPIOptions.DataAPIClientOptionsBuilder withMaxDocumentCount(int maxDocumentCount)
      Sets the maximum number of documents that can be returned by the count function.

      If not explicitly set, the default value is defined by MAX_DOCUMENTS_COUNT, which is 1000 documents.

      Parameters:
      maxDocumentCount - the maximum number of documents that can be returned by the count function. Must be a positive number.
      Returns:
      a reference to this builder, allowing for method chaining. Example usage:
       
       DataAPIClientOptions
         .builder()
         .withMaxDocumentCount(2000); // Sets the maximum number of documents to 2000.
       
    • withMaxPageSize

      public DataAPIOptions.DataAPIClientOptionsBuilder withMaxPageSize(int maxPageSize)
      Sets the maximum number of documents that can be returned in a single page.

      If not explicitly set, the default value is defined by MAX_PAGE_SIZE, which is 20 documents.

      Parameters:
      maxPageSize - the maximum number of documents that can be returned in a single page. Must be a positive number.
      Returns:
      a reference to this builder, allowing for method chaining. Example usage:
       
       DataAPIClientOptions
         .builder()
         .withMaxPageSize(50); // Sets the maximum page size to 50 documents.
       
    • withMaxDocumentsInInsert

      public DataAPIOptions.DataAPIClientOptionsBuilder withMaxDocumentsInInsert(int maxDocumentsInInsert)
      Sets the maximum number of documents that can be inserted in a single operation.

      If not explicitly set, the default value is defined by MAX_DOCUMENTS_IN_INSERT, which is 20 documents.

      Parameters:
      maxDocumentsInInsert - the maximum number of documents that can be inserted in a single operation. Must be a positive number.
      Returns:
      a reference to this builder, allowing for method chaining. Example usage:
       
       DataAPIClientOptions
         .builder()
         .withMaxDocumentsInInsert(50); // Sets the maximum number of documents to insert to 50.
       
    • withObserver

      public DataAPIOptions.DataAPIClientOptionsBuilder withObserver(String name, CommandObserver observer)
      Allow to register a listener for the command.
      Parameters:
      name - name of the observer
      observer - observer to register
      Returns:
      instance of the command options
    • withObserver

      Register an observer with its className.
      Parameters:
      observer - command observer
      Returns:
      instance of the command options
    • logRequests

      Help to enable loggin requests.
      Returns:
      current reference
    • build

      public DataAPIOptions build()
      Build the options.
      Returns:
      options