23#include "web/SubscriptionContextInterface.hpp"
25#include <boost/asio/spawn.hpp>
26#include <boost/json/array.hpp>
27#include <boost/json/conversion.hpp>
28#include <boost/json/object.hpp>
29#include <boost/json/value.hpp>
30#include <boost/json/value_from.hpp>
31#include <xrpl/basics/base_uint.h>
32#include <xrpl/basics/strHex.h>
67 bool const lhsHasError = !
static_cast<bool>(lhs);
68 bool const rhsHasError = !
static_cast<bool>(rhs);
69 return lhsHasError == rhsHasError && (!lhsHasError || lhs.error() == rhs.error());
75using Error = std::unexpected<Status>;
80template <
typename OutputType>
93 ReturnType(std::expected<boost::json::value, Status> result, boost::json::array warnings = {})
94 : result{std::move(result)}, warnings(std::move(warnings))
101 operator bool()
const
103 return result.operator bool();
106 std::expected<boost::json::value, Status> result;
107 boost::json::array warnings;
119 boost::asio::yield_context yield;
121 bool isAdmin =
false;
122 std::string clientIp = {};
123 uint32_t apiVersion = 0u;
138 response = std::move(returnType.result).value().as_object();
140 response = std::move(returnType.result).error();
142 warnings = std::move(returnType.warnings);
159 explicit Result(boost::json::object response) : response{std::move(response)}
163 std::variant<Status, boost::json::object> response;
164 boost::json::array warnings;
171 ripple::uint256 index;
172 std::uint32_t hint{};
182 return ripple::strHex(index) +
"," + std::to_string(hint);
193 return index.isNonZero() || hint != 0;
207 jv = boost::json::object{};
This namespace contains everything to do with the ETL and ETL sources.
Definition CacheLoader.hpp:36
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:36
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:81
std::expected< void, Status > MaybeError
Return type used for Validators that can return error but don't have specific value to return.
Definition Types.hpp:55
void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, BookChange const &change)
Implementation of value_from for BookChange type.
Definition BookChangesHelper.hpp:241
std::unexpected< Status > Error
The type that represents just the error part of MaybeError.
Definition Types.hpp:75
bool operator==(MaybeError const &lhs, MaybeError const &rhs)
Check if two MaybeError objects are equal.
Definition Types.hpp:65
This namespace implements the web server and related components.
Definition Types.hpp:43
std::shared_ptr< SubscriptionContextInterface > SubscriptionContextPtr
An alias for shared pointer to a SubscriptionContextInterface.
Definition SubscriptionContextInterface.hpp:86
A cursor object used to traverse nodes owned by an account.
Definition Types.hpp:170
std::string toString() const
Convert the cursor to a string.
Definition Types.hpp:180
bool isNonZero() const
Check if the cursor is non-zero.
Definition Types.hpp:191
Context of an RPC call.
Definition Types.hpp:118
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:129
Result(boost::json::object response)
Construct a new Result object from a response object.
Definition Types.hpp:159
Result(ReturnType returnType)
Construct a new Result object from ReturnType.
Definition Types.hpp:135
Result(Status status)
Construct a new Result object from Status.
Definition Types.hpp:150
The final return type out of RPC engine.
Definition Types.hpp:86
ReturnType(std::expected< boost::json::value, Status > result, boost::json::array warnings={})
Construct a new Return Type object.
Definition Types.hpp:93
A status returned from any RPC handler.
Definition Errors.hpp:82
An empty type used as Output for handlers than don't actually produce output.
Definition Types.hpp:113
Base class for all connections.
Definition ConnectionBase.hpp:44