Explorer

definy.rpc-call

description
Call an RPC handler with the body of the request (JSON or CBOR) and answer in the same format
type
Fn(request: @http.request, handler: Fn(request: @definy.json) -> @definy.service-io) -> @definy.service-io
expression
fn(request$0, handler$1) =>
  @definy.rpc-respond(
    cbor: @definy.request-wants-cbor(request: $0),
    io: match @definy.rpc-request-json(request: $0) {
      #json(json$2) =>
        $1(request: $2),
      #invalid(message$3) =>
        @definy.rpc-error(code: "invalid_argument", message: $3)
    }
  )
visibility
public
definy.rpc-call (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: q_YdP4lcMynNYcddt-8f8SNlZ4fZnw74SIjvLm1mtW8
content hash: jlIY_uMcNZgEMLUmv1kwA_JAT7wsiWm2OQDuutwSZ20