API_​AddOnCommand

Base class for the Add-On commands.

    class API_AddOnCommand {
    public:
        virtual GS::String                          GetName () const = 0;
        virtual GS::String                          GetNamespaceName () const = 0;
        virtual API_AddOnCommandExecutionPolicy     GetExecutionPolicy () const = 0;
        virtual GS::Optional<GS::UniString>         GetSchemaDefinitions () const = 0;
        virtual GS::Optional<GS::UniString>         GetInputParametersSchema () const = 0;
        virtual GS::Optional<GS::UniString>         GetResponseSchema () const = 0;
        virtual GS::ObjectState                     Execute (const GS::ObjectState& parameters, GS::ProcessControl& processControl) const = 0;
        virtual void                                OnResponseValidationFailed (const GS::ObjectState& response) const = 0;
    };

 

Members

GetName ()
Returns the unique name of the command. This name cannot be an empty string or contain '.' characters.
GetNamespaceName ()
Returns the namespace of the command. This string must be unique for each Add-On. It cannot be an empty string or contain '.' characters.
GetExecutionPolicy ()
Returns the execution policy.
GetSchemaDefinitions ()
Returns the schema definitions. Must be a valid JSON string. Types defined in the schema definitions can be used in the input/output schemas.
GetInputParametersSchema ()
This schema will be used to validate the incoming request parameters. Must be a valid JSON string.
GetResponseSchema ()
This schema will be used to validate the incoming request response. Must be a valid JSON string.
Execute ()
Write the Add-On command logic inside this function.
OnResponseValidationFailed ()
This function is called when an error occured inside the Add-On command logic and the output schema validation failed.

 

Remarks

Inherit from this abstract class and implement the required functions to specify an Add-On command.

Validating the "{}" string, matches all the input/output schemas.

You can install an Add-On command handler with the ACAPI_Install_AddOnCommandHandler function.

 

Requirements

Version: API 25 or later
Header: APIdefs_Registration.h

 

See Also

API Types