Class ClientBuilder


  • public class ClientBuilder
    extends java.lang.Object
    Builder for the EspoApiClient
    Since:
    1.0.0
    • Constructor Detail

      • ClientBuilder

        public ClientBuilder()
    • Method Detail

      • setHost

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

        public ClientBuilder setUsername​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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:
        java.lang.IllegalStateException - When the validation check fails