public abstract class BranchRemoteInterface
extends java.lang.Object
Abstract class for Branch remote interface. This class provides the abstraction layer for network operations between
Branch SDK and remote Branch servers. Extend this class for creating custom network interface.
Class provide abstract method for implementing RESTful requests to Branch server
see doRestfulGet(String)
doRestfulPost(String, JSONObject)
BranchRemoteInterface.BranchResponse
BranchRemoteInterface.BranchRemoteException
Modifier and Type | Class and Description |
---|---|
static class |
BranchRemoteInterface.BranchRemoteException
Exception thrown when there is an error while doing a restful operation with Branch Remote server
see
doRestfulGet(String) and doRestfulPost(String, JSONObject) |
static class |
BranchRemoteInterface.BranchResponse
Class for providing result of RESTful operation against Branch Remote server
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
RETRY_NUMBER
Key for adding retry numbers for the request.
|
Constructor and Description |
---|
BranchRemoteInterface() |
Modifier and Type | Method and Description |
---|---|
abstract BranchRemoteInterface.BranchResponse |
doRestfulGet(java.lang.String url)
Abstract method to implement the network layer to do a RESTful GET to Branch servers.
|
abstract BranchRemoteInterface.BranchResponse |
doRestfulPost(java.lang.String url,
org.json.JSONObject payload)
Abstract method to implement the network layer to do a RESTful GET to Branch servers.
|
static BranchRemoteInterface |
getDefaultBranchRemoteInterface(android.content.Context context) |
ServerResponse |
make_restful_get(java.lang.String url,
org.json.JSONObject params,
java.lang.String tag,
java.lang.String branchKey)
Method for handling the RESTful POST operations to Branch Servers.
|
ServerResponse |
make_restful_post(org.json.JSONObject body,
java.lang.String url,
java.lang.String tag,
java.lang.String branchKey)
Method for handling the RESTful POST operations to Branch Servers.
|
public static final java.lang.String RETRY_NUMBER
public abstract BranchRemoteInterface.BranchResponse doRestfulGet(java.lang.String url) throws BranchRemoteInterface.BranchRemoteException
Abstract method to implement the network layer to do a RESTful GET to Branch servers. This method is called whenever Branch SDK want to make a GET request to Branch servers. Please note that this methods always called on the background thread and no need for thread switching for the network operations.
url
- The url end pointBranchRemoteInterface.BranchResponse
with the get result data and http status codeBranchRemoteInterface.BranchRemoteException
- Branch remote exception is thrown when there is an error in communicating to the Branch servers
BranchRemoteException contains the corresponding BranchError code for the error BranchError.ERR_BRANCH_NO_CONNECTIVITY
| BranchError.ERR_BRANCH_REQ_TIMED_OUT
see BranchRemoteInterface.BranchRemoteException
BranchRemoteInterface.BranchResponse
NOTE: For better debugging purpose conside adding RETRY_NUMBER
as a query params if you implement multiple retries for your request
public abstract BranchRemoteInterface.BranchResponse doRestfulPost(java.lang.String url, org.json.JSONObject payload) throws BranchRemoteInterface.BranchRemoteException
Abstract method to implement the network layer to do a RESTful GET to Branch servers. This method is called whenever Branch SDK want to make a GET request to Branch servers. Please note that this methods always called on the background thread and no need for thread switching to execute network operations.
url
- The url end pointpayload
- The JSon object payload for the post requestBranchRemoteInterface.BranchResponse
with the get result data and http status codeBranchRemoteInterface.BranchRemoteException
- Branch remote exception is thrown when there is an error in communicating to the Branch servers
BranchRemoteException contains the corresponding BranchError code for the error BranchError.ERR_BRANCH_NO_CONNECTIVITY
| BranchError.ERR_BRANCH_REQ_TIMED_OUT
see BranchRemoteInterface.BranchRemoteException
BranchRemoteInterface.BranchResponse
NOTE: For better debugging purpose conside adding RETRY_NUMBER
as a JSon keyvalue if you implement multiple retries for your request
public final ServerResponse make_restful_get(java.lang.String url, org.json.JSONObject params, java.lang.String tag, java.lang.String branchKey)
doRestfulGet(String)
url
- The url end pointparams
- with parameters to the GET call
tag
- String
Tag for identifying the request for analytical or debugging purposebranchKey
- String
Branch keyServerResponse
object representing the result of RESTful GET to Branch Serverpublic final ServerResponse make_restful_post(org.json.JSONObject body, java.lang.String url, java.lang.String tag, java.lang.String branchKey)
doRestfulPost(String, JSONObject)
url
- The url end pointbody
- with parameters to the POST call
tag
- String
Tag for identifying the request for analytical or debugging purposebranchKey
- String
Branch keyServerResponse
object representing the result of RESTful POST to Branch Serverpublic static final BranchRemoteInterface getDefaultBranchRemoteInterface(android.content.Context context)