Package com.vonage.client.numbers
Class NumbersClient
java.lang.Object
com.vonage.client.numbers.NumbersClient
public class NumbersClient extends java.lang.Object
A client for accessing the Vonage API calls that manage phone numbers.
-
Constructor Summary
Constructors Constructor Description NumbersClient(HttpWrapper httpWrapper) -
Method Summary
Modifier and Type Method Description voidbuyNumber(java.lang.String country, java.lang.String msisdn)Start renting a Vonage Virtual Number.voidcancelNumber(java.lang.String country, java.lang.String msisdn)Stop renting a Vonage Virtual Number.voidlinkNumber(java.lang.String msisdn, java.lang.String country, java.lang.String appId)Link a given Vonage Virtual Number to a Vonage Application with the given ID.ListNumbersResponselistNumbers()Get the first page of phone numbers assigned to the authenticated account.ListNumbersResponselistNumbers(ListNumbersFilter filter)Get a filtered set of numbers assigned to the authenticated account.SearchNumbersResponsesearchNumbers(SearchNumbersFilter filter)Search for available Vonage Virtual Numbers.SearchNumbersResponsesearchNumbers(java.lang.String country)Search for available Vonage Virtual Numbers.voidupdateNumber(UpdateNumberRequest request)Update the callbacks and/or application associations for a given Vonage Virtual Number.
-
Constructor Details
-
Method Details
-
listNumbers
Get the first page of phone numbers assigned to the authenticated account.- Returns:
- A ListNumbersResponse containing the first 10 phone numbers
- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-
listNumbers
public ListNumbersResponse listNumbers(ListNumbersFilter filter) throws VonageResponseParseException, VonageClientExceptionGet a filtered set of numbers assigned to the authenticated account.- Parameters:
filter- A ListNumbersFilter describing the filters to be applied to the request.- Returns:
- A ListNumbersResponse containing phone numbers matching the supplied filter.
- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-
searchNumbers
public SearchNumbersResponse searchNumbers(java.lang.String country) throws VonageResponseParseException, VonageClientExceptionSearch for available Vonage Virtual Numbers.- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-
searchNumbers
public SearchNumbersResponse searchNumbers(SearchNumbersFilter filter) throws VonageResponseParseException, VonageClientExceptionSearch for available Vonage Virtual Numbers.- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-
buyNumber
public void buyNumber(java.lang.String country, java.lang.String msisdn) throws VonageResponseParseException, VonageClientExceptionStart renting a Vonage Virtual Number.- Parameters:
country- A String containing a 2-character ISO country code.msisdn- The phone number to be bought.- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-
cancelNumber
public void cancelNumber(java.lang.String country, java.lang.String msisdn) throws VonageResponseParseException, VonageClientExceptionStop renting a Vonage Virtual Number.- Parameters:
country- A String containing a 2-character ISO country code.msisdn- The phone number to be cancelled.- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-
updateNumber
public void updateNumber(UpdateNumberRequest request) throws VonageResponseParseException, VonageClientExceptionUpdate the callbacks and/or application associations for a given Vonage Virtual Number.- Parameters:
request- Details of the updates to be made to the number association.- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-
linkNumber
public void linkNumber(java.lang.String msisdn, java.lang.String country, java.lang.String appId) throws VonageResponseParseException, VonageClientExceptionLink a given Vonage Virtual Number to a Vonage Application with the given ID.- Parameters:
msisdn- The Vonage Virtual Number to be updated.country- The country for the given msisdn.appId- The ID for the Vonage Application to be associated with the number.- Throws:
VonageResponseParseException- if the response from the API could not be parsed.VonageClientException- if an error is returned by the server.
-