Package com.vonage.client.account
Class AccountClient
java.lang.Object
com.vonage.client.account.AccountClient
A client for talking to the Vonage Account API. The standard way to obtain an instance of this class is to use
VonageClient.getAccountClient().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateSecret(String secret) Create a secret to be used with this account's main API key.createSecret(String apiKey, String secret) Create a secret to be used with a specific API key.Obtains the current account remaining balance.getPrefixPrice(ServiceType type, String prefix) Retrieve the pricing for a specified prefix.Get information for a specific secret id associated with this account's main API key.Get information for a specific secret id associated to a given API key.getSmsPrice(String country) Retrieve the SMS pricing for a specified country.getVoicePrice(String country) Retrieve the voice pricing for a specified country.listPriceAllCountries(ServiceType service) Obtain pricing data on all supported countries for a specific service type.List the ID of each secret associated with this account's main API key.listSecrets(String apiKey) List the ID of each secret associated to the given API key.voidrevokeSecret(String secretId) Revoke a secret associated with this account's main API key.voidrevokeSecret(String apiKey, String secretId) Revoke a secret associated with a specific API key.voidTop-up your account when you have enabled auto-reload in the dashboard.Updates the account-level delivery receipt URL (mainly used by the SMS API).updateSettings(SettingsRequest request) Deprecated.Updates the account-level incoming SMS URL, as used by the SMS API.
-
Constructor Details
-
AccountClient
Constructor.- Parameters:
wrapper- (required) shared HTTP wrapper object used for making REST calls.
-
-
Method Details
-
getBalance
Obtains the current account remaining balance.- Returns:
- The account balance along with other metadata.
- Throws:
AccountResponseException- If the balance could not be retrieved.
-
listPriceAllCountries
Obtain pricing data on all supported countries for a specific service type.- Parameters:
service- The service type to retrieve pricing and network information for.- Returns:
- The list of pricing information for all supported countries.
- Throws:
AccountResponseException- If the pricing data could not be retrieved.- Since:
- v7.9.0
-
getVoicePrice
Retrieve the voice pricing for a specified country.- Parameters:
country- The two-character country code for which you would like to retrieve pricing.- Returns:
- PricingResponse object which contains the results from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
getSmsPrice
Retrieve the SMS pricing for a specified country.- Parameters:
country- The two-character country code for which you would like to retrieve pricing.- Returns:
- PricingResponse object which contains the results from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
getPrefixPrice
public PrefixPricingResponse getPrefixPrice(ServiceType type, String prefix) throws AccountResponseException Retrieve the pricing for a specified prefix.- Parameters:
type- The type of service to retrieve pricing for.prefix- The prefix to retrieve the pricing for.- Returns:
- PrefixPricingResponse object which contains the results from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
topUp
Top-up your account when you have enabled auto-reload in the dashboard. Amount added is based on your initial reload-enabled payment.- Parameters:
transaction- The ID associated with your original auto-reload transaction- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
listSecrets
List the ID of each secret associated with this account's main API key.- Returns:
- ListSecretsResponse object which contains the results from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.- Since:
- 7.9.0
-
listSecrets
List the ID of each secret associated to the given API key.- Parameters:
apiKey- The API key to look up secrets for.- Returns:
- ListSecretsResponse object which contains the results from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
getSecret
Get information for a specific secret id associated with this account's main API key.- Parameters:
secretId- The id of the secret to get information on.- Returns:
- SecretResponse object which contains the results from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.- Since:
- 7.9.0
-
getSecret
Get information for a specific secret id associated to a given API key.- Parameters:
apiKey- The API key that the secret is associated to.secretId- The id of the secret to get information on.- Returns:
- SecretResponse object which contains the results from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
createSecret
Create a secret to be used with this account's main API key.- Parameters:
secret- The contents of the secret.- Returns:
- SecretResponse object which contains the created secret from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.- Since:
- 7.9.0
-
createSecret
Create a secret to be used with a specific API key.- Parameters:
apiKey- The API key that the secret is to be used with.secret- The contents of the secret.- Returns:
- SecretResponse object which contains the created secret from the API.
- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
revokeSecret
Revoke a secret associated with this account's main API key.- Parameters:
secretId- The id of the secret to revoke.- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.- Since:
- 7.9.0
-
revokeSecret
Revoke a secret associated with a specific API key.- Parameters:
apiKey- The API key that the secret is associated to.secretId- The id of the secret to revoke.- Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
updateSmsIncomingUrl
Updates the account-level incoming SMS URL, as used by the SMS API.- Parameters:
url- The URL where Vonage will send a webhook when an incoming SMS is received when a number-specific URL is not configured. Set to an empty string to unset the value.- Returns:
- A
SettingsResponsecontaining the newly-updated account settings. - Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
updateDeliveryReceiptUrl
Updates the account-level delivery receipt URL (mainly used by the SMS API).- Parameters:
url- The URL where Vonage will send a webhook when an incoming SMS is received when a number-specific URL is not configured. Set to an empty string to unset the value.- Returns:
- A
SettingsResponsecontaining the newly-updated account settings. - Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
updateSettings
@Deprecated public SettingsResponse updateSettings(SettingsRequest request) throws AccountResponseException Deprecated.UseupdateSmsIncomingUrl(String)orupdateDeliveryReceiptUrl(String)instead.Updates the account-level settings.- Parameters:
request- TheSettingsRequestcontaining the fields to update.- Returns:
- A
SettingsResponsecontaining the newly-updated account settings. - Throws:
AccountResponseException- If there was an error making the request or retrieving the response.
-
updateSmsIncomingUrl(String)orupdateDeliveryReceiptUrl(String)instead.