Package com.vonage.client
Class VonageClient.Builder
java.lang.Object
com.vonage.client.VonageClient.Builder
- Enclosing class:
VonageClient
Builder for specifying the properties of the client.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWhen setting an apiKey, it is also expected thatapiSecret(String)and/orsignatureSecret(String)will also be set.When setting an apiSecret, it is also expected thatapiKey(String)will also be set.applicationId(String applicationId) When setting an applicationId, it is also expected that theprivateKeyContentswill also be set.applicationId(UUID applicationId) Set the application ID for this client.build()Builds the client with this builder's parameters.hashType(HashUtil.HashType hashType) Sets the hash type to use for signing requests.httpClient(org.apache.http.client.HttpClient httpClient) Deprecated.This method will be removed in the next major release.httpConfig(HttpConfig httpConfig) Configure the HTTP client parameters.privateKeyContents(byte[] privateKeyContents) When setting the contents of your private key, it is also expected thatapplicationId(String)will also be set.privateKeyContents(String privateKeyContents) When setting the contents of your private key, it is also expected thatapplicationId(String)will also be set.privateKeyPath(String privateKeyPath) When setting the path of your private key, it is also expected thatapplicationId(String)will also be set.privateKeyPath(Path privateKeyPath) When setting the path of your private key, it is also expected thatapplicationId(String)will also be set.signatureSecret(String signatureSecret) When setting a signatureSecret, it is also expected thatapiKey(String)will also be set.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
httpConfig
Configure the HTTP client parameters.- Parameters:
httpConfig- Configuration options for theHttpWrapper.- Returns:
- This builder.
-
httpClient
Deprecated.This method will be removed in the next major release.Set the underlying HTTP client instance.- Parameters:
httpClient- Custom implementation ofHttpClient.- Returns:
- This builder.
-
applicationId
Set the application ID for this client. This will be used alongside your private key (se viaprivateKeyContents) for authenticating requests.- Parameters:
applicationId- The application UUID.- Returns:
- This builder.
- Since:
- 7.11.0
-
applicationId
When setting an applicationId, it is also expected that theprivateKeyContentswill also be set.- Parameters:
applicationId- Used to identify each application.- Returns:
- This builder.
-
apiKey
When setting an apiKey, it is also expected thatapiSecret(String)and/orsignatureSecret(String)will also be set.- Parameters:
apiKey- The API Key found in the dashboard for your account.- Returns:
- This builder.
-
apiSecret
When setting an apiSecret, it is also expected thatapiKey(String)will also be set.- Parameters:
apiSecret- The API Secret found in the dashboard for your account.- Returns:
- This builder.
-
signatureSecret
When setting a signatureSecret, it is also expected thatapiKey(String)will also be set.- Parameters:
signatureSecret- The Signature Secret found in the dashboard for your account.- Returns:
- This builder.
-
hashType
Sets the hash type to use for signing requests.- Parameters:
hashType- The hashing strategy for signature keys as an enum.- Returns:
- This builder.
-
privateKeyContents
When setting the contents of your private key, it is also expected thatapplicationId(String)will also be set.- Parameters:
privateKeyContents- The contents of your private key used for JWT generation.- Returns:
- This builder.
-
privateKeyContents
When setting the contents of your private key, it is also expected thatapplicationId(String)will also be set.- Parameters:
privateKeyContents- The contents of your private key used for JWT generation.- Returns:
- This builder.
-
privateKeyPath
public VonageClient.Builder privateKeyPath(Path privateKeyPath) throws VonageUnableToReadPrivateKeyException When setting the path of your private key, it is also expected thatapplicationId(String)will also be set.- Parameters:
privateKeyPath- The path to your private key used for JWT generation.- Returns:
- This builder.
- Throws:
VonageUnableToReadPrivateKeyException- if the private key could not be read from the file system.
-
privateKeyPath
public VonageClient.Builder privateKeyPath(String privateKeyPath) throws VonageUnableToReadPrivateKeyException When setting the path of your private key, it is also expected thatapplicationId(String)will also be set.- Parameters:
privateKeyPath- The path to your private key used for JWT generation.- Returns:
- This builder.
- Throws:
VonageUnableToReadPrivateKeyException- if the private key could not be read from the file system.
-
build
Builds the client with this builder's parameters.- Returns:
- A new
VonageClientfrom the stored builder options. - Throws:
VonageClientCreationException- if credentials aren't provided in a valid pairing or there were issues generating anJWTAuthMethodwith the provided credentials.
-