kvision / pl.treksoft.kvision.rest / RestClient / call

call

inline fun <reified T : Any> call(url: String, data: dynamic = null, method: HttpMethod = HttpMethod.GET, contentType: String = "application/json", noinline beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null, noinline transform: ((dynamic) -> dynamic)? = null): Promise<T>

Helper inline function to automatically get deserializer for the result value with dynamic data.

Parameters

url - an URL address

data - data to be sent

method - a HTTP method

contentType - a content type of the request

beforeSend - a content type of the request

transform - a function to transform the result of the call

Return
a promise of the result

inline fun <reified V : Any> call(url: String, data: V, method: HttpMethod = HttpMethod.GET, contentType: String = "application/json", noinline beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null): Promise<dynamic>

Helper inline function to automatically get serializer for the data.

Parameters

url - an URL address

data - data to be sent

method - a HTTP method

contentType - a content type of the request

beforeSend - a content type of the request

Return
a promise of the result

inline fun <T : Any, reified V : Any> call(url: String, data: V, deserializer: DeserializationStrategy<T>, method: HttpMethod = HttpMethod.GET, contentType: String = "application/json", noinline beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null, noinline transform: ((dynamic) -> dynamic)? = null): Promise<T>

Helper inline function to automatically get serializer for the data.

Parameters

url - an URL address

data - data to be sent

deserializer - a deserializer for the result value

method - a HTTP method

contentType - a content type of the request

beforeSend - a content type of the request

transform - a function to transform the result of the call

Return
a promise of the result

inline fun <reified T : Any, V : Any> call(url: String, serializer: SerializationStrategy<V>, data: V, method: HttpMethod = HttpMethod.GET, contentType: String = "application/json", noinline beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null, noinline transform: ((dynamic) -> dynamic)? = null): Promise<T>

Helper inline function to automatically deserializer for the result value with typed data.

Parameters

url - an URL address

serializer - for the data

data - data to be sent

method - a HTTP method

contentType - a content type of the request

beforeSend - a content type of the request

transform - a function to transform the result of the call

Return
a promise of the result

inline fun <reified T : Any, reified V : Any> call(url: String, data: V, method: HttpMethod = HttpMethod.GET, contentType: String = "application/json", noinline beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null, noinline transform: ((dynamic) -> dynamic)? = null): Promise<T>

Helper inline function to automatically get serializer for the data and deserializer for the result value.

Parameters

url - an URL address

data - data to be sent

method - a HTTP method

contentType - a content type of the request

beforeSend - a content type of the request

transform - a function to transform the result of the call

Return
a promise of the result