public class WebAPI
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
WebAPI.WebAPIRequestException
Thrown when WebAPI request fails (non success response code).
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_BASE_ADDRESS |
| Constructor and Description |
|---|
WebAPI(okhttp3.OkHttpClient httpClient,
java.lang.String baseAddress,
java.lang.String _interface,
java.lang.String webAPIKey) |
| Modifier and Type | Method and Description |
|---|---|
KeyValue |
call(java.lang.String function)
Manually calls the specified Web API function with the provided details.
|
void |
call(java.lang.String function,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
Manually calls the specified Web API function with the provided details.
|
KeyValue |
call(java.lang.String function,
int version)
Manually calls the specified Web API function with the provided details.
|
void |
call(java.lang.String function,
int version,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
Manually calls the specified Web API function with the provided details.
|
KeyValue |
call(java.lang.String function,
int version,
java.util.Map<java.lang.String,java.lang.String> parameters)
Manually calls the specified Web API function with the provided details.
|
KeyValue |
call(java.lang.String function,
java.util.Map<java.lang.String,java.lang.String> parameters)
Manually calls the specified Web API function with the provided details.
|
void |
call(java.lang.String function,
java.util.Map<java.lang.String,java.lang.String> parameters,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
Manually calls the specified Web API function with the provided details.
|
KeyValue |
call(java.lang.String httpMethod,
java.lang.String function)
Manually calls the specified Web API function with the provided details.
|
void |
call(java.lang.String httpMethod,
java.lang.String function,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
Manually calls the specified Web API function with the provided details.
|
KeyValue |
call(java.lang.String httpMethod,
java.lang.String function,
int version)
Manually calls the specified Web API function with the provided details.
|
void |
call(java.lang.String httpMethod,
java.lang.String function,
int version,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
Manually calls the specified Web API function with the provided details.
|
KeyValue |
call(java.lang.String httpMethod,
java.lang.String function,
int version,
java.util.Map<java.lang.String,java.lang.String> parameters)
Manually calls the specified Web API function with the provided details.
|
void |
call(java.lang.String httpMethod,
java.lang.String function,
int version,
java.util.Map<java.lang.String,java.lang.String> parameters,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
Manually calls the specified Web API function with the provided details.
|
KeyValue |
call(java.lang.String httpMethod,
java.lang.String function,
java.util.Map<java.lang.String,java.lang.String> parameters)
Manually calls the specified Web API function with the provided details.
|
void |
call(java.lang.String httpMethod,
java.lang.String function,
java.util.Map<java.lang.String,java.lang.String> parameters,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
Manually calls the specified Web API function with the provided details.
|
okhttp3.HttpUrl |
getBaseAddress() |
java.lang.String |
getInterface() |
java.lang.String |
getWebAPIKey() |
public static final java.lang.String DEFAULT_BASE_ADDRESS
public WebAPI(okhttp3.OkHttpClient httpClient,
java.lang.String baseAddress,
java.lang.String _interface,
java.lang.String webAPIKey)
public KeyValue call(java.lang.String httpMethod, java.lang.String function, int version, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOException, WebAPI.WebAPIRequestException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.version - The version of the function to call.parameters - A map of string key value pairs representing arguments to be passed to the API.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedWebAPI.WebAPIRequestException - the request was successful but returned a non success response codepublic KeyValue call(java.lang.String function, int version, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOException
function - The function name to call.version - The version of the function to call.parameters - A map of string key value pairs representing arguments to be passed to the API.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedpublic KeyValue call(java.lang.String httpMethod, java.lang.String function, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.parameters - A map of string key value pairs representing arguments to be passed to the API.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedpublic KeyValue call(java.lang.String function, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.io.IOException
function - The function name to call.parameters - A map of string key value pairs representing arguments to be passed to the API.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedpublic KeyValue call(java.lang.String httpMethod, java.lang.String function, int version) throws java.io.IOException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.version - The version of the function to call.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedpublic KeyValue call(java.lang.String function, int version) throws java.io.IOException
function - The function name to call.version - The version of the function to call.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedpublic KeyValue call(java.lang.String httpMethod, java.lang.String function) throws java.io.IOException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedpublic KeyValue call(java.lang.String function) throws java.io.IOException
function - The function name to call.KeyValue object representing the results of the Web API call.java.io.IOException - if the request could not be executedpublic void call(java.lang.String httpMethod,
java.lang.String function,
int version,
java.util.Map<java.lang.String,java.lang.String> parameters,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
throws java.io.IOException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.version - The version of the function to call.parameters - A map of string key value pairs representing arguments to be passed to the API.callback - the callback that will be called with the resulting KeyValue object.error - the callback for handling response errors.java.io.IOException - if the request could not be executedpublic void call(java.lang.String httpMethod,
java.lang.String function,
int version,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
throws java.io.IOException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.version - The version of the function to call.callback - the callback that will be called with the resulting KeyValue object.error - the callback for handling response errors.java.io.IOException - if the request could not be executedpublic void call(java.lang.String httpMethod,
java.lang.String function,
java.util.Map<java.lang.String,java.lang.String> parameters,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
throws java.io.IOException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.parameters - A map of string key value pairs representing arguments to be passed to the API.callback - the callback that will be called with the resulting KeyValue object.error - the callback for handling response errors.java.io.IOException - if the request could not be executedpublic void call(java.lang.String httpMethod,
java.lang.String function,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
throws java.io.IOException
httpMethod - The http request method. Either "POST" or "GET".function - The function name to call.callback - the callback that will be called with the resulting KeyValue object.error - the callback for handling response errors.java.io.IOException - if the request could not be executedpublic void call(java.lang.String function,
int version,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
throws java.io.IOException
function - The function name to call.version - The version of the function to call.callback - the callback that will be called with the resulting KeyValue object.error - the callback for handling response errors.java.io.IOException - if the request could not be executedpublic void call(java.lang.String function,
java.util.Map<java.lang.String,java.lang.String> parameters,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
throws java.io.IOException
function - The function name to call.parameters - A map of string key value pairs representing arguments to be passed to the API.callback - the callback that will be called with the resulting KeyValue object.error - the callback for handling response errors.java.io.IOException - if the request could not be executedpublic void call(java.lang.String function,
Consumer<KeyValue> callback,
Consumer<WebAPI.WebAPIRequestException> error)
throws java.io.IOException
function - The function name to call.callback - the callback that will be called with the resulting KeyValue object.error - the callback for handling response errors.java.io.IOException - if the request could not be executedpublic okhttp3.HttpUrl getBaseAddress()
public java.lang.String getInterface()
public java.lang.String getWebAPIKey()