CCF
Loading...
Searching...
No Matches
Namespaces | Typedefs | Functions
json_handler.h File Reference
#include "ccf/endpoint_registry.h"
#include <llhttp/llhttp.h>
#include <variant>

Go to the source code of this file.

Namespaces

namespace  ccf
 
namespace  ccf::jsonhandler
 

Typedefs

using ccf::jsonhandler::JsonAdapterResponse = std::variant< ErrorDetails, RedirectDetails, nlohmann::json >
 
using ccf::HandlerJsonParamsAndForward = std::function< jsonhandler::JsonAdapterResponse(endpoints::EndpointContext &ctx, nlohmann::json &&params)>
 
using ccf::ReadOnlyHandlerWithJson = std::function< jsonhandler::JsonAdapterResponse(endpoints::ReadOnlyEndpointContext &ctx, nlohmann::json &&params)>
 
using ccf::CommandHandlerWithJson = std::function< jsonhandler::JsonAdapterResponse(endpoints::CommandEndpointContext &ctx, nlohmann::json &&params)>
 

Functions

nlohmann::json ccf::jsonhandler::get_json_params (const std::shared_ptr< ccf::RpcContext > &ctx)
 
void ccf::jsonhandler::set_response (JsonAdapterResponse &&res, std::shared_ptr< ccf::RpcContext > &ctx)
 
jsonhandler::JsonAdapterResponse ccf::make_success ()
 
jsonhandler::JsonAdapterResponse ccf::make_success (nlohmann::json &&result_payload)
 
jsonhandler::JsonAdapterResponse ccf::make_success (const nlohmann::json &result_payload)
 
jsonhandler::JsonAdapterResponse ccf::make_error (ccf::http_status status, const std::string &code, const std::string &msg)
 
jsonhandler::JsonAdapterResponse ccf::make_redirect (ccf::http_status status)
 
endpoints::EndpointFunction ccf::json_adapter (const HandlerJsonParamsAndForward &f)
 
endpoints::ReadOnlyEndpointFunction ccf::json_read_only_adapter (const ReadOnlyHandlerWithJson &f)
 
endpoints::CommandEndpointFunction ccf::json_command_adapter (const CommandHandlerWithJson &f)