Kagome
Polkadot Runtime Engine in C++17
get_metadata.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_API_REQUEST_GET_METADATA
7 #define KAGOME_API_REQUEST_GET_METADATA
8 
9 #include <jsonrpc-lean/request.h>
10 
11 #include <optional>
12 #include <vector>
13 
16 #include "common/buffer.hpp"
17 #include "outcome/outcome.hpp"
18 #include "primitives/block_id.hpp"
19 
21 
22  struct GetMetadata final
23  : details::RequestType<std::string, std::optional<std::string>> {
24  public:
25  explicit GetMetadata(std::shared_ptr<StateApi> api)
26  : api_(std::move(api)){};
27 
28  outcome::result<Return> execute() {
29  if (const auto &param_0 = getParam<0>()) {
30  return api_->getMetadata(*param_0);
31  }
32  return api_->getMetadata();
33  }
34 
35  private:
36  std::shared_ptr<StateApi> api_;
37  };
38 
39 } // namespace kagome::api::state::request
40 
41 #endif // KAGOME_API_REQUEST_GET_METADATA
std::shared_ptr< StateApi > api_
STL namespace.
outcome::result< Return > execute()
GetMetadata(std::shared_ptr< StateApi > api)