Kagome
Polkadot Runtime Engine in C++17
methods.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_API_RPC_REQUEST_METHODS
7 #define KAGOME_API_RPC_REQUEST_METHODS
8 
9 #include <jsonrpc-lean/request.h>
10 #include <boost/assert.hpp>
11 
12 #include "outcome/outcome.hpp"
14 
15 namespace kagome::api {
16  class RpcApi;
17 }
18 
19 namespace kagome::api::rpc::request {
20 
25  class Methods final {
26  public:
27  Methods(Methods const &) = delete;
28  Methods &operator=(Methods const &) = delete;
29 
30  Methods(Methods &&) = default;
31  Methods &operator=(Methods &&) = default;
32 
33  explicit Methods(std::shared_ptr<RpcApi> api) : api_(std::move(api)) {
34  BOOST_ASSERT(api_);
35  };
36  ~Methods() = default;
37 
38  outcome::result<void> init(const jsonrpc::Request::Parameters &params);
39 
40  outcome::result<primitives::RpcMethods> execute();
41 
42  private:
43  std::shared_ptr<RpcApi> api_;
44  };
45 
46 } // namespace kagome::api::rpc::request
47 
48 #endif // KAGOME_API_RPC_REQUEST_METHODS
outcome::result< void > init(const jsonrpc::Request::Parameters &params)
Definition: methods.cpp:12
Methods(Methods const &)=delete
Methods & operator=(Methods const &)=delete
STL namespace.
std::shared_ptr< RpcApi > api_
Definition: methods.hpp:43
outcome::result< primitives::RpcMethods > execute()
Definition: methods.cpp:21
Methods(std::shared_ptr< RpcApi > api)
Definition: methods.hpp:33