SkirRPC integration for MoonBit
pub(all) enum HttpErrorCode {
Code_400_BadRequest
Code_401_Unauthorized
Code_402_PaymentRequired
Code_403_Forbidden
Code_404_NotFound
Code_405_MethodNotAllowed
Code_406_NotAcceptable
Code_407_ProxyAuthenticationRequired
Code_408_RequestTimeout
Code_409_Conflict
Code_410_Gone
Code_411_LengthRequired
Code_412_PreconditionFailed
Code_413_ContentTooLarge
Code_414_UriTooLong
Code_415_UnsupportedMediaType
Code_416_RangeNotSatisfiable
Code_417_ExpectationFailed
Code_418_ImATeapot
Code_421_MisdirectedRequest
Code_422_UnprocessableContent
Code_423_Locked
Code_424_FailedDependency
Code_425_TooEarly
Code_426_UpgradeRequired
Code_428_PreconditionRequired
Code_429_TooManyRequests
Code_431_RequestHeaderFieldsTooLarge
Code_451_UnavailableForLegalReasons
Code_500_InternalServerError
Code_501_NotImplemented
Code_502_BadGateway
Code_503_ServiceUnavailable
Code_504_GatewayTimeout
Code_505_HttpVersionNotSupported
Code_506_VariantAlsoNegotiates
Code_507_InsufficientStorage
Code_508_LoopDetected
Code_510_NotExtended
Code_511_NetworkAuthenticationRequired
} derive(Eq, Hash, Debug)pub struct MethodEntry[Meta] {
// private fields
}fn[Req, Resp, Meta] MethodEntry::new(rpc_method : Method[Req, Resp], impl_fn : async (Req, Meta) -> Result[Resp, ServiceError]) -> MethodEntry[Meta]pub(all) struct MethodErrorInfo[Meta] {
error_message : String
method_name : String
status_code : HttpErrorCode?
request_meta : Meta
}pub(all) struct RawResponse {
data : String
status_code : Int
status_text : String
content_type : String
}pub(all) struct RpcError {
status_code : Int
message : String
}pub struct Service[Meta] {
// private fields
}async fn[Meta] Service::handle_request(self : Service[Meta], body : String, meta : Meta) -> RawResponsefn[Meta] Service::new(methods : Array[MethodEntry[Meta]], unrecognized_values? : UnrecognizedValues, can_send_unknown_error_message? : (MethodErrorInfo[Meta]) -> Bool, error_logger? : (MethodErrorInfo[Meta]) -> Unit, studio_app_js_url? : String) -> Result[Service[Meta], String]pub struct ServiceClient {
// private fields
}async fn[Req, Resp] ServiceClient::invoke_remote(self : ServiceClient, rpc_method : Method[Req, Resp], request : Req, extra_headers : Array[(String, String)]) -> Result[Resp, RpcError]fn ServiceClient::new(service_url : String, default_headers? : HashMap[String, String]) -> ServiceClientfn get_percent_decoded_query_from_url(path : String) -> String