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
LiRestResponseExceptionpublic Gson getGson()
public LiBaseResponse processSync(LiBaseRestRequest baseRestRequest) throws LiRestResponseException
baseRestRequest - LiBaseRestRequestLiBaseResponseLiRestResponseException - LiRestResponseExceptionpublic void processAsync(LiBaseRestRequest baseRestRequest, LiAsyncRequestCallback callback)
baseRestRequest - LiBaseRestRequestcallback - LiAsyncRequestCallbackpublic void uploadImageProcessAsync(LiBaseRestRequest baseRestRequest, LiAsyncRequestCallback callback, java.lang.String imagePath, java.lang.String imageName, java.lang.String requestBody)
baseRestRequest - LiBaseRestRequestcallback - LiAsyncRequestCallbackimagePath - 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 - LiBaseRestRequestpublic java.lang.String asString(LiBaseResponse response) throws java.io.IOException
java.io.IOExceptionpublic byte[] asBytes(LiBaseResponse response) throws java.io.IOException
java.io.IOExceptionpublic org.json.JSONObject asJSONObject(LiBaseResponse response) throws org.json.JSONException, java.io.IOException
org.json.JSONExceptionjava.io.IOExceptionpublic byte[] consume(LiBaseResponse response) throws java.io.IOException
java.io.IOException