send Paginated Request

fun <R : Requester, T> R.sendPaginatedRequest(request: R.() -> JSONObject, supplier: (JSONObject) -> T, onSuccess: (PaginatedResponse<T>) -> Unit, onFailure: (JsonHelper) -> Unit, onConnectionError: (JsonHelper) -> Unit? = null)

Method to execute and manage the paginated response of a request

Parameters

request

The request to execute

supplier

The supplier Method to instantiate a T item

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

T

generic type of the items in the page response