public class ApiClient extends Object
| Constructor and Description |
|---|
ApiClient(String appId,
Credentials credentials)
ApiClient constructor.
|
ApiClient(String appId,
Credentials credentials,
String agentString)
ApiClient Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
call(String method,
String url,
Object obj,
com.fasterxml.jackson.core.type.TypeReference<T> valueType,
boolean auth)
call is used to make a API call.
|
<T> T |
callWithAuth(String method,
String endpoint,
Object obj,
com.fasterxml.jackson.core.type.TypeReference<T> valueType)
callWithAuth is used to make requests that require Authentication on
CoScale API.
|
String |
getApiPath()
getApiPath is used to get the API path.
|
String |
getApiVersion()
getApiVersion is used to get the API version which will be used to build
the request URL.
|
String |
getAppRequestURL(String endpoint)
getAppRequestURL will construct the URL for a request using the end point
provided.
|
String |
getBaseURL()
getBaseURL is used to get the CoScale API domain.
|
int |
getConnectionTimeout()
return the default connection timeout in ms.
|
int |
getDeserializationExceptions()
getDeserializationExceptions is used to get the number of JSON
deserialization errors.
|
String |
getGlobalRequestURL(String endpoint)
getGlobalRequestURL will construct the URL for a request using the end
point provided.
|
int |
getReadTimeout()
return the default read timeout in ms.
|
String |
getRequesUrl(String endpoint,
Options options,
boolean globalApi)
getRequesUrl will build the URL for a request using the end point
provided.
|
static String |
getSource()
Get the SOURCE String which mark the created resources.
|
void |
setBaseURL(String url)
setBaseURL is used to set a new API base URL.
|
void |
setConnectionTimeout(int timeout)
Change the default connection timeout.
|
void |
setReadTimeout(int timeout)
Change the default read timeout.
|
void |
setSource(String source)
Set the Source String which mark the created resources.
|
public ApiClient(String appId, Credentials credentials)
appId - The CoScale Application id.credentials - Api authentication informations.public ApiClient(String appId, Credentials credentials, String agentString)
appId - The CoScale Application id.credentials - API authentication informations.agentString - HTTP "User-Agent" headerpublic String getApiPath()
public String getApiVersion()
public String getBaseURL()
public void setBaseURL(String url)
url - public int getConnectionTimeout()
public void setConnectionTimeout(int timeout)
timeout - in ms.public int getReadTimeout()
public void setReadTimeout(int timeout)
timeout - in ms.public static String getSource()
public void setSource(String source)
source - public int getDeserializationExceptions()
public <T> T callWithAuth(String method, String endpoint, Object obj, com.fasterxml.jackson.core.type.TypeReference<T> valueType) throws IOException
method - request HTTP method.endpoint - The url for the request.obj - object with data for the request. This parameter can be null.valueType - is the type expected.IOExceptionpublic <T> T call(String method, String url, Object obj, com.fasterxml.jackson.core.type.TypeReference<T> valueType, boolean auth) throws IOException
method - request HTTP method.url - for the request.obj - object with data for the request. This parameter can be null.valueType - is the type expected.IOExceptionpublic String getAppRequestURL(String endpoint)
endpoint - String representing the API end point of the request.public String getGlobalRequestURL(String endpoint)
endpoint - String representing the API end point of the request.public String getRequesUrl(String endpoint, Options options, boolean globalApi)
endpoint - String representing the API end point of the request.options - Optional query parametersglobalApi - if is set true, application Id will not be include into URL.Copyright © 2016. All rights reserved.