Class ApiKeyCredential.Builder

java.lang.Object
io.superdurable.dex.ApiKeyCredential.Builder
Enclosing class:
ApiKeyCredential

public static final class ApiKeyCredential.Builder extends Object
Configures the timeout and HTTP transport for an API key credential.

Obtain a builder from ApiKeyCredential.builder(URI, String, String). The enclosing type shows a complete Client example. Build does not contact the token endpoint. The default timeout is ten seconds, and a supplied HTTP connection factory remains the caller's property.

  • Method Details

    • exchangeTimeout

      public ApiKeyCredential.Builder exchangeTimeout(Duration value)
      Sets the maximum duration for one exchange, including connection and response.
      Parameters:
      value - a positive duration; the default is ten seconds
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the duration is null, zero, negative, or too large
    • httpConnectionFactory

      Uses a connection factory for token exchanges and proxy configuration.

      The default opens a connection through Java's standard proxy configuration. See ApiKeyCredential.HttpConnectionFactory for an explicit proxy example.

      Parameters:
      value - the nonnull factory; the caller retains ownership
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the factory is null
    • build

      public ApiKeyCredential build()
      Builds the thread-safe credential without contacting the token endpoint.
      Returns:
      a credential owned by the application and shared with its Clients or Workers