6#include <nlohmann/json.hpp>
24 const std::optional<nlohmann::json> ¶ms = std::nullopt,
25 std::optional<nlohmann::json>
id = std::nullopt);
40 [[nodiscard]]
auto ToJson()
const -> nlohmann::json;
43 [[nodiscard]]
auto GetMethod() const -> std::
string {
48 [[nodiscard]]
auto GetParams() const -> std::optional<nlohmann::json> {
53 [[nodiscard]]
auto GetId() const -> std::optional<nlohmann::json> {
62 std::optional<nlohmann::json> params_;
65 std::optional<nlohmann::json> id_;
Represents a JSON-RPC request.
static auto FromJson(const nlohmann::json &json_obj) -> Request
Creates a Request object from a JSON object.
auto GetParams() const -> std::optional< nlohmann::json >
Gets the parameters.
auto GetId() const -> std::optional< nlohmann::json >
Gets the request ID.
auto GetMethod() const -> std::string
Gets the method name.
auto ToJson() const -> nlohmann::json
Serializes the Request object to a JSON object.
Request(std::string method, const std::optional< nlohmann::json > ¶ms=std::nullopt, std::optional< nlohmann::json > id=std::nullopt)
Constructs a Request object.