#include <util.h>
|
| enum class | Type {
OBJ
, ARR
, STR
, NUM
,
BOOL
, OBJ_NAMED_PARAMS
, OBJ_USER_KEYS
, AMOUNT
,
STR_HEX
, RANGE
} |
| |
| enum class | Optional { NO
, OMITTED
} |
| |
| using | DefaultHint = std::string |
| | Hint for default value. More...
|
| |
| using | Default = UniValue |
| | Default constant value. More...
|
| |
| using | Fallback = std::variant< Optional, DefaultHint, Default > |
| |
|
| | RPCArg (std::string name, Type type, Fallback fallback, std::string description, RPCArgOptions opts={}) |
| |
| | RPCArg (std::string name, Type type, Fallback fallback, std::string description, std::vector< RPCArg > inner, RPCArgOptions opts={}) |
| |
| bool | IsOptional () const |
| |
| UniValue | MatchesType (const UniValue &request) const |
| | Check whether the request JSON type matches. More...
|
| |
| std::string | GetFirstName () const |
| | Return the first of all aliases. More...
|
| |
| std::string | GetName () const |
| | Return the name, throws when there are aliases. More...
|
| |
| std::string | ToString (bool oneline) const |
| | Return the type string of the argument. More...
|
| |
| std::string | ToStringObj (bool oneline) const |
| | Return the type string of the argument when it is in an object (dict). More...
|
| |
| std::string | ToDescriptionString (bool is_named_arg) const |
| | Return the description string, including the argument type and whether the argument is required. More...
|
| |
Definition at line 186 of file util.h.
◆ Default
Default constant value.
Definition at line 222 of file util.h.
◆ DefaultHint
Hint for default value.
Definition at line 220 of file util.h.
◆ Fallback
◆ Optional
| Enumerator |
|---|
| NO | Required arg.
|
| OMITTED | Optional argument for which the default value is omitted from help text for one of two reasons:
- It's a named argument and has a default value of
null.
- Its default value is implicitly clear. That is, elements in an array may not exist by default. When possible, the default value should be specified.
|
Definition at line 206 of file util.h.
◆ Type
| Enumerator |
|---|
| OBJ | |
| ARR | |
| STR | |
| NUM | |
| BOOL | |
| OBJ_NAMED_PARAMS | Special type that behaves almost exactly like OBJ, defining an options object with a list of pre-defined keys.
The only difference between OBJ and OBJ_NAMED_PARAMS is that OBJ_NAMED_PARMS also allows the keys to be passed as top-level named parameters, as a more convenient way to pass options to the RPC method without nesting them.
|
| OBJ_USER_KEYS | Special type where the user must set the keys e.g. to define multiple addresses; as opposed to e.g. an options object where the keys are predefined.
|
| AMOUNT | Special type representing a floating point amount (can be either NUM or STR)
|
| STR_HEX | Special type that is a STR with only hex chars.
|
| RANGE | Special type that is a NUM or [NUM,NUM].
|
Definition at line 187 of file util.h.
◆ RPCArg() [1/2]
◆ RPCArg() [2/2]
◆ GetFirstName()
| std::string RPCArg::GetFirstName |
( |
| ) |
const |
Return the first of all aliases.
Definition at line 912 of file util.cpp.
◆ GetName()
| std::string RPCArg::GetName |
( |
| ) |
const |
Return the name, throws when there are aliases.
Definition at line 917 of file util.cpp.
◆ IsOptional()
| bool RPCArg::IsOptional |
( |
| ) |
const |
◆ MatchesType()
Check whether the request JSON type matches.
Returns true if type matches, or object describing error(s) if not.
Definition at line 899 of file util.cpp.
◆ ToDescriptionString()
| std::string RPCArg::ToDescriptionString |
( |
bool |
is_named_arg | ) |
const |
Return the description string, including the argument type and whether the argument is required.
Definition at line 932 of file util.cpp.
◆ ToString()
| std::string RPCArg::ToString |
( |
bool |
oneline | ) |
const |
Return the type string of the argument.
Set oneline to allow it to be overridden by a custom oneline type string (m_opts.oneline_description).
Definition at line 1249 of file util.cpp.
◆ ToStringObj()
| std::string RPCArg::ToStringObj |
( |
bool |
oneline | ) |
const |
Return the type string of the argument when it is in an object (dict).
Set oneline to get the oneline representation (less whitespace)
Definition at line 1210 of file util.cpp.
◆ m_description
| const std::string RPCArg::m_description |
◆ m_fallback
◆ m_inner
| const std::vector<RPCArg> RPCArg::m_inner |
Only used for arrays or dicts.
Definition at line 227 of file util.h.
◆ m_names
| const std::string RPCArg::m_names |
The name of the arg (can be empty for inner args, can contain multiple aliases separated by | for named request arguments)
Definition at line 225 of file util.h.
◆ m_opts
◆ m_type
| const Type RPCArg::m_type |
The documentation for this struct was generated from the following files: