Package dev.array21.espocrm.client
Class ClientBuilder
java.lang.Object
dev.array21.espocrm.client.ClientBuilder
Builder for the EspoApiClient
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create an instance of EspoApiClient from this builder.Set the API key to use for authentication.Set the EspoCRM URLsetPassword(String password) Set the password to use for authentication.setSecretKey(String secretKey) Set the secret key to use for authentication.setUsername(String username) Set the username to use for authentication.
-
Constructor Details
-
ClientBuilder
public ClientBuilder()
-
-
Method Details
-
setHost
Set the EspoCRM URL- Parameters:
host- The host- Returns:
- Returns an instance of ClientBuilder for easy chaining
-
setUsername
Set the username to use for authentication. You must also callsetPassword(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
Set the password to use for authentication. You must also callsetUsername(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
Set the API key to use for authentication. If you wish to use HMAC authentication, you must also callsetSecretKey(String)- Parameters:
apiKey- The apiKey- Returns:
- Returns an instance of ClientBuilder for easy chaining
-
setSecretKey
Set the secret key to use for authentication. You must also callsetApiKey(String)- Parameters:
secretKey- The secret key- Returns:
- Returns an instance of ClientBuilder for easy chaining
-
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
-