Package org.onyx.http

Class Client.Builder

java.lang.Object
org.onyx.http.Client.Builder
Enclosing class:
Client

public static class Client.Builder extends Object
A builder class for creating client objects
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setCredential

      public Client.Builder setCredential(String credential)
      Sets the credential for the client
      Parameters:
      credential - an API credential from a user of the ledger's team
    • setLedgerName

      public Client.Builder setLedgerName(String name)
      Sets the ledger name for the client. The client will access the named ledger.
      Parameters:
      name - The ledger name
    • setConnectTimeout

      public Client.Builder setConnectTimeout(long timeout, TimeUnit unit)
      Sets the connect timeout for the client
      Parameters:
      timeout - the number of time units for the default timeout
      unit - the unit of time
    • setReadTimeout

      public Client.Builder setReadTimeout(long timeout, TimeUnit unit)
      Sets the read timeout for the client
      Parameters:
      timeout - the number of time units for the default timeout
      unit - the unit of time
    • setWriteTimeout

      public Client.Builder setWriteTimeout(long timeout, TimeUnit unit)
      Sets the write timeout for the client
      Parameters:
      timeout - the number of time units for the default timeout
      unit - the unit of time
    • setProxy

      public Client.Builder setProxy(Proxy proxy)
      Sets the proxy for the client
      Parameters:
      proxy -
    • setConnectionPool

      public Client.Builder setConnectionPool(int maxIdle, long timeout, TimeUnit unit)
      Sets the connection pool for the client
      Parameters:
      maxIdle - the maximum number of idle http connections in the pool
      timeout - the number of time units until an idle http connection in the pool is closed
      unit - the unit of time
    • setLogger

      public Client.Builder setLogger(OutputStream logger)
      Sets the request logger.
      Parameters:
      logger - the output stream to log the requests to
    • setLogLevel

      public Client.Builder setLogLevel(LoggingInterceptor.Level level)
      Sets the level of the request logger.
      Parameters:
      level - all, errors or none
    • build

      public Client build() throws ConfigurationException
      Builds a client with all of the provided parameters.
      Throws:
      ConfigurationException