Package com.nexmo.client.numbers
Class NumbersClient
- java.lang.Object
-
- com.nexmo.client.numbers.NumbersClient
-
public class NumbersClient extends java.lang.Object
A client for accessing the Nexmo API calls that manage phone numbers.
-
-
Constructor Summary
Constructors Constructor Description NumbersClient(HttpWrapper httpWrapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuyNumber(java.lang.String country, java.lang.String msisdn)Start renting a Nexmo Virtual Number.voidcancelNumber(java.lang.String country, java.lang.String msisdn)Stop renting a Nexmo Virtual Number.voidlinkNumber(java.lang.String msisdn, java.lang.String country, java.lang.String appId)Link a given Nexmo Virtual Number to a Nexmo 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 Nexmo Virtual Numbers.SearchNumbersResponsesearchNumbers(java.lang.String country)Search for available Nexmo Virtual Numbers.voidupdateNumber(UpdateNumberRequest request)Update the callbacks and/or application associations for a given Nexmo Virtual Number.
-
-
-
Constructor Detail
-
NumbersClient
public NumbersClient(HttpWrapper httpWrapper)
-
-
Method Detail
-
listNumbers
public ListNumbersResponse listNumbers() throws NexmoResponseParseException, NexmoClientException
Get the first page of phone numbers assigned to the authenticated account.- Returns:
- A ListNumbersResponse containing the first 10 phone numbers
- Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if an error is returned by the server.
-
listNumbers
public ListNumbersResponse listNumbers(ListNumbersFilter filter) throws NexmoResponseParseException, NexmoClientException
Get 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:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if an error is returned by the server.
-
searchNumbers
public SearchNumbersResponse searchNumbers(java.lang.String country) throws NexmoResponseParseException, NexmoClientException
Search for available Nexmo Virtual Numbers.- Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if an error is returned by the server.
-
searchNumbers
public SearchNumbersResponse searchNumbers(SearchNumbersFilter filter) throws NexmoResponseParseException, NexmoClientException
Search for available Nexmo Virtual Numbers.- Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if an error is returned by the server.
-
buyNumber
public void buyNumber(java.lang.String country, java.lang.String msisdn) throws NexmoResponseParseException, NexmoClientException
Start renting a Nexmo Virtual Number.- Parameters:
country- A String containing a 2-character ISO country code.msisdn- The phone number to be bought.- Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if an error is returned by the server.
-
cancelNumber
public void cancelNumber(java.lang.String country, java.lang.String msisdn) throws NexmoResponseParseException, NexmoClientException
Stop renting a Nexmo Virtual Number.- Parameters:
country- A String containing a 2-character ISO country code.msisdn- The phone number to be cancelled.- Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if an error is returned by the server.
-
updateNumber
public void updateNumber(UpdateNumberRequest request) throws NexmoResponseParseException, NexmoClientException
Update the callbacks and/or application associations for a given Nexmo Virtual Number.- Parameters:
request- Details of the updates to be made to the number association.- Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- 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 NexmoResponseParseException, NexmoClientException
Link a given Nexmo Virtual Number to a Nexmo Application with the given ID.- Parameters:
msisdn- The Nexmo Virtual Number to be updated.country- The country for the given msisdn.appId- The ID for the Nexmo Application to be associated with the number.- Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if an error is returned by the server.
-
-