Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
NFTsByIssuer.hpp
1#pragma once
2
3#include "data/BackendInterface.hpp"
4#include "rpc/common/SpecBackend.hpp"
5#include "rpc/common/Types.hpp"
6
7#include <boost/json/array.hpp>
8#include <boost/json/conversion.hpp>
9#include <boost/json/value.hpp>
10#include <rpcspec/handlers/nfts_by_issuer/Types.hpp>
11
12#include <cstdint>
13#include <memory>
14#include <optional>
15#include <string>
16#include <utility>
17
18namespace rpc {
19
23class NFTsByIssuerHandler : public rpc::HandlerFor<rpc::spec::handlers::nfts_by_issuer::Input> {
24 std::shared_ptr<BackendInterface> sharedPtrBackend_;
25
26public:
27 static constexpr auto kLimitMin = rpc::spec::handlers::nfts_by_issuer::kLimitMin;
28 static constexpr auto kLimitMax = rpc::spec::handlers::nfts_by_issuer::kLimitMax;
29 static constexpr auto kLimitDefault = rpc::spec::handlers::nfts_by_issuer::kLimitDefault;
30
34 struct Output {
35 boost::json::array nfts;
36 uint32_t ledgerIndex;
37 std::string issuer;
38 bool validated = true;
39 std::optional<uint32_t> nftTaxon;
40 uint32_t limit;
41 std::optional<std::string> marker;
42 };
43
44 using Result = HandlerReturnType<Output>;
45
51 NFTsByIssuerHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
52 : sharedPtrBackend_(std::move(sharedPtrBackend))
53 {
54 }
55
63 [[nodiscard]] Result
64 process(Input const& input, Context const& ctx) const;
65
66private:
73 friend void
74 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
75};
76} // namespace rpc
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition NFTsByIssuer.cpp:91
NFTsByIssuerHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new NFTsByIssuerHandler object.
Definition NFTsByIssuer.hpp:51
Result process(Input const &input, Context const &ctx) const
Process the NFTsByIssuer command.
Definition NFTsByIssuer.cpp:27
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:17
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:61
spec::HandlerFor< InputT, boost::json::value > HandlerFor
The spec-driven base every typed handler inherits.
Definition SpecBackend.hpp:24
Context of an RPC call.
Definition Types.hpp:98
A struct to hold the output data of the command.
Definition NFTsByIssuer.hpp:34
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:109