You can use the TWebAct
enumeration to put together an array of records that tie the web actions to their respective request and response structures.
type
// ancestor class for all requests and responses
TJSONStructure = class(TObject);
TJSONRequest = class(TJSONStructure);
TJSONRequestClass = class of TJSONRequest;
TJSONResponse = class(TJSONStructure);
TJSONResponseClass = class of TJSONResponse;
const
WEBACT_STRUCTURES: array[TWebAct] of
record
RequestClass: TJSONRequestClass;
ResponseClass: TJSONResponseClass;
end = (
{ttInfo} (RequestClass: TInfoRequest; ResponseClass: TInfoResponse)
, {ttLogin} (RequestClass: TLoginRequest; ResponseClass: TLoginResponse)
...
);