JSON-RPC 2.0
JSON-RPC 2.0 Modern C++ Library
|
Represents a JSON-RPC request. More...
#include <request.hpp>
Public Member Functions | |
Request (std::string method, std::optional< nlohmann::json > params, bool is_notification, const std::function< int()> &id_generator) | |
Constructs a new Request object. | |
auto | RequiresResponse () const -> bool |
Checks if the request requires a response. | |
auto | GetKey () const -> int |
Returns the unique key (ID) for the request. | |
auto | Dump () const -> std::string |
Serializes the request to a JSON string. | |
Represents a JSON-RPC request.
This class handles the creation and management of JSON-RPC requests, including notifications (requests that do not expect a response).
Definition at line 17 of file request.hpp.
jsonrpc::client::Request::Request | ( | std::string | method, |
std::optional< nlohmann::json > | params, | ||
bool | is_notification, | ||
const std::function< int()> & | id_generator ) |
Constructs a new Request object.
method | The name of the method to be invoked. |
params | Optional parameters to be passed with the request. |
isNotification | True if this is a notification (no response expected). |
idGenerator | A function to generate unique request IDs. |
Definition at line 5 of file request.cpp.
|
nodiscard |
Serializes the request to a JSON string.
Definition at line 25 of file request.cpp.
|
nodiscard |
Returns the unique key (ID) for the request.
Definition at line 21 of file request.cpp.
|
nodiscard |
Checks if the request requires a response.
Definition at line 17 of file request.cpp.