README

colmugx/acp/jsonrpc does not have a README file

#
JsonRpcCodecError

pub(all) suberror JsonRpcCodecError {
ParseError(message~ : String)
InvalidRequest(reason~ : String)
InvalidId(reason~ : String)
InvalidParams(reason~ : String)
InvalidError(reason~ : String)
UnknownField(path~ : String)
MissingField(path~ : String)
ConflictingFields(path~ : String)
InvalidField(path~ : String, reason~ : String)
InvalidInteger(path~ : String, reason~ : String)
} derive(Eq,
Debug
)

Errors raised while parsing or validating a JSON-RPC envelope.

These are local codec errors. They are intentionally separate from JsonRpcError, which is a valid wire error object that can be sent to a peer.

#
JsonRpcError

pub struct JsonRpcError {
code : JsonRpcErrorCode
message : String
data : Json?
} derive(Eq,
Debug
)

The structured error object carried by an error response.

#
JsonRpcError::auth_required

fn JsonRpcError::auth_required(data? : Json) -> JsonRpcError

Construct an authentication-required object using the standard message.

#
JsonRpcError::internal_error

fn JsonRpcError::internal_error(data? : Json) -> JsonRpcError

Construct an internal-error object using the standard message.

#
JsonRpcError::invalid_params

fn JsonRpcError::invalid_params(data? : Json) -> JsonRpcError

Construct an invalid-params object using the standard message.

#
JsonRpcError::invalid_request

fn JsonRpcError::invalid_request(data? : Json) -> JsonRpcError

Construct an invalid-request object using the standard message.

#
JsonRpcError::method_not_found

fn JsonRpcError::method_not_found(data? : Json) -> JsonRpcError

Construct a method-not-found object using the standard message.

#
JsonRpcError::new

fn JsonRpcError::new(code~ : JsonRpcErrorCode, message~ : String, data? : Json) -> JsonRpcError

Construct an error object with an explicit message and optional data.

#
JsonRpcError::parse_error

fn JsonRpcError::parse_error(data? : Json) -> JsonRpcError

Construct a parse-error object using the standard message.

#
JsonRpcError::request_cancelled

fn JsonRpcError::request_cancelled(data? : Json) -> JsonRpcError

Construct a request-cancelled object using the standard message.

#
JsonRpcError::resource_not_found

fn JsonRpcError::resource_not_found(data? : Json) -> JsonRpcError

Construct a resource-not-found object using the standard message.

#
JsonRpcErrorCode

pub(all) enum JsonRpcErrorCode {
ParseError
InvalidRequest
MethodNotFound
InvalidParams
InternalError
RequestCancelled
AuthRequired
ResourceNotFound
Custom(Int)
} derive(Eq,
Debug
)

Standard JSON-RPC and ACP error codes.

Custom preserves an otherwise unknown signed 32-bit wire code instead of mapping it to a success or a known error.

#
JsonRpcErrorCode::default_message

fn JsonRpcErrorCode::default_message(self : JsonRpcErrorCode) -> String

The standard message associated with a known code.

#
JsonRpcErrorCode::from_int

fn JsonRpcErrorCode::from_int(code : Int) -> JsonRpcErrorCode

Decode a signed integer error code, retaining unknown values as Custom.

#
JsonRpcErrorCode::to_int

fn JsonRpcErrorCode::to_int(self : JsonRpcErrorCode) -> Int

Return the signed integer represented by an error code.

#
JsonRpcFailure

pub struct JsonRpcFailure {
id : JsonRpcId
error : JsonRpcError
} derive(Eq,
Debug
)

An error JSON-RPC response envelope.

#
JsonRpcId

#alias(ResponseId)
pub(all) enum JsonRpcId {
String(String)
Number(Int64)
Null
} derive(Eq,
Debug
)

A JSON-RPC response envelope identifier.

Response errors may carry null when a request identifier cannot be determined. Correlatable request and success identifiers use RequestId, which also permits null in the pinned ACP v1 schema.

#
JsonRpcMessage

pub(all) enum JsonRpcMessage {
Request(JsonRpcRequest)
Notification(JsonRpcNotification)
Response(JsonRpcResponse)
} derive(Eq,
Debug
)

A decoded JSON-RPC message.

#
JsonRpcMessage::notification

fn JsonRpcMessage::notification(notification : JsonRpcNotification) -> JsonRpcMessage

Construct a JSON-RPC message from a notification envelope.

#
JsonRpcMessage::request

fn JsonRpcMessage::request(request : JsonRpcRequest) -> JsonRpcMessage

Construct a JSON-RPC message from a request envelope.

#
JsonRpcMessage::response

fn JsonRpcMessage::response(response : JsonRpcResponse) -> JsonRpcMessage

Construct a JSON-RPC message from a response envelope.

#
JsonRpcNotification

pub struct JsonRpcNotification {
method_name : String
params : Json?
} derive(Eq,
Debug
)

A JSON-RPC notification envelope.

#
JsonRpcNotification::new

fn JsonRpcNotification::new(method_name~ : String, params? : Json) -> JsonRpcNotification raise JsonRpcCodecError

Construct a notification envelope. params is omitted when it is None.

#
JsonRpcRequest

pub struct JsonRpcRequest {
id : RequestId
method_name : String
params : Json?
} derive(Eq,
Debug
)

A JSON-RPC request envelope.

#
JsonRpcRequest::new

fn JsonRpcRequest::new(id~ : RequestId, method_name~ : String, params? : Json) -> JsonRpcRequest raise JsonRpcCodecError

Construct a request envelope. params is omitted when it is None.

#
JsonRpcResponse

pub(all) enum JsonRpcResponse {
Success(JsonRpcSuccess)
Error(JsonRpcFailure)
} derive(Eq,
Debug
)

The two mutually exclusive JSON-RPC response forms.

#
JsonRpcResponse::error

Construct an error response envelope.

#
JsonRpcResponse::success

fn JsonRpcResponse::success(id~ : RequestId, result~ : Json) -> JsonRpcResponse

Construct a successful response envelope.

#
JsonRpcSuccess

pub struct JsonRpcSuccess {
id : RequestId
result : Json
} derive(Eq,
Debug
)

A successful JSON-RPC response envelope.

#
RequestId

pub(all) enum RequestId {
String(String)
Number(Int64)
Null
} derive(Eq,
Debug
)

A request identifier that can be correlated to a request.

ACP's pinned v1 schema permits JSON null as a request identifier. It is a real identifier value, distinct from an omitted id field (which denotes a notification), and therefore remains in the typed correlation domain.

#
JSON_RPC_VERSION

let JSON_RPC_VERSION : String

The JSON-RPC protocol version implemented by this package.

#
jsonrpc_decode

fn jsonrpc_decode(source : String) -> JsonRpcMessage raise JsonRpcCodecError

Decode one complete JSON-RPC message from JSON text.

This function parses exactly one JSON value and then validates its complete envelope. It does not implement line framing; callers that use stdio must split frames before calling it.

#
jsonrpc_decode_int64

fn jsonrpc_decode_int64(value : Double, repr : String?, path~ : String) -> Int64 raise JsonRpcCodecError

#
jsonrpc_decode_json

fn jsonrpc_decode_json(value : Json) -> JsonRpcMessage raise JsonRpcCodecError

Decode one JSON-RPC message from an already parsed JSON value.

#
jsonrpc_encode

fn jsonrpc_encode(message : JsonRpcMessage) -> String raise JsonRpcCodecError

Encode one JSON-RPC message as compact JSON text.

The returned text contains no framing newline. Newline-delimited stdio is a runtime concern and must append its own delimiter.

#
jsonrpc_to_json

fn jsonrpc_to_json(message : JsonRpcMessage) -> Json raise JsonRpcCodecError

Encode one JSON-RPC message as a JSON value.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io