send Request

fun <R : Requester> R.sendRequest(request: R.() -> JSONObject, onResponse: (JsonHelper) -> Unit, onConnectionError: (JsonHelper) -> Unit? = null)

Method 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 <R : Requester> R.sendRequest(request: R.() -> JSONObject, onSuccess: (JsonHelper) -> Unit, onFailure: (JsonHelper) -> Unit, onConnectionError: (JsonHelper) -> Unit? = null)

Method 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