send
Request
fun sendRequest(request: () -> JSONObject, onResponse: (JsonHelper) -> Unit, onConnectionError: (JsonHelper) -> Unit? = null)
Function to execute and manage the response of a request
Parameters
request
: the request to execute
on Response
: the action to execute when a response is returned from the backend
on Connection Error
: the action to execute if the request has been failed for a connection error
fun sendRequest(request: () -> JSONObject, onSuccess: (JsonHelper) -> Unit, onFailure: (JsonHelper) -> Unit, onConnectionError: (JsonHelper) -> Unit? = null)
Function to execute and manage the response of a request
Parameters
request
: the request to execute
on Success
: the action to execute if the request has been successful
on Failure
: the action to execute if the request has been failed
on Connection Error
: the action to execute if the request has been failed for a connection error