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

Link copied to clipboard
open class CallAgent

An agent responsible for remote calls.

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

Username and password credentials.

Link copied to clipboard
enum HttpMethod : Enum<HttpMethod>
Link copied to clipboard
class IllegalParameterCountException(actualParameterCount: Int, expectedParamterCount: Int) : RuntimeException
Link copied to clipboard
typealias JSON = RemoteSerialization
Link copied to clipboard
data class JsonRpcRequest(id: Int, method: String, params: List<String?>, jsonrpc: String)
Link copied to clipboard
data class JsonRpcResponse(id: Int?, result: String?, error: String?, exceptionType: String?, jsonrpc: String)
Link copied to clipboard
open class KVRemoteAgent<T : Any>(serviceManager: <ERROR CLASS><T>, serializersModules: List<<ERROR CLASS>>?, requestFilter: <ERROR CLASS>.() -> Unit?)

Client side agent for JSON-RPC remote calls.

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

Binds HTTP calls to kotlin functions

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

Base interface for fullstack service manager.

Link copied to clipboard
class LoginService(loginEndpoint: String)

Form login dispatcher.

Link copied to clipboard
typealias NameGenerator = () -> String
Link copied to clipboard
external class Object

JavaScript Object type

Link copied to clipboard
interface ObjectDeSerializer
Link copied to clipboard
data class RemoteData<T>(data: List<T>, last_page: Int)
Link copied to clipboard
data class RemoteFilter(field: String, type: String, value: String?)
Link copied to clipboard
data class RemoteOption(value: String?, text: String?, className: String?, subtext: String?, icon: String?, content: String?, disabled: Boolean, divider: Boolean)
Link copied to clipboard
expect object RemoteSerialization

JSON utility functions

Link copied to clipboard
data class RemoteSorter(field: String, dir: String)
Link copied to clipboard
enum ResponseBodyType : Enum<ResponseBodyType>

HTTP response body types.

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

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

Link copied to clipboard
class SecurityException(message: String)

A security exception.

Link copied to clipboard
abstract class SecurityMgr

Form login dispatcher.

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

A websocket client implementation.

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

Websocket closed exception class.

Functions

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

Create a default implementation of @see RouteMapRegistry

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

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

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.

Link copied to clipboard
fun kotlinxObjectDeSerializer(serializersModules: List<<ERROR CLASS>>? = null): ObjectDeSerializer
Link copied to clipboard
fun obj(init: dynamic.() -> Unit): dynamic

Helper function for creating JavaScript objects.

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

Properties

Link copied to clipboard
const val HTTP_UNAUTHORIZED: Int = 401

HTTP status unauthorized (401).