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

onResponse

: the action to execute when a response is returned from the backend

onConnectionError

: 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

onSuccess

: the action to execute if the request has been successful

onFailure

: the action to execute if the request has been failed

onConnectionError

: the action to execute if the request has been failed for a connection error