public abstract class LiRestClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
SERVER_TIMEOUT |
static java.lang.String |
TOKEN_REFRESH_TAG |
Constructor and Description |
---|
LiRestClient() |
Modifier and Type | Method and Description |
---|---|
byte[] |
asBytes(LiBaseResponse response) |
org.json.JSONObject |
asJSONObject(LiBaseResponse response) |
java.lang.String |
asString(LiBaseResponse response) |
protected Request |
buildRequest(LiBaseRestRequest baseRestRequest)
Helper to build okHttp Request from RestRequest
|
byte[] |
consume(LiBaseResponse response)
Fully consume response entity content and closes content stream
Must be called before returning control to the UI thread
|
Gson |
getGson() |
void |
processAsync(LiBaseRestRequest baseRestRequest,
LiAsyncRequestCallback callback)
Makes Async Network call.
|
LiBaseResponse |
processSync(LiBaseRestRequest baseRestRequest)
Makes Sync Network call.
|
void |
uploadImageProcessAsync(LiBaseRestRequest baseRestRequest,
LiAsyncRequestCallback callback,
java.lang.String imagePath,
java.lang.String imageName,
java.lang.String requestBody)
Makes Async Call for uploading an image to the community.
|
public static final java.lang.String TOKEN_REFRESH_TAG
public static final int SERVER_TIMEOUT
public LiRestClient() throws LiRestResponseException
LiRestResponseException
public Gson getGson()
public LiBaseResponse processSync(LiBaseRestRequest baseRestRequest) throws LiRestResponseException
baseRestRequest
- LiBaseRestRequest
LiBaseResponse
LiRestResponseException
- LiRestResponseException
public void processAsync(LiBaseRestRequest baseRestRequest, LiAsyncRequestCallback callback)
baseRestRequest
- LiBaseRestRequest
callback
- LiAsyncRequestCallback
public void uploadImageProcessAsync(LiBaseRestRequest baseRestRequest, LiAsyncRequestCallback callback, java.lang.String imagePath, java.lang.String imageName, java.lang.String requestBody)
baseRestRequest
- LiBaseRestRequest
callback
- LiAsyncRequestCallback
imagePath
- Absolute path of the image file.imageName
- Name of the image file.requestBody
- Request body of image upload API.protected Request buildRequest(LiBaseRestRequest baseRestRequest)
baseRestRequest
- LiBaseRestRequest
public java.lang.String asString(LiBaseResponse response) throws java.io.IOException
java.io.IOException
public byte[] asBytes(LiBaseResponse response) throws java.io.IOException
java.io.IOException
public org.json.JSONObject asJSONObject(LiBaseResponse response) throws org.json.JSONException, java.io.IOException
org.json.JSONException
java.io.IOException
public byte[] consume(LiBaseResponse response) throws java.io.IOException
java.io.IOException