command_parser()
#
command_parser()
processes a command string, expands its parameters, checks authorization, and executes the corresponding function or event.
Prototype
json_t *command_parser(
hgobj gobj,
const char *command,
json_t *kw,
hgobj src
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The GObj handling the command execution. |
|
|
The command string to be parsed and executed. |
|
|
A JSON object containing additional parameters for the command. |
|
|
The source GObj that issued the command. |
Return Value
A JSON object containing the command execution result, or NULL
if the response is asynchronous.
Notes
If the command is not found, an error response is returned. If the command requires authorization, it is checked before execution. If the command has a function handler, it is executed directly. If the command does not have a function handler, it is redirected as an event.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples