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

Go to the source code of this file.

Classes

class  sysio::chain_api_plugin_impl
 
struct  sysio::async_result_visitor
 

Namespaces

namespace  sysio
 

Macros

#define CALL_WITH_400(api_name, api_handle, api_namespace, call_name, http_response_code, params_type)
 
#define CALL_ASYNC_WITH_400(api_name, api_handle, api_namespace, call_name, call_result, http_response_code, params_type)
 
#define CHAIN_RO_CALL(call_name, http_response_code, params_type)
 
#define CHAIN_RW_CALL(call_name, http_response_code, params_type)
 
#define CHAIN_RO_CALL_ASYNC(call_name, call_result, http_response_code, params_type)
 
#define CHAIN_RW_CALL_ASYNC(call_name, call_result, http_response_code, params_type)
 
#define CHAIN_RO_CALL_WITH_400(call_name, http_response_code, params_type)
 

Functions

template<>
chain_apis::read_only::get_transaction_status_params sysio::parse_params< chain_apis::read_only::get_transaction_status_params, http_params_types::params_required > (const std::string &body)
 

Macro Definition Documentation

◆ CALL_ASYNC_WITH_400

#define CALL_ASYNC_WITH_400 ( api_name,
api_handle,
api_namespace,
call_name,
call_result,
http_response_code,
params_type )
Value:
{std::string("/v1/" #api_name "/" #call_name), \
[api_handle](string, string body, url_response_callback cb) mutable { \
api_handle.validate(); \
try { \
auto params = parse_params<api_namespace::call_name ## _params, params_type>(body);\
api_handle.call_name( std::move(params),\
[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));\
}\
});\
} catch (...) { \
http_plugin::handle_exception(#api_name, #call_name, body, cb); \
} \
}\
}
account_query_db::get_accounts_by_authorizers_params params

Definition at line 64 of file chain_api_plugin.cpp.

64#define CALL_ASYNC_WITH_400(api_name, api_handle, api_namespace, call_name, call_result, http_response_code, params_type) \
65{std::string("/v1/" #api_name "/" #call_name), \
66 [api_handle](string, string body, url_response_callback cb) mutable { \
67 api_handle.validate(); \
68 try { \
69 auto params = parse_params<api_namespace::call_name ## _params, params_type>(body);\
70 api_handle.call_name( std::move(params),\
71 [cb, body](const std::variant<fc::exception_ptr, call_result>& result){\
72 if (std::holds_alternative<fc::exception_ptr>(result)) {\
73 try {\
74 std::get<fc::exception_ptr>(result)->dynamic_rethrow_exception();\
75 } catch (...) {\
76 http_plugin::handle_exception(#api_name, #call_name, body, cb);\
77 }\
78 } else {\
79 cb(http_response_code, std::visit(async_result_visitor(), result));\
80 }\
81 });\
82 } catch (...) { \
83 http_plugin::handle_exception(#api_name, #call_name, body, cb); \
84 } \
85 }\
86}

◆ CALL_WITH_400

#define CALL_WITH_400 ( api_name,
api_handle,
api_namespace,
call_name,
http_response_code,
params_type )
Value:
{std::string("/v1/" #api_name "/" #call_name), \
[api_handle](string, string body, url_response_callback cb) mutable { \
api_handle.validate(); \
try { \
auto params = parse_params<api_namespace::call_name ## _params, params_type>(body);\
fc::variant result( api_handle.call_name( std::move(params) ) ); \
cb(http_response_code, std::move(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 51 of file chain_api_plugin.cpp.

51#define CALL_WITH_400(api_name, api_handle, api_namespace, call_name, http_response_code, params_type) \
52{std::string("/v1/" #api_name "/" #call_name), \
53 [api_handle](string, string body, url_response_callback cb) mutable { \
54 api_handle.validate(); \
55 try { \
56 auto params = parse_params<api_namespace::call_name ## _params, params_type>(body);\
57 fc::variant result( api_handle.call_name( std::move(params) ) ); \
58 cb(http_response_code, std::move(result)); \
59 } catch (...) { \
60 http_plugin::handle_exception(#api_name, #call_name, body, cb); \
61 } \
62 }}

◆ CHAIN_RO_CALL

#define CHAIN_RO_CALL ( call_name,
http_response_code,
params_type )
Value:
CALL_WITH_400(chain, ro_api, chain_apis::read_only, call_name, http_response_code, params_type)
#define CALL_WITH_400(api_name, api_handle, api_namespace, call_name, http_response_code, params_type)

Definition at line 88 of file chain_api_plugin.cpp.

◆ CHAIN_RO_CALL_ASYNC

#define CHAIN_RO_CALL_ASYNC ( call_name,
call_result,
http_response_code,
params_type )
Value:
CALL_ASYNC_WITH_400(chain, ro_api, chain_apis::read_only, call_name, call_result, http_response_code, params_type)
#define CALL_ASYNC_WITH_400(api_name, api_handle, api_namespace, call_name, call_result, http_response_code, params_type)

Definition at line 90 of file chain_api_plugin.cpp.

◆ CHAIN_RO_CALL_WITH_400

#define CHAIN_RO_CALL_WITH_400 ( call_name,
http_response_code,
params_type )
Value:
CALL_WITH_400(chain, ro_api, chain_apis::read_only, call_name, http_response_code, params_type)

Definition at line 93 of file chain_api_plugin.cpp.

◆ CHAIN_RW_CALL

#define CHAIN_RW_CALL ( call_name,
http_response_code,
params_type )
Value:
CALL_WITH_400(chain, rw_api, chain_apis::read_write, call_name, http_response_code, params_type)

Definition at line 89 of file chain_api_plugin.cpp.

◆ CHAIN_RW_CALL_ASYNC

#define CHAIN_RW_CALL_ASYNC ( call_name,
call_result,
http_response_code,
params_type )
Value:
CALL_ASYNC_WITH_400(chain, rw_api, chain_apis::read_write, call_name, call_result, http_response_code, params_type)

Definition at line 91 of file chain_api_plugin.cpp.