sendRequest
suspend fun <R : Requester> R.sendRequest( request: suspend R.() -> JsonObject, onResponse: (JsonObject) -> Unit, onConnectionError: (JsonObject) -> Unit? = null)
Method used to execute and handle the response of the request
Parameters
request
The request to execute
onResponse
The callback to execute when a response is returned from the backend
onConnectionError
The callback to execute if the request has been failed for a connection error
suspend fun <R : Requester> R.sendRequest( request: suspend R.() -> JsonObject, onSuccess: (JsonObject) -> Unit, onFailure: (JsonObject) -> Unit, onConnectionError: (JsonObject) -> Unit? = null)
Method used to execute and handle the response of the request
Parameters
request
The request to execute
onSuccess
The callback to execute if the request has been successful
onFailure
The callback to execute if the request has been failed
onConnectionError
The callback to execute if the request has been failed for a connection error