import * as Types from './types' ; import * as Constants from './constants' ; import type { RobotApiRequestMeta , RobotApiV2ErrorResponseBody , } from '../robot-api/types' ; export const createSession = ( robotName , sessionType , params = { } ) : Types . CreateSessionAction => ( { type : Constants . CREATE_SESSION , payload : { robotName , sessionType , params } , meta : { } as RobotApiRequestMeta , } ) ; export const createSessionSuccess = ( robotName , body , meta ) : Types . CreateSessionSuccessAction => ( { type : Constants . CREATE_SESSION_SUCCESS , payload : { robotName , ... body } , meta : meta , } ) ; export const createSessionFailure = ( robotName , error , meta ) : Types . CreateSessionFailureAction => ( { type : Constants . CREATE_SESSION_FAILURE , payload : { robotName , error } , meta : meta , } ) ; export const deleteSession = ( robotName , sessionId ) : Types . DeleteSessionAction => ( { type : Constants . DELETE_SESSION , payload : { robotName , sessionId } , meta : { } as RobotApiRequestMeta , } ) ; export const deleteSessionSuccess = ( robotName , body , meta ) : Types . DeleteSessionSuccessAction => ( { type : Constants . DELETE_SESSION_SUCCESS , payload : { robotName , ... body } , meta : meta , } ) ; export const deleteSessionFailure = ( robotName , sessionId , error , meta ) : Types . DeleteSessionFailureAction => ( { type : Constants . DELETE_SESSION_FAILURE , payload : { robotName , sessionId , error } , meta : meta , } ) ; export const fetchSession = ( robotName , sessionId ) : Types . FetchSessionAction => ( { type : Constants . FETCH_SESSION , payload : { robotName , sessionId } , meta : { } as RobotApiRequestMeta , } ) ; export const fetchSessionSuccess = ( robotName , body , meta ) : Types . FetchSessionSuccessAction => ( { type : Constants . FETCH_SESSION_SUCCESS , payload : { robotName , ... body } , meta : meta , } ) ; export const fetchSessionFailure = ( robotName , sessionId , error , meta ) : Types . FetchSessionFailureAction => ( { type : Constants . FETCH_SESSION_FAILURE , payload : { robotName , sessionId , error } , meta : meta , } ) ; export const fetchAllSessions = ( robotName ) : Types . FetchAllSessionsAction => ( { type : Constants . FETCH_ALL_SESSIONS , payload : { robotName } , meta : { } as RobotApiRequestMeta , } ) ; export const fetchAllSessionsSuccess = ( robotName , body , meta ) : Types . FetchAllSessionsSuccessAction => ( { type : Constants . FETCH_ALL_SESSIONS_SUCCESS , payload : { robotName , sessions : body . data } , meta : meta , } ) ; export const fetchAllSessionsFailure = ( robotName , error , meta ) : Types . FetchAllSessionsFailureAction => ( { type : Constants . FETCH_ALL_SESSIONS_FAILURE , payload : { robotName , error } , meta : meta , } ) ; export const createSessionCommand = ( robotName , sessionId , command ) : Types . CreateSessionCommandAction => ( { type : Constants . CREATE_SESSION_COMMAND , payload : { robotName , sessionId , command } , meta : { } as RobotApiRequestMeta , } ) ; export const createSessionCommandSuccess = ( robotName , sessionId , body , meta ) : Types . CreateSessionCommandSuccessAction => ( { type : Constants . CREATE_SESSION_COMMAND_SUCCESS , payload : { robotName , sessionId , ... body } , meta : meta , } ) ; export const createSessionCommandFailure = ( robotName , sessionId , error , meta ) : Types . CreateSessionCommandFailureAction => ( { type : Constants . CREATE_SESSION_COMMAND_FAILURE , payload : { robotName , sessionId , error } , meta : meta , } ) ; export const ensureSession = ( robotName , sessionType , params = { } ) : Types . EnsureSessionAction => ( { type : Constants . ENSURE_SESSION , payload : { robotName , sessionType , params } , meta : { } as RobotApiRequestMeta , } ) ; export const clearAllSessions = ( robotName ) : Types . ClearAllSessionsAction => ( { type : Constants . CLEAR_ALL_SESSIONS , payload : { robotName } , } ) ;