public class FigoApi extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
API_FIGO_LIVE |
protected static String |
API_FIGO_STAGE |
| Constructor and Description |
|---|
FigoApi(String authorization,
int timeout) |
FigoApi(String apiEndpoint,
String authorization,
int timeout) |
| Modifier and Type | Method and Description |
|---|---|
protected com.google.gson.Gson |
createGson()
Instantiate the GSON class.
|
String |
getApiEndpoint() |
int |
getTimeout()
The timeout used for queries.
|
protected <T> T |
handleResponse(InputStream stream,
Type typeOfT)
Handle the response of a request by decoding its JSON payload
|
protected <T> T |
processResponse(HttpURLConnection connection,
Type typeOfT)
Method to process the response.
|
<T> T |
queryApi(String path,
Object data,
String method,
Type typeOfT)
Helper method for making a OAuth2-compliant API call
|
void |
setProxy(Proxy proxy) |
void |
setTimeout(int timeout) |
void |
setTrustManager(X509TrustManager trustManager) |
protected void |
setupTrustManager(HttpURLConnection connection,
X509TrustManager trustManager)
Method to configure TrustManager.
|
protected static final String API_FIGO_LIVE
protected static final String API_FIGO_STAGE
public FigoApi(String apiEndpoint, String authorization, int timeout)
apiEndpoint - authorization - timeout - public FigoApi(String authorization, int timeout)
public void setTrustManager(X509TrustManager trustManager)
public void setProxy(Proxy proxy)
public <T> T queryApi(String path, Object data, String method, Type typeOfT) throws IOException, FigoException
T - Type of expected responsepath - path on the server to calldata - Payload of the requestmethod - the HTTP verb to usetypeOfT - Type of expected responseFigoException - Base class for all figoExceptionsIOException - IOExceptionprotected void setupTrustManager(HttpURLConnection connection, X509TrustManager trustManager) throws IOException
connection - IOException - IOExceptionprotected <T> T processResponse(HttpURLConnection connection, Type typeOfT) throws IOException, FigoException
T - connection - typeOfT - FigoException - Base class for all figoExceptionsIOException - IOExceptionprotected <T> T handleResponse(InputStream stream, Type typeOfT)
stream - Stream containing the JSON datatypeOfT - Type of the data to be expectedprotected com.google.gson.Gson createGson()
public String getApiEndpoint()
public int getTimeout()
public void setTimeout(int timeout)
timeout - the timeout used for queriesCopyright © 2018 figo GmbH. All rights reserved.