Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
producer_api_plugin.cpp File Reference
Include dependency graph for producer_api_plugin.cpp:

Go to the source code of this file.

Classes

struct  sysio::detail::producer_api_plugin_response
 
struct  sysio::async_result_visitor
 

Namespaces

namespace  sysio
 
namespace  sysio::detail
 

Macros

#define CALL_WITH_400(api_name, api_handle, call_name, INVOKE, http_response_code)
 
#define CALL_ASYNC(api_name, api_handle, call_name, call_result, INVOKE, http_response_code)
 
#define INVOKE_R_R(api_handle, call_name, in_param)
 
#define INVOKE_R_R_II(api_handle, call_name, in_param)
 
#define INVOKE_R_V(api_handle, call_name)
 
#define INVOKE_R_V_ASYNC(api_handle, call_name)
 
#define INVOKE_V_R(api_handle, call_name, in_param)
 
#define INVOKE_V_V(api_handle, call_name)
 

Functions

 FC_REFLECT (sysio::detail::producer_api_plugin_response,(result))
 

Macro Definition Documentation

◆ CALL_ASYNC

#define CALL_ASYNC ( api_name,
api_handle,
call_name,
call_result,
INVOKE,
http_response_code )
Value:
{std::string("/v1/" #api_name "/" #call_name), \
[&api_handle](string, string body, url_response_callback cb) mutable { \
if (body.empty()) body = "{}"; \
auto next = [cb, body](const std::variant<fc::exception_ptr, call_result>& result){\
if (std::holds_alternative<fc::exception_ptr>(result)) {\
try {\
std::get<fc::exception_ptr>(result)->dynamic_rethrow_exception();\
} catch (...) {\
http_plugin::handle_exception(#api_name, #call_name, body, cb);\
}\
} else {\
cb(http_response_code, std::visit(async_result_visitor(), result));\
}\
};\
INVOKE\
}\
}

Definition at line 41 of file producer_api_plugin.cpp.

41#define CALL_ASYNC(api_name, api_handle, call_name, call_result, INVOKE, http_response_code) \
42{std::string("/v1/" #api_name "/" #call_name), \
43 [&api_handle](string, string body, url_response_callback cb) mutable { \
44 if (body.empty()) body = "{}"; \
45 auto next = [cb, body](const std::variant<fc::exception_ptr, call_result>& result){\
46 if (std::holds_alternative<fc::exception_ptr>(result)) {\
47 try {\
48 std::get<fc::exception_ptr>(result)->dynamic_rethrow_exception();\
49 } catch (...) {\
50 http_plugin::handle_exception(#api_name, #call_name, body, cb);\
51 }\
52 } else {\
53 cb(http_response_code, std::visit(async_result_visitor(), result));\
54 }\
55 };\
56 INVOKE\
57 }\
58}

◆ CALL_WITH_400

#define CALL_WITH_400 ( api_name,
api_handle,
call_name,
INVOKE,
http_response_code )
Value:
{std::string("/v1/" #api_name "/" #call_name), \
[&api_handle](string, string body, url_response_callback cb) mutable { \
try { \
INVOKE \
cb(http_response_code, fc::variant(result)); \
} catch (...) { \
http_plugin::handle_exception(#api_name, #call_name, body, cb); \
} \
}}
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191

Definition at line 30 of file producer_api_plugin.cpp.

30#define CALL_WITH_400(api_name, api_handle, call_name, INVOKE, http_response_code) \
31{std::string("/v1/" #api_name "/" #call_name), \
32 [&api_handle](string, string body, url_response_callback cb) mutable { \
33 try { \
34 INVOKE \
35 cb(http_response_code, fc::variant(result)); \
36 } catch (...) { \
37 http_plugin::handle_exception(#api_name, #call_name, body, cb); \
38 } \
39 }}

◆ INVOKE_R_R

#define INVOKE_R_R ( api_handle,
call_name,
in_param )
Value:
auto params = parse_params<in_param, http_params_types::params_required>(body);\
auto result = api_handle.call_name(std::move(params));
account_query_db::get_accounts_by_authorizers_params params

Definition at line 60 of file producer_api_plugin.cpp.

60#define INVOKE_R_R(api_handle, call_name, in_param) \
61 auto params = parse_params<in_param, http_params_types::params_required>(body);\
62 auto result = api_handle.call_name(std::move(params));

◆ INVOKE_R_R_II

#define INVOKE_R_R_II ( api_handle,
call_name,
in_param )
Value:
auto params = parse_params<in_param, http_params_types::possible_no_params>(body);\
auto result = api_handle.call_name(std::move(params));

Definition at line 64 of file producer_api_plugin.cpp.

64#define INVOKE_R_R_II(api_handle, call_name, in_param) \
65 auto params = parse_params<in_param, http_params_types::possible_no_params>(body);\
66 auto result = api_handle.call_name(std::move(params));

◆ INVOKE_R_V

#define INVOKE_R_V ( api_handle,
call_name )
Value:
body = parse_params<std::string, http_params_types::no_params>(body); \
auto result = api_handle.call_name();

Definition at line 68 of file producer_api_plugin.cpp.

68#define INVOKE_R_V(api_handle, call_name) \
69 body = parse_params<std::string, http_params_types::no_params>(body); \
70 auto result = api_handle.call_name();

◆ INVOKE_R_V_ASYNC

#define INVOKE_R_V_ASYNC ( api_handle,
call_name )
Value:
api_handle.call_name(next);

Definition at line 72 of file producer_api_plugin.cpp.

72#define INVOKE_R_V_ASYNC(api_handle, call_name)\
73 api_handle.call_name(next);

◆ INVOKE_V_R

#define INVOKE_V_R ( api_handle,
call_name,
in_param )
Value:
auto params = parse_params<in_param, http_params_types::params_required>(body);\
api_handle.call_name(std::move(params)); \

Definition at line 75 of file producer_api_plugin.cpp.

75#define INVOKE_V_R(api_handle, call_name, in_param) \
76 auto params = parse_params<in_param, http_params_types::params_required>(body);\
77 api_handle.call_name(std::move(params)); \
78 sysio::detail::producer_api_plugin_response result{"ok"};

◆ INVOKE_V_V

#define INVOKE_V_V ( api_handle,
call_name )
Value:
body = parse_params<std::string, http_params_types::no_params>(body); \
api_handle.call_name(); \

Definition at line 80 of file producer_api_plugin.cpp.

80#define INVOKE_V_V(api_handle, call_name) \
81 body = parse_params<std::string, http_params_types::no_params>(body); \
82 api_handle.call_name(); \
83 sysio::detail::producer_api_plugin_response result{"ok"};

Function Documentation

◆ FC_REFLECT()

FC_REFLECT ( sysio::detail::producer_api_plugin_response ,
(result)  )