Package dev.array21.espocrm.client
Class ClientBuilder
- java.lang.Object
-
- dev.array21.espocrm.client.ClientBuilder
-
public class ClientBuilder extends java.lang.ObjectBuilder for the EspoApiClient- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description ClientBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EspoApiClientbuild()Create an instance of EspoApiClient from this builder.ClientBuildersetApiKey(java.lang.String apiKey)Set the API key to use for authentication.ClientBuildersetHost(java.lang.String host)Set the EspoCRM URLClientBuildersetPassword(java.lang.String password)Set the password to use for authentication.ClientBuildersetSecretKey(java.lang.String secretKey)Set the secret key to use for authentication.ClientBuildersetUsername(java.lang.String username)Set the username to use for authentication.
-
-
-
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 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
public ClientBuilder setPassword(java.lang.String password)
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
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 callsetSecretKey(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 callsetApiKey(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
-
-