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 Link icon

    • DataAPIClientOptionsBuilder Link icon

      public DataAPIClientOptionsBuilder()
      Default constructor.
  • Method Details Link icon

    • withCaller Link icon

      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 Link icon

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

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

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

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

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

      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 Link icon

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

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

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

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

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

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