import * as Constants from './constants' ; import * as Types from './types' ; import type { RobotApiRequestMeta } from '../robot-api/types' ; export const fetchModules = ( robotName ) : Types . FetchModulesAction => ( { type : Constants . FETCH_MODULES , payload : { robotName } , meta : { } , } ) ; export const fetchModulesSuccess = ( robotName , modules , meta ) : Types . FetchModulesSuccessAction => ( { type : Constants . FETCH_MODULES_SUCCESS , payload : { robotName , modules } , meta , } ) ; export const fetchModulesFailure = ( robotName , error , meta ) : Types . FetchModulesFailureAction => ( { type : Constants . FETCH_MODULES_FAILURE , payload : { robotName , error } , meta , } ) ; export const sendModuleCommand = ( robotName , moduleId , command , args = [ ] ) : Types . SendModuleCommandAction => ( { type : Constants . SEND_MODULE_COMMAND , payload : { robotName , moduleId , command , args } , meta : { } , } ) ; export const sendModuleCommandSuccess = ( robotName , moduleId , command , returnValue , meta ) : Types . SendModuleCommandSuccessAction => ( { type : Constants . SEND_MODULE_COMMAND_SUCCESS , payload : { robotName , moduleId , command , returnValue } , meta , } ) ; export const sendModuleCommandFailure = ( robotName , moduleId , command , error , meta ) : Types . SendModuleCommandFailureAction => ( { type : Constants . SEND_MODULE_COMMAND_FAILURE , payload : { robotName , moduleId , command , error } , meta , } ) ; export const updateModule = ( robotName , moduleId ) : Types . UpdateModuleAction => ( { type : Constants . UPDATE_MODULE , payload : { robotName , moduleId } , meta : { } , } ) ; export const updateModuleSuccess = ( robotName , moduleId , message , meta ) : Types . UpdateModuleSuccessAction => ( { type : Constants . UPDATE_MODULE_SUCCESS , payload : { robotName , moduleId , message } , meta , } ) ; export const updateModuleFailure = ( robotName , moduleId , error , meta ) : Types . UpdateModuleFailureAction => ( { type : Constants . UPDATE_MODULE_FAILURE , payload : { robotName , moduleId , error } , meta , } ) ;