Package io.kvision.remote

A set of components for creating multiplatform automatic JSON-RPC connectivity with a backend server.

A set of components for creating multiplatform automatic JSON-RPC connectivity with a backend server.

A set of components for creating multiplatform automatic JSON-RPC connectivity with a backend server.

Types

CallAgent
Link copied to clipboard
open class CallAgent

An agent responsible for remote calls.

Credentials
Link copied to clipboard
data class Credentials(username: String?, password: String?)

Username and password credentials.

HttpMethod
Link copied to clipboard
enum HttpMethod : Enum<HttpMethod>
IllegalParameterCountException
Link copied to clipboard
class IllegalParameterCountException(actualParameterCount: Int, expectedParamterCount: Int) : RuntimeException
JSON
Link copied to clipboard
object JSON

JSON utility functions

JsonRpcRequest
Link copied to clipboard
data class JsonRpcRequest(id: Int, method: String, params: List<String?>, jsonrpc: String)
JsonRpcResponse
Link copied to clipboard
data class JsonRpcResponse(id: Int?, result: String?, error: String?, exceptionType: String?, jsonrpc: String)
KVRemoteAgent
Link copied to clipboard
open class KVRemoteAgent<T : Any>(serviceManager: <ERROR CLASS><T>, requestFilter: <ERROR CLASS>.() -> Unit?) : RemoteAgent

Client side agent for JSON-RPC remote calls.

KVServiceBinder
Link copied to clipboard
abstract class KVServiceBinder<T, RH, WH>(deSerializer: ObjectDeSerializer, routeNameGenerator: NameGenerator?)

Binds HTTP calls to kotlin functions

KVServiceManagerJs
Link copied to clipboard
open class KVServiceManagerJs<T : Any>
KVServiceMgr
Link copied to clipboard
interface KVServiceMgr<T : Any>

Base interface for fullstack service manager.

LoginService
Link copied to clipboard
class LoginService(loginEndpoint: String)

Form login dispatcher.

NameGenerator
Link copied to clipboard
typealias NameGenerator = () -> String
NotEnumTypeException
Link copied to clipboard
class NotEnumTypeException
NotStandardTypeException
Link copied to clipboard
class NotStandardTypeException(type: String)
Object
Link copied to clipboard
external class Object

JavaScript Object type

ObjectDeSerializer
Link copied to clipboard
interface ObjectDeSerializer
RemoteAgent
Link copied to clipboard
open class RemoteAgent

Interface for client side agent for JSON-RPC remote calls.

RemoteData
Link copied to clipboard
data class RemoteData<T>(data: List<T>, last_page: Int)
RemoteFilter
Link copied to clipboard
data class RemoteFilter(field: String, type: String, value: String?)
RemoteOption
Link copied to clipboard
data class RemoteOption(value: String?, text: String?, className: String?, subtext: String?, icon: String?, content: String?, disabled: Boolean, divider: Boolean)
RemoteSorter
Link copied to clipboard
data class RemoteSorter(field: String, dir: String)
ResponseBodyType
Link copied to clipboard
enum ResponseBodyType : Enum<ResponseBodyType>

HTTP response body types.

RouteMapEntry
Link copied to clipboard
data class RouteMapEntry<T>(method: <ERROR CLASS>, path: String, handler: T)
RouteMapRegistry
Link copied to clipboard
interface RouteMapRegistry<T>

Stores a mapping from an HTTP-method+path to a handler

SecurityException
Link copied to clipboard
class SecurityException(message: String)

A security exception.

SecurityMgr
Link copied to clipboard
abstract class SecurityMgr

Form login dispatcher.

ServiceException
Link copied to clipboard
class ServiceException(message: String)
SimpleRemoteOption
Link copied to clipboard
data class SimpleRemoteOption(value: String, text: String?)
Socket
Link copied to clipboard
class Socket

A websocket client implementation.

SocketClosedException
Link copied to clipboard
class SocketClosedException(reason: String) : Throwable

Websocket closed exception class.

Functions

createNameGenerator
Link copied to clipboard
fun createNameGenerator(prefix: String): NameGenerator
createRouteMapRegistry
Link copied to clipboard
fun <T> createRouteMapRegistry(): RouteMapRegistry<T>

Create a default implementation of @see RouteMapRegistry

deserialize
Link copied to clipboard
inline fun <T> ObjectDeSerializer.deserialize(str: String?): T
getWebSocketUrl
Link copied to clipboard
fun getWebSocketUrl(url: String): String

Creates a websocket URL from current window.location and given path.

handleWebsocketConnection
Link copied to clipboard
suspend fun <T, OBJECTS_IN, OBJECTS_OUT> handleWebsocketConnection(deSerializer: ObjectDeSerializer, rawIn: <ERROR CLASS><String>, rawOut: <ERROR CLASS><String>, serializerIn: <ERROR CLASS><OBJECTS_IN>, serializerOut: <ERROR CLASS><OBJECTS_OUT>, service: T, function: suspend T.(<ERROR CLASS><OBJECTS_IN>, <ERROR CLASS><OBJECTS_OUT>) -> Unit)

Convenience function for cases were the raw channels work with strings. See the overloaded method for details.

suspend fun <T, RAW_IN, RAW_OUT, OBJECTS_IN, OBJECTS_OUT> handleWebsocketConnection(deSerializer: ObjectDeSerializer, rawIn: <ERROR CLASS><RAW_IN>, rawInToText: (RAW_IN) -> String?, rawOut: <ERROR CLASS><RAW_OUT>, rawOutFromText: (String) -> RAW_OUT, serializerIn: <ERROR CLASS><OBJECTS_IN>, serializerOut: <ERROR CLASS><OBJECTS_OUT>, service: T, function: suspend T.(<ERROR CLASS><OBJECTS_IN>, <ERROR CLASS><OBJECTS_OUT>) -> Unit)

Reads JSON-RPC calls from rawIn, deserializes them and forwards them in form of a channel to function. Additionally function also receives a SendChannel, from which objects are read, serialized and sent to the client in the form of JSON-RPC calls.

kotlinxObjectDeSerializer
Link copied to clipboard
fun kotlinxObjectDeSerializer(): ObjectDeSerializer
obj
Link copied to clipboard
fun obj(init: dynamic.() -> Unit): dynamic

Helper function for creating JavaScript objects.

requireParameterCountEqualTo
Link copied to clipboard
fun requireParameterCountEqualTo(actualParameterCount: Int, expectedParamterCount: Int)
fun requireParameterCountEqualTo(params: Collection<*>, expectedParameterCount: Int)
serializeNonNull
Link copied to clipboard
inline fun <T> ObjectDeSerializer.serializeNonNull(obj: T): String
serializeNullable
Link copied to clipboard
inline fun <T> ObjectDeSerializer.serializeNullable(obj: T?): String?

Properties

HTTP_UNAUTHORIZED
Link copied to clipboard
const val HTTP_UNAUTHORIZED: Int = 401

HTTP status unauthorized (401).

kvSerializersModule
Link copied to clipboard
val kvSerializersModule: <ERROR CLASS>