build_command_response()
#
Constructs a JSON response object containing the result, comment, schema, and data fields.
Prototype
json_t *build_command_response(
hgobj gobj,
json_int_t result,
json_t *jn_comment, // owned, if null then not set
json_t *jn_schema, // owned, if null then not set
json_t *jn_data // owned, if null then not set
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The GObj instance associated with the response. |
|
|
The result code of the command execution. |
|
|
A JSON string containing a comment or message. If null, it is not set. |
|
|
A JSON object representing the schema of the response. If null, it is not set. |
|
|
A JSON object containing the response data. If null, it is not set. |
Return Value
A JSON object containing the response structure with ‘result’, ‘comment’, ‘schema’, and ‘data’ fields.
Notes
The caller is responsible for managing the memory of the returned JSON object. If any of the optional parameters (jn_comment, jn_schema, jn_data) are null, they are replaced with default values.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples