Builder

final class Builder

Provides JSON-RPC response builder.

class Object
trait Matchable
class Any

Value members

Concrete methods

def attributes(value: Map[String, Any]): Builder

Sets attributes.

Sets attributes.

def attributes(one: (String, Any), more: (String, Any)*): Builder

Sets attributes.

Sets attributes.

Creates JSON-RPC response with current settings.

Creates JSON-RPC response with current settings.

def error(value: JsonRpcError): Builder

Sets error.

Sets error.

def error(code: Int, message: String, data: Option[JsonValue]): Builder

Sets error.

Sets error.

Value Params
code

error code

data

optional additional data

message

error message

def error(code: Int, message: String, data: JsonValue): Builder

Sets error.

Sets error.

Value Params
code

error code

data

additional data

message

error message

Sets identifier.

Sets identifier.

def id(value: String): Builder

Sets identifier.

Sets identifier.

def id(value: Long): Builder

Sets identifier.

Sets identifier.

def idNull(): Builder

Sets identifier to null value.

Sets identifier to null value.

def result(value: JsonValue): Builder

Sets result.

Sets result.

Sets either result or error.

Sets either result or error.

def tryResult(value: => JsonValue)(using onFailure: PartialFunction[Throwable, JsonRpcError]): Builder

Tries to set result or sets error on failure.

Tries to set result or sets error on failure.

Note

If value throws exception that does not match onFailure, then the exception is raised.

def version(value: String): Builder

Sets version.

Sets version.