mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 11:45:53 +00:00
@@ -98,6 +98,37 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// example handler
|
||||
class CoroutineHandlerFake
|
||||
{
|
||||
public:
|
||||
using Input = TestInput;
|
||||
using Output = TestOutput;
|
||||
using Result = RPCng::HandlerReturnType<Output>;
|
||||
|
||||
RPCng::RpcSpecConstRef
|
||||
spec() const
|
||||
{
|
||||
using namespace RPCng::validation;
|
||||
|
||||
// clang-format off
|
||||
static const RPCng::RpcSpec rpcSpec = {
|
||||
{"hello", Required{}, Type<std::string>{}, EqualTo{"world"}},
|
||||
{"limit", Type<uint32_t>{}, Between<uint32_t>{0, 100}} // optional field
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
return rpcSpec;
|
||||
}
|
||||
|
||||
Result
|
||||
process(Input input, boost::asio::yield_context* ptrYield) const
|
||||
{
|
||||
return Output{
|
||||
input.hello + '_' + std::to_string(input.limit.value_or(0))};
|
||||
}
|
||||
};
|
||||
|
||||
class NoInputHandlerFake
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user