Package com.nexmo.client
Class NexmoClient.Builder
- java.lang.Object
-
- com.nexmo.client.NexmoClient.Builder
-
- Enclosing class:
- NexmoClient
public static class NexmoClient.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NexmoClient.BuilderapiKey(java.lang.String apiKey)When setting an apiKey, it is also expected thatapiSecret(String)and/orsignatureSecret(String)will also be set.NexmoClient.BuilderapiSecret(java.lang.String apiSecret)When setting an apiSecret, it is also expected thatapiKey(String)will also be set.NexmoClient.BuilderapplicationId(java.lang.String applicationId)When setting an applicationId, it is also expected that theprivateKeyContentswill also be set.NexmoClientbuild()NexmoClient.BuilderhttpClient(org.apache.http.client.HttpClient httpClient)NexmoClient.BuilderhttpConfig(HttpConfig httpConfig)NexmoClient.BuilderprivateKeyContents(byte[] privateKeyContents)When setting the contents of your private key, it is also expected thatapplicationId(String)will also be set.NexmoClient.BuilderprivateKeyContents(java.lang.String privateKeyContents)When setting the contents of your private key, it is also expected thatapplicationId(String)will also be set.NexmoClient.BuilderprivateKeyPath(java.lang.String privateKeyPath)When setting the path of your private key, it is also expected thatapplicationId(String)will also be set.NexmoClient.BuilderprivateKeyPath(java.nio.file.Path privateKeyPath)When setting the path of your private key, it is also expected thatapplicationId(String)will also be set.NexmoClient.BuildersignatureSecret(java.lang.String signatureSecret)When setting a signatureSecret, it is also expected thatapiKey(String)will also be set.
-
-
-
Constructor Detail
-
Builder
public Builder()
-
-
Method Detail
-
httpConfig
public NexmoClient.Builder httpConfig(HttpConfig httpConfig)
- Parameters:
httpConfig- Configuration options for theHttpWrapper- Returns:
- The
NexmoClient.Builderto keep building.
-
httpClient
public NexmoClient.Builder httpClient(org.apache.http.client.HttpClient httpClient)
- Parameters:
httpClient- Custom implementation ofHttpClient.- Returns:
- The
NexmoClient.Builderto keep building.
-
applicationId
public NexmoClient.Builder applicationId(java.lang.String applicationId)
When setting an applicationId, it is also expected that theprivateKeyContentswill also be set.- Parameters:
applicationId- Used to identify each application.- Returns:
- The
NexmoClient.Builderto keep building.
-
apiKey
public NexmoClient.Builder apiKey(java.lang.String 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:
- The
NexmoClient.Builderto keep building.
-
apiSecret
public NexmoClient.Builder apiSecret(java.lang.String 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:
- The
NexmoClient.Builderto keep building.
-
signatureSecret
public NexmoClient.Builder signatureSecret(java.lang.String 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:
- The
NexmoClient.Builderto keep building.
-
privateKeyContents
public NexmoClient.Builder privateKeyContents(byte[] 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:
- The
NexmoClient.Builderto keep building.
-
privateKeyContents
public NexmoClient.Builder privateKeyContents(java.lang.String 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:
- The
NexmoClient.Builderto keep building.
-
privateKeyPath
public NexmoClient.Builder privateKeyPath(java.nio.file.Path privateKeyPath) throws NexmoUnableToReadPrivateKeyException
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:
- The
NexmoClient.Builderto keep building. - Throws:
NexmoUnableToReadPrivateKeyException- if the private key could not be read from the file system.
-
privateKeyPath
public NexmoClient.Builder privateKeyPath(java.lang.String privateKeyPath) throws NexmoUnableToReadPrivateKeyException
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:
- The
NexmoClient.Builderto keep building. - Throws:
NexmoUnableToReadPrivateKeyException- if the private key could not be read from the file system.
-
build
public NexmoClient build()
- Returns:
- a new
NexmoClientfrom the stored builder options. - Throws:
NexmoClientCreationException- if credentials aren't provided in a valid pairing or there were issues generating anJWTAuthMethodwith the provided credentials.
-
-