Package com.nexmo.client.insight
Class InsightClient
- java.lang.Object
-
- com.nexmo.client.AbstractClient
-
- com.nexmo.client.insight.InsightClient
-
public class InsightClient extends AbstractClient
A client for talking to the Nexmo Number Insight API. The standard way to obtain an instance of this class is to useNexmoClient.getInsightClient().
-
-
Field Summary
Fields Modifier and Type Field Description protected com.nexmo.client.insight.AdvancedInsightEndpointadvancedprotected com.nexmo.client.insight.BasicInsightEndpointbasicprotected com.nexmo.client.insight.StandardInsightEndpointstandard-
Fields inherited from class com.nexmo.client.AbstractClient
httpWrapper
-
-
Constructor Summary
Constructors Constructor Description InsightClient(HttpWrapper httpWrapper)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AdvancedInsightResponsegetAdvancedNumberInsight(AdvancedInsightRequest advancedInsightRequest)Perform an Advanced Insight Request with aAdvancedInsightRequest.AdvancedInsightResponsegetAdvancedNumberInsight(java.lang.String number)Perform an Advanced Insight Request with a number.AdvancedInsightResponsegetAdvancedNumberInsight(java.lang.String number, java.lang.String country)Perform an Advanced Insight Request with a number and country.AdvancedInsightResponsegetAdvancedNumberInsight(java.lang.String number, java.lang.String country, java.lang.String ipAddress)Deprecated.Create aAdvancedInsightRequestand usegetAdvancedNumberInsight(AdvancedInsightRequest)AdvancedInsightResponsegetAdvancedNumberInsight(java.lang.String number, java.lang.String country, java.lang.String ipAddress, boolean cnam)Deprecated.Create aAdvancedInsightRequestand usegetAdvancedNumberInsight(AdvancedInsightRequest)BasicInsightResponsegetBasicNumberInsight(BasicInsightRequest basicInsightRequest)Perform a Basic Insight Request with aBasicInsightRequest.BasicInsightResponsegetBasicNumberInsight(java.lang.String number)Perform a Basic Insight Request with a number.BasicInsightResponsegetBasicNumberInsight(java.lang.String number, java.lang.String country)Perform a Basic Insight Request with a number and country.StandardInsightResponsegetStandardNumberInsight(StandardInsightRequest standardInsightRequest)Perform a Standard Insight Request with aStandardInsightRequest.StandardInsightResponsegetStandardNumberInsight(java.lang.String number)Perform a Standard Insight Request with a number.StandardInsightResponsegetStandardNumberInsight(java.lang.String number, java.lang.String country)Perform a Standard Insight Request with a number and country.StandardInsightResponsegetStandardNumberInsight(java.lang.String number, java.lang.String country, boolean cnam)Deprecated.Create aStandardInsightRequestand usegetStandardNumberInsight(StandardInsightRequest)
-
-
-
Constructor Detail
-
InsightClient
public InsightClient(HttpWrapper httpWrapper)
Constructor.- Parameters:
httpWrapper- (required) shared HTTP wrapper object used for making REST calls.
-
-
Method Detail
-
getBasicNumberInsight
public BasicInsightResponse getBasicNumberInsight(java.lang.String number) throws NexmoResponseParseException, NexmoClientException
Perform a Basic Insight Request with a number.- Parameters:
number- A single phone number that you need insight about in national or international format.- Returns:
- A
BasicInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getBasicNumberInsight
public BasicInsightResponse getBasicNumberInsight(java.lang.String number, java.lang.String country) throws NexmoResponseParseException, NexmoClientException
Perform a Basic Insight Request with a number and country.- Parameters:
number- A single phone number that you need insight about in national or international formatcountry- If a number does not have a country code or it is uncertain, set the two-character country code.- Returns:
- A
BasicInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getBasicNumberInsight
public BasicInsightResponse getBasicNumberInsight(BasicInsightRequest basicInsightRequest) throws NexmoResponseParseException, NexmoClientException
Perform a Basic Insight Request with aBasicInsightRequest.- Parameters:
basicInsightRequest- A request object containing the details of the request to make.- Returns:
- A
BasicInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getStandardNumberInsight
public StandardInsightResponse getStandardNumberInsight(java.lang.String number) throws NexmoResponseParseException, NexmoClientException
Perform a Standard Insight Request with a number.- Parameters:
number- A single phone number that you need insight about in national or international format.- Returns:
- A
StandardInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getStandardNumberInsight
public StandardInsightResponse getStandardNumberInsight(java.lang.String number, java.lang.String country) throws NexmoResponseParseException, NexmoClientException
Perform a Standard Insight Request with a number and country.- Parameters:
number- A single phone number that you need insight about in national or international format.country- If a number does not have a country code or it is uncertain, set the two-character country code.- Returns:
- A
StandardInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getStandardNumberInsight
@Deprecated public StandardInsightResponse getStandardNumberInsight(java.lang.String number, java.lang.String country, boolean cnam) throws NexmoResponseParseException, NexmoClientException
Deprecated.Create aStandardInsightRequestand usegetStandardNumberInsight(StandardInsightRequest)Perform a Standard Insight Request with a number, country, and cnam.- Parameters:
number- A single phone number that you need insight about in national or international format.country- If a number does not have a country code or it is uncertain, set the two-character country code.cnam- Indicates if the name of the person who owns the phone number should also be looked up and returned. Set to true to receive phone number owner name in the response. This is only available for US numbers and incurs an additional charge.- Returns:
- A
StandardInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getStandardNumberInsight
public StandardInsightResponse getStandardNumberInsight(StandardInsightRequest standardInsightRequest) throws NexmoResponseParseException, NexmoClientException
Perform a Standard Insight Request with aStandardInsightRequest.- Parameters:
standardInsightRequest- A request object containing the details of the request to make.- Returns:
- A
StandardInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getAdvancedNumberInsight
public AdvancedInsightResponse getAdvancedNumberInsight(java.lang.String number) throws NexmoResponseParseException, NexmoClientException
Perform an Advanced Insight Request with a number.- Parameters:
number- A single phone number that you need insight about in national or international format.- Returns:
- A
AdvancedInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getAdvancedNumberInsight
public AdvancedInsightResponse getAdvancedNumberInsight(java.lang.String number, java.lang.String country) throws NexmoResponseParseException, NexmoClientException
Perform an Advanced Insight Request with a number and country.- Parameters:
number- A single phone number that you need insight about in national or international format.country- If a number does not have a country code or it is uncertain, set the two-character country code.- Returns:
- A
AdvancedInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getAdvancedNumberInsight
@Deprecated public AdvancedInsightResponse getAdvancedNumberInsight(java.lang.String number, java.lang.String country, java.lang.String ipAddress) throws NexmoResponseParseException, NexmoClientException
Deprecated.Create aAdvancedInsightRequestand usegetAdvancedNumberInsight(AdvancedInsightRequest)Perform an Advanced Insight Request with a number, country, and ipAddress.- Parameters:
number- A single phone number that you need insight about in national or international format.country- If a number does not have a country code or it is uncertain, set the two-character country code.ipAddress- The IP address of the user. If supplied, we will compare this to the country the user's phone is located in and return an error if it does not match.- Returns:
- A
AdvancedInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getAdvancedNumberInsight
@Deprecated public AdvancedInsightResponse getAdvancedNumberInsight(java.lang.String number, java.lang.String country, java.lang.String ipAddress, boolean cnam) throws NexmoResponseParseException, NexmoClientException
Deprecated.Create aAdvancedInsightRequestand usegetAdvancedNumberInsight(AdvancedInsightRequest)Perform an Advanced Insight Request with a number, country, ipAddress, and cnam.- Parameters:
number- A single phone number that you need insight about in national or international format.country- If a number does not have a country code or it is uncertain, set the two-character country code.ipAddress- The IP address of the user. If supplied, we will compare this to the country the user's phone is located in and return an error if it does not match.cnam- Indicates if the name of the person who owns the phone number should also be looked up and returned. Set to true to receive phone number owner name in the response. This is only available for US numbers and incurs an additional charge.- Returns:
- A
AdvancedInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
getAdvancedNumberInsight
public AdvancedInsightResponse getAdvancedNumberInsight(AdvancedInsightRequest advancedInsightRequest) throws NexmoResponseParseException, NexmoClientException
Perform an Advanced Insight Request with aAdvancedInsightRequest.- Parameters:
advancedInsightRequest- A request object containing the details of the request to make.- Returns:
- A
AdvancedInsightResponserepresenting the response from the Nexmo Number Insight API. - Throws:
NexmoResponseParseException- if the response from the API could not be parsed.NexmoClientException- if there was a problem with the Nexmo request or response objects.
-
-