aide/json_rpc

Types

pub type ErrorObject {
  ErrorObject(code: Int, message: String, data: utils.Any)
}

Constructors

  • ErrorObject(code: Int, message: String, data: utils.Any)
pub type Id {
  StringId(String)
  NumberId(Int)
}

Constructors

  • StringId(String)
  • NumberId(Int)
pub type ParamsDecoder(t) {
  FromParams(decode.Decoder(t))
  OptionalParams(decode.Decoder(t))
  NoParams(t)
}

Constructors

pub type Request(r, n) {
  Request(version: String, id: Id, value: r)
  Notification(version: String, value: n)
}

Constructors

  • Request(version: String, id: Id, value: r)
  • Notification(version: String, value: n)
pub type Response(t) {
  Response(
    version: String,
    id: Id,
    return: Result(t, ErrorObject),
  )
}

Constructors

  • Response(version: String, id: Id, return: Result(t, ErrorObject))

Values

pub fn encode_response(
  response: Response(a),
  encode_return: fn(a) -> json.Json,
) -> json.Json
pub fn notification(value: a) -> Request(b, a)
pub fn request_decoder(
  request_decoders: List(#(String, decode.Decoder(a))),
  notification_decoders: List(#(String, decode.Decoder(b))),
  zero: b,
) -> decode.Decoder(Request(a, b))
pub fn response(id: Id, return: t) -> Response(t)
Search Document