cmd blocks (#74)

This commit is contained in:
Mike Sawka
2024-06-24 14:34:31 -07:00
committed by GitHub
parent edb8eb25b8
commit 77b5acfc5a
16 changed files with 523 additions and 124 deletions
+15
View File
@@ -23,6 +23,7 @@ const (
BlockCommand_SetMeta = "setmeta"
BlockCommand_GetMeta = "getmeta"
BlockCommand_Input = "controller:input"
BlockCommand_Restart = "controller:restart"
BlockCommand_AppendBlockFile = "blockfile:append"
BlockCommand_AppendIJson = "blockfile:appendijson"
Command_ResolveIds = "resolveids"
@@ -31,6 +32,7 @@ const (
var CommandToTypeMap = map[string]reflect.Type{
BlockCommand_Input: reflect.TypeOf(BlockInputCommand{}),
BlockCommand_Restart: reflect.TypeOf(BlockRestartCommand{}),
BlockCommand_SetView: reflect.TypeOf(BlockSetViewCommand{}),
BlockCommand_SetMeta: reflect.TypeOf(BlockSetMetaCommand{}),
BlockCommand_GetMeta: reflect.TypeOf(BlockGetMetaCommand{}),
@@ -97,6 +99,19 @@ func ParseCmdMap(cmdMap map[string]any) (BlockCommand, error) {
return cmd.(BlockCommand), nil
}
type BlockRestartCommand struct {
Command string `json:"command" tstype:"\"controller:restart\""`
BlockId string `json:"blockid"`
}
func (rc *BlockRestartCommand) GetCommand() string {
return BlockCommand_Restart
}
func (rc *BlockRestartCommand) GetBlockId() string {
return rc.BlockId
}
type BlockInputCommand struct {
BlockId string `json:"blockid"`
Command string `json:"command" tstype:"\"controller:input\""`