Class ClientBuilder

java.lang.Object
dev.array21.espocrm.client.ClientBuilder

public class ClientBuilder extends Object
Builder for the EspoApiClient
Since:
1.0.0
  • Constructor Details

    • ClientBuilder

      public ClientBuilder()
  • Method Details

    • setHost

      public ClientBuilder setHost(String host)
      Set the EspoCRM URL
      Parameters:
      host - The host
      Returns:
      Returns an instance of ClientBuilder for easy chaining
    • setUsername

      public ClientBuilder setUsername(String username)
      Set the username to use for authentication. You must also call setPassword(String)

      It is highly discouraged to use this method of authentication. You should prefer to authenticate with an API key or with HMAC authentication
      Parameters:
      username - The username
      Returns:
      Returns an instance of ClientBuilder for easy chaining
    • setPassword

      public ClientBuilder setPassword(String password)
      Set the password to use for authentication. You must also call setUsername(String)

      It is highly discouraged to use this method of authentication. You should prefer to authenticate with an API key or with HMAC authentication
      Parameters:
      username - The username
      Returns:
      Returns an instance of ClientBuilder for easy chaining
    • setApiKey

      public ClientBuilder setApiKey(String apiKey)
      Set the API key to use for authentication. If you wish to use HMAC authentication, you must also call setSecretKey(String)
      Parameters:
      apiKey - The apiKey
      Returns:
      Returns an instance of ClientBuilder for easy chaining
    • setSecretKey

      public ClientBuilder setSecretKey(String secretKey)
      Set the secret key to use for authentication. You must also call setApiKey(String)
      Parameters:
      secretKey - The secret key
      Returns:
      Returns an instance of ClientBuilder for easy chaining
    • build

      public EspoApiClient build()
      Create an instance of EspoApiClient from this builder. This will perform validation checks.
      Returns:
      Returns the EspoApiClient built from this ClientBuilder instance
      Throws:
      IllegalStateException - When the validation check fails