Package com.hyperwallet.clientsdk.util
Class HyperwalletApiClient
- java.lang.Object
-
- com.hyperwallet.clientsdk.util.HyperwalletApiClient
-
public class HyperwalletApiClient extends Object
The Hyperwallet API Client
-
-
Constructor Summary
Constructors Constructor Description HyperwalletApiClient(String username, String password, String version, HyperwalletEncryption hyperwalletEncryption, int connectionTimeout, int readTimeout)Create a instance of the API client
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckErrorResponse(cc.protea.util.http.Response response)Evaluates theResponsecontains Api Server error when HTTP status from 4.x.x and raiseHyperwalletException<T> Tget(String url, com.fasterxml.jackson.core.type.TypeReference<T> type)Perform a GET call to the Hyperwallet API server<T> Tget(String url, Class<T> type)Perform a GET call to the Hyperwallet API serverProxygetProxy()Returns Proxy setting for AuthenticationStringgetProxyPassword()Returns Proxy Password for AuthenticationStringgetProxyUsername()Returns Proxy Username for Authentication<T> Tpost(String url, Object bodyObject, Class<T> type)Perform a POST call to the Hyperwallet API server to uploadObject<T> Tpost(String url, Object bodyObject, Class<T> type, HashMap<String,String> header)Perform a POST call to the Hyperwallet API server to uploadObject<T> Tput(String url, Multipart uploadData, Class<T> type)Perform a PUT call to the Hyperwallet API server to uploadMultipart<T> Tput(String url, Object bodyObject, Class<T> type)Perform a PUT call to the Hyperwallet API server to uploadObjectvoidsetProxy(String url, Integer port)Create Proxy setting for API Client instancevoidsetProxy(Proxy proxy)Create Proxy setting for API Client instancevoidsetProxyPassword(String proxyPassword)Create Proxy Password setting for AuthenticationvoidsetProxyUsername(String proxyUsername)Create Proxy Username for AuthenticationBooleanusesProxy()Checks if current API Client instance uses a proxy
-
-
-
Constructor Detail
-
HyperwalletApiClient
public HyperwalletApiClient(String username, String password, String version, HyperwalletEncryption hyperwalletEncryption, int connectionTimeout, int readTimeout)
Create a instance of the API client- Parameters:
username- the API usernamepassword- the API passwordversion- the SDK versionhyperwalletEncryption- theHyperwalletEncryptionconnectionTimeout- the timeout value that will be used for making new connections to the Hyperwallet API (in milliseconds).readTimeout- the timeout value that will be used when reading data from an established connection to the Hyperwallet API (in milliseconds).
-
-
Method Detail
-
get
public <T> T get(String url, Class<T> type)
Perform a GET call to the Hyperwallet API server- Type Parameters:
T- Response class type- Parameters:
url- The api endpoint to calltype- The response class type- Returns:
- an instance of response class type
-
get
public <T> T get(String url, com.fasterxml.jackson.core.type.TypeReference<T> type)
Perform a GET call to the Hyperwallet API server- Type Parameters:
T- Response class type- Parameters:
url- The api endpoint to calltype- The responseTypeReferencetype- Returns:
- an instance of
TypeReference
-
put
public <T> T put(String url, Multipart uploadData, Class<T> type)
Perform a PUT call to the Hyperwallet API server to uploadMultipart- Type Parameters:
T- Response class type- Parameters:
url- The api endpoint to calluploadData- TheMultiparttype- The response class type- Returns:
- an instance of response class type
-
put
public <T> T put(String url, Object bodyObject, Class<T> type)
Perform a PUT call to the Hyperwallet API server to uploadObject- Type Parameters:
T- Response class type- Parameters:
url- The api endpoint to callbodyObject- TheObjectbodytype- The response class type- Returns:
- an instance of response class type
-
post
public <T> T post(String url, Object bodyObject, Class<T> type)
Perform a POST call to the Hyperwallet API server to uploadObject- Type Parameters:
T- Response class type- Parameters:
url- The api endpoint to callbodyObject- TheObjectbodytype- The response class type- Returns:
- an instance of response class type
-
post
public <T> T post(String url, Object bodyObject, Class<T> type, HashMap<String,String> header)
Perform a POST call to the Hyperwallet API server to uploadObject- Type Parameters:
T- Response class type- Parameters:
url- The api endpoint to callbodyObject- TheObjectbodytype- The response class typeheader- HTTP header properties- Returns:
- an instance of response class type
-
usesProxy
public Boolean usesProxy()
Checks if current API Client instance uses a proxy- Returns:
- Boolean if client has a proxy config
-
setProxy
public void setProxy(String url, Integer port)
Create Proxy setting for API Client instance- Parameters:
url- url of Proxyport- port of Proxy
-
getProxy
public Proxy getProxy()
Returns Proxy setting for Authentication- Returns:
- Proxy current Proxy config of client
-
setProxy
public void setProxy(Proxy proxy)
Create Proxy setting for API Client instance- Parameters:
proxy- value of Proxy
-
getProxyUsername
public String getProxyUsername()
Returns Proxy Username for Authentication- Returns:
- current ProxyUsername
-
setProxyUsername
public void setProxyUsername(String proxyUsername)
Create Proxy Username for Authentication- Parameters:
proxyUsername- username of Proxy
-
getProxyPassword
public String getProxyPassword()
Returns Proxy Password for Authentication- Returns:
- current ProxyUsername
-
setProxyPassword
public void setProxyPassword(String proxyPassword)
Create Proxy Password setting for Authentication- Parameters:
proxyPassword- username of Proxy
-
checkErrorResponse
protected void checkErrorResponse(cc.protea.util.http.Response response)
Evaluates theResponsecontains Api Server error when HTTP status from 4.x.x and raiseHyperwalletException- Parameters:
response- theResponse- Throws:
HyperwalletException- aHyperwalletException
-
-