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:
30 static constexpr auto kLimitMin = rpc::spec::handlers::nfts_by_issuer::kLimitMin;
34 static constexpr auto kLimitMax = rpc::spec::handlers::nfts_by_issuer::kLimitMax;
38 static constexpr auto kLimitDefault = rpc::spec::handlers::nfts_by_issuer::kLimitDefault;
39
43 struct Output {
44 boost::json::array nfts;
45 uint32_t ledgerIndex;
46 std::string issuer;
47 bool validated = true;
48 std::optional<uint32_t> nftTaxon;
49 uint32_t limit;
50 std::optional<std::string> marker;
51 };
52
57
63 NFTsByIssuerHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
64 : sharedPtrBackend_(std::move(sharedPtrBackend))
65 {
66 }
67
75 [[nodiscard]] Result
76 process(Input const& input, Context const& ctx) const;
77
78private:
85 friend void
86 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
87};
88} // namespace rpc
HandlerReturnType< Output > Result
The result type of the command: either the Output or an error status.
Definition NFTsByIssuer.hpp:56
static constexpr auto kLimitDefault
Default value of the limit parameter.
Definition NFTsByIssuer.hpp:38
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
static constexpr auto kLimitMax
Maximum allowed value of the limit parameter.
Definition NFTsByIssuer.hpp:34
static constexpr auto kLimitMin
Minimum allowed value of the limit parameter.
Definition NFTsByIssuer.hpp:30
NFTsByIssuerHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new NFTsByIssuerHandler object.
Definition NFTsByIssuer.hpp:63
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:63
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:102
A struct to hold the output data of the command.
Definition NFTsByIssuer.hpp:43
std::string issuer
Address of the issuer.
Definition NFTsByIssuer.hpp:46
uint32_t ledgerIndex
Sequence of the ledger used.
Definition NFTsByIssuer.hpp:45
bool validated
Whether the ledger is validated.
Definition NFTsByIssuer.hpp:47
std::optional< uint32_t > nftTaxon
Taxon filter from the request, if any.
Definition NFTsByIssuer.hpp:48
std::optional< std::string > marker
Marker to fetch the next page, if any.
Definition NFTsByIssuer.hpp:50
boost::json::array nfts
NFTs minted by the issuer, as JSON.
Definition NFTsByIssuer.hpp:44
uint32_t limit
Limit used for this page.
Definition NFTsByIssuer.hpp:49
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:132