kvision / pl.treksoft.kvision.remote / CallAgent

CallAgent

open class CallAgent

An agent responsible for remote calls.

Constructors

<init>

CallAgent()

An agent responsible for remote calls.

Functions

call

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

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

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

Helper inline function to automatically get serializer for the data.

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

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

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

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

jsonRpcCall

fun jsonRpcCall(url: String, data: List<String?> = listOf(), method: HttpMethod = HttpMethod.POST): Promise<String>

Makes an JSON-RPC call to the remote server.

remoteCall

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

Makes a remote call to the remote server.

Extension Functions

createInstance

fun <T> Any?.createInstance(vararg args: dynamic): T

Helper function for creating JavaScript objects from dynamic constructors.